Your Ad Here

Tuesday, November 17, 2009

Learning Software Maintenance from old continuous systems

Great software article promoting continuous software maintenance model which was invented in some systems over 40 years ago.

You Don't Know Jack About Software Maintenance

We can learn a thing or two for modern software development

Monday, November 16, 2009

Apple App Store Process is Frustrating

I have had lot's of frustration with the App Store process. Namely with the feed back on rejections being so poor. Developers leaving the Apple App Store. I am not leaving but it is a crappy position to put developers in whom put in their own hard time into producing something that might be rejected or floating in limbo for ever.

Programming words of wisdom

1. Either leave the existing brace style the hell alone and live with it, or completely re-write the code. Going the middle road leaves two unhappy parties, leaving it alone or replacing it leaves just one. And while you should err on the side of just living with what’s already there, you shouldn’t be shy about cleaning up a train wreck.

2. Good programs do not contain spelling errors or have grammatical mistakes. I think this is probably a result of fractal attention to detail; in great programs things are correct at all levels, down to the periods at the ends of sentences in comments.

“Aw, c’mon! You’re kidding!” You might think that nit-picking like this is beneath you, whereupon I will start pointing out errors in your code. It was embarrassing the first couple times this happened to me.

3. Crack open your current project. Now, delete as much stuff as you can and still have it work. Done? Okay, now toss out more, because I know that your first pass was too timid. Pretend that you’re paying cash for every line of code. If your project incorporates code by other people, wade into their stuff, too. You’ll be amazed how much can come out.

Don’t leave unused code hanging around because it might be useful someday. If it’s not being used right now, remove it, because even just sitting there it’s costing you. It costs to compile (you have to fix build breaks in stuff you’re not even using), it costs to ignore it in searches, and the chances are pretty good that if you do go to use it someday, you’ll have to debug it, which is really expensive.

It’s tremendously freeing to zap the fat in a system, and after a while it’s addictive. Read all code with an eye towards “What is superfluous?” and you’ll be amazed at how much unused, half-written and buggy crap there is in loose in the world, and how much better off we are without it.


Thanks Landon Dyer - I have to say I completely agree with 1 and 3 and mostly agree with 2. Which is the most controversial of the three. Original Blog Post by Landon Dyer

Thursday, November 12, 2009

Bash how to write a file using cat and multi line string

Thought this was a cool example

cat >hello.go <<EOF
package main

import "fmt"

func main() {
fmt.Printf("hello, world\n")
}
EOF

Thursday, October 22, 2009

Bash Single Line For Loop Example

Here is a example of a for each loop in a single line in Bash

# for hi in 1 2 ; do echo $hi; echo "wow"; done;
1
wow
2
wow
#

Wednesday, September 30, 2009

mysql get first and last day of the month

mysql get first and last day of the month


mysql> select SUBDATE('2009-08-20',DAYOFMONTH('2009-08-20')-1),DAYOFMONTH('2009-08-20'),LAST_DAY('2009-08-20') from dual;
+--------------------------------------------------+--------------------------+------------------------+
| SUBDATE('2009-08-20',DAYOFMONTH('2009-08-20')-1) | DAYOFMONTH('2009-08-20') | LAST_DAY('2009-08-20') |
+--------------------------------------------------+--------------------------+------------------------+
| 2009-08-01 | 20 | 2009-08-31 |
+--------------------------------------------------+--------------------------+------------------------+
1 row in set (0.00 sec)

mysql get first day of the month

This will return the first day of the month '2009-08-01' in mysql

select SUBDATE('2009-08-31',DAYOFMONTH('2009-08-31')-1) from dual;

Monday, September 28, 2009

perl test if directory exists

In perl to test if a directory exists use
-d "somedir"

example:

if(-d "/home/username") {
print "User directory exists\n";
}

Thursday, September 17, 2009

Ten most common mistakes in advertising

10 Most Common Mistakes in Online Advertising

This is interesting

lucent in tenebris

Apparently the Morin family motto.
"lucent in tenebris" which is latin for "light in darkness"

Monday, September 14, 2009

test if variable exists in ruby

Testing if a variable exists in ruby is pretty easy.

irb(main):001:0> defined? variablename

This will return if it's defined but not just variables but a few things

  • "local-variable"
  • "global-variable"
  • nil # (undefined)
  • "method"
  • "super"
  • "yield"

Wednesday, September 09, 2009

Interesting bash loop snippet

for r in `git rev-list master...master-fubar --since="8:00" --before="12:00" --no-merges`; do git revert --no-edit -s $r; done

Friday, September 04, 2009

Hadoop pid file location and file name

The default pid file location for a hadoop cluster as of 19.1 and 19.2, might also be the same for earlier versions of hadoop

/tmp/hadoop-[USERNAME]-[NODETYPE].pid

I usually run hadoop as root so here is an example of the default pid file for a datanode

/tmp/hadoop-root-datanode.pid

NODETYPES
namenode
datanode
tasktracker

Monday, August 31, 2009

perl convert a string to a number

All you have to do is call int to change a string to a int

my $someint = int($somestring);

Friday, August 28, 2009

python print standard error

Printing is very simple to the standard error

sys.stderr.write('Printing to the stderr')

Wednesday, August 26, 2009

vim insert mode

To get into vim insert mode

Just type the letter i

This will put you in insert mode when you are in command mode.

By default your in command mode when you enter vim. To get into command mode just type the escape key ESC

Monday, August 24, 2009

python else if statement

Is actually a elif statement. Here is an example below

python else if statement


>>> x = int(raw_input("Please enter a number: "))
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1:
... print 'Single'
... else:
... print 'More'

python elsif statement

python else if statement


>>> x = int(raw_input("Please enter a number: "))
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1:
... print 'Single'
... else:
... print 'More'

vim how to highlight

vim how to highlight

You can turn on syntax highlighting by typing:
>:syntax enable

vim how to go to the end of file

vim how to go to the end of file.

Just type:
>g

Where is is meant to say you hold down the shift key while pressing g

vim how to quit

vim how to quit.

That's another easy one. Just type:
>:q

To quit without saving type:
>:q!

To save then quit type:
>:wq

vim how to save

Vim how to save a file easy.

Just type ESC key (this put you in command mode)

If you open a file using something like vim SOMEFILENAME
Then type
>:w

If it's a new file just type
>:w SOMEFILENAME

Vim how to open a file to edit

All you need to do is type the vim command :edit or you can use the shortcut :e will open the file for editing.