Wordpress Automatic Installer Shell Script
Posted by Ali Gangji | Filed under Wordpress, command line
Today I’m going to share with you a little script to automate installing Wordpress. This is a standalone shell script that will download the latest version of wordpress and configure it for you.
First of all, here is the script.
This script will download the latest version of wordpress and extract it to the directory you specify. It will then create a wp-config.php file and configure it for you. Just run the script and then visit wp-admin/install.php on the new installation.
Usage
$ wordpress install_dir -u dbuser -p dbpass -d dbname
Options
- -u dbuser Database username
- -p dbpass Database password
- -d dbname Database name
- -h dbhost Database host
- –private Hide blog from search engines
- –prefix prefix Database prefix
A clean and easy cross-browser CSS dropdown menu
Posted by Ali Gangji | Filed under CSS techniques
Everybody needs a portable CSS dropdown menu in their bag of tricks. It’s not difficult to build a dropdown menu, but i’m lazy. This way I have a re-usable cross browser solution. Even your mom can’t argue with that.
First, I will say a word about getting the dropdown to work in Internet Explorer 6. IE 6 does not support the :hover sudo-class on li tags. There are two solutions to this problem. Both behaviors only occur when the user visits with IE 6 or lower.
- Use javascript to simulate the :hover sudo-class with a regular class.
- Nest dropdowns inside of a table and inside the parent anchor tag .
I will use the first solution. It keeps the HTML and the CSS cleaner. I am ok with the javascript since it will only be run on IE 6 and lower.
Here is the HTML structure of the dropdown. I have imported the CSS at the top, but I suggest that you include with a link tag in the head of your page.
Here is the CSS:
Lastly, the javascript bit for IE 6:
Installing Adobe Flex Builder for Linux on Arch Linux x64
Posted by Ali Gangji | Filed under free software
As you probably know if you are reading this, Adobe Labs has a Flex Builder alpha available for linux. Unfortunately, Flex builder for Linux is 32-bit so running it on Arch Linux or any other 64-bit Linux distro requires 32-bit versions of the JRE, Eclipse, and Firefox. Thankfully, you can find the JRE and Firefox on the AUR (Arch User Repository). The easiest way to install packages from the AUR is with yaourt yaourt. Yaourt is a wrapper for pacman. It works just like pacman but “it adds seamless access to the AUR”. The name is awkward but that’s why God created the alias command. If it bothers you that much (I don’t see any other reason not to use it), you can use the AUR User Guidelines to install it with pacman. I used Yaourt and these are the steps I followed:
- First we need the 32-bit Java Runtime Environment. Install bin32-jre from the AUR.
$ yaourt -S bin32-jre - Do the same for firefox32.
$ yaourt -S firefox32 - Download one of the eclipse europa packages and extract it to the location you would like eclipse to be installed. I extracted it to /opt/eclipse32. Now don’t go getting a newer version. As of this writing Flex builder for Linux does not work with newer versions of Eclipse.
- In your eclipse directory (the folder you just extracted), edit eclipse.ini and add the following line after the org.eclipse.platform line.
-vm /opt/bin32-jre/ - In the same folder, create a file called eclipse.sh. Enter the following. If you have used different directories, then be sure to change these to your own.
- Now source the file to make sure that eclipse works and to set up the environment for the Flex Builder installer.
$ source eclipse.sh - Download run the Flex Builder for Linux installer. I installed Flex Builder at /opt/Flex. If you install it somewhere different, be sure to update the eclipse.sh you created.
$ sh flexbuilder_linux_install_a5_112409.bin - Copy the libflashplayer.so from the Flex installation to your firefox32 plugins folder.
$ cp /opt/Flex/Player/linux/install_flash_player_9_linux/libflashplayer.so /opt/firefox32/plugins/ - Edit Adobe_Flex_builder.sh in the Flex Builder directory. At the very bottom, change eclipse to eclipse.sh.
"${ECLIPSE_LOCATION}"/eclipse.sh -vmargs -Xmx512M
Now you can run /opt/Flex/Adobe_Flex_builder.sh to start Flex Builder for Linux! I think this and SWFTools are the best Flash authoring options that we’ll have on Linux for a while to come. So if you’re waiting for a better solution from Adobe, don’t hold your breath. It is quite miraculous that Adobe actually went through the effort. If only they were willing to finish the job!
Tags: flex
Why I use free and open software
Posted by Ali Gangji | Filed under free software
This is by no means comprehensive, but I wanted to quickly outline my reasons for staying away from proprietary software and sticking to free and open source software. My reasons are both technical as well as ethical.
Proprietary software products are specialized consumer products. They employ a systemic division between user and developer. There is no such distiction with free and open software. The users are the developers, and the developers are the users. Consequently, proprietary software is very restrictive and uncontrollable.
A common manifestation of this division is closed source releases. This makes you more susceptible to bugs, and completely vulnerable to malware. It also devoids the product of educational value. On the contrary, open source software often benifits from public rigor to achieve superior stability, security and performance. This also leaves you free to modify the program to suit your needs.
Propreitary software licenses restrict you from sharing the software. I consider this unethical simply on the grounds of free speech. Software is simply information. You cannot convey to me a piece of information and still own it. These restrictions are also morally corruptive to society. Combined with closed source, this also prevents collaboration and learning.
Proprietary software also breeds dependence. They employ techniques such as using secret formats and conspire with eachother to keep you stuck with certain technologies. This is why formats like MP3 and DVD are in standard use. Not because they have any technological benefit, but because the proprietors have conspired to keep themselves getting paid. Open source developers are not motivated by money, they are motivated by the software. That’s what I want. I don’t want software designed to restrict me and make someone else money while also having some functionality. I want software that every ounce of was designed for functionality and freedom. Every ounce.
Most importantly, linux is just a kick ass operating system that is utterly unparalleled. It’s just amazing. I could not live without it!
Tags: ethics, freedom, open source
Convert FLAC files to MP3 with flac and lame
Posted by Ali Gangji | Filed under command line
Flac files are just dandy, and I’m happy to use them. Sometimes, however, you might need mp3 files instead. Particularly if a friend of yours asks you to make him an mp3 cd out of some albums you only have in FLAC format. So what to do? well it’s easy enough to do from the command line, provided you have flac and lame installed.
first create a file called flac2mp3 somewhere in your path.
copy the following into it:
#!/bin/bash
FLAC=$1
MP3="${FLAC%.flac}.mp3"
[ -r "$FLAC" ] || { echo can not read file \"$FLAC\" >&1 ; exit 1 ; } ;
metaflac --export-tags-to=- "$FLAC" | sed 's/=\(.*\)/="\1"/' >tmp.tmp
cat tmp.tmp
. ./tmp.tmp
rm tmp.tmp
flac -dc "$FLAC" | lame -b 192 -h --tt "$Title" \
--tn "$Tracknumber" \
--tg "$Genre" \
--ty "$Date" \
--ta "$Artist" \
--tl "$Album" \
--add-id3v2 \
- "$MP3"
Now just enter the directory with your flac files and run the following:
for file in *.flac; do $(flac2mp3 "$file"); done
That’s it! wasn’t that easy? good ol’ ‘nix.
Tags: code, flac, lame, mp3, scripts
ImageMagick: Join images together on the command line with ImageMagick
Posted by Ali Gangji | Filed under command line
Turns out it is pretty easy to join images together. This is especially useful for joining together a button image and it’s rollover state.
Here, I want to join together the images portfolio.png and portfolio_over.png
Read the rest of this entry…
Tags: images
Code highlighting colors for Geany
Posted by Ali Gangji | Filed under free software
If you’re anything like me, you love Geany for its super fast loading and restoring open tabs. However, I really didn’t like the highlighting colors. I used to use Kdevelop, and I enjoy Kate’s colors for web code so here I’ve made some filedefs for geany to get Kate like colors for XML, CSS, JS, and PHP.
Read the rest of this entry…
We’re live
Posted by Ali Gangji | Filed under news
aligangji.com is now officially re-released. Much better than before, now with multiple pages and a blog. A real post will be coming soon.
