1,260 karma · joined November 2, 2009
What about JS frameworks like JavascriptMVC or Sammy [1]? Google even created a spec [2] for crawling such sites.
[1] http://sammyjs.org/ [2] http://code.google.com/web/ajaxcrawling/docs/getting-started...
foobar() is the same as FOOBAR()
$foobar is completely separate from $FOOBARI've seen this before, but never found a suitable alternative. Where does it belong? Suppose multiple developers are compiling a C++ .dll which testers are grabbing through websvn and testing. To track down crashes they get, we need the associated .pdb for the right revision. Where should these files be kept? In a plain folder where each revision gets its own subfolder named as the revision number? That means updating two separate locations with each build, using two different interfaces...
Part of a product I'm working on now is being able to schedule repeating tasks every day, every month, etc. Which means that "07:30 every Friday" has to happen at 07:30 in the author's timezone, whether or not DST is active. To my knowledge Javascript can only tell you the timezone offset from UTC for a given date/time. You can determine the DST-less offset that way, but there are multiple timezones sharing the same offset (e.g. PHP has 63 separate timezone records for Europe alone) and then simply matching them by offsets doesn't work ideally, you need the user to make a choice.
Their behaviour is defined by the standards and special checks are required to identify these values properly. In SQL, it's
X IS (NOT) NULL
, in Javascript it'd be isNaN(X)
.rand() (well, most of the time[1]). This you just have to know :)
Improperly expanding C macros:
#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
#define X isupper(getchar())
printf("X == X = %d\n", X == X);
And like lurker14 said, anything in general that has side-effects.[1] It is possible rand() will return the same value twice in a row, just not very likely. Also the original author might have been twisted enough to memoize it. Thank you, "Higher order Perl", for that idea.
Also, after understanding what's going on, existing solutions might be better than rolling your own: http://api.jquery.com/jQuery.proxy/ .
Disabling shell functions (system, exec, etc.) is also a good idea, unless the application itself requires them (e.g. if the host is too stupid/lazy to have the imagick extension installed and tells you to call /usr/bin/imagick instead...).
A colleague pointed me to Yii Framework [1] a couple years ago, and I stopped looking for alternatives. Don't see any reason to invent my own frameworks, since Yii has practically every feature I could want already implemented and, more importantly, well tested. In those rare cases when I need to customize or extend something, it's fairly simple to do so, since the code is well documented and organized (though the authors seem to be suffering from a severe allergy to whitespace...).
Controllers with access control rules and filters? Check.
Autoloading? Check.
Caching with support for multiple mechanisms (file cache, db cache, eAccelerator, MemCache, XCache, Zend Data Cache)? Check.
DB layer based on PDO? Check.
ActiveRecord? Check.
Mass attribute assignment to Active Record, complete with validation and allowed/forbidden attribute configuration)? Check.
Named scopes? Check.
Multiple database engine support (MySQL, MSSQL, Oracle, SQLite, PostgreSQL)? Check.
Testing environment? Check.
CLI mode? Check.
I18N support? Check.
Plain PHP views with simple HTML escaping and HTML construction? Check.
Event raising and handling? Check.
[1] http://www.yiiframework.com/
Edit: However, no framework can take away the programmer's stupidity. My former colleague used another framework that has decent support for parametrized queries and still concatenated his SQL from raw user input and printed data into javascript variables by simply wrapping it in '' with no escaping... So glad all of his code has been retired.
Stating the function type explicitly also helps it display the right arguments given to it. This output could be significantly improved if the assembly version were available as well.
Unfortunately there's still a lot decompilers can't do, mostly compiler tricks (e.g. storing a pointer to the middle of a structure instead of its beginning, and using negative offsets to access other struct members [3] - this is usually obvious when looking at it, but HexRays can't make sense of it so it falls back to raw pointer math).
[1] http://www.hex-rays.com/ [2] http://img824.imageshack.us/img824/1188/hexrayscpp.png [3] https://github.com/Laurelai/decompile-dump/blob/master/outpu...
0041301E 33 D2 xor edx, edx
00413020 83 E8 02 sub eax, 2
00413023 74 01 jz loc_00413026
00413025 4A dec edx
00413026 ...
Without a single-byte int 3, a break on dec edx will mess up everything if that branch is not taken.The Korean concept of Han, as explained by The West Wing: "There is no literal English translation. It's a state of mind. Of soul, really. A sadness. A sadness so deep no tears will come. And yet still there's hope."
.browser-support dd:nth-of-type(3) { background-image:url("img/opera-logo.png"); }
.browser-support dd.no-support:nth-of-type(3) { background-image:url("img/opera-logo-white.png"); }
And looking at the calculated width example reminded me of the box-sizing property [1], which would simplify that particular use case.Oy. Not the best idea, generally speaking.
Edit: I used to read the localized paper version of http://xakep.ru/ several years ago, and practically every hacking story/tool roundup they had mentioned the annoying problem with ls --color, it was apparently present in almost every public rootkit at the time. It's kinda interesting to see that idiots still use outdated tools years later.
For hosts that don't (i.e. we used to have one project running on a Windows server with nothing but Remote Desktop access and no permission to install any VCS), I use this:
alias gdate=date\ +%Y.%m.%d-%H.%M.%S
gitzip () { zip -ruv "$(gdate).zip" $(git diff $@ --name-only); }
Invoking `gitzip $commit` produces a zip file containing all the changed files since said commit. Unzip archive to wwwroot, check for files that need to be deleted, done.Suvorov wrote a lot of books exploring WWII and demonstrating large amounts of evidence for his "Icebreaker" theory, claiming that Stalin intentionally led Hitler to power, planning to occupy Europe after Nazis and the Western countries were both weary and weakened. The theory has a lot of vocal opponents, but Suvorov never misses a chance to point out that most of them are (paid by) Soviet political/military figures, who are obviously biased and would never admit such a plan. It's a shame that these books are not all translated to English.
He also wrote two memoir books, (Tales of a) "Liberator", describing his service in the Soviet regular forces, and "Aquarium", covering the period after he got noticed by and accepted into the intelligence forces. The first one contains some rather fascinating stories of everyday Soviet life and dogma, well worth a read if you can find it. The second one is also good, even though it lacks those everyday stories.
Summa summarum, the book OP linked to is an interesting view into the old Soviet thinking. Might be an eye opener for those who believe the Soviets were anywhere near as humane as the Western countries.
Excusing the Russians' war atrocities simply because they beat the Germans is quite like picking the frying pan instead of the fire - they are both very bad, just one is somewhat worse than the other. (Then again, I'm from the Baltic states, where we were actually stuck with the Russians until 1990, so I am probably biased.)
Did the Nazis have long distance bombers that could actually destroy the industrial complexes in Ural or further to the East? I am not aware of any.
- carried out his orders blindly and without thinking ( see http://en.wikipedia.org/wiki/Battles_of_Rzhev where he blindly sent several hundred thousand troops into fortified German position - if you send your forces up the same road for two months straight without gaining any advances, wouldn't you at least try to find an alternate route that the enemy doesn't expect you to use? ) ,
- was very hungry for fame and glory (I can't find references now, but it was his initial reports to higher command during the first few days after 1941-06-22 that led Stalin to believe the German invasion was already mostly contained and delayed Russian defense deployments. In addition, Stalin demoted Zhukov later, citing "attributes others' achievements to himself" as a significant reason.), and
- was generally vain, sadistic and incompetent. Several high ranking officials and civilians reported his attitude towards his subordinates as nothing less than disgusting.
- He was also in charge of Totsk nuclear testing ( http://www.johnstonsarchive.net/nuclear/radevents/1954USSR1.... ), where he had over 40k soldiers split into two teams and engage each other moments after a nuke had been detonated above the battlefield.
Also, he had nothing to do with the German defeat at Stalingrad - he was still too busy headbutting Rzhev: http://en.wikipedia.org/wiki/Battle_for_Velikiye_Luki_(1943)
For more details, I suggest looking up Viktor Suvorov's "Shadow of Victory". And other Suvorov's books for a different view of WWII in general.