Better HN
topnewbestaskshowjobs
Log inSign up

DCoder

1,260 karma · joined Nov 2, 2009 (17y ago) · 479 submissions

not here anymore
Submissions

comment 16y ago · link · parent

Your choice. I'll just take YUI Reset, combine it with YUI Base, both of which have already been tested thoroughly, and get a reusable foundation for future use.

comment 16y ago · link · parent

That loses all default theming from form inputs though.

comment 16y ago · link · parent

The whole point of a Reset is to have a clean slate to start from. Do you really know, and want to know, every case where IE6/Safari3/ObscureBrowser300 adds a default padding/margin, and how that is different from Opera/Firefox/etc? Same for font families, sizes and styles?

In my opinion, working without a reset of some kind is quite similar to writing C++ classes where data members are not initialized to meaningful values... you just can't trust what you'll end up with.

comment 16y ago · link · parent

We built a similar app for internal use, with the addition of real-time collaboration (flash-based audio/video chat + NetMeeting-style abilities to draw, type, etc. on the reviewed document). While this requires a central server to stream a/v and good connection, it's quite popular around here now.

comment 16y ago · link · parent

Sorry, I hadn't tested that enough. Here's a revised version that works better. Tested and removed my tag from another account's photo correctly. Unfortunately the CSRF tokens are not updated in the response, so you cannot run multiple requests without retrieving new tokens (opening another page should be enough).

  var loc = window.location.href.split('?')[1].split('#')[0].split('&');
  var qs = {};
  $jq.each(loc, function(ix, el) {
   var m = el.split('='), k = m[0], v = m[1];
   qs[k] = v;
  });
  
  var args = {
  	pid: qs.pid, // photo ID
  	id: qs.id, // photo owner ID
  	subject: Env.user, // user ID to remove
  	name: '', // not checked
  	action: 'remove',
  	__a: 1,
  	fb_dtsg: Env.fb_dtsg,
  	post_form_id: Env.post_form_id,
  	post_form_id_source: 'AsyncRequest'
  };
  
  $jq.post('/ajax/photo_tagging_ajax.php', args);
It seems to me that now it should be easy to adapt this to work on the "photos of me" page if you don't mind reloading it after each removal - $jq('a.UIPhotoGrid_PhotoLink:first'); should find the first link to a photo, and you can tokenize it instead of window.location.href on the first line.

comment 16y ago · link · parent

And I thought reverse-engineering a C++ application with COM was hardcore...

comment 16y ago · link · parent

Yeah, that was the context in which the OP was trying to do it. And they're using auth tokens, which, if they're at all competent, cannot be reused to automate it. I'll see what can be done to improve it when I get back home.

comment 16y ago · link · parent

Nah, I don't mind. Hope it helps.

comment 16y ago · link · parent

Using Firebug, FireQuery, jQuery no conflict as $jq, from inside a photo page (http://www.facebook.com/photo.php?pid=xxx&id=y) :

  var loc = window.location.href.match(/pid=(\d+)&id=(\d+)/);
  
  var args = {
  	pid: loc[1], // photo ID
  	id: loc[2], // request sender id? photo owner id? not sure, haven't tested, but my user ID worked when trying to remove someone from a photo in my album
  	subject: loc[2], // user ID to remove
  	name: '', // not checked
  	action: 'remove',
  	__a: 1,
  	fb_dtsg: $jq('input[name="fb_dtsg"]').val(),
  	post_form_id: $jq('#post_form_id').val(),
  	post_form_id_source: 'AsyncRequest'
  };
  
  $jq.post('/ajax/photo_tagging_ajax.php', args);
  
It doesn't update the UI. The fb_dtsg and post_form_id are required and seem to be anti-CSRF tokens. Haven't experimented enough to know if they can be reused multiple times.

comment 16y ago · link · parent

> but I do know that a government and regulatory pile-on to “fix” Facebook’s privacy issues will feel just as wrong as when the Cordlandt Homes was altered from Howard Roark’s original vision.

Yes, a thousand times yes.

comment 16y ago · link · parent

Electronic Arts did a similar thing when creating the C&C First Decade collection DVD: Red Alert 2 was recompiled to modify CD checks (the game compares the CD label against a hardcoded one, on top of the usual CD checks), but its expansion pack, Yuri's Revenge, was hex-edited instead to the same effect. This was done to maintain compatibility with the community-made patch that hooks into the EXE at assembly level to add new functions and fix bugs. (I'm the current lead developer for said patch.)

See, EA is not all bad. :-)

comment 16y ago · link · parent

I pasted your script into Eclipse (new JS source file), Source -> Format to make it readable. Then I took the big array that's assigned to _0x82af , pasted it into Firebug, bam, normalized strings. After that it was just plain find/replace. The first few lines came from the part before eval(.

comment 16y ago · link · parent

There's just so many times you can direct people to http://www.catb.org/~esr/faqs/smart-questions.html without losing your sanity. I spent several years trying to help people on a specific topic and eventually gave up because the stream of people who haven't put their brain to use before asking was reaching 90%. And that's on a niche topic, I don't even want to know how much more noise common topics get, and I have great respect for people like Heathfield for not giving up.

comment 16y ago · link · parent

http://pastebin.com/ceWGKZjJ , now you just need to firebug a Facebook page so you can figure out what those element IDs do...

At a quick glance, I'd say ErrantX is correct.

comment 16y ago · link · parent

Well, it also parses hex numbers prefixed with 0x... Hard to be surprised after the first time you get tripped by it.

comment 16y ago · link · parent

Well, at least they had to try to find a hole. I've had the pleasure of maintaining a "typical PHP project" - written by someone with no clue about xss, csrf or anything else. It had an admin interface that simply returned the Location: / header to an unauthorized user without exiting. In a publicly accessible /admin folder no less. The owner only wisened up when Yahoo's spider crawled in and followed all the "delete news item" links. Yes, GET links for delete, and DB storing passwords in plain text, isn't that nice.

comment 16y ago · link · parent

Related: http://catless.ncl.ac.uk/Risks/26.06.html#subj12

comment 16y ago · link · parent

Impressive, but I'll second the heating remark.

I just bought one of these http://www.amazon.co.uk/gp/product/B001E03444/ and swap out the drives as I need them. + two Fractal 120mm fans (incredibly quiet yet powerful, highly recommended) from the sides to keep the heat away. I chose that instead of building a similar frame, since a frame for 25 drives (that's what I have :-) ) would need some serious additional cooling and power, whereas the swapping solution doesn't.

comment 16y ago · link · parent

In my experience (limited to single threaded code though), modern C++ compilers (especially MSVC which does a better job than GCC in general) optimize really well. It's interesting to compare the assembly generated for the same operations in VC6 and VC2008/2010.

In line with what was mentioned below, VC6 used a series of lea to seek (a*x+b)th byte in a structure whereas VC2010 just uses a single multiply.

And something I was surprised by, VC6 always used fnstsw ax; test ax, 40h; jz $+16; to compare floating point values. VC2010 uses jp instead, I'd presume for a good reason as well.

Anecdote: One time and one time only I witnessed GCC write more "clever" code than MSVC, though I haven't benchmarked this:

  switch(val) {
   case 1:
   case 2:
   case 6:
   case 15:
    return foo;
   default:
    return bar;
  }
Both compilers returned > 15 normally, but optimized differently: MSVC compiled this into a normal two-step jumptable

  mov eax, table1[dl] // assuming dl contains val, table1 contains either 1 for bar or 0 for foo
  jmp table2[al] // contains addresses of two branches
GCC did the equivalent of this:

  return ((1 << val) & ((1 << 1) | (1 << 2) | (1 << 6) | (1 << 15)))
   ? foo
   : bar
  ;

comment 16y ago · link · parent

Microsoft has published their UI Design Guidelines, but it gets largely ignored as far as I can see - as long as developers don't see UI polish as a high priority issue, it gets pushed back as long as possible like other "polishing" tasks. I know I was certainly guilty of this when I was working in Delphi, less so nowadays. (And if Raymond Chen's stories are any indicator, developers in general are too lazy to RTFM at all, why would they bother looking for any guidelines for a low priority task.)

If you develop a desktop app on your company's time, your boss will find a million more important things to do than to make sure keyboard accelerators work, make sense, or are configurable. If you do it on your own, you will probably find a different million of things to improve, like the main number crunching loop. After all, you're coding it primarily for yourself so why do you care what Alt-W or Ctrl-U do in your app, you use the mouse. Maybe if you publish it, you'll get some feedback from users and you fix it, but it's more likely that they'll just decide it's "no more limited than that other tool" and you'll never know that it is a problem for them.

Not to mention there are varied GUI toolkits available depending on the programming language you use, each with its own style - Borland's VCL, especially with its button graphics which stand out to this day; MFC; wxWidgets... each with their own idea of how things should be handled. And there's OwnerDraw, giving the more "hardcore" coders another chance to shoot themselves in the foot by allowing the application to draw the control as it saw fit, which of course means they cannot take advantage of the new Windows common controls themes.

comment 16y ago · link · parent

(Edit: fixed formatting) Revolting? I think that's a pretty good, if complex, example of "pushing the limits". IMHO, the label "revolting" is reserved for code like this:

  Derived() : Base() {
    THISCALL(0x535AA0);
    *(DWORD*)this = 0x7E1AF4;
  }
That's the kind of code I get to write in my hobby project.

comment 16y ago · link · parent

Another good intro to lambdas and more: http://blogs.msdn.com/vcblog/archive/2008/10/28/lambdas-auto... . It's for Microsoft's VC++ (including the free Express edition I'm using right now), not GCC, but the syntax is obviously the same in both cases.

comment 16y ago · link · parent

A few years ago I had just a passing familiarity with assembler. Nowadays I write C++ that integrates with a closed source application, deals with its data structures, classes, and function calls, and adds functionality, as a hobby. Too bad I can't find a job doing something like that...

comment 16y ago · link · parent

I tried Tetris ... 11k points later I realised that 25 minutes had gone by. Addictive, and very well done from both technical and gameplay perspective!

comment 16y ago · link · parent

When it's valid and constructive, negative feedback is a good thing. When it's neither of those, and repetitive on top of that, you can't help but leave civility at the door and tell the complainers to shove it.

I get a lot of bitching and negative outside feedback in my project too, including some very uninformed and unreasonable comments, boiling down to "$past_competitor released much more often than you do" and ignoring the fact that their releases were much buggier and less polished. I am not sure what I can do to reduce the amount of complaints like that...

comment 16y ago · link · parent

You're looking for an issue tracking system / bugtracker. Try the Issues tab on github. You create an issue/task that needs to be done, assign it to a developer, and ask them to update the issue's details as he/she progresses.

I am not that familiar with GitHub, so I can't give you specific instructions or examples, but the project I'm working on uses Mantis for this, and it works a treat - we integrated it with SVN and now svn commits create new Product Versions, revision commit messages are automatically posted as issue comments + issues get marked as "resolved" if applicable, changelogs for latest changes, roadmaps for future plans, etc.

comment 16y ago · link · parent

In my current free time project, I learned enough C++ by reading assembly to not find anything new in Lippman's "C++ Object Model". I'm not sure if that's a good sign or a bad one - did I see so many tricks, was I not reading attentively, or what... pity the book doesn't cover COM+ though.

When I inherited this project, it was relying on (cast)s and macros all around and this led me to some nasty traps, I switched to building a lot of templates, they've so far proven invaluable in saving debugging time, enforcing type safety, and communicating expected data types to other developers. Templates are good. And macros are traps, but everyone already knew that.

Granted, the project is a niche, I don't think there are many similar projects out there, so not sure how useful my knowledge of the object model is. I'm reversing/extending a C++ game with no source, btw. DLL injection and all that goodness.

comment 16y ago · link · parent

Reverse engineering a C++ game and patching it. The usual thing fans do to fix their favourite broken games :)

comment 17y ago · link · parent

Debugging and reverse engineering games.

When publishers/developers don't give a bleep, the fans take up the task of fixing the bugs themselves. I happen to run one such project in my spare time (for C&C: Red Alert 2), and it's amazing how much stuff is broken. It's not as "serious" as other projects mentioned here, but still a reason to know ASM. (And a good way to see bad programming practices in action :) )

1
1213141516