Apple: The crazed dictator business partner
Posted on: 2009-07-02 20:30:15

I'll admit, as a software developer I have been tempted by tales of thousands of dollars a month for simple applications for the iPhone. But these days, writing apps for the iPhone is a risky proposition.

If you are starting a serious business, you have to consider risks involved. Being dependent on a single vendor puts you on shakey ground to start with. After spending thousands of dollars on Apple development tools, investing hundreds of hours in development time, who wants to be told:

Upon review of your application, <name> cannot be posted to the App Store due to <insane reason of the week>. This behaviour is prohibited, as outlined in the iPhone SDK Agreement section 3.3.1.xx.5a.

THIS REJECTION NOTICE IS PROTECTED UNDER YOUR NON-DISCLOSURE AGREEMENT WITH APPLE (PAGE 42). ANY VIOLATIONS OF THE NDA WILL BE DEALT WITH AT THE FULL EXTENT OF THE LAW.

This is just one of hundreds of stories of Apple crushing dreams, posted weekly to programming websites and blogs.

To be sure, many apps are rejected for valid reasons. But sometimes the reasons are questionable and inconsistent. Apple must realize that this damages their reputation. What are they going to do next? Nobody knows, because they're craaaaazzy! Next think you know, they'll be trying to control the media.

More...

Game Theory, Salary Negotiation, and Programmers
Posted on: 2009-06-25 22:41:12
Disclaimer: Use these tips at your own risk. Don’t get career advice from bloggers.

When you get a new job, you can breathe a sigh of relief, but not for long. You have an offer letter in your hand, and it is easy to miss one of the most important opportunities of your life – the starting salary. Here’s the tale of two programmers. When getting a job, Goofus didn’t negotiate. Gallant asked and got an extra $2500. They both get yearly raises of 3%

YearGoofusGallant
14500047500
24635048925
34774050392
44917251904
55064753461

After five years, Gallant has made an extra $13272, enough to get his car paid off, or keep his Macbook software up to date.

Goofus is in prison because he had to become a spam lord to pay child support for his six kids.

Everything in life is negotiable. C.E.O.s and corporate executives are simply people that learned this at an early age. The things that are most negotiable are the things written in black and white in indelible ink. They are engraved in silver, carved in stone, simply to trick you into thinking you cannot negotiate. “Just sign here. It's a formality.” “It's a preprinted form, it can't be changed.”

Do not be intimidated. Salary negotiation is a game, and the first to give a number loses.

When it goes wrong…

A friend once confided in me one of the biggest mistakes of his life.

More...

Coding tips they don't teach you in school
Posted on: 2009-06-23 09:45:19
When a reporter mangles your elevator pitch
Posted on: 2009-06-01 18:00:30

If a reporter asks you about your new startup company, be careful what you say.

  1. The statement that sounds best will be quoted.
  2. Some of what you say will be re-ordered or deleted.
  3. Long, rambling descriptions will be paraphrased and condensed.

Here is a pitch from a new startup company, taken from an article in The KW Record on Wednesday, April 1st, 2009:

More...

Test Driven Development without Tears
Posted on: 2009-05-13 20:46:35

Every company that I worked for has its own method of testing, and I've gained a lot of experience in what works and what doesn't. At last, that stack of conflicting confidentiality agreements that I got as a coop student have now all expired, so I can talk about it. (I never signed them anyway.)

More...

Drawing Graphs with Physics
Posted on: 2009-05-08 21:42:40

I use graphviz whenever I need to draw state machine diagrams. Drawing circles connected with lines is a hard problem for computers, because they have to decide where to place the circles so the diagram makes sense. These types of diagrams are called graphs.

To my surprise, I found that there is a very simple way to arrange graphs that can be expressed in only a few lines of code, using force-directed placement [Fruchterman, 1991].

More...

Free up disk space in Ubuntu
Posted on: 2009-05-06 18:09:58

I've been installing Ubuntu exclusively on USB memory sticks, because then if Canonical suddenly decides I don't need frivolous things like sound or wifi to work properly, I can just pop in another installation and keep going. A 4GB USB drive is plenty of space, if you remove the all the junk that comes with the default Ubuntu Desktop installation.

I went through the entire package listing in Ubuntu 8.10 and figured out which packages were useless space-hogs. It is utterly astounding that for every package installed by default, someone at Canonical decided it would be more useful than VLC Media Player.

For every package installed by default, someone at Canonical decided it would be more useful than VLC media player.

More...

Keeping Abreast of Pornographic Research in Computer Science
Posted on: 2009-04-25 08:00:09

There are burgeoning numbers of Ph.D's and grad students who are choosing to study pornography. Techniques for the analysis of "objectionable images" are gaining increased attention (and grant money) from governments and research institutions around the world, as well as Google. But what, exactly, does computer science have to do with porn? In the name of academic persuit, let's roll up our sleeves and plunge deeply into this often hidden area that lies between the covers of top-shelf research journals.

More...

Exploiting perceptual colour difference for edge detection
Posted on: 2009-04-16 19:42:41

I once took computer vision class. Every algorithm we learned was done on grayscale images, as if it were 1950 and we couldn't afford those new fangled colour VDTs. I put up my hand and asked why we discard all of this lovely colour information. The prof answered that some people have tried it, but it doesn't give much benefit.

But in some situations, colour can be important.

More...

Experiment: Deleting a post from the Internet
Posted on: 2009-04-12 13:40:20

Once you post something on the Internet, it is hard to get rid of it. As an experiment, I deleted one of my past posts, and I tried to remove all traces of it.

More...

Is 2009 the year of Linux malware?
Posted on: 2009-04-03 23:24:27

It is common knowledge that Linux users needn't worry about viruses because users don't run as root. I've never understood the reasoning behind this. Here are a few of the malicious things that a program can do without being root on Ubuntu 8.10:

More...

How a programmer reads your resume (comic)
Posted on: 2009-03-26 21:11:26

Click to enlarge

More...

How wide should you make your web page?
Posted on: 2009-03-22 15:58:15
Based on 22500 unique IP addresses over the past week, reddit users have these browser widths:

More...

Usability Nightmare: Xfce Settings Manager
Posted on: 2009-03-21 22:22:04

Quick! Where do you go to increase the text size in all your applications? Can you pick the right button on the first try? Do you feel lucky, punk?

More...

Usability Nightmare: ktoon
Posted on: 2009-03-20 15:49:14

Today's usability tips

  • If users have to start a new project to use your program, then when your program starts, it should automatically start a new project.
  • It is never a good idea to make menu items that inexplicably do nothing.
  • Few types of software benefit from a "Tip of the day". If you can't think of any tips, then your software is not one of them.
  • If you have a help feature, it should be under the help menu.
  • Slapping up a wiki is not a substitute for a help system.

Case study: ktoon

More...

cairo blur image surface
Posted on: 2009-03-14 13:34:45
Automatically remove wordiness from your writing
Posted on: 2009-03-04 11:37:18

Show/Hide Changes

I recently started re-reading William Zinsser's On Writing Well. Zinsser emphasizes simplicity in writing.

More...

Why Perforce is more scalable than Git
Posted on: 2009-02-23 21:31:22

Okay, say you work at a company that uses Perforce (on Windows). So you're happily tapping away using perforce for years and years. Perforce is pretty fast -- I mean, it has this "nocompress" option that you can tweak and turn on and off depending on where you are, and it generally lets you get your work done. If you change your client spec, it synchronizes only the files it needs to. Wow, that's blows the mind! Perforce is great, why would you ever need anything else? And its way better than CVS.

More...

A complete blogging system in 900 lines of php
Posted on: 2009-01-28 07:21:53
Here's the php file that runs this blog. (930 lines) It's best read from the bottom up. Here's the SQL file that sets things up.

More...

Optimizing Ubuntu to run from a USB key or SD card
Posted on: 2009-01-25 20:17:06
If you've installed Ubuntu on a USB key or SD card, you are probably experiencing the annoying slowness of Firefox. It freezes up for a couple of seconds every time you click a link. Like many things on Ubuntu, it doesn't work right out of the box and needs some tweaking. Fortunately, by following the tips below, you can make your USB or SD card based linux system fly!

Tip 1: Stop Firefox from writing to disk

More...

UMA Questions Answered
Posted on: 2008-12-20 10:08:32
Geez, I just went through my server logs and it is clear that people have lots of questions on UMA. Whenever someone asks a question in Google, and my web page pops up, and they click on it, I can see what they typed into Google. So in a way, all of you people on the Internet are able to tell me what to write about. So here is my page with what you want to know about UMA.

More...

Make Windows XP look like Ubuntu, with Spinning Cube Effect
Posted on: 2008-12-13 14:06:48

If you miss Ubuntu, but want the hardware compatibility of Windows, you can configure Windows XP with Ubuntu themes. You can even have the spinning cube effect.

More...

See sound without drugs
Posted on: 2008-12-09 19:19:33

To further my understanding of frequency analysis and the fast fourier transform, I have created an application that just turns on the microphone and continually plots the FFT magnitude of what it records. It allows control over the window size and sampling rate.


Download SoundLab

More...

Standby Preventer
Posted on: 2008-11-09 00:16:51
Have you ever been giving a presentation, or watching a movie, or showing someone some photos on your laptop, and you have to keep moving the mouse because the screen keeps blanking out?

Here's a quick little Windows XP/Vista tray application that I made to disable the screensaver and standby modes.


Download StandbyPreventerInstall.exe

More...

Stock Picking using Python
Posted on: 2008-10-18 17:16:08
The stock market is a lot different than it was just a few months ago. Once again, I present my stock selections, as found via python script. Comparing it with last time, you will find most of the same names are on there.
  1. Financial data for 1600 public companies listed on the TSX is downloaded from http://finance.google.com.
  2. The annual and quarterly revenue and earnings is scraped from the HTML file using an sgrep query.
  3. Each company is filtered according to the following criteria:
    • Resource, mining, and energy stocks are excluded.
    • Stocks with PE ratio higher than 50 are excluded.
    • Stocks which had negative revenue or earnings in the past two years are excluded.
  4. The remaining stocks are sorted by growth and displayed here.

More...

Spoke.com scam
Posted on: 2008-09-24 08:53:48

I stumbled accross this page about myself on this rotten company Spoke.com, who, without my permission, gathered my name and employment history together into one place. I object to it, but there was no obvious way to get it removed. After a lot of searching, I found a contact page and filled it out, but I'm not at all confident that it will be acted on.

Spoke, if you want me to remove this entry about you, you can opt-out at any time using the contact form below. After I verify your identity I will put your request into a queue for removal.

More...

Stackoverflow.com
Posted on: 2008-09-19 22:47:41
If you're in to programming, check out www.stackoverflow.com. It's a site where you can ask programming questions, and it's really addictive if you like that kind of thing. I asked three questions and they where all answered within 30 seconds!

More...

Copy a cairo surface to the windows clipboard
Posted on: 2008-09-19 10:00:00

I just spent several hours debugging clipboard copy of a DIB image. I could copy from my application, and paste into Paint. I could paste into Word. But if I pasted into WordPad, nothing showed up. If I pasted into GIMP, it crashed.

The general procedure is to fill out a BITMAPINFO structure, calculate the size of the image + row padding + the bitmap info structure itself, the allocate a memory handle with GlobalAlloc(), then copy the BITMAPINFO structure followed by the image.

What they don't tell you in msdn is that you must use a positive value for the BITMAPINFOHEADER biHeight member. That means that you have to create the bitmap upside down

More...

Simulating freehand drawing with Cairo
Posted on: 2008-07-30 20:49:28

Have a look at this image. You might think I scrawled it on a napkin and scanned it in. Wrong! It was completely automatically generated by an upcoming release of www.websequencediagrams.com, with the new "napkin" style. Getting it to render this way was easy, simply with a tiny bit of math and a change to my line drawing function. The handwriting font FG Virgil.

More...

Free, Raw Stock Data
Posted on: 2008-06-05 21:23:37

Why can't anybody write a decent stock screener? Google did, but they left out my favourite exchange, the TSX. The best indicator of whether a stock is going to go up in the medium term is growth in earnings, but it is near impossible to find this information for Canadian stocks. I have tried the one at GlobeInvestor.com, but it seems to be written by an imbecile, and its results are quite random.

Frustrated, I wrote my own tool to pull this information from publicly available sources (Only took about 5 hours). Here, at last, is a text file containing the fundamentals for about 1100 securities on the TSX, as of June, 2008.

More...

Installing Ubuntu on the Via Artigo
Posted on: 2008-04-06 08:41:09

The Via Artigo was just too cute to pass up. The videos don't do its size justice. When I unpacked it, it was even smaller than I expected. I was looking for a system to replace my home web server, on which this blog is hosted.

By the time I put it all together, I was so impressed that I began to use it as my full desktop system. It consumes so little power that I can just leave it on all the time without feeling pangs of guilt.

Here are some notes about my experiences.

More...

Why are all my lines fuzzy in cairo?
Posted on: 2008-04-04 13:50:07

Cairo is the hot new cross platform graphics library. It is becoming very popular, because it solves two outstanding problems in a portable way:

  1. Path based drawing
  2. Antialiasing

Both of these problems are astoundingly hard. You would have to read a whole graphics textbook in order to implement basic drawing, and antialising. Before cairo, your choices were Win32 GDI based drawing, or whatever GTK uses. In addition, cairo is supported in Python.

More...

Handling Unicode Form Data in PHP and Python
Posted on: 2008-03-23 16:17:13

Recently on www.websequencediagrams.com, I noticed that I had a link from a Japanese web site. So I decided to check how my web application worked with Japanese. Of course it didn't work. So I had to figure out how php and python use unicode.

More...

A simple command line calculator
Posted on: 2008-03-23 15:28:15
How many times have you needed to calculate something, for example the value of 0x398A3BB, so you pop up windows calculator to convert it? I did lots of times. The problem is I hate to use the mouse. It takes precious deciseconds away from software development time to remove my hands from the keyboard and use the mouse. That's why I created calc.exe. Its a simple command line calculator (and its also an example of recursive decent parsing).

Examples

C:\>calc 5+5*5
30.000000

c:\>calc 0x30
48.000000

c:\>calc (123456 % 51)/12
3.000000

More...

Tool for Creating UML Sequence Diagrams
Posted on: 2008-03-03 19:51:21

If you have to draw something called "UML Sequence Diagrams" for work or school, you already know that it can take hours to get a diagram to look right. Here's a web site that will save you some time:

www.websequencediagams.com

You can just write the diagram out in text, click "Draw", and the web site will spit out an image. Then you can tell your boss that you slaved for hours in MS Visio perfecting every line...

More...

A Class Library for Windows
Posted on: 2008-01-16 20:24:22
I am pleased to announce the release of my utils C++ class library for win32. I would like to release open source applications on www.hanovsolutions.com, but prior to this release, they would be useless to anyone because I use this huge undocumented library of classes that nobody else would understand. That is, until today. I have used doxygen to document all of the classes, so anyone can understand them.

More...

Exploring sound with Wavelets
Posted on: 2007-12-27 22:39:00
Here's a program to create scalograms of sound files. Pictured below is the "windows xp startup sound". See how the individual frequencies have been isolated visually.

I have created a separate web page for this project... please go there.


Download Installer

More...

A Fast Calorie Calculator for Windows
Posted on: 2007-11-15 19:10:58
I haven't written anything in a while, so here's a treat: This is a small application I whipped up last year when I was into calorie counting. I downloaded the US official database of over 6000 foods, compressed them down to a 600 K memory blob, and made this dialog to search them.

Download Installer now.

More...

UMA and free long distance
Posted on: 2007-07-29 21:47:40

UMA and free long distance

Last time, I talked about the UMA technology used in some newer cell phones. Some of you might be thinking, these new cell phones work over the Internet. What's to stop me from travelling to another continent, and then making free long distance calls to local numbers back home?

More...

UMA's dirty secrets
Posted on: 2007-07-24 19:57:10

For more UMA answers, see my more recent article.

What's UMA?

Recently, many carriers have started offering UMA, or WiFi phones. These are cell phones with WiFi capabilites. Don't be fooled -- you won't be able to get free calls and run skype on them. The UMA technology is meant to extend the carrier's cellular network into your home using your broadband internet connection.

How does UMA work?

An UMA phone operates just like a regular cell phone. It can talk to cellular base stations. But it is dual mode, and it also has a WiFi radio on board. When it finds a WiFi access point, it will attempt to connect to your carrier's servers over the Internet. If the connection is successful, it will "Rove in" and begin sending everything over the Internet.

More...

Creating a Todo list in Ajax
Posted on: 2007-05-19 16:19:59
Javascript is fun to work with. You don't have to worry about memory, declaring variables, or missing semicolons, and browsers are very forgiving if you don't do everything exactly right. Last night, my wife was out of town. Free of any distaction from my nerdy interests, I tried creating a Web 2.0 application: a Todo list.

Go to http://gandolf.homelinux.org/~smhanov/todo/ to try it out.

Here's the php source code.

More...

Installing the Latest Debian on an Ancient Laptop
Posted on: 2007-05-19 16:09:36

The challenge: Install Linux on a really old laptop. The catch: It has only 32 MB of RAM, no network ports, no CD-ROM, and the floppy drive makes creaking noises. Is it possible? Yes. Is it easy? No. Is is useful? Maybe...

Motivation

Why? Like mountain climbers say: because it's there. As an environmental nut, I don't like to throw away things that still work. But I have a PCMCIA network card and I would rather not have to hunt down and install 10 year old drivers to get it to work with Windows 95. The latest Linux definitely supports more hardware out of the box than Windows 95.

More...

How to make the MSDN style tree view in Javascript
Posted on: 2007-05-08 23:58:32
If you look at the MSDN library documentation you will see the nice treeview control on the left side. You can click on items to expand the tree. The tree contains the entire msdn library, but loads instantly. It's not too difficult to duplicate this in Javascript and Ajax.

More...

Dissecting Adsense
Posted on: 2007-04-28 09:55:52
A lot of the Internet uses Google Adsense, and yet very little is known about how it works. I downloaded the show_ads.js script that every adsense page references, and analyzed it to try to see how it works. I found lots of hidden features along the way.

The google show_ads.js script has been optimized for quick loading. Google has removed all whitespace, and renamed variables and funcitons to have single letter names. While this is good for fast page loading, it is not so good for understanding what it does. So I ran this through my Javascript PrettyPrinter, and then renamed the functions and some variables based on what I think they do.

More...

HTML/ Javascript/ CSS Pretty Printer
Posted on: 2007-04-26 20:26:38
I've been learning a lot of web programming lately. One way to learn is to look at other people's code. Unfortunately, to save space a lot of the web pages out there have all the white space removed. So I wrote this java program to format any web page so that you can study it.
  • It handles HTML, embedded javascript and CSS
  • It uses syntax highlighting for keywords and punctuation.
  • It adds links to Javascript function calls so you can click on them to jump to their definition.

Enter Url (Beginning with http://)

More...

Comment Spam
Posted on: 2007-04-23 08:53:00
Silly me. I thought that by writing my own blog software, those nasty comment spammers wouldn't be able to penetrate my fortress of php spaghetti code. But since I have added an atom feed, I have been getting a couple of automatically generated comment spams per week.

More...

Web Comic Aggregator
Posted on: 2007-04-21 19:50:09
Here's a python script that scrapes your favourite comics, and assembles them all onto one page. It also archives them on your server with back/forward buttons.

More...

Experiments in making money online
Posted on: 2007-04-18 19:04:30
Is it possible to make money on the internet, if you try really hard? I want to find out. I have always been interested in getting money for doing nothing. In an ideal business, you would do some initial work to get a system set up, and then wait for cash to come in. Here are some results, including revenue earned, from:
  • Shareware
  • Adware
  • Adsense
  • Donations

More...

How much cash do celebrities make?
Posted on: 2007-04-12 19:07:33

Compare your per-second income with various celebrities. It only works with Firefox.

Your weekly income:
You:
Compare to:

More...

Draw waveforms and hear them
Posted on: 2007-04-11 19:18:09
A while back I thought it would be interesting to be able to draw arbitrary waveforms and then listen to how they sound. I had an audio engine just laying around, so I whipped up a quick application to do that.


download WaveStudio.exe

More...

Cell Phones on Airplanes
Posted on: 2007-04-08 20:22:03
Much ink has been spilled about the use of cell phones on airplanes. Here's the truth, which will be disappointing to conspiracy theorists: Cell phone signals most definately have an effect on other electronic equipment. Read on for more.

More...

Detecting C++ memory leaks
Posted on: 2007-04-07 19:38:11
A while ago I had the problem of detecting memory leaks in my code, and I didn't want to spend lots of money on a brittle software package to do that. It's fairly simple to redefine malloc() and free() to your own functions, to track the file and line number of memory leaks. But what about the new() and delete() operators? It's a little more difficult with C++, if you want to figure out the exact line number of a resource leak.

In this article, I'll explain how you can get a stack trace for where your resource leaks occur. This method is for Microsoft Windows. Linux developers are better served with Valgrind.

More...

What does your phone number spell?
Posted on: 2007-04-07 18:35:22

Type it in here and see.
You might want to visit DialAbc.com, which has more results. Stay here if you are interested in the theory behind it.

This article was actually written in 2002. Here, I explain a technique for figuring out which words are in which phone numbers. Full C source code is included.

More...

A Rhyming Engine
Posted on: 2007-04-06 10:31:11

Here's a rhyming engine, written in 1000 lines of C++ code. It uses the freely available Moby dictionary, and full source code is provided. Give it a try. Read on for technical information.



Results:

More...

Rules for Effective C++
Posted on: 2007-04-06 10:25:28
I used to be a strong supporter of C++. It was the perfect language. In C++, if you want to influence how the hardware instructions are generated, you can do that. If you want to program without pointers and without caring about how memory is allocated, you can do that.

Recently, however, my views have changed after reading Scott Meyer's book, Effective C++. In Meyer's book, he goes through every feature of C++ and shows you how you have to program with extreme care to avoid undefined behaviour. It seems like every modern feature that C++ has was specifically designed to help you shoot yourself in the foot.

I never realized this before, because I simply never use these dangerous features. In this article, I'll show you how to program in C++ safely.

More...

Cell Phone Secrets
Posted on: 2007-04-03 17:00:27
I am a mobile telecommunications engineer, and I thought I'd explain what to look for in a cell phone. Most guides will review phones on their user interface, but pay little attention to one of the most important pieces: the radio. The radio on GSM cell phones is very mysterious to most people, so here is a guide on how to decode the features of cell phones.

More...