Pages

29 April 2013

Linux Mint 14, Cinnamon Woes and Openbox

So, I installed Linux Mint 14 (Cinnamon) recently on my gradually dying but not yet dead laptop. Then, I found out that what a big memory glutton Cinnamon is. Other users have also complained of the same. I guess, I should not have installed it in such an old machine in the first place. So, I decided to install Openbox on it and use that until I figure out what new distro to try out next.

So, I installed Openbox and tweaked it to look like this:



The main packages I am using are openbox, thunar for file management, dmenu as application launcher, tint2 as taskbar, conky and tilda.

The taskbar on the bottom is tint2. The config filepath is /home/username/.config/tint2 and this is my config file:




The terminal on the left is tilda. Its config filepath is /home/username/.tilda/config_0 and this is my config file:




The system monitor on the right is conky. The config filepath is /home/username/.conkyrc and here is my config:




In the screenshot, dmenu is not visible. Instead of launching it directly, I am using a script which changes its colors and places it on the top of screen. I placed the script at /home/username/.scripts/dmenuBlue. Remember to make sure that the script is executable, which you can do by typing chmod +x file. Here is the script:




Now, after installing Openbox, if you are having resolution problems, then you can edit the Openbox's autostart file, whose location is /home/username/.config/openbox/autostart. You can also set conky, tint2 and tilda to start with Openbox. You can also rename a image file as wallpaper.jpg and place in the directory /home/user/ to set as wallpaper using hsetroot. Here my autostart file:




Now, I am using some keybinds like Alt+F2 for dmenu and Win+E for thunar. If you want to change your keybinds then you will have to edit the file /home/username/.config/openbox/rc.xml. Here is my copy of the file:




Anyway, I am still having slowdowns. The Xorg process for some reason starts grabbing processor resources after a few minutes and I have to restart it. I am thinking of switching to CrunchBang.

24 February 2012

In the Age of Tablets, Netbooks are not Dead



Apple released its first tablet, iPad, in April 2010, and sold 3 million in 80 days. During 2010, Apple sold 14.8 million iPads. By the release of the iPad2 in March 2011, more than 15 million iPads had been sold. Tech-blogs are heralding the rise of the tablet and death of the netbook.

But, I think netbooks will still be preferred over laptops or tablets by many, mostly because of the easy input, low cost and portability.

So who will prefer them?

1. Bloggers who are always on the move.
2. Students who need a PC to do coursework but cannot afford a full-fledged laptop. Also, consider the portability and cost factors. They are good enough for text-processing and most calculations. Although those doing multimedia editing will prefer something with a little bit more juice.
3. Professionals like journalists, who are always on the move, will choose it for easier input.
4. Gamers who mostly play MMOs. For them, keyboard shortcuts are a plus. Also, hardcore gaming may come to netbook with better APUs.

Moreover, it is not necessary the laptop, tablet and netbook segments will remain separate. Better processors will bring netbooks closer to laptops and laptops will get lighter and smaller. Also devices like Lenovo Ideapad U1 are blurring the line between laptops and tablets.

Personally, I feel tablets are good for surfing, casual gaming, reading books and watching a couple of videos. Also, you may choose to use your tablet as a PDA.

But tablets, in my opinion, are not good for:

1. Watching movies. Am I supposed to hold it all through a 90 minute movie? Or am I supposed to put it on my lap or desk and strain my neck trying to watch it? Then again, I can buy a holder or dock.
2. Listening to music. No thank you, I will prefer my smartphone. A 10-11 inch tablet is too bulky for this.
3. Gaming. Tablets are good for social and casual games but not for other types of games. Also, until they all settle on a standard platform, development for them will be hell.
4. Input. Tablets good enough for inputting a couple of lines. They also good for pointing and selecting. Tablets are awesome for drawing. But, how I am supposed to type if half the screen is covered by my hands and/or the on-screen keyboard. Also, what about those who use touch-typing? Then again, I can buy a keyboard attachment; which brings me back to the question, how to hold it?

Until they figure out these problems, I feel netbooks give me the best of both world, work and entertainment. It makes more sense for people who don't want or can't afford multiple devices. For them, one netbook and a cellphone is a much better option.

For the shake of comparison let's check out Apple iPad 2 and Asus EeePC 1000HA.





iPad2 Asus EeePC 1000HA
Processor 1 GHz Dual Core Apple A5 1.6 Ghz Intel Atom
Hard Disk 32GB Flash Memory 160 GB HDD
Memory 512 MB RAM 1 GB RAM
Display 9.7 inch 11 inch
Weight 600 grams 1400 grams
Operating System iOS 5.0 Aurora Linux/Windows 7s
Price 600 USD 390 USD


16 February 2011

How to Learn a Programming Language in 3 Days

One summer, I and a couple of good friends were working on a project. The friends decided to do it in a language I didn't know. So, I borrowed a book from the library and learnt the language in roughly 17-18 hours spread over a period of three days. My friends were stunned because they had taken a 60 hours one month course from a good institute in that language and yet I had a better understanding of the language.
It is not so tough and I am not a genius. I will tell you how to do it.

Day 1:

1. The Preparation: Empty Your Mind

First, finish all your pending tasks and make yourself free. Otherwise, these pending tasks will keep bugging you and you will lose concentration. Turn off your computer (at least for now) and cellphone. Get a good book, ask for recommendations from those who know the language and go for something similar to Schaum's Outlines series or For Dummies series books. Do not use ebooks (unless if you have a ebook reader like Kindle) and online references for now. It is alright studying on a computer if you have super-human concentration, but I get distracted by IM popups. Already knowing a language helps. And if you can read fast then better. Find a good place to study like a library or your room with a "Don't Disturb" sign outside. Be prepared to commit 7-8 hours per day. Caffeine will keep you alert but too much caffeine will make you jumpy and upset your stomach. Music also helps, but instead to listening to new tracks, listen to what you have heard a hundred times and feel pepped up with. I usually listen to post-grunge (Breaking Benjamin, Default etc.). Use earphones, it blocks out all distracting noise (my neighbour had a big dog). Take power-naps or walk around a bit after every 2-3 hour. Keep some food and drink within reach because hunger and thirst are also big distractions. Install the compiler/interpreter and IDE recommended in your book. You may switch later, but for now use whatever the book says or you'll face problems in the execution of programs.

2. The Beginning: Data Types and Variables

Find out a little bit about the language (is it compiled or interpreted, is it object oriented, etc). Then, check out the "Hello World" program to find out about the basic output statement and program structure. Find out the fundamental data types (integer, floating point, boolean, character etc.), how variables in each type is declared and defined. Now do the same for derived data types (arrays, strings, structures etc.). If the language supports functions (or subroutines) and objects, leave them for later.

3. Manipulation of Data: Operations, Expressions and Statements

Find out the types of operations supported by the language and learn to use them. Basically, learn addition (+), subtraction (-), multiplication (*), division (-), modulo (%), power (^), increment (++) and decrement (--). Then, learn to combine these into expressions and how type conversion takes place. Learn how to store the value of an expression in an variable (assignment operator). Check out basic logical connective (AND, OR, NOT etc) and comparison operations supported (like > , < , == , != , <= , >= etc). Learn the basic statement formats for manipulation of data.

4. Talking to the User: Input and Output

Learn how to get input of different data types from the keyboard, store them in corresponding variables and display them on the screen. Thus, you must know about the basic input and output statements (both formatted and unformatted). Try to solve and execute some of the exercises provided in your book on input/output. This should be the first time you turn on your computer.

5. Flow of Control: Conditional Statements and Loops

Learn the basic conditional statements (if then, if else , switch etc.). Learn how you can construct a loop (while loop, for loop, do while loop etc.). The for loop is the most important one, understand it properly. Now turn on the computer and try out some programs.

Day 2:

6. Avoiding Repeated Statement and Hiding Data: Functions and Objects

Learn how functions are declared, defined and used. There may be something called scope rules, check that out. Objects are user-defined data types that combine data and functions that operate on the data. Most modern languages support objects, so find out about their declaration, definition format and usage. Now try out some programs using these concepts.

7. Bells and Whistles: Libraries and Stuff

Most modern languages provide libraries to make the life of a programmer easier. Learn how to use a library. Some languages like C, C++, Java etc. are entirely based around libraries. Also, you may have reached this step without learning anything about libraries, if you are learning something like JavaScript. Find out the librabries most frequently used, these are usually related to mathematics, graphics, audio, hardware and process threads. Most languages provide some features that make them unique, check them out. Now practice using the libraries.

Day 3:

8. Practice, Practice and Practice

Yes, day 3 is all about practice. Find some challenging problems that force you use all the concepts learnt so far and grill yourself down. If you already know some languages, you have probably already written such programs, so now try them out in this new language that you are learning. You probably have gathered a lot of doubts by now, check them out online.
Now you are ready, now you are a novice not an expert. But you can solve the most common problems, read and understand others' codes and impress your friends that you learnt an entire language in 3 days.
Since you are learning on your own, you are bound to face some teething problems. So check them out in the documentation provided with your software, or check in the forums. Here are a few programming sites/forums that I frequent:

www.reddit.com/r/learnprogramming(subreddit for programming)
www.stackoverflow.com
www.webmonkey.com(for web development)

Learning a language is not enough, good programming practices and style are also important. Always comment your code, especially explain what each function and object does. Use meaningful variable, function and object names.
After all this, do not consider yourself an expert in the language, keep track of new releases and development.
If you don't know any programming languages then I recommend start with Python or JavaScript.
And finally try to use open and free software (like GCC, Mono etc.).