Feb 3
I have my iPhone officially unlocked by O2. However, today I had to unlock it unofficially too — naturally, using blackra1n + blacksn0w combination (I've donated for blackra1n once, and now I feel like I need to donate for using blacksn0w — it was my most painless jailbreak and unlock ever). You can ask, why did I do that?
Well, how'd you like a reason: when I swap my SIM cards I am not necessarily at my home iMac so I can connect iPhone to iTunes to do an iActiva..damn, just to activate it! I don't want it, really — it's nowhere simple and counterintuitive like hell: I've activated it already once, and I've unlocked it once — why should I bother doing it every now and then?
So I had my iPhone blackra1n'ed, installed blacksn0w — whoa! It turns out, swapping SIM cards could be just that — swapping SIM cards. And this is the way it supposed to work.
Jan 29
Coded while professor explained what is the gamma code. Horribly inefficient but apparently works.
include <memory.h>
#include <math.h>
#include <stdio.h>
int binlog(
int number)
{
return log((
float)number) / log(2.0);
}
int main()
{
int value = 26;
char buf[0x100];
int i;
int position = 0;
memset(buf, 0x100, 0);
printf(
"%d\n", binlog(value));
int power = binlog(value);
for ( i = 0; i < power; ++i )
{
buf[position++] =
'0';
}
buf[position++] =
'1';
int remains = value - ( 1 << power );
int tmppos = position;
for ( i = 0; i < power-1; ++i )
{
buf[tmppos++] =
'0';
}
i = 0;
while ( remains != 0 )
{
printf(
"Remains: %d\n", remains);
buf[tmppos-i] =
'0' + (remains & 1);
remains >>= 1;
++i;
}
printf(
"%s\n", buf);
return 0;
}
Jan 27
For quite a while I used to have a huge pain in my arse — namely, programming in C++ for Linux on my Mac.
I think I said this before, but I like IDEs — especially, I like Eclipse: it saves my time and allows me to develop stuff much faster and more efficiently, it is also great when you’re learning some new code (and if you have a very large project at hands, that means pretty much all the time).
The problem was, I should still build the project on Linux. That means I was doomed to put all the sources on the network drive, which was accessible both from my Mac and from Linux server, and build it all there. Not convenient and slow. Very slow, in fact — builds were taking ages and ages. Other guys were using stuff like vim and emacs, and I didn’t find it useful at all: these tools are old, and give you next to none help when it comes to writing the code. So I kept struggling with using Eclipse in this hostile environment, until I come out with the idea, which is best of all described by these few lines of Makefile:
build:
rsync -rvz . my.dev.server:/path/to/project
ssh my.dev.server 'cd /path/to/project && build'
test: build
ssh my.dev.server 'cd /path/to/project && make test'
Now, when I finish editing the files (or want to check something) I simply do on my local machine:
kirillov:/local/source/dir $ make test
And voila — all sources are synchronised, built and tested! An extra benefit of this approach is that I have no object files, .d files, executable files and other useless stuff in my dev-folder (and, consequently, visible in my project). An only downside is, if your source tree is very large, rsync can take a good deal of time (that is why I’m syncing only my subproject in my real Makefile).
Jan 26
That said, one can do almost anything as long as this anything is not writing a lecture (which that specific one should be doing — at least, theoretically).
Now, I'm not different in any sense. Instead of writing an Image-Based Information Processing lecture (which puts me to sleep almost immediately — or is it the professor who does it?) I've managed to get a VNC working on my Mac. On my home Mac.
Well, it all started with the TeamViewer, which suddenly stopped to work. It was disappointing, as I couldn't play with Boxee on my home computer during the lecture anymore, so I've tried to invent something. Indeed, I could SSH into my iMac (via a resident NAS which acts as an SSH gateway to my home network). What I ended up doing could be best described by these commands:
imac$ sudo port install tightvnc
imac$ vncserver
... password
... verify
... your VNC server is running on iMac:1
nas$ sudo ssh -f roman@imac -L 5901:localhost:5901 -N
macbook$ ssh -f my-nas-username@my-nas-host 5901:127.0.01:5901 -N # it didn't work with localhost here
Then I simply used JollyFastVNC to VNC into my iMac by connecting to 127.0.0.1 and port 5901. Yay!
However, ten minutes later I realised, that in fact I can set up a tunnel to my Mac's default (bundled) VNC server on screen 0. So I did — and apart of the fact that I should've enabled monitor mirroring (otherwise it tried to skew my iMac's monitor + my HD TV connected to it into one rectangular window, which didn't look neither pretty nor comfortable), it did work quite good. That works and an only question I ask myself - why on Earth do I need it if TeamViewer has started working again?
Jan 22
OK, fine, I know — an average Englishman is fairly unlikely to need a dictionary when reading in his very own native English; an educated Englishman will hardly need dictionary ever. However, for us, foreigners, expats, or simply people who struggle (to whatever degree) to speak and read the language of Shakespeare, Jane Austen and Austin Powers, this may become handy.
You see the word. You don't understand it. You double click it. Now you do [understand it and go ahead].
That's pretty much the whole usage pattern for a new Google Chrome extension —
Google Dictionary, offered, surprisingly, by Google itself. Well, it's not your average dictionary, it looks just a bit more sleek and fun, explaining things in a language which is likely to be understand by someone who doesn't have a PhD in English literature; well, it works for me. Take a look yourself if you're like me — not feeling entirely confident in a grim and dangerous world of irregular verbs, past perfect tenses and their ilk; or again, may be you're just curious. Take a look anyway.
Jan 22
Did you know you can define custom search engines in Google Chrome? Yes you can. When I want to find a map of something, I type "map <mysomething>" in address/search bar and — voila, a map appears. How to do it? It's simple, really:
- Right-click your address bar
- Click "Edit Search Engines"
- Click "Plus" button
- Type your search engine name
- Type an activator (a short keyword you should use to tell Chrome that you want to use a custom search)
- A search URL, with query replaced to "%s"
It's even more simple once you've seen the pictures. Try it for yourself — saves a lot of time.
Jan 21
Suddenly found an absolutely killing feature of NetBeans 6.8 (don't
know, it could've been there before, but I found it only now) — it can
sync every file you save locally to remote server (FTP/SFTP), which
is, IMO, absolutely brilliant as now I can edit files locally using
nice IDE and then build and run them on large scary Linux server.
Probably, picture says it all.
Jan 20
One guy: don't want to replace my MacBook Pro right now, need to wait until 27th
Me: is there anything to wait for?
One guy: it certainly is
Me: you know what is it?
One guy: Yep.
Me: fancy to share?!?!?!?!!11
One guy: NDA.
Me: ...
One guy under NDA: do I really want to get killed?