Getting ready for an interview
hard life...
I'm getting ready for an interview. I'm going to be interviewed for a new position and it will be a tough one because I'm looking towards the unexplored world of Java. I really don't know anything about it so I'm trying to be prepared as much as I can.
I than started browsing the web and I found this awesome site with all the possible questions they might ask you during an interview.
here it goes for your pleasure: http://dev.fyicenter.com/interview/index.html
Which is the difference between event capture and event bubbling?
The DOM has two ways for objects to detect events: from the top down, and from the bottom up. The first method is known as event capture, the second is called event bubbling.
Event Capture
Let's say that your document contains a
<div> which contains a <span> which contains an <img alt="" />. Further, let's say you've added an event listener to all of them. When a user clicks on the image, a mouseclick event occurs.
Even though the user clicked the image, the image doesn't get the event first. Instead, the event listener attached to the document grabs the event first and processes it. The event is then passed down to the
<div>'s event listener. The event then goes to the <span>, and finally to the <img alt="" />. That is, all of the clicked-on object's "ancestors" higher up in the document capture the event for processing before sending it down the chain to its intended target.
Event Bubbling
Now let's look at the same situation from the inside out. You have an <img alt="" /> inside a
<span> , which is inside a <div>, which is inside your document. When a user clicks the image, this time the events rise like a bubble in a glass of water. The click's original target, the <img alt="" />, gets to see the event first, and then passes it upwards to the <span> for further processing, which passes it on to the <div> , which finally passes it up to the document.
Using dropbox as git repository
This is just another way to give some use to your dropbox account. Although I use git in this article, you can pretty much do it with any other SCM tool.
First of all you obviously need a dropbox account. If you don't have one already, go register for one and get 2Gb of free online storage.
Now that you have an account, create a folder on your dropbox and on the web interface and share the folder with some friends if you wish to do so.
All is ready now to start creating the repo. For this post I'm assuming you already have a local git repository of a project called my_killer_app and that you are working on a unix based operating system like OS X or Linux.
Open up a terminal, and change directory to your project folder:
cd ~/Sites/my_killer_app
The next step is to clone your existing local repo into the shared dropbox folder:
git clone --bare . ~/Dropbox/shared_folder/my_killer_app.git
The --bare option tells git to not include the project files. Only those files needed to track the versioning are cloned (mainly those present in the .git/ folder).
Now you have sort of a remote repository. Although it's on your machine, it's remote to everyone else sharing the folder. But to make things work we need to add this "remote" location and give it an alias:
git remote add my_killer_app ~/Dropbox/shared_folder/my_killer_app.git
There! It's done. Now you can push your changes to the repository. And pull the changes on another machine with your dropbox account. Also people sharing the folder will be able to do the same.
Just for the sake of completeness, here's how you would make changes and commit them to the "remote" server:
You made changes to the code, now it's time to add and commit:
git commit -a -m "another commit example"
Nice! Now let push them to the "remote" server:
git push my_killer_app master
Piece of cake.
And here's how a different user sharing the folder would do to collaborate on your project:
Clone the repository:
git clone ~/Dropbox/shared_folder/my_killer_app.git
Add the alias to remote repository:
git remote add my_killer_app ~/Dropbox/shared_folder/my_killer_app.git
And that's it! Now it's pull, commit, push. If you need more info on git usage you can check this manual.
from:http://blog.rogeriopvl.com/archives/using-git-with-dropbox/
How to convert PSD to JPG using Linux convert from command line
I recently had the need to convert psd images to jpg from command line. I browsed the net a little bit and I found an interesting article about how to do it easily. The right command is "convert" and it works for several images type and among them photoshop psd.
here is how it looks like:
/usr/bin/convert -quality 80 -flatten myimage.psd myimage.jpg