1,260 karma · joined Nov 2, 2009 (17y ago) · 479 submissions
comment 15y ago · link · parent
var f = []['concat']; (f + '');
// Chrome
"function concat() { [native code] }"
// IE (9)
"
function concat() {
[native code]
}
"
This script tries to extract letters from that string representation, which fails if the string is different. (This is also used as an anti-debugging measure in some JS malware, to prevent researchers from replacing document.write with alert() or similar.)2. Iterating over the window object doesn't work the same way in IE: http://blogs.msdn.com/b/ericlippert/archive/2005/05/04/41468...
In particular, this script tries to extract strings 'sessionStorage', 'getComputedStyle', 'onchange' by iterating over the window object, all of whom fail in IE.
comment 15y ago · link · parent
[1] http://www.hexblog.com/?p=21 - The author of IDA Pro disassembler wrote a hotfix for the WMF vulnerability in Windows about a week before MS released a fix. From what I've heard, his site completely tanked due to all the downloads.
comment 15y ago · link · parent
I've gotten into the habit of auto'ing most variables nowadays, it's quite convenient not having to type
LongTemplateName<ClassName> variable = LongTemplateName<ClassName>::StaticCollection.Find(something);comment 15y ago · link · parent
comment 15y ago · link · parent
----
Small clarification: I shared some info on the internal workings of Command&Conquer in the comments of the last post. The author of this post took that to mean that I was one of the developers. That's not true - I'm just a bored coder with a disassembler and (not so much lately) free time on my hands. Some friends of mine and I reverse engineered large amounts of code in those games to add new functionality or fix bugs, which there were plenty of...
comment 15y ago · link · parent
R. A. Heinlein, "Life-Line", 1939
comment 15y ago · link · parent
The cheaters also found a small loophole in the hashing, because only specific fields are hashed and not entire objects, one important field was missed that gave cheaters an unfair advantage of seeing the current targets of their opponents' units. It is easy enough to fix when you know about it, fortunately.
comment 15y ago · link · parent
It is possible they recompiled it with the new license and the installer project was configured to carry all resources it found in specific folders, while the executable was configured to only include specific resource files... I used Extract instead of Install because my system disk is already truecrypt'ed, but if you can provide the files the installation creates, I could compare those too.
comment 15y ago · link · parent
Edit: However, the installer binaries' sizes differ by 113280 bytes, while the extracted files' size totals differ only by 925 bytes.
Edit 2: the majority of the size difference is in the .rsrc section, the newer version contains several additional binary resources, some of which appear to be boot loaders. And the text resources are different... is it possible the installed versions are different and the extracted ones are not?
comment 15y ago · link · parent
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...
comment 15y ago · link · parent
comment 15y ago · link · parent
comment 15y ago · link · parent
I'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...
comment 15y ago · link · parent
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.
comment 15y ago · link · parent
comment 15y ago · link · parent
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.
comment 15y ago · link · parent
comment 15y ago · link · parent
Also, after understanding what's going on, existing solutions might be better than rolling your own: http://api.jquery.com/jQuery.proxy/ .
comment 15y ago · link · parent
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...).
comment 15y ago · link · parent
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.
comment 15y ago · link · parent
comment 15y ago · link · parent
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.