Latest Entries »

If you’re having errors with drush since upgrading to Ubuntu 13.10 here are the steps to make it work:

Now editing the file, make sure the “disabled_functions =” list is empty.

There you go, problem solved, drush should throw no more errors.

To change Pidgin‘s language from the detected one, add the variable “LANGUAGE” to the system wide environment variables.

For example for british english, add a variable “LANGUAGE” and set it to “en_GB:en”. Be aware that this will change the option for all programs which use this variable.

To set it just for pidgin you can create a batch file “pidgin.bat” like this:

Place the file in the pidgin folder, create a shortcut and use it to launch pidgin.

Quick and dirty instructions to install Manjaro Linux behind a proxy:

Open a terminal:

Add:

Save (ESC, :wq). Then run:

And uncomment:

Finally run:

And you’re done! 😉

I’m REALLY tired of people asking me advice on “Hey, what kinda laptop should I buy?” when I have no freaking clue because I’ve been happy with mine for the last 2 years, don’t plan on buying a new one anytime soon and I know jack shit about laptops or hardware in general. I’m a Software Engineer, note how there’s no “Hardware” in there. It’s like someone asking a guy that makes GPS for cars what is the best car for them.

But I do buy electronic hardware, so here is how I do it. For simplicity’s sake I’m gonna use a laptop as an example but this “guide” pretty much applies to any thing you want to buy, from a blender to a gaming computer.

Visit the stores

First of all, go visit hardware stores near you. That’s right, go waste a good 4-6 hours, drive/walk around, find a handful of brands and models you like and take notes. Preferably take photos too. Make sure to take note of the prices too.

Next, go home. Don’t buy anything. Don’t ask any store tech/salesman anything. Don’t trust anyone which is interested in YOU buying something from THEM.

Research

Now that you are home, get those brands and models you took note and start searching for things like

  • “BRAND MODEL review”
  • “BRAND MODEL comparison”

This will show you some reviews and comparison against similar models.

  1. Prefer reviews from actual people instead of bloggers who just want to gain visits.
  2. Youtube videos are (sometimes) good source for reviews.
  3. Read at least 5 reviews per brand/model.
  4. See ratings people gave the laptop on sites such as amazon.com/co.uk, cnet.com, etc.
  5. Make sure you read comments (if you do end up reading blog reviews).
  6. Consider wasting an hour for each $100 you want are willing to spend to buy the thing you want.

Search for problems

Next search for

  • “BRAND MODEL problem”
  • “BRAND MODEL is crap”

Now this is the real critical test. It should give you a good overview of what problems you can expect from your laptop and how satisfied are people with the laptop. If you only get random problems such as “I turn on laptop as soon as I got back from the store and it exploded!” then you are looking at a fairly safe buy. If you see a lot of people complaining about the heat, laptop shutting down after a few hours, crashes, etc… then consider another one.

The decision

Finally, weigh in the price, tech support you can get from the store you are planning to buy from, reviews, problems, technical specifications, etc, and try to make a decision. It is never simple.

Still need help?

Other things you can search for if you need help, for example:

  • “Best Laptop “

Remember to check last year too when searching for “The best laptop”. You get good deals on later models during stock clearance.

  • “How to buy a Laptop”

For this one remember to ignore sites which have more than 2 years. They are usually outdated. If the site you are consulting doesn’t have a timestamp on the information it is providing then ignore it too, it’s probably a crappy site anyway.

What about the tech specs?

Most of the times, manufacturers offer pretty much the same thing at very similar prices. But you can always check Wikipedia and the “How to buy a …” guides on technical things to look at and which ones are better. Make an informed decision on what is the best thing for you: RAM, CPU or/and Graphics Card. It all comes down to those 3.

A very specific argument that arises when discussing indentation styles is Tabs versus Spaces. For me, there is no argument. It’s the one thing I could never, ever, adapt to when writing code. Before I get flamed for my rant lets check the pros and cons and the typical arguments made by space-lovers. No, not the outer space, I mean the largest key on your keyboard.

View Code

If you use spaces, your indentation will always look the same, be it on your favorite IDE, vim, pico, joe, Kate, Geany, cat, less, more, github online, bitbucket online, etc. But… it will always look the same to you and everyone else. Let’s face it, we don’t all have the same tastes. When coding in group (job, school, hobby) we already have to agree on indentation style, so why should we also give in when it comes to indent spacing? If we had no option… but we do! We can use tabs and everyone can space it to whatever they want since almost any editor out there supports changing the tabsize. Even in your virtual terminal you can change tab size with  ‘tabs’ (if the VT supports it).

Editing Code

Previous argument in favor of using spaces makes me wonder if a programmer spends more time reading the code or editing it. It’s quite simple. Hitting tab costs you 1 key stroke. Hitting 2, 3, 4 or 8 spaces costs you… 2, 3, 4, 8 times more keystrokes. Look at your code. You will see that a great part of it shows you spent more time hitting the poor space bar (or tab key) than any other key.

Now is where you argue that in your editor when you hit ‘tab’ it fills in the spaces for you. Excellent! Now lets go back to the previous argument. You said it was so you could look at code anywhere and it always looks the same. Well… I prefer to edit code the same way on any editor. Tab is my universal indent key and delete/backspace is my universal unindent key. If you use spaces that is no longer true and you will end up making small indentation mistakes more often than not and that leads to very ugly code.

Bottom line is, spaces will always cost you a lot more keystrokes when compared to using tabs. The more time you spend typing white space the more time you waste because white space is non productive. Unlike using long variable/function names or writing lots of comments and documentation about your complex code.

The Script

If you are indeed forced to use spaces instead of tabs because whatever reason, you can always do like me and use a script to edit your code from/to spaces.

Save this to a file, put it in your path and then give it exec permissions (chmod 755 <file>). It takes 2 arguments. The first is either t2s (tabs to spaces) or s2t (spaces to tabs). The second one is if you only wish to change files which have a certain text. For example, I use:

This makes sure it only changes files which have me as the author (provided I put my name on all files I change). This script allows you to change all files, recursively, from the current folder where you are running the script from. So just set your terminal’s current directory to your source folder and run it.

Now lets look at that first line in the script since you probably should change somethings there.

These are 3 variables. First one is FILTER_FILES and it’s a regular expression to filter the files to process. The one I’m using filters C++ source (cpp) and header files (hpp). Second one is BACKUP_EXTENSION. I keep this in case something goes wrong. This one makes a backup of each changed file. The variable hold the extension used for the old file. You can then add this extension to your SCM ignore list. The SPACES variable is self explanatory, it means the amount of spaces that correspond to a Tab.

Once upon a time there was a game called Iron Seed…

Iron Seed Screenshot

It is a space exploration game with role play and strategy elements, not unlike Star Control 2 and Syd Mead’s Maelstrom.

Nowadays the game is available at http://ironseed.com/forums/index.php for free. It can be played with the DOSBox emulator (which I very much like since I also programmed the similar AcuDOS emulator (which has been discontinued).

As I understand it, the game was programmed in Pascal. I would very much like to port it to C\C++ using modern libraries, so it would run at least on Windows, Linux, MacOS.

Unfortunately, the forums are closed and I can’t obtain neither the source code nor permission to attempt a port.

Could someone please help me get in touch with the guys over there? 😉

By the way… download and enjoy this great game (and its soundtrack)! 🙂

UPDATE: The source code wad released and is available at http://ironseed.com/. If anyone wants to port this Turbo Pascal, Assembly written source code with me, please let me know. 😉

A thing that makes a programmer produce faster is assigning tasks to shortcut keys.

Qliner Hotkeys

Qliner Hotkeys

I’ve always relied upon Qliner Hotkeys (http://qliner.com/hotkeys/) software to do this.

Unfortunately, Qliner Hotkeys doesn’t work on 64 bit systems and doesn’t seem to be updated anymore.

Fortunately, this is easy to solve:

  1. Download Qliner Hotkeys (http://qliner.com/hotkeys/. This article assumes the latest version is 2.0.1
  2. Open the installed hotkeys.exe file in your favorite hex editor
  3. At offset 0x1018 ($1018 if you prefer this notation :D), there should be a byte with the value ‘0x01’. Change it to ‘0x03’
  4. Reboot. Everything should be ok.

What we did here was adding a flag (00000001 -> 00000011) to tell the executable to load 64 bit libraries instead of 32 bit ones, when needed.

Have fun automating everything with your keyboard. 😉

Addendum (for those who never used a hex editor)

First download a hex editor at http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm#download

Using the XVI32 program open hotkeys.exe and go to offset 0x1018

Select the value (0x01) with the left mouse button

Write ‘0’, ‘3’ using the keyboard

Save the file (Ctrl + S). If you get an error saving it is because you are editing the file under the ‘Program Files’ directory. First make a copy of the hotkeys.exe file into the desktop. Edit this file. Then copy back the file into the ‘Program Files\QLiner’ directory.

Editing hotkeys.exe

Editing hotkeys.exe

A couple of months ago, I bought two cards to program in CUDA, a Gigabyte GT430 and a EVGA GTX570.

Since then my monitor (a Samsung 223BW) had been flickering like hell every time I turned it on or it came back from stand-by.

I’m running Windows 7 (64 bits).

Well, it appears the solution to this problem is very simple:

  1. Go to the Samsung support site and download the drivers for the 223BW monitor (http://www.samsung.com/us/support/downloads/lcd/LS22MEVSFY/XAA)
  2. Connect the monitor to the card and port of your choice.
  3. Install the previously download drivers and select the correct card and port into which the monitor is now connected. (Be aware that a VGA port is ‘Analog’ and HDMI/DVI are ‘Digital’, when the installer asks you that question)
  4. No more flickering!!! 😀

Well, I hope this helps. Have fun programming (and finally resting your eyes ;))