hacks

How to use .NET 3.x features in .NET 2.0 (Visual Studio 2008)

You're stuck with targeting .NET 2.0 in Visual Studio 2008, but you'd like to use all the latest goodness from .NET 3.x features, like: LINQ Extension Methods Lambdas What can one do to enable this awesomeness? EDIT: I had not originally found the post: http://stackoverflow.com/questions/173080/c-net-3-0-3-5-features-in-2-0-using-v...

Flash games hack, score is 49700?? How to improve flash games security?

I have 2 flash games (written in as3). Both the highscore value being hacked. The normal range of each game score is not more than 5000 (normal users, will only get 2000 - 3000 points). My current method of anti-hacking is: After finish the game, flash will use post parameters send: username=mike&score=2000&hash=md5(secret . username . ...

Anyone ever flip (<$>)

I found defining the following (%) = flip fmap I can write code like the following: readFile "/etc/passwd" % lines % filter (not . null) to me it makes more sense then the alternative filter (not . null) <$> lines <$> readFile "/etc/passwd" Obviously its just a matter of order, does anyone else do this? is there a valid reason ...

What cool hacks can be done using sys.settrace?

I love being able to modify the arguments the get sent to a function, using settrace, like : import sys def trace_func(frame,event,arg): value = frame.f_locals["a"] if value % 2 == 0: value += 1 frame.f_locals["a"] = value def f(a): print a if __name__ == "__main__": sys.settrace(trace_func) for i ...

Chrome and Safari Hack

Hello, I have the following style: table.jqTransformTextarea td#jqTransformTextarea-mm textarea{ margin:0; } This works as expected in Firefox, Opera, Internet Explorer 7,8 and 6. However, to make it work in Chrome and Safari I need to do: table.jqTransformTextarea td#jqTransformTextarea-mm textarea{ margin:10px 0 0 10px; }...

CSS pointer-events='none' and/or XUL mousethrough='always' in web pages for Firefox

Morning all. Very recently I asked this question on how to pass clicks through an element (e.g. full screen overlaying ). Received some good advice, but I still wondered which browsers supported this natively... For those skipping the previous link, the overlay is purely cosmetic, must be overlayed and should ignore clicks (all mouse e...

fun error logging / reporting idea for small website

I want to write (or implement) a quick and easy logging solution for our website. I figure rss is fine for the format. I was thinking of piping apache's error log to a simple script that, if the url passes a blacklist, gets logged into a sqlite database. The database will store for each log entry the ip address, url, current count of th...

CSS Hacks, Firefox 3.5 and Google Chrome

I searched around and allegedly, body:nth-of-type(1) is used in CSS to target only Safari and Google Chrome. Lo and behold, Mozilla reads it properly too. I searched ten times more but came up with nothing, so here I am. Is there a Google Chrome-only CSS hack? ...

Does anyone still bother with IE6 hacks?

I'm working on a web development project usng PNG transparency, CSS3 and all the other goodies you would come to expect in a "new" web design. IE8 and Firefox look great, IE7 is passable and IE6 looks like the dog coughed it up. With Windows 7 out in the wild (If you have to dual boot... do it in style :P) and Internet Explorer 6 down t...

Ruby to_proc hack with binding

I'm trying to create a little Ruby hack to make something like the reverse of the Symbol#to_proc hack. Whereas the Symbol#to_proc hack makes this possible: some_array.each(&:some_method) is the same as some_array.each { |obj| obj.some_method } I want to make this possible: some_array.each(&[:some_method]) would be the same as ...

Hacking attr_accessible to support a different set of accessible attributes for create and update

I'm trying to figure out how to make this hack for attr_accessible to support a really common use case in my code, but really after looking at attr_acessible and ActiveRecord::Base source code for a while, still don't know where to start. I can probably figure it out after digging deeper, but first I'd like to ask if anyone else would f...

Operator Overloading Plugin for Java

I have seen some nice Java compiler hacks wherein you can replace assertions by throw-exception statements, you can have auto-generated properties for fields and so on... I was just wondering... Is it possible to hack Java compiler so that it supports Operator Overloading? EDIT : It's not that I am missing operator overloading in Jav...

Favorite C++ template hack

Templates are both the blessing and curse of C++. Someone hates them, someone loves them. For those of you are in the latter group, whats your favorite template "hack", and what does it do? I'll start with my personal favorite, the "friender". This template allowes access to protected members - which I very frequently use for unittestin...

Hack a FITs Image Header

I need to change a few values in a couple of FITs image headers to fit with some test data I have. Therefore I'm trying to hack a FITs image header at the minute to run with the application. However at the minute - I can't even see the header, never mind hack it. I run Ubuntu. Can anyone advise some software to view the FITs - perhaps ...

java ternary hack

So I'm not going for maintainability or elegance here.. looking for a way to cut down on the total tokens in a method just for fun. The method is comprised of a long nested if-else construct and I've found that (I think) the way to do it with the fewest tokens is the ternary operator. Essentially, I translate this: String method(param) ...

Rack rSpec Controller Tests with Rack Middleware issue

Howdy, I'm having big trouble testing with rSpec's controller API. Right now I'm using a middleware authentication solution (Warden), and when I run the specs, the proxy added by the middleware is not there, and all the authentication tests are throwing NilPointerExceptions all over the place. It seems rSpec is not adding the middlewar...

Future proof CSS hack for LTE Opera 10

I’m currently using @media screen and (-webkit-min-device-pixel-ratio:0) { example {} html:first-child example {} } to target Safari + Opera 9.2 Is there a safe way to target opera gte op 9.5 or lte op 10? (for example it won't be picked up by an upcoming version of firefox) By the way, type="text/opera" isn't working any...

eagerly evaluating boolean expressions in Python

Hi! Is there a way (using eval or whatever) to evaluate eagerly boolean expressions in python? Let's see this: >>> x = 3 >>> 5 < x < y False Yikes! That's very nice, because this will be false regardless of y's value. The thing is, y can be even undefined, and I'd like to get that exception. How can I get python to evaluate all expre...

Firefox 3 only CSS Hack

Looking for a Firefox 3 CSS hack that doesn't inherit in Firefox 3.6. html>/**/body .blockmeta .date-ui, x:-moz-any-link, x:default { border:1px solid #ccc; border-bottom:2px solid #ccc; background:#f2f2f2; margin-top:-1px; } The code above seems to also work in Firefox 3.6 which is undesirable. ...

Explain the deviousness of the Perl "preamble"

The Perl manual describes a totally devious construct that will work under any of csh, sh, or Perl, such as the following: eval '(exit $?0)' && eval 'exec perl -wS $0 ${1+"$@"}' & eval 'exec /usr/bin/perl -wS $0 $argv:q' if $running_under_some_shell; Devious indeed... can someone please explain in detail how this works? ...