My Science Is Better

7Jan/130

MySQL select duplicates

SELECT *
FROM table_name a
WHERE EXISTS (

SELECT 1
FROM table_name b
WHERE b.name = a.name
LIMIT 1 , 1
)
ORDER BY name ASC
Tagged as: No Comments
27Jul/120

Mount a Mac formatted HDD in Ubuntu

You can make it possible to mount HFS+ as Read and Write in Ubuntu Linux.

sudo apt-get install hfsplus

Then, use the -o force option to force the drive to mount:

sudo mount -o remount, force /dev/sdX /your/mount/point

Filed under: linux, ubuntu No Comments
23Jul/120

Magento tip : Image Upload HTTP error

There are a few possible causes including problems with mod_security.. however, if you are working behind a .htaccess/.htpasswd files to protect your site, you need to allow POST calls to go through; they’re being blocked b/c the AJAX call doesn’t know to use your cookie.

add

<LimitExcept POST>
Require valid-user
</LimitExcept>

to your .htaccess and you should be good to go.

Filed under: magento No Comments
22May/120

Real time folder monitoring in CLI Linux

I needed to see the changes to a folder in realtime and after a bit of looking around, i've found this solution:

 watch -d -n 1 'df; echo " "; echo "Local folder updates:"; ls -FIAt;'

If you want to refresh at longer intervals (not 1s as it is now) all you have to do is change the value of the -n parameter as so:

 watch -d -n 10 'df; echo " "; echo "Local folder updates:"; ls -FIAt;'

This will show you the changes to the current folder every 10s.

Filed under: linux No Comments
21May/120

Cannot See Video For Google Plus Hangout on Linux

After installing the Google Talk plugin, run the following to add an override for your video settings.

sudo echo "O3D_OVERRIDE_RENDER_MODE=2D" >> /opt/google/talkplugin/envvars

Use sudo if necessary. Restart your browser after doing this and check to see if you can see video streams now.

Filed under: Uncategorized No Comments
18Apr/120

Netbeans 7.1 integration in Unity

Go to Tools -> Plugins -> Settings -> Add

Name: Java Ayanata
URL: http://java-swing-ayatana.googlecode.com/files/netbeans-catalog.xml

then install the plugin

more details: http://danjared.wordpress.com/netbeans/

Filed under: Uncategorized No Comments
20Mar/120

Create PDF from multiple image files on Linux

I had a bunch of image files A01.jpg, A02.jpg and so forth that i needed created into a PDF. ImageMagick to the rescue:

cd /path/to/jpgs
convert -define pdf:use-trimbox=true *.jpg batbox.pdf
20Feb/120

Sublime text 2 Unity Launcher

I've looked into Sublime text 2 today, mostly unhappy with the speed Java based IDEs have on linux 64bit. When launching it, although I chose "keep in launcher", the icon does not stay there, so i created a custom launcher.

Create a file sublime2.desktop and save it in ~/.local/share/applications. The file should look like this:

#!/usr/bin/env xdg-open

[Desktop Entry]
Name=Sublime Text Editor
Comment=Sublime Text Editor
Exec="/usr/bin/sublime" %F
MimeType=text/plain;
Terminal=false
Type=Application
Icon=/home/mimir/sublime.png
Categories=GNOME;GTK;Utility;TextEditor;Development;Utility;

You can find the link to the icon here: http://d2o0t5hpnwv4c1.cloudfront.net/1038_sublime/sublime.png

Make sure to change the Exec path, to where you have installed Sublime2. I've installed in /opt but i've symlinked in /usr/bin

16Feb/121

Perl recursive replace in files

While working on a ZF application, i had some models under the wrong namespace, and changing all the files from Default namespace to Application would have taken me ages. After a bit of google-ing i've found this great perl onliner:

perl -p -i -e 's/Default_/Application_/g' `find ./ -name '*.php'`
Filed under: Uncategorized 1 Comment
10Feb/120

Install synergy client on Lion

I do most of my work on my Ubuntu laptop but i also have one mac mini next to it so i can debug websites in Safari or iPhone/iPad. In Snow Leopard i had setup synergy server on the laptop and the client on my mac, and i could easily use laptop's mouse and keyboard to control both machines. Here is how you can setup this:

On Ubuntu machine (server):

# install synergy 1.3.6 (other versions seem to have all sort of bugs)
# if 1.3.6 is not in repo anymore, check the download page: http://synergy-foss.org/download/
sudo apt-get install synergy

Now create the server config file (you might need to adapt this according to your setup


section: screens
	orion:
	io.local:
		ctrl = super
		alt = alt
		super = ctrl
end
section: options
        mousebutton(7) = keystroke(control+right)
	mousebutton(6) = keystroke(control+left)

end
section: links
       orion:
           left = io.local
       io.local:
           right = orion

Add this line to startup:

/usr/bin/synergys --config /home/<your_user_here>/synergy.conf -f

On Mac mini (client):
First of all, you'll need to install brew, if you haven't already (http://mxcl.github.com/homebrew/). For that check the installation at: https://github.com/mxcl/homebrew/wiki/installation

After you have brew installed open a terminal and install synergy:

brew install synergy

Now create a .profile file in your home directory and add:

if [ "$(pidof synergyc)" ]
then
    echo "Synergy is already started";
else
    /usr/local/bin/synergyc <your_server_ip>
fi
Filed under: Uncategorized No Comments

Tag Cloud

Categories

Archives

Akismet

Blogroll

Ads