Just thoughts

Sunday, November 28, 2010

Deleting the Facebook account

Yesterday I managed to delete my Facebook account. This isn't that interesting after all, but seemed to be the right move after all the ... whatever. I thought it will be an easy ride to delete the account but it actually has proven to be a minor headache due to the lack of information about how to actually do it. In my settings page I found a "Deactivate account" feature, but that wasn't what I wanted to do. I wanted Facebook to leave me alone and my personal data, mostly because I love so much zucchini and his arrogant ignorance.

So, how to do it? You have to click a link which is buried I have no idea where. Even though I'm quite good in search, it took me at least 10 minutes to find it: http://www.facebook.com/help/contact.php?show_form=delete_account. After clicking that link, you will be asked if you want to delete your account. Okay, yes. After you press "Okay", you're asked to provide your password and to test your eyesight with a Captcha challenge.


By the way. See that Captcha there? It's reCaptcha which is owned by Google and taking the challenge you actually help G digitalizing books while deleting your Facebook account. :)

I thought I was done, but no: Facebook reminded me that I will still have to wait 14 days in order to have my account deleted from their site (wondering if I can have my username back afterward). If by a mistake I login to Facebook during this period, my account will not be deleted. What does this mean? It means that I had to do the above described process again because I dared to "like" a Techcrunch article. Seems that even though I was logged out after deleting my account, a slippery cookie still remained active and logged me back in to Facebook. Nice try!

But what's my issue with Facebook? It's a hype. According to their press package they have 500 million active users. Mind if I don't believe that? Maybe if they'd drop the "active" adjective. I am skeptical because I saw what happened when I pressed that "Lick" button on TC. Ooops, typo: "like". Logged out users are magically logged back in if they press a like button and yes, that will appear on their wall, but that doesn't really mean they're active.
Secondly, Facebook is worth nothing for me. I find a site useful when I can learn something thanks to it. I follow blogs that publish comics; thanks to these blogs I improve my sense of humor. I use Twitter, because the people who I follow are really awesome and I become a better human barely by reading their congested thoughts (that sounds a bit 'yech'). I enjoy sites where users publish their images; my sense of beautiful is redefined each time I see a picture that was shot by someone who can appreciate what's beautiful or plain stunning, impressive.
In Facebook's case there's nothing to learn in my case. I'm flooded with information which has nothing to do with me, ads that are irrelevant for me and suggestions to become "friends" with people I don't find interesting at all. All this if I'm inside Facebook. If I am not... there's no valuable content.

Moreover, I haven't seen any technique on Facebook that would make me "wow" or at least would make me think about how it's done. In Twitter's case I always wonder how did they solve so neatly to push updates into my homepage, Google's Instant feature amazes me because it's so fast and I don't really get how could they make it so fast; even Bing makes me wonder sometimes about certain things they do. Facebook? Nothing at all.

So to summarize: Facebook is nothing more than a mammoth with high user base, a site that brings no innovation to the internet; they're stuck at where they were 3 or 4 years ago, both content and speed wise. It's an overrated rudimentary website, period.

Gary's off... with a trend

Friday, November 26, 2010

So, after I hacked Google's Instant previews and now unfortunately for me, I can use it in a ... wherever I want, I had to do something neat. And here came in the picture Assembly :), so the rest of the post will be in assembly.

call 0x00890105
add [ecx+0x64E53160], cl
rcl [edx-0x75], cl
mov esi, [eax]
or al, 0x52
push edx
mov ecx, [ebx-0x488DD7EC]
mov tr1, [edx-0x1]
xor eax, eax
xor [esp+ebp*4], edi
jl 0x00000089
pop edx
loopnz 0x0000008B
call [edi+0x58]
mov ebx, [edx-0x15]
adc bl, [ebp-0x7A]
xor ebp, [eax+]
xor ch, [eax+]
jnc 0x00000113
lea edx, [eax]
and al, 0x00
push esp
inc esp
push esi
push eax
push esi
push esi
push esi
inc esi
push esi
dec esi
push ebx
push esi
push 0x8679CC56
aas 
aad 0xFF
loopnz 0x000000B7
push eax
push eax
push eax
push eax
inc eax
push eax
inc eax
jmp $0xDF68:0xDF68
push esi
dec esi
inc [esi+0x68]
xor [edi-0x2AE29FF8], al
push eax
mov ebx, 0x5668B5A2
xchg eax, ebp
cmps es:[edi], ds:[esi]
popf 
mov ebp, 0x3C06FFD5
or bh, [ebx+edi*8-0x80]
jnz 0x0000012E
push esi
dec esi
inc [esi+0x68]
xor [edi-0x2AE29FF8], al
push eax
mov ebx, 0x5668B5A2
xchg eax, ebp
cmps es:[edi], ds:[esi]
popf 
mov ebp, 0x3C06FFD5
or bh, [ebx+edi*8-0x80]
jnz 0x0000012E
mov ebx, 0x6F471305
jc 0x00000155
push 0xFF
push ebx
inc ecx
push 0xFF
push ebx
inc ecx
mov ebx, 0x6F471305
jc 0x00000155
push 0xFF
push ebx
inc ecx
pop edi
xor ch, [eax+0x54]
ja 0x000000EE
push edi
aad 0xC7
mov [ebp+0x68], esi
dec ebp
outs dl, ds:[esi]
jmp [ecx+0x68]
pop es
aad 0xFF
nop 
mov eax, 0x00290100
push esp
les ebp, [eax+0x50]
sub [ecx], 0x00
imul edx, ebp, 0xFF
push eax
push eax
push eax
push eax
push eax
inc eax
push eax
inc eax
jmp $0xDF68:0xDF68
pop edi
pop eax
mov ebx, [edx-0x15]
adc bl, [ebp-0x7A]
xor ebp, [eax+]
xor ch, [eax+]
jnc 0x00000113
pop edi
xor ch, [eax+0x54]
ja 0x000000EE
pop es
aad 0xFF
nop 
mov eax, 0x00290100
push esp
les ebp, [eax+0x50]
sub [ecx], 0x00
imul edx, ebp, 0xFF
push eax
push eax
push eax
push eax
push eax
inc eax
push eax
inc eax
jmp $0xDF68:0xDF68
sub al, 0x02
shl [eax], 0x0D
iret 
mov [ecx], 0x5257E2F0
push edx
mov ecx, [ebx-0x2FBDC3F0]
add [eax-0x75], eax
test [eax+0x74], edi
rol [ecx], 0x4A
push eax
ror [eax-0x75], 0x01
mov ebx, [eax]
and [eax-0x2D], bl
add [ebx], edi
mov ecx, [ecx-0x75]
xor al, 0xD6
add edi, edi
xor eax, eax
xor ecx, eax
lods al, ds:[esi]
or eax, 0xE001C7CF
cmp ah, dh
jnz 0x000000E2
call [ebx-0x2B]
push edi
push ebx
jz 0x00000152
outs edx, ds:[esi]
jc 0x00000155
push 0xFF
push ebx
inc ecx
cmp ebp, esp
jmp ecx
add edi, [ebx]
clc 
and al, 0x7D
loop 0x000000E1
jmp 0xD55400E5
mov ebx, [eax+0x24]
pop eax
rol [ecx], cl
mov esp, [esi+0x4B]
or al, 0x58
mov eax, [ecx]
sbb al, 0x8B
ror [ebx+0x4401D004], cl
mov [esp], esp
pop ebx
pop ebx
pop ecx
popa 
push ecx
pop edx
loopnz 0x0000008B
pop edi
pop eax
mov ebx, [edx-0x15]
adc bl, [ebp-0x7A]
xor ebp, [eax+]
xor ch, [eax+]
jnc 0x00000113
pop edi
xor ch, [eax+0x54]
ja 0x000000EE
pop es
aad 0xFF
nop 
mov eax, 0x00290100
push esp
les ebp, [eax+0x50]
sub [ecx], 0x00
imul edx, ebp, 0xFF
push eax
push eax
push eax
push eax
push eax
inc eax
push eax
inc eax
jmp $0xDF68:0xDF68 

Tomorrow I tell you what it does. Or not, will see :)

Google Chrome with Xvfb (Headless Server)

Because I'm so damn bored, I tried to set up a box to take screenshots of webpages. This is usually fairly easy to do with khtml2png or with PyQt, but to be honest I haven't heard about a Chrome based screenshot generator. Why Google Chrome? Well, it has libgcflashplayer.so (like... Flash player, anyone?) by default so you don't have to hack your way through pixmaps and get a headache thanks to the flood of segfaults.

The issue is, that Google Chrome doesn't support natively "headless mode" and is very likely that we hit a nice concrete wall fairly fast after we install it and attempt to capture a screenshot with an external program like ImageMagick. But here comes in the picture the X virtual frame buffer, aka. Xvfb.

By now, thanks to all these weird names I used, I hope everyone thinks that it's very hard to persuade Google Chrome to run in a headless environment; it's not.
I grabbed an Ubuntu EC2 micro instance from Amazon (~$15 per month?), ran a few package installs and there you go, had the screenshot generator:

root@localhost: ~# apt-get install xvfb imagemagick
root@localhost: ~# apt-get install google-chrome

For the latter you may need to "force" things, but aptitude will tell you what to do, so I won't.

And kinda that was all you needed, because apt-get will find the dependencies and will install them for you. Now to get a screenshot of a webpage:

root@localhost: ~# xvfb-run --server-args='-screen 0, 1024x768x24' \
google-chrome -start-maximized http://www.example.com \
> & /dev/null &
root@localhost: ~# DISPLAY=:99 import -window root myimage.png

And that's it. There are still some problems, but in general it works neatly. There were two errors I encountered, first being Chrome's inability to create the 'Local State' file in ~/.config/google-chrome/. To fix this I ran [ touch 'Local State' ]. It fixed the issue; if it doesn't for you, find this file on your local system and paste the contents of it into the server's 'Local State' file.
The second issue happened sporadically when I tried to capture a webpage which contained Flash. A segmentation fault occurred which crashed to death the frame buffer. I didn't fix this issue (yet) because, one, it happens rarely, two, even if it happens, running again xvfb-run sets the frame buffer up correctly and I can use import to capture the contents of the root window in the specified display.

And finally, flash content is client side, that is it has to be downloaded before we get something. I say this because if I didn't let Chrome to run the flash for a few seconds, I got an empty container on the screenshot in place of Flash content. To 'fix' this, I let Chrome to run for about 5 seconds, and only then captured the image.


Hope this helps someone :)

Tuesday, November 2, 2010

Android Timer and UI threads

In the past few days I was trying to create a daemonized timer without too much luck, then after sweating blood I managed to come up with the following code:

public class SampleTimer extends Activity {

 /** Called when the activity is first created. */
 @Override
 public void onCreate(Bundle icicle) {
  super.onCreate(icicle);
  setContentView(R.layout.yourlayout);

  // we create a new timer
  // arg0 -- String - The timer's name
  // arg1 -- Boolean- Whether the timer should be daemonized
  Timer timer = new Timer("MyTimerName", true);

  timer.schedule(new TimerTask() {
   @Override
   public void run() {
    // method to repeat
    SampleMethod();
   }
  // initial delay is 0 seconds
  // and SampleMethod() will run every
  // 1.8 million milliseconds (30mins)
  }, 0, 1800000);
 }

 private void SampleMethod(){
  // we run a new worker thread on the UI thread
  this.runOnUiThread(worker);
 }

 private Runnable worker = new Runnable() {
  public void run() {
   // do some checks then send notification (upcoming post)
  }
 };
}

This piece of code, without the class container, is actually used in another background thread (in a class which extends Activity and implement Runnable).  I bet if a long-time Java programmer would see my code, would cut my throat, but hey, it works :)

Labels: ,