This Blog has permanently moved to http://gleek.github.io/
Recent Updates Toggle Comment Threads | Keyboard Shortcuts
-
Umar Ahmad
-
Umar Ahmad
From WordPress to Octopress
This post is about choosing Octopress over WordPress hosted blog, it does not talk about WordPress as a framework.
It has been a very few days I started this blog. Now I feel a bit of a weird pride in announcing that this may be the last post on the wordpress, it’s now hosted on github – http://gleek.github.io , and powered by Octopress.
Why I chose WordPress?
When I first thought about blogging, the first thing that came to my mind was choosing the right framework for it. Three of them came to my mind, namely Drupal, WordPress and Octopress. Since I didn’t have any reliable hosting at that time and had previous experience with WordPress, I decided to go with blog hosted on WordPress.com.
The problems
What I didn’t realize at that time was that installing and using wordpress, on an owned server, was a lot different that hosting a blog on WordPress.com.
The main problem is that I have no desire to empty my pockets on a blog, but still demand full control over it.
WordPress sets up a free blog with a theme, but I had to pay even for the slightest tweak. So most of my problems which weren’t expected initially were:
- There are a lot of themes which were usable for free, but tweaking the themes is not tolerated without costing you some bucks.
- I couldn’t control the back-end of the blog. (I expected that, actually 😀 )
- You can’t write JavaScript
- You can’t write your CSS without paying a little something. I had to write some inline CSS to make something a little prettier.
- WordPress puts its advertisements at the end of every blog post.
- Custom WordPress plugins cannot be used in the blog.
Switching to Octopress
Disappointed by WordPress, hosting my blog on Github or Heroku with Octopress seemed to be the only option. Since I keep almost all my projects on github, I chose the same for the blog. There were some initial problems while setting up the blog. But issue queue helped me in solving them.
Pros
- I get the content control over my website. Above mentioned problems in wordpress site such as no JS/CSS support is now solved.
- It’s not necessary to be online while you write the blog
- Git is used to manage the blog which makes it easy to manage.
- Static pages makes it incredibly fast.
- Posts are written in Markdown
Cons
- Initial installation and setup is a bit time-taking.
- Your blog is restricted to your local machine. To use a different machine to blog, you’ll have to clone entire blog on it.(Which also eliminates using mobiles for blogging)
- For large websites generating the pages can take some time, though using
rake isolate[path/to/post.markdown]
andrake integrate
may solve the problem if you are working on a single post. Find more on Pavan’s blog
You can take a look at performance aspect of Octopress on Praveen’s Blog.
Summary
Choosing a framework for a Blog is a matter of choice. As far as I am concerned I’m satisfied with the results Octopress is giving me. I might remind you that this post was on my experience in blogging at WordPress and on Octopress.
-
Umar Ahmad
Customizing Emacs
I believe the environment in which one works is directly responsible for one’s productivity. It’s the reason I think, it’s important to choose the right editor, font, etc.
I used notepad, notepad++ in my Windows days. I have to say I spent a lot of time with notepad++ and it was my favorite at that time. My notepad++ days ended when one of my friends recommended Sublime Text to me. It was the best editor I ever had encountered till that time. The most important thing was that ‘it was cross-platform’.
Switching to Emacs
I switched to Emacs mainly because of it’s philosophy, as I am willing to put up with a much steeper learning curve if it makes me more productive or more comfortable in general. Now that some time has passed I’m much faster with Emacs than on any other text editor I use (namely Sublime Text, gedit and Vim). The other reason is it’s features. Emacs has tonnes of features which are very hard to replicate in other text editors. These may include from Shell mode to IRC-Chat to E-mail to even playing games inside Emacs.
Things to do after installation
- Enable CUA Mode: This basically enables Ctrl+X, Ctrl+C, Ctrl+V, Ctrl+Z, Shift+Arrow keys. Different key-bindings for such commands are sometimes annoying. Easiest way to do it is Options –> Use CUA Keys
- Hide the Toolbar: The Toolbar is pretty much useless if you are well versed with the key-bindings. Also it frees up a lot of writing space. You can even disable the Menu Bar (can be accessed by F10 from inside Emacs).
- Adding Melpa package Archive: This gives you tonnes of packages you won’t find on default archives. There are other managers out there like Marmalade which you can add too, but I feel that it’s not that frequently updated. But nonetheless you can add both of them.
- Choosing the right theme: I recommend using a theme which is a bit easy on the eyes such as Monokai, Zenburn or Solarized themes. I recommend you install them from the package manager.
- Choosing the right font: This is more of a personal choice actually. Any monospace font would do the job. You can refer to Dan’s article or Jeff’s Blog for more details.
- Making your scroll smooth: Emacs Scroll will seem a bit weird to some people who are new to it. To remove the jumpy effect of scroll you can add following lines in your .emacs file
(setq redisplay-dont-pause t scroll-margin 1 scroll-step 1 scroll-conservatively 10000 scroll-preserve-screen-position 1)
Well these are some basic customization which should be done by everyone using Emacs. You can add more features to Emacs by simply searching the package archive.
If you’re a confused with the basic key-bindings for navigation, you may refer to this page.
Finally, once you really get the hang of Emacs, it’s basically like dark magic. Check out some videos on the Emacs rocks page to see this magic in action.
If you’re addicted to vi there’s a funny song on GNU’s website : ‘Addicted to vi’ 😛
-
Umar Ahmad
Automatically Changing desktop background on gnome-shell
Click here to download the scripts directly, or view them on Github
One of the main attractions about a system is the desktop background. We tend to choose our background which identifies our interests , are aesthetically pleasing or remind us of our good times.
But the thing with consistency is that it gets boring with time. Wallpapers we once loved, becomes a burden and we find it hard to come back to that wallpaper after getting it on 24×7.
This is the problem I had. I cancelled out each wallpaper from my list of all wallpapers I had, after I completely sucked out the goodness of a wallpaper with my eyes.
I came up with the idea of automatically changing the wallpaper randomly via some sort of shell script. It’s implementation used
gsettings
to change the desktop wallpaper. It was supposed to run automatically as a cron-job but I couldn’t make the cron work. The current implementation usessleep
to get the delaySo a simple wall paper changing script looked like:
#!/bin/bash image_path=$1 #Setting up a path for local storage if [ ! -d "$image_path" ]; then echo "Path doesn't exist (Pass absolute path as parameter)" 1>&2 exit fi local_dir="/home/$(whoami)/.local/wall_change" #creating local directory mkdir -p $local_dir #getting name of the picture pic=$(find $image_path -regextype posix-extended -regex "(.*\.jpg)|(.*\.png)"|shuf -n1) echo $pic #Storing image in local_dir filename=$(basename "$pic") extension=".${filename##*.}" local_wallpaper=$local_dir/mywallpaper$extension #setting the wallpaper cp "$pic" $local_wallpaper #echo $local_wallpaper #Adding bogus wallpaper (don't know if this is a gsettings bug or i'm doing some basic flaw) gsettings set org.gnome.desktop.background picture-uri file:/$local_wallpaper #try increasing the sleep if wallpaper doesn't change sleep 1; gsettings set org.gnome.desktop.background picture-uri file://$local_wallpaper
You can find the rest of the files on Github
Have fun with your wallpapers 😉 -
Umar Ahmad
Adding Drupal IRC-Bot to #jmilug
One of the main drawbacks of IRC-chat is the absence of logging. This was the main reason why our community JMI-LUG almost stopped using the channel for any discussion, as there was nothing to refer to later.
There was a need for a kind of a bot which could save all the logs of the chats we had. Hence, I began my search for any open-source IRC bot to cater our needs.
I found many bots which could do the task.In my research I found a bot which could be integrated with Drupal and can be installed as a simple Module. As a matter of fact it is already used to log all official Drupal Channels (you can find it here). Since, the JMI-LUG website is already on Drupal it was a nice idea to use this one.
Installing
- Bot can be installed via update manager module of drupal or can be
git clone
d in the /sites/all/modules/ directory. - Installing the Net_SmartIRC libraries with
pear install Net_SmartIRC
(make sure to change the owner of the installed libraries) - Configure the Bot Settings from the configuration Menu.
- Change the permissions from the Modules list.
- Use shell to run
drush bot-start &
from the Drupal installation directory to start the bot
Bang, you’re done, have fun with your new bot. The bot can be trained using Botagotchi and adding factoids from the chat.
- Bot can be installed via update manager module of drupal or can be
-
Umar Ahmad
Migrating to Fedora 20
I’ve been a Fedora Fan-boy ever-since I started using it three years ago and Fedora 17 is the only Linux Based Distro which lasted for more than a year on my laptop. But just as every good thing has to come to an end, my company with Fedora 17 had completed it’s lifetime.
Why did I stick with it ?
To be honest, I was too scared to move on to a different O.S. because of the compatibility issues which my system has with Linux. To name the few:
- Extra media/function keys don’t work
- Battery Applet can’t detect change in battery-charging status
- Linux goes into kernel-panic if connected with Bluetooth Mobile Internet (DUN)
Wrong Resolution detected by X(Bug Resolved after an update)- Wi-fi cannot connect to Ad-Hoc network
- Wi-fi cannot create Hotspot
- and many more minor bugs…..
The problem is that every time I install a new linux distro I have to fight with some new even more puzzling bugs, and that is some tough battle to fight. So once I finally settled myself with Fedora 17, I never dared to move to some other O.S.
Why did I upgrade ?
Well, all things die with time and so did Fedora 17. Updates started depleting and new packages stalled. Considering these points and applaud for Fedora 20 helped me to move.
How ?
Once I decided to move on to Fedora 20 , I went researching about the methods and issues people had while upgrading fedora. Most of it was concerned with efi the new ‘use only Windows’ policy of the hardware vendors…but that wasn’t the case with me. So I moved on.
I found many ways to upgrade to f20:- Using (Fedup)[http://fedoraproject.org/wiki/FedUp] (Recommended, but sadly not available for F17 😦 )
- Using (yum)[http://fedoraproject.org/wiki/Upgrading_Fedora_using_yum] (Highly unstable…not recommended)
- Using (pre-upgrade)[https://fedoraproject.org/wiki/How_to_use_PreUpgrade]
- Installing with boot-media
The first two options were rejected instantly because of lack of support.
Pre-Upgrade; looked nice, but even a fully-updated system didn’t show any new releases of Fedora in the Pre-Upgrade Window.
Since I was left with no choice, I adapted the old-school method of formatting the partition and re-installing everything…
Since I was too desperate to try F20 I didn’t think of the consequences and went on with the method.- I backed up my home folder
- Got the name of every package installed with
rpm -qa --qf '%{NAME}\n'
and when on to format the partition.
The Dumb Review
What’s awesome?
The best thing about Fedora 20 is the new Gnome-Shell 3.10 with much more cleaner interface. The gnome apps are awesome, and lots of bugs have been fixed.
- The applications list is sorted out and grouped in a better manner.
- I don’t know how but all the applications which had problem running on previous versions of Fedora, such as Wine or Conky, worked fine now.
What’s not so awesome
- My old GTK+ and Gnome-Shell themes don’t work anymore. I had to tweak every old thing a bit.
- The top-bar is a bit too compact for me. I would have loved some more options such as my current connectivity status, etc.
- It’s still a tiring task to actually edit the application list. It would be better if there could be options to add applications to the list.
What Sucks?
- That damn Nautilus :Nautilus is a big setback. They have disabled the backspace key and the search is now recursive. They have also disabled the Split-View. In short they have removed everything I loved about Nautilus.
I could find only one solution to fix all the problems – Degrade to the previous version.
Note: You can fix the backspace feature (Ask Ubuntu)I’m sure to find some more bugs as I move Along ,and this page will be updated 😛
-
Umar Ahmad
Fixing brightness problems in Linux…
You can find the said applications/scripts in my
This is a problem which I faced since the beginning I installed Linux. My system neither recognized my display settings nor those damn shortcut keys (the combination of fn keys) worked , so I ended up getting a dark screen (with zero brightness) every time the system starts-up. I couldn’t even change the brightness with those faulty shortcut keys!!So the obvious question was:
How the hell did I work with no display?
I worked in recovery mode!! To be honest I started to hate my Fedora ’cause of that bulgy screen I would get in 800×600 resolution mode. Since I was a noobier noob at that time I decided to work with that. Later I found a silly workaround by “practicing” changing brightness in recovery mode and then “actually” changing brightness without the display on normal mode to get the display 😯 …Yeah..Lame!
The actual workaround..
I had to find a way to change the brightness of the display by a script of some sort, which can be automated later by a keyboard shortcut or at system start-up.
I found out that the actual brightness file was
/sys/class/backlight/acpi_video0/brightness
or
/sys/class/backlight/intel_backlight/brightness
and changing them with root access changes the brightness.
The problem here was that I wasn’t able to give a script root access without it prompting for a password. I moved the other way since I couldn’t figure that out.Recently, I figured out the way to give the scripts root access by editing
/etc/sudoers/
file and adding$user ALL = (ALL) NOPASSWD: $path_to_script;
where
$user
is the user-name and$path_to_script
is what it says it is!Method II: Making a Python Script
After some researching I found out about the dbus module of python, which basically could help me
get
orset
the brightness. Using this and a little argument parsing I was successfully able to make a script which changed the brightness.
Update:This method doesn’t work on Gnome-Shell v3.10 😦 . I will update a patch soon.Method III :Emulating brightness keys with xdotool
The Xdotool can be used to emulate the brightness virtual key
xdotool key XF86MonBrightnessUp
to increase the brightness andxdotool key XF86MonBrightnessDown
to decrease the brightness.Method IV :Using xbacklight
xbacklight is a tool adjust backlight brightness using RandR extension. It’s the easiest way to change the brightness, without getting into details. It can be installed from the repository by a simple
yum
command. Brightness can be changed usingxbacklight inc 10
to increase brightness by 10% andxbacklight dec 10
to decrease the brightness by the same amount.Method V :When everything else fails…(using xrandr)
Recently one of my friends brought his laptop to me with a problem with similar nature, yet was very different. His brightness keys were fully functional but due to some bug his brightness didn’t change on changing the brightness through the default applet or the keys. On googling about it a bit, I found that it was a known bug with a shell script solution in one of the comments using
xrandr
. I modified the shell script to make it work with keyboard shortcuts and it solved his problem 8) .Finally…Adding keyboard shortcut
Once you’ve got your script ready and working you need to automate it using a keyboard shortcut.
This can easily be done by Settings>Keyboard>Shortcuts>Custom Shortcuts
and add your application
(Warning:Your keyboard shortcut shouldn’t overlap with already mapped shortcuts. Example: You can set options such as Ctrl + F3 to increase and Ctrl+F2 to decrease brightness)
Tip:You can usegconf-editor
for advanced options.Adding Scripts at start-up
If you’re having problems with your default brightness setting i.e. your brightness is either too low or too high or maybe you don’t require a keyboard shortcut, just a way to change script automatically at start-up. You can add applications at start-up without worrying to add keyboard shortcuts like in the previous method.
There are many ways you can add application at start-up they are given here and here but what I find simplest is using
gnome-session-properties
and simply adding the application.Once you’ve made those changes, you’re ready to feel the magic of automatic brightness.
-
Umar Ahmad
Hello Blogging…….
So how did it start…Well what can I say, it was nothing more than a small pulse that waved through my brain….
But why exactly ?
I think the answer to that will be same as the answer of the question that
Why do people ever blog ?
It should just be a sack-load of time wasted writing the things you already know. This question vexed my mind too and that’s why I turned to my Guru, Google, just to find my answer here. The only point which intrigued me was the comparisons of blog to a journal.
Well yeah, I’ve always been thinking about a way I couldSave everything on what I think and am working on
maybe this is the way it is supposed to be done. I can simply document my work through a public blog-post, which I can easily find and refer to later. Hopefully other people will find these posts helpful, relevant, or interesting.
Reply