« first day (718 days earlier)      last day (3597 days later) » 

12:00
re: golden-cuffs: that's just the thing, I don't think StackExchange should likewise be purified... it makes one afraid of posting, investing time
Using as! and the ! in other places, if it fails, it crashes your app without any chance of recovery.
Of course
But that's the beauty of the idea (if it has any)
It cannot fail
If you are ONLY using this api to access user defaults
Using as? and ? optionals gives us chances to recover. I don't agree that your code cannot fail.
You don't want to recover in this case
you want a compile-time error
it's difficult to explain without the code
It won't be a compile time error though.
12:04
one of the edits that were rolled out, shows a compiler error in case you did not provide support for a type
the problem you raised in the comment I up-voted is a fundamental persistence problem that my little api never intend to solve
all it hopes to do is allow me never to heave to reference a user default by a string key
and to type check all my code
declaring the property multiple times in your app would defeat the whole point of using the api
all this I discussed in the rolled out bits (which does not change anything relevant to your answer)
@milos if all this explanation is required to use your API correctly, then as a bonus answer, I recommend your code be far better documented
sure
that's what i did in the edits
Stop getting hung up on the edits.
12:11
:)
but you are asking the things that I addressed there
If you post a new question focusing on the use of the class rather than the class itself, I will gladly answer that.
Your edits didn't address the documentation level of the code, and the code itself still wasn't protected to the point of preventing misuse.
It can be though.
note, however, that my api never promised to solve those problems, so it's perhaps not fair to expect that it should document them - like selling a hammer and having to provide a manual on how (among all other things) to not hit you thumb.
but, let's leave it at that, I'm already very grateful to you for giving me so much of your time
NSUserDefaults documents these problems. The way you present your class (especially if we look at public code only, which most devs will) can misleadingly suggest that the problems are solved.
If you develop another class to manage usage of this, you can solve a lot of these problems though.
but this is a 33 line struct
and only creates a property
not a global object
like other related projects
which is why I had to answer in the way I did.
12:17
yes
but that is a good thing
Unless you're going to write a lot of management code, your struct has to not crash like this.
both are good things
Other people will misuse your code.
if I was a major vendor of pristine libraries
not advice seeker
If you are the only one using your code, you probably don't need it reviewed. If other people are using it, other people are misusing it, and as such, we have to program defensively and be as clear to the user as possible when they've done something wrong, why it's wrong, and how to fix it.
12:19
sure
but it is important to understand the scope of the proposed solutions
I never want a 3rd party library to crash like your code would. I want it to give me a helpful warning.
I understand the scope--that's why I answered as I did rather than recommending a massive class for managing this stuff.
(again my code would never crush the way you expect it would)
sure, I like that you answered it that way
You can't guarantee it won't.
i just don't think that there is any benefit in deleting my additional details that address these precise issues
and, yes, I think that the struct and the two protocols guarantee that if you only access the user defaults with this api, it will never go wrong
the problems you raise have to do with the nature of persistence and that one can use other means of accessing the defaults
like, u can set the value for the key using Apple's apis direclty
Or instantiate other instances of your structs
12:25
or that
With duplicate keys
yes
because that's all they are
you can have a solution of your choice to unique them
you can screw up with CoreData too (in so many ways)
the value of the proposed solution (if there is any) is that it is light and easy to understand
So... You want someone to say your code is perfect with no room for improvement?
its purpose is to only EVER write the string key once
no
but this discussion is precisely what i hoped for
You can manage that simply by defining constant strings...
12:28
i just don't think it should be taking place in a chat room
yes
or not
That's how I always recommend people use defaults.
the api obviates the need for them
instead of a global string constant
you have a global property that can be written to and read dirrectly
Instead you need the global structs?
yes
or something else equivalent
it's up to the programmer
they can use parts of the CoreData stack to manage versioning if they like
I mean... Without a big class managing this all and truly making more safe and more lightweight, i''m not ready to buy into the value yet.
12:31
though, again, the value here is the light weight
I don't see the value of using this over just using NSUserDefualts directly, really
NSUserDefaults won't crash like yours if I get something wrong.
Well, I was using it in my project for a while at its very charming... I'm now working on observing changes and updating the property automatically
I probably need to do some actual work now.
you have code Review for reviewing your code! codereview.stackexchange.come-nouri 50 secs ago
me too
many thanks for the chat
bye
12:35
@e-nouri Code Review is for "my code works, help me make it better!" And not for "does this thing even work?" — nhgrif 31 secs ago
Still a code review, debugging if you want ! still a review, see my response below! — e-nouri 30 secs ago
This question would be closed as off-topic, so regardless of whether or not you consider it "a code review", you shouldn't recommend questions that would be closed on that target site. If this question isn't a good fit for SO, explain why and recommend changes that would make it a better fit for SO. It doesn't belong on Code Review. — nhgrif 40 secs ago
0
Q: python script to retrive the path of files from a folder into a text file

user70961import shutil import os def get_files(): source = os.listdir("/output_folder/sample/cufflinks/") destination = "output_folder/assemblies.txt" for files in source: if files.with("transcripts.gtf"): shutil.move(files,destination) I want to retrieve transcripts.gtf files from "/output...

@e-nouri code review has a rule that the code must be working code, if the author doesn't know if it's correct (same as working in mine eye's). See meta.stackoverflow.com/questions/253975/…chillworld 11 secs ago
just i asked this in code review. i got a msg saying it doesn't belong there — user3351523 58 secs ago
13:16
This guy just elevated himself from clueless to clueless-asshat:
2
From your snippets, you can see that you copied the code partially. You can't simply selectively modify the code then make statements. That's fine. You don't seem to be an expert in swift anyways. I don't blame you since it's a relatively new language. Hopefully you don't just post random comments on things you're not familiar with. Let me know when if I can help you with a few good references on swift. Start with Apple's docs. Let's revisit then. — user2867432 3 mins ago
@nhgrif just reading his deleted post and comments ^^
He deleted his post?
Perhaps I will post an excruciatingly detailed answer this afternoon.
I am sure you know more than he does about swift....lol
Greetings, Programs.
@nhgrif oh lol no, it was grey by the 4 downvotes
@nhgrif but your not the expert in swift, he is ^^
13:31
You have a type as class? And would be better in Code Review? — Soner Gönül 26 secs ago
@nhgrif If I have such discussions, I just stop it with commenting. To bad for mine blood pressure
-3
Q: Encription _decription

BharatCREATE FUNCTION ConvertTextToVARBINARY ( paramMasterPassKey VARCHAR(255), paramColValue TEXT, paramCompanyId VARCHAR(50) ) RETURNS varbinary(32000) BEGIN DECLARE iIs_Encrypted INTEGER; DECLARE sPassKey VARCHAR(200); DECLARE iRecordExist INTEGER; DECLARE EXIT HANDLER FOR...

0
Q: Finding triples between 1 and 10 that add to 7

Ryan NeedhamI have a list comprehension for finding triples between 1 and 10 that add to 7 but need to remove any duplicates (all but one of (1, 1, 5), (1, 5, 1), (5, 1, 1) should be removed). Can anyone point me in the right direction on this? [(x, y, z)|x <-[1..10], y <-[1..10], z <-[1..10], x + y + z ==...

0
A: use of unresolved identifier userObject placesObject

user2867432Figured it out. Was missing these 2 declarations (not shown in the parse guide): var placeObject = PFObject(className:"PlaceObject") var placesObjects = query.findObjects()

for(Line line : codeLines) {
addComment(line);
}
tsss, I think he need to pass here :)
If your code is working I would advise you to head over code review here codereview.stackexchange.com ;) — Ataww 48 secs ago
Yeah... I need to just stop. I'll post an answer later and leave it at that.
13:37
If you need to put for each code line a extra line of comment, it's time to visit codereview.stackexchange.comchillworld 44 secs ago
I commented his question ^^
maybe he can hail you then ;)
Doubt it... I probably have more Swift rep on SO...
Not that it matters, and he's obviously not going to be convinced of anything
He just doesn't understand how StackExchange works.
0
Q: MVVM. Am I doing it right?

Dan SewellI am creating a C# WPF application. I am intending to bind all of the GUI controls via data binding to my ViewModel, rather than code behind - as per MVVM. I have made some good headway with this, but unsure about something. In my ViewModel, I am binding all the properties like this: private ...

....but regarding the comment you left: importblogkit.com/2015/03/writing-readable-code
SQL is SQL, right?
0
A: Optimizing performance of slow complicated article-sorting query

Lyle's MugI don't think that having a Select Statements nested 3+ deep makes for a very good query, I would recommend that you start from the inside and make at least the main Select statements their own table, use a Temp Table for each of them, that way you can index each one the way that you want them in...

13:46
Yes-ish.
But "you may say this will run slower, but I think it will run faster" is far from convincing.
@nhgrif gone
now says "This will run faster because..."
@nhgrif indeed, self documenting. He ask, we teach it to him ;)
Oh, it is being discussed here too.
@Lyle'sMug - that answer would make things so much more complciated, and messy
But, you ... oh, you deleted.
The data is dependent on user preferences, joined to all sorts of other things... the values would be a massive cross-product to get all the data in there.
Temp tables are yucky, I am thinking CTE's may be much better
check whether postgres has them
13:58
they do
I didn't know if they did when I first answered the question though.
I will have to repost and then come back and edit them later, have some Sharepoint training I have to go to! woot
monking!
monking!
@Mat'sMug myroi!
@JeroenVannevel ?
mon - king, my - roi
french english, english french
It's not easy making jokes, okay
I'm out
14:09
lol
I thought I turned into some return on investment for a minute
0
Q: what is the error in this code

NouraQustion: compute the sum for an integer from 1 to n the user should keep enter integers until enter 0 solution: .data prompt1: .asciiz "Enter a number" prompt2: .asciiz "The sum of entered number is: " .text # i..>$t0 sum...>$t1 n...>$t2 main: li $v0, 4 #System call c...

0
Q: Java Progamming

PaiyaaThe One Bookseller is a small bookstore located in a shopping mall. The manager wants you to develop a simple book inventory system to help them to maintain their inventory file. The inventory file will be a database of all the books in the bookstore. In general, the software is to perform the fo...

@CaptainObvious there's 1 single more generic title I can think of: "Programming"
That sounds fun! Once you get a working implementation done, post it here, we'll review it! (in the mean time we're going to have to close this question, please see our help center for all the details on what this site is about) :) — Mat's Mug 54 secs ago
@JeroenVannevel I should have picked that one up. it's just unusual to see French here, j'ai pas fait la transition dans ma p'tite tête :)
pas de problême, comprendre mes blagues n'est pas pour toutes
Gotta go now, time to go find myself a certificate of good behaviour
:p
later!
Then I can get arrested without a worry it will interfere since it's valid for a year
sayonara
14:17
0
Q: encryption and decryption mysql

BharatFunction ConvertToVarbinary`( paramMasterPassKey VARCHAR(255), paramColValue VARCHAR(255), paramCompanyId VARCHAR(50) ) RETURNS varbinary(255) BEGIN DECLARE iIs_Encrypted INTEGER; DECLARE sPassKey VARCHAR(200); DECLARE iRecordExist INTEGER; DECLARE EXIT HANDLER FOR...

is it legal in to declare a function without ..using a function keyword?
oh
FUNC: BEGIN
wow
Hungarian notation is evil. Proof:
SET sReturnString = CAST(vbResult as Char);
vbResult
(anti-VB joke)
#FAIL
Hey @Mat'sMug
AAAAAAH!! A GHOST!!
hi!
welcome back!
did you revive @Duga yet?
Thanks
We'll see.
We miss her very very much in the VBA chatroom :)
14:31
I bet you do!
I gotta say, if you think Code Review is friendly, you haven't met the Ukrainians I have met! What a great bunch of people!
saw your tweets ;)
I wanted to tweet more, but I was too busy actually living.
And there were so many impressions and emotions that it was hard to fit into 140 characters.
-1
Q: what is the error

NouraQustion: compute the sum for an integer from 1 to n ,the user should keep enter integers until enter 0 //// i...>$t0 & sum...>$t1 & n...>$t2 solution: .data prompt1: .asciiz "Enter a number" prompt2: .asciiz "The sum of entered number is: " main: li $v0, 4 #System c...

@CaptainObvious which part of "we don't debug" don't you understand?
14:49
This code review part is a very interesting idea. Thanks for the suggestions, I'm gone put it there. — VeVi 26 secs ago
This code review part is a very interesting idea. Thanks for the suggestions, I'm gone put it there. — VeVi 26 secs ago
@StackMonkey @Duga let's see who picks up the first one that the other doesn't...
Bets anyone?
You may wish to consider a Multiton. — OldCurmudgeon 29 secs ago
You may wish to consider a Multiton. — OldCurmudgeon 29 secs ago
@StackMonkey That's my line!!
14:51
@Mat'sMug that will be @StackMonkey, as @Duga's memory is not perfect.
Yes, but she just booted, and monkey's been up for a week or so ;)
wait, monkey's perfect?
@Mat'sMug not sure. But it likely is, as it is doing only the comment-scanning, which indicates that the memory leak is somewhere else.
is Rubberduck too active for @Duga to keep up?
lol, yes, let's blame it on that for now :)
14:54
hi!
You don't have some sort of allocations profiler?
@nhgrif Haven't been able to get JVisualVM working correctly on that part. @rolfl tried to as well but also was not able to get it working.
@nhgrif - yes, there is, but it appears the profiler is deficient with the latest changes to the Java language.... which Duga uses a lot of.
@rolfl Oh, is that why?
14:58
I believe it is unable to track back the allocations through anonymous lambda functions.
especially when the indirection is not linked to the standard class loaders in Java (i.,e. it is a tomcat problem).
@rolfl apparently the JVM as well ;)
Are lambada that new?
In the Java world, yes. all the hype last year...
Objective-C blocks can be very bad about creating leaks when you don't know what you're doing
@nhgrif introduced in Java 8, so yes.
15:01
And I think ObjC blocks == Java lambdas
after a quick google search, I'd say yes.
Usually the ObjC problem is capturing self in a block.
15:17
This question belongs on codereview.stackexchange.com. — Mogsdad 56 secs ago
This is exactly the answer I was hoping someone would post! — RobH 7 mins ago
I ♥ CR
@Mogsdad No, this does not belong on Code Review. Please read Be careful when recommending Code Review to askersSimon André Forsberg 40 secs ago
0
Q: Handling console application commands/input

noraaI am new to c++ and as a project to learn the language I have been working on a console application that would be able to handle and execute commands from the user. I have gotten it to work the way I want it to however I feel that I am doing it a very inefficient way (both handling the command an...

0
Q: Get list of files in directory

segarciThis method returns the list of files (absolute path) in a folder (or tree). It allows filtering by extensions or filenames. The method receives the following parameters: string path: folder path to scan for files. string[] exclude: can contain filenames such as "read.me" or extensions such as...

15:35
This looks like a job for codereview.stackexchange.comMadConan 48 secs ago
@MadConan codereview is for code improvements, not as a platform to debug your code. — Luiggi Mendoza 10 secs ago
@SimonAndréForsberg - fair enough, broken code doesn't belong on CR. My bad. — Mogsdad 10 mins ago
0
Q: Implementing a Yearmonth class

EdwardRecently I wrote a program that was required to handle year and month data and so I wrote this class to encapsulate that handling. What I needed was a way to initialize the Yearmonth object based on the current local time, and allow a simple method of calculating future Yearmonth values based on...

zombie:
2
Q: Throttle actions by number per period

MatthewTodayI want to throttle asynchronous actions at a specific maximum rate of n actions per t period, and have pending actions wait until there is a free slot (rather than drop them). I want to receive the outcome When an action completes or fails. I also want the option of cancelling an action. The or...

@Mat'sMug maybe the OP did not know of that method? In which case it is a valid answer. Not a high-quality answer, and it could certainly be expanded on, but I think it is a valid answer.
I'm losing a rep point then. feel free to upvote it, I flagged it as NAA and DV'd. I think's answers on this site should review OP's code, not just provide alternatives - whether the alternatives are built into a framework or not.
15:46
This is a valid reason to downvote though:
It's not exactly reinventing the wheel. The big difference here is the exclude, which is something that neither GetFiles() nor EnumerateFiles() currently has. Note the OP uses EnumerateFiles() which is preferred in many ways. — Rick Davin 1 min ago
It is an answer, it's just a bad one. If I were a mod, I would not convert it to a comment.
I think it's crap that doesn't belong on this site. Allowing this as full-fledged answers diminishes the quality of the site IMO. If I were a mod this would turn into a comment - then the author would still be free to post an actual answer and/or expand on their comment.
and there's not even a link to the relevant method override on MSDN.
Being allowed and being non-crap are two different things. I'd allow it as an answer, but the answer is also down-worthy.
I consider it as a valid answer because of the possible commit message "removed method and replaced with a call to an existing method"
the answer is bad though because, as stated by Rick Davin, this method contains a "exclude".
I think I agree with @SimonAndréForsberg here.
It may not be a good answer, but it seems a valid one.
1
Q: Observable Collection “Deep”

SteBertIn a project of mine I needed a class "Document" to be able to notify any change in its fields. This class keep a collection of class "AnotherClass". Using an ObservableCollection for this collection is not enough because my application can't receive notification from Document if a field INSIDE a...

@Mat'sMug Zombie down.
15:54
@Hosch250 thanks, but what I meant is that this question needs another answer ;)
I don't see anything wrong with your approach, it looks pretty sound to me - but then again, I know that I don't know enough on the subject to mention anything like that in an answer and risk sticking a foot in my mouth... I'm sure another C# reviewer that's more familiar with that part of the framework than I am will come along and address that aspect of the code though - I just had to mention these points anyway. — Mat's Mug Apr 17 at 3:16
@nhgrif fair enough. I can't retract my flag, but I've edited a MSDN link into the answer, which is keeping my DV.
@Mat'sMug BTW, I VTD'd that A in the VLQ queue as a LOA - NS.
LOA - NS?
Link Only Answer - Not Spam.
I wtf'd that message as bbq - lol
2
I don't consider it LOA.
15:56
there wasn't even a link!
There is now - you put one in.
the answer wanted to inform about Directory.GetFiles(string, string, SearchOption) , you don't need a link to do that.
right. but it belonged there
absolutely. adding the link helped. but you would have been able to find that information anyway, thanks to the method reference. The main problem with the answer is that it is incorrect.
Answers should stand on their on with a link. Links should never be necessary.
16:00
and in this case, the link is not necessary. helpful, but not necessary.
I like helpful
I did the same here:
13
A: Function that convert decimal to binary

Jeroen VannevelOne major improvement would be to just use what is supplied through .NET: Convert.ToString(int, 2); where int is your supplied argument. Convert.ToString Method (Int32, Int32) Converts the value of a 32-bit signed integer to its equivalent string representation in a specified base. Note...

If something can be done through the standard library then that is a huge improvement
The people that can implement something better than in there won't be posting on CR in the first place
@d347hm4n see here for an example of a great answer that suggests replacing OP's code with a BCL call. — Mat's Mug 28 secs ago
unless they are me ... ;-)
Turns out the answer isn't even right - let's remove it.
16:03
delete is not for wrong answers
3
that's what down-vote is for
Oh, I see.
It's definitely not a link-only answer though
Because of the measly sentence supplied?
It didn't originally have a link @Hosch250
Because (if it would be the right answer) it gives all the necessary information
16:05
It did when I reviewed it.
but it didn't when it entered the VLQ
But I see, I will remove the comment and vote.
If the answer is "use GetFiles(string, string, stringeling)" then that is perfectly fine
It wouldn't get my upvote, but it's fine
@JeroenVannevel you missed my entire diatribe about names arguments yesterday.
I'd recommend moving EnumerateFiles inside the true block of (exclude.Length > 0). There's no reason to fetch file names otherwise. Also your check could be ((exclude != null) && (exclude.Length > 0)). — Rick Davin 5 mins ago
wtf, comments as answers, answers as comments.. what's wrong with these people?
16:07
I followed it with halfassed attention
But I'm not going into language discussions anymore
They end up with me eating my shoes and stabbing my eyes
Why are you eating shoes and stabbing eyes? Is that how you cope with C# not being perfect?
I'm not going there.
Stab stab
@Mat'sMug You also want a "not a comment, it's an answer" flag option?
I'm not claiming any language is perfect.
16:09
:p
@nhgrif except
magic is not perfect.
Swift is magic--not perfect.
On the specific topic of named vs unnamed parameters, I think named is better and I think I demonstrated pretty clearly why.
@nhgrif one day I'll quote you on that one.
Quote me on what one?
programming languages are just like standards...
Fortunately, the charging one has been solved now that we've all standardized on mini-USB. Or is it micro-USB? Shit.
2
16:19
0
Q: How to find the least 3 values of an array(C++)?

abdulkarimYou are required to manage the sales data of a car showroom. There are 8 salesman. At the end of the month you have to make a report. You are required to make the following calculations.Input the monthly sales for each salesman from the user and then find the following: 1) Total sales. 2) Average...

@CaptainObvious off-topic
16:32
As your program works, perhaps the question (whatever it is) would be better asked on Code Review. — Weather Vane 57 secs ago
Welcome back, @Simon vvvvvv
Oh, clever, CR is not Code Review.... does not get trapped in the scanner
@WeatherVane Although the program works, it seems like it does not output things as intended, which makes this off-topic for CR. — Simon André Forsberg 1 min ago
@rolfl wait, you just figured that one out? ;)
2
didn't you review Simon's Comments of Interest post?
oh you didn't.
private boolean isInterestingComment(StackExchangeComment comment) {
    String commentText = comment.getBodyMarkdown().toLowerCase();
    return commentText.contains("code review") || commentText.contains("codereview");
}
@Mat'sMug that!
Thanks for helping @Duga out when I was away, @rolfl.
Apparently @Duga wanted to visit Ukraine as well.... can't blame her, really. Lovely country.
Really nice colors in their flag as well ;)
Welcome back @Duga!
(Oh and @SimonAndréForsberg as well :))
16:54
дуже дякую (Ukrainian for "many thanks")
So close to a Good Answer badge...
@SimonAndréForsberg Usually programming languages are standards.
17:09
Also, you will be watched next week.
@Donald.McLean And, as I've been away for more than a week, I was watched today.
What are you guys talking about...
I hoped there would be a new episode out today so that I could be watched twice in a row, but it seems I was not that lucky.
Really? No one-boxing for IMDB?
On Netflix?
Don't think it's available on American Netflix.
17:13
Why not? Is it bbc?
@nhgrif CBS. I watch it live usually, or on-demand.
Yes, I have cable, but I need to catch up if I'm going to watch.
17:29
0
Q: Can I get some feedback on my simple database design?

galdikasOk, so I am carrying out a rather simple task as part of a job requiretement. Here is the task in a nutshell: Design a form for creating ad for selling car Form has 2 have: 2 drop downs: Car make Car model (car model has to be dynamic, based on selected model textaera for short description ...

Is UML review off topic, or no?
Welcome to Code Review! Can you please include the code you use to create your database/schema? We can't "code review" only a schema diagram, since it's not code... — sᴉɔuɐɹɥԀ 6 secs ago
UML seems more like something for programmers.SE
you're not generally asking for a review of UML markup so much as a review of a design
0
Q: Check if two strings are anagrams - HackerEarth

Atul Shanbhag You are given two strings. You have to check if the strings are permutations of each other and output "YES" or "NO" accordingly without quotes. Input: 2 lines of input each containing a string. (a to z and 0 to 9) Output: A single line containing YES or NO. Constraints: S...

Irregardless of the suitability of the example code for code review or other scrutiny, providing a helpful answer would be more effective than bashing the example code or suggesting diversionary courses of action. — Daniel Randall 17 secs ago
17:47
0
Q: Generic pathfinding framework in C++

coderoddeI have this generic framework for finding (weighted) shortest paths. Also, the program demonstrates the performance of A* and Dijkstra's algorithms on a directed weighted graph. shortest_path.h: #ifndef SHORTEST_PATH_H #define SHORTEST_PATH_H #include <queue> #include <unordered_map> #include <...

Is it possible to be a mod on multiple StackExchange sites?
@nhgrif yes, of course it is.
There are some crazy mods, who have more than 5 sites....
Not all sites are as technically demanding as Code Review, though.
@200_success are you a mod on Programmers?0
Me? I don't even know what's on-topic for Programmers.
2
That ^^^^
Oh. Oh wait, the source site's mod shows up
@200_success @Nobody does.
Although thanks to @Duga and the endless stream of bad recommendations to Programmers, I can definitely tell what is not on-topic on Programmers.
17:56
@200_success But nobody knows!
1 min ago, by Simon André Forsberg
@200_success @Nobody does.
I'm starting to get a sense of what questions are welcome there.
For example questions that are not off-topic
heya
I mean monking
hey @janos
Been quite a while there
17:59
@janos JANOOOOS!!! I've We've missed you!
hey @skiwi, oh yeah

« first day (718 days earlier)      last day (3597 days later) »