I'm a HUGE fan of Quicksilver, i simply cannot use a pc that lacks it. Right now, i'm using for few things, app launcher, iTunes control ("pp" FTW), and to browse my contacts when i need to send an email.
On the other hand, i'm not that much an user of Twitter, but i know some really cool people there and once in a while i check it out. I tought, maybe i'll use it a bit more if i can use it the way i use the rest of software, like when the IM support was working, for example.
So, as an excuse to start editing some code, i brushed up my old post on Python, plugins and Adium and started VIM, my console-editor of choice (the other beings TextWrangler and Xcode).
Turns out that Quicksilver is an half-dead project, and docs is really non-existant, but i managed to found some good posts about Quicksilver plugins.
That, and what i've learnt from my previous approach, helped me to bake in roughly an hour TwitterSilver, the Quicksilver Plugin that Tweets!
Of course you can download and use it, and, surprise, i'm using it to introduce my brand new code repository at Google Code, where you can find lots of non working vapourware!
When i look at my home directory in Finder, there was something that stroked my eyes: my Project directory, the one in which i use to put all my code, is the only one without a custom icon.
Today i was in an harddisk-cleaning mood, and i found the skills to do a (pretty bad) custom icon for that directory!
I tried to find a tutorial, to "emboss" some custom graphic into the standard Leopard folder, but the only one i found was using a Photoshop template and it did not explain nothing but "drag your bitmapped image to this layer, the template will do the stuff".
I've considered the option to download a demo copy of Photoshop to do the trick, but it was an huge download, really overkill for what i wanted to do, besides Adobe has this bad reputation with installer i didn't even wanted to try.
Instead i tried to reccall all the Pixelcorps free tutorials i've watched, and fired up The Gimp.
It turned out the process of creating this style of icons is really simple:
create a layer with the "base" folder
duplicate it, and the copy a bit using tools such as Luminosity and Contrast
create a one-channel mask with the graphics you want to "etch" on the folder
make a bump map of the light folder with the mask
use the mask as the alpha channel for the dark folder
easy, isn't it?
However, just to prove my mad gimp-fu, here is the screenshoot of my new home directory:
and, since i'm really generous =), you can download the icon and use it as you please!.
A while ago, circa january 2008, i was coming back home drank as hell. Before going to bed, i've peeked at the email client and there was an email labeled "Google Engineering".
Clearly i've drank that much to have hallucinations.
So, after a good sleep, i came back at my terminal, and the mail was still here!!
A Google recruiter actually contacted me to send a C.V.!! I couldn't miss that occasion and for a weekend i was the happier person in the earth.
It turned out that they wanted only graduated persons, and while i've spent 6 years in two universities, i still don't have my fscking degree. They asked me an estimate on my graduation (which i missed, of course..) and to my GREAT surprise, they recalled me!!!
So yesterday, after some days of chasing, i got the screening call from the recruiter.
I was nervous as hell, and after the WWDC experience, i do not trust my spoken english anymore, so just to loose my nerves i've drank a beer =), i don't know if it helped, tought.
I had to choose from three main topics, i don't remember the first, maybe system administration, TCP/IP stuff, and general computer science questions.
I choose the last one, feeling like a guest in a TV quiz game.
The questions started, to my surprise they was all really easy, maybe because it was the non-technical interview, by the was that's more or less how the conversation felt like.
What's the quicksort complexity? Quicksort? Easy one: that's a comparison sort, so it have its O(nlogn) and Theta(n squared). She liked the fast response i gave, or at least that's what i'd like to think. =) (i was so nervous my hands was shaking)
Order from quicker to slower the following: context switch, memory write, disk seek, register read. (Thinking...) What's that? I'm really in "Who wants to be a millionarie? (Speaking) Ok, of course register read, then memory write, now i'm in doubt between context switch and disk seek, it should depend on machine architecture, but i'd say first context switch then disk seek. I hope that last note was appreciated! (despite i did know the answer, my voice was flickering)
Algorithms: you've a 10000 int array, you've to write a fast algorithm to count all the bits set to 1, and you've got unlimited RAM Oh... let'see the first algo i can think of is a linear search counting the bits of one integer using 32 bitmasks, which is constant time... i'd say you can go faster, but i can't think of a way right now. (shaking, flickering voice, soaked in sweat).
How you'd use the hint that you've got how many ram you'd like? Uh, i think i'd broke the integer some way, putting the pieces in some known buckets and count them... (ockay i reckon that was really non sense but she stopped me anyway...)
Now this is an hard question choose your best language... Argh... C, C++, Python? Err.. C! What is a void *? HEAJ? And that's an hard question, it's a pointer to an unkown type!!
Ah, by the way, our answer to that algorithm was: you divide the int by two bytes, and you made a lookup table to count byte per byte, so your answer was indeed on the right track!!
Wow, right now i'm pretty happy with this talk... I've answered correctly in basically no time. Now i know that those was really basic questions, still they managed to tickle my reality distortion field! =). (mine is not triggered only by Steve).
Now i'm waiting a written questionnaire, then i'll have to do two highly technical 45 minutes phone talks, and if i'll prove to be good enough for the Big G, i'll get an interview in person!! WOO
I don't know what will happen... But so far, i'm really happy!!! Even if they'll dump me, after all i still have no BS, being contacted by Google, and getting to have even the screening interview for me is like being in heaven =).
Well, i had to add more eye-candiness to get my grade, and it seems Cisternis' liked it, i got 30/30 cum laude =)
This is a screencast:
The concept is quite simple, you get the last 5 entries of the Safari's subscribed feeds, and you navigate them with the Apple Remote.
The code has a little... ehm.. "shortcut" i don't like at all, but i had to do it really fast, and i didnt want to refactor the code 30 minutes before the exam, but...
I wanted to try this for a long time, but i never had the willings to implement the protocol bits. Don't know how, but i'm in a hack-my-blog mood, so here we are...
I've implemented a partially working Meta Weblog API that allows me to use a blogging client like Mars Edit to write my blog posts!
Working with Python is really a pleasure...
Right now my implementation lacks a proper authentication, i just check my credentials as "magic numbers", edit and tag support.
I don't think i'll ever address the auth thing, but if i'm in the mood of completing this thing, at least to allow basic post editing, i'll release the script...
Well, don't know if it will be useful to anyone, since it's tied to my model classes, but maybe it will be a good starting point, or an example, i don't know.
Of course, if you want it right now, just shout in the comments =).
When someone has to study, you know, he will find a great number of excuses to slaking off in peace with his consciousness.
That's why this site sports a whole new design. It's more flexible, so code should be more readable, and i think it'll scale well with non-blog kind of content.
Next steps: collect all the mini-scripts and things i've hidden in the Net and collect 'em here.
Yeah, something to do in the hot days here in Calabria!
At WWDC i've had the chance to meet many different kinds of developers: the "shareware student", the indie "bigs", the employee of big companies, even some IT guys.
For me, with the little experience i have, it was a big chance to relate with others, and get inspired. I've realized that living in a rich environment stimulates you, it makes you more productive by putting you in "the right mood" to actually start and getting some things done!
Talking to some people, conversation naturally shifts to the tools we use, as computer programmers, developers and scientists. And as anyone knows, those topics are a rough equivalent of religion. Church of VIM, church of Emacs, the Ruby vs Emacs... you name it!
After the light fights of text editors, the turn of programming languages arrived, and i got really "ignited" when i've heard something in the line of "i hate objective-c because it lacks garbage collection, objective-c 2.0 is muuuuuuuuuuuuuuuuuch better.. why i have to manage my memory!".
Now, let me state that i love GC and i use it actively, BUT as i say, "as a programmer you've got to know every other byte in the address space your application run".
Now i really was the guy from the outer space, actually liking all that retain and release methods, malloc() and free() functions... i really had to be some strange, uncommon alien.
But now, let me exapand a little on this, which i meant to be this post's topic.
Of course you'll use GC, automatic memory managment and a whole set of tools to make your job easier and less error-prone, but you do not have to forget what you're actually doing, you've to carefully know what choices you've made, yourself or by using a determined set of tools.
A computer really is nothing more than a thing that computes things on memory, just that. Every other piece of software or hardware is just something that can be seen as piece of memory or piece of "something that computes".
The monitor you see this website is basically a matrix of pixel in memory, the mouse and keyboard are really a small number between other 2^32, disks, something more, but substance doesn't change that much.
It's not by chance that the kernel of an operating system simply is nothing but a manager for the computational resources - the scheduling part - and the memory resources - the virtual memory, paging on disk, et cetera.
Managing computational resources used to be simple, you take the processor do some work, then kindly release it so other can use it.
We know this is changing with time: we're heading at multicore machines, and bla bla bla.. all things you already know if you're not living inside a bunker.
Scaling used to be very easy too... just wait til intel or amd build a faster cpu and your program run faster.
Memory is really another beast.
First thing first, memory costs. Because of that cost we've designed a memory hierarchy, exploiting the fact that memory the slower is, the cheaper is, and usually at minus cost per bytes.
Because of that hierarchy we have introduced a bit of time delays in transferring chunks of memory between layers, if you do opengl stuff just look at texture management.
Sometimes when programming it's useful to have in mind that memory caching *does* affect performance. One notable example, the radix sort: despite being linear, it's execution time is often greater than comparison sorts, with their O(nlogn) scores. [The Influence of Caches on the Performance of Sorting - LaMarca and Ladner]
Translation: because of caching, a program theoretically blazing fast, is actually slower than a program theoretically fast, but not blazing.
Then, as a consequence of memory being costly, memory is small. And already packed up with code and resources. And our dataset. But that's an abstraction, in reality we have that our memory is shared between all the other programs, and we have to play nicely on that!
In particular, allocation and deallocation of memory are operations that take some time to do, so it's better to do it well.
Even if you're using garbage collection, you need to know what it does, and how. Like any other tool you have to know its strenght and weakness in order to master it.
This has been really an awesome week, i've met really nice persons and all the WWDC's
sessions were really awesome, even if some were really basic... you know for all the
newbies that are jumping in the whole iPhone thing.
Right now i'm in the plane from SFO to JFK playing around with my copy of the awesome
Snow Leopard Developer Preview, but do not worry or get too excited, you know all the NDA
things.
Instead, i want to talk you about Installer Packages.
I've not yet installed 10.6 but i'm on a really, really long flight and, guess what,
really bored, but i don't want to install a whole OS running on batteries, but however i
slapped the cd in the Xantia's drive, and i just realized what i had to do: i cannot install
the os, at least let's see the documentation of the magnificent new features, [REDACTED] someone
might say =).
Then, of course, the problem: my copy of Pacifist kept crashing and i couldn't extract the
documents i want to read, after a couple of tries i fired up my terminal to investigate
another solution.
First thing first, let's guess the file format of the package. I tought it was a bundle
of some sort, but it turned out it was a plain data file.
Xanthia:devs willy$ file DevDocumentation.pkg
DevDocumentation.pkg: data
Xanthia:devs willy$
Now, not that i really read that kind of hex, but the first 3 chars are "xar", which
i remember it should be a new archive format, maybe we have a command to mangle with it?!
Xanthia:devs willy$ xar | head
Usage: xar -[ctx][v] -f ...
-c Creates an archive
-x Extracts an archive
-t Lists an archive
[...]
Just a cool excerpt of a chat log with me and a friend of mine... =)
N.P.:
in 1950 they estabilished that the Virgin Mary ascended in body and soul to heaven.
soul aside, assuming restricted relativity, where the maximum speed of a body is the speed
of light, the Virgin Mary should be now within a ~1950 light years radius...
Biappi:
she didn't get burned during the atmosphere exit?
N.P.:
i don't know... she was a virgin before, during and after the birth of Christ, she can even
exit atmosphere at the speed of light
Ok, this blog is rarely updated, do i have to apologize every time? No, i don't. :P
With this new iPhone/iPod SDK some friends of mine began writing in Objective-C
after ages of Java or C++. Yay for them!
I wanted to show 'em a lil bit of dynamism the objc runtime offers to us. Today, my fellow
readers (do i have even one?), we'll try to instantiate an object of a class unknown at compile
time.
So, let's start with a basic objc class (no cocoa there)
UsefulClass * uno = [[UsefulClass alloc] init];
[uno doSomething];
Nihil sub sole novum, that's just Obj-C 1-0-1, but what if we want to instantiate another
object the same class of "uno"?
We can track "uno"'s type just by declaring a class variable, then just asking
"uno" itself!
Class unknownClassToInstantiate = [uno class];
id trallalla = [[unknownClassToInstantiate alloc] init];
Yep, it's that simple!
We find out the class with the class message provided by all NSObject-compliant
object, which appens to be all objects in a Cocoa environment, then we treat the class
variable just like a "real" class name!