Reputation
Top tag
Next privilege 15,000 Rep.
Protect questions
Badges
20 47
Newest
 Nice Answer
Impact
~102k people reached

Apr
15
comment Function in Mathematica 10.1, but not in CDF Player 10.0.2
the corresponding player versions ususally are made available a few months after a new mathematica version is available, so that seems to be WRIs strategy. I don't know why they do it that way, it makes the whole concept of CDFs somewhat questionable unless you stick to that version for which players already are available (which I usually do). You'd then use the newest mathematica version only to prepare stuff you want to deploy for the upcoming players...
Apr
15
comment Function in Mathematica 10.1, but not in CDF Player 10.0.2
@abwatson: soory, I didn't see your comment, if you use the @ notation, a message will displayed for the user you are addressing so you are more likely to get an answer. "define only for older version" could either be done checking $VersionNumber and $ReleaseNumber or, and I think that would be the better solution by checking if the symbol already exists using NameQ: If[Not@NameQ["MinMax"],(*define it...*)];
Apr
13
comment How do I interrupt (abort) a computation in Mathematica?
unfortunately often the kernel will eat up all of your memory and it might happen that your system becomes unresponsive (which shouldn't happen with a modern OS, but of course still does...). To avoid that, you can try MemoryConstrained and TimeConstrained which will abort the calculation when the given limits are passed even when you can't interact with your computer anymore. This is not bullet proof AFAIK but has saved me from needing to switch off an unreponsive computer several times...
Apr
12
comment Function in Mathematica 10.1, but not in CDF Player 10.0.2
if your MinMax is doing the same thing as the new 10.1 MinMax you could define it only for the older version, or probably more correctly if it isn't defined already. If they do different things, you'll need to rename your MinMax and Nassers comment fully applies...
Apr
11
revised Package Loading: How to get rid of Needs::nocont?
added 1127 characters in body
Apr
11
answered Package Loading: How to get rid of Needs::nocont?
Apr
11
comment CountryData fails for some tags and properties
I think you should try to remove the content of Paclets/Repository but not the directory itself. Then before doing anything else do RebuildPacletData[]. After that try CountryData again, it should now download the matching paclet version which will take some time. If this does not work I'm out of ideas, I don't know about the stuff in Temporary, never touched that. On my system there is CountryData-10.0.73, 10.0.39 and the 9.0.64 that you also see. I don't know but would think that this could have to do with the fact that I'm still using version 9 and have been using 10.0.1 and 10.0.2...
Apr
10
comment Package Loading: How to get rid of Needs::nocont?
Can you explain why using Get["TestApplication`TestPackage`"] in init.m and renaming your encoded files to TestPackage.m instead of TestPackage-encoded is not good enough? It seems to not make much sense to use Needs in your TestAppliation`init.m as that will be read only once when loaded with Needs["TestApplication`"] anyway, so there is no gain in using Needs there over Get. I also don't understand why it would be a problem when the context is not human readable within an encoded file, Mathematica will happily load it anyway...
Apr
9
comment CountryData fails for some tags and properties
Are you still getting the same error messages? A brute force alternative to guarantee you have a clean state would be to delete all 9.x files/directories in Paclets/Repository and then do RebuildPacletData, but probably what I have in mind is not your problem...
Apr
9
awarded  Nice Answer
Apr
8
comment CountryData fails for some tags and properties
have you tried RebuildPacletData[]? I think that problem has already come up, there seems to be a problem when updating from v9 to v10 but I can't find the question for the moment...
Apr
8
comment A too complicated lookup
depending on how you use that and how important lookup speed is for your application I think you should also consider Picketts solution: if you build the Association once then the lookup of keys in it will be the most efficient way to get at the desired data...
Apr
8
comment A too complicated lookup
I think that you should mention that if the OP wants to search for several keys he could do lookup=AssociationThread[nm->ln] and then look up a given key with lookup[searchKey]. That way one would avoid the relatively expensive build of the Association and once that has been build using it would AFAIK be the most efficient way for such lookups.
Apr
8
comment A too complicated lookup
I just made some comments to my solution: I now believe that my solution (by luck) might do what the OP wanted, but yours correctly does what his example code is doing. Concerning speed I think we compare apples with oranges as what my code does is actually something less difficult than what yours does...
Apr
8
comment A too complicated lookup
@eldo: My version only works if keys are unique and the length of ln and nm are equal and "corresponding" means that the nth element of ln corresponds to the nth elment of nm. This is for what the Pick solution works, if it is what you need then thats fine. Your code (and Taikis solution) actually wouldn't need the key list nm as you just select the entry which starts with the same characters as the search string which for the given example data (ln and nm) happens to be the same thing, but could be something very different for other cases...
Apr
8
comment A too complicated lookup
@eldo: I just have had a look at the other answers and your own proposed code and am not so sure whether my code really solves your problem. When answering I understood it as if you'd want to get the element in ln for which nm equals the search string, but what you and the others have coded actually does something else (match by string similarity). Can you probably explain what "corresponding" means in your question?
Apr
8
comment A too complicated lookup
@eldo: it's just a trivial special case of pattern matching, but it sometimes is good to remind that pattern matching also includes simple equality in that way :-)
Apr
8
comment How to make function accept list of rules as an argument?
@Gerli: good point, I somehow had in mind that I had seen this, but as I only have 10.0.2 installed I couldn't find it and I did not bother to search more. I have added it in my answer, thanks for pointing that out...
Apr
8
revised How to make function accept list of rules as an argument?
added note about KeyValueMap for V 10.1
Apr
8
answered A too complicated lookup