Zend Studio old menu style in Unity

May 10 2011

Java apps have a small issue with global menu in Unity.

To revert Zend Studio to old-style menus:

Create a “ZendStudio.sh” file in ZendStudio directory

#!/bin/bash
UBUNTU_MENUPROXY=0
/path/to/ZendStudio

Make the file executable

chmod +x ZendStudio.sh

Now create a lanucher icon “zend-studio.desktop”

vim ~/.local/share/applications/zend-studio.desktop

Add the following content to it

[Desktop Entry]
Name=Zend Studio
Exec=/path/to/ZendStudio/ZendStudio.sh
Icon=/path/to/ZendStudio/icon.xpm
Terminal=false
Type=Application
StartupNotify=true

Make the file executable

chmod +x ~/.local/share/applications/zend-studio.desktop

Then, navigate to that location via Nautilus (press CTRL+H to |un|hide files), run the “Zend Studio” icon and pin it to the launcher.

Comments Off

The simplest, yet most powerful VIM configuration line

Apr 17 2011

./configure --with-features=big

Comments Off

Nohup and Screen

Apr 11 2011

I always thought that when you create a process from terminal, and move it to background with &, that It was supposed to stay in background, right?

Well, the problem is that processes that output data back to terminal, when you close the terminal, will close the processes created in it as well.

In order to resolve this issue, just type ‘nohup’ in front of the command you want to run in background and that solves the problem.

The other way is to use a screen command.

Screen basically detaches the terminal session and puts it in background.

You can always come back later, or even ssh to a remote box and return back to a terminal session, right where you left it with ‘screen -r’

Comments Off

SSH SOCKS proxy server

Jan 04 2011

If you crave for privacy and wish to protect your communications (like chat and email) from prying eyes, this is how dynamic port forwarding can turn SSH into a SOCKS proxy server.

The idea is to forward all traffic from @unsecure to @secure location via SSH and then use Internet from @secure location.

To set up a proxy run

ssh -C -D 1080 user@SecureLocation.com

-C enables compression
-D 1080 runs dynamic port forwarding on port 1080

After you connect to secure location, edit browser, email or chat SOCKS proxy settings, pointing them to ‘localhost:1080‘ and use your apps without worrying of being snooped.

Comments Off

Reset Gnome Settings

Dec 10 2010

If you’ve “tweaked” Gnome beyond repair, by deleting its settings folders, Gnome can be restored to default looks.

First stop the GDM service

$ sudo service gdm stop

After that login to shell with your username/password and delete following folders in home directory

rm -rf .gnome2 .gconf .gconfd

When done, start the GDM service and login as usual.

$ sudo service gdm start

Gnome should look just like after the fresh install.

Comments Off

Stop cron emails

Nov 23 2010

When you run a cron job that returns some output, that output is sent back to the user that created the cron job.

In order to stop receiving email notifications just add “>/dev/null 2>&1” at the end of your cron command line.

For example

0 * * * * ls ~ >/dev/null 2>&1

Comments Off

Pidgin MSN “Unable to validate certificate” error

Nov 22 2010

This is a nice trick in order to fix the above error.

Open up your favourite browser, *cough* Firefox *cough*, and point it to ‘https://contacts.msn.com/‘ url.

You will see a ‘Directory Listing Denied”, but that’s not the reason we are there ;)

Now click on the blue certificate section in url (it says ‘msn.com’)

then go to ‘More information’,

‘View Certificate’,

‘Details tab’

and finally ‘Export’ button.

Save the certificate into the ‘~/.purple/certificates/x509/tls_peers/’ folder, and disable/enable your MSN account in Pidgin.

Comments Off

Selecting random value in MySQL

Oct 28 2010

SELECT FLOOR(1 + (RAND() * 100))

where 100 is a maximum allowed number in random sequence

Comments Off

Update timestamp in MySQL datetime field

Oct 13 2010

This example will update a year in table field which was wrongly set to 2011 and set it to 2010.

e.g. 2011-09-20 will be changed to 2010-09-20 throughout the table.

UPDATE $table \
SET $field = $field - INTERVAL 1 YEAR \
WHERE year($field)=2011;

Comments Off

Import .csv file into MySQL database

Aug 22 2010

I was implementing PhishTank database to one of my projects.

PhishTank is a service, operated by OpenDNS which updates a current list of phishing sites on the Internet.

When dealing with large number or requests it is advised that you download their hourly updated database dump.

I decided to grab the .csv dump and import it in my database using cron.

The heart of this cron is the following command which imports .csv data into local database

mysql -u$username -p$password -e \
"load  \
    data local
infile  \
    \"./verified_online.csv\" \
into table  \
    $database.$table \
fields terminated by \",\" \
enclosed by '\"' \
lines terminated by \"\n\" \
( \
    phish_id, \
    phish_detail_url, \
    url, \
    submission_time, \
    verified, \
    verification_time, \
    online, \
    target \
);"

Make sure that you already have the table created with following fields “phish_id, phish_detail_url, url, submission_time, verified, verification_time, online, target”

Comments Off

« Newer - Older »

Performance Optimization WordPress Plugins by W3 EDGE