goldb.org home

AS OF MAY 2008, THIS BLOG IS NO LONGER BEING UPDATED.
Visit the new blog at: http://coreygoldberg.blogspot.com



 Friday, August 31, 2007

Python 3000 alpha 1 Released!

wow... congrats to Guido and everyone else involved.

get it here:

http://python.org/download/releases/3.0/
#    Comments [0] |

JavaScript - Anti-Spam Email Link

Posting a link to your email address on your website is inviting spiders to grab it and spam you.  I get around this by using a JavaScript snippet so my email address link renders on the client but not in the actual HTML source.

While I'm sure there are much better ways to do this, this has been successful for me so far.

This script creates a "mailto" link for my email address:


<script type="text/javascript">
    <!--
    var name = "corey"
    var emailHost = "goldb.org"
    document.write("<a href=" + "mail" + "to:" + name + "@" + emailHost + ">"
        + name + "@" + emailHost + "</a>")
    //-->
</script>
#    Comments [1] |
 Saturday, August 25, 2007

Investment Advice - Simple Strategy and Recommended Reading

(this post is completely off-topic. stay tuned for regularly scheduled software and technology stuff)

With the rough weeks in US markets (subprime fiasco, credit crunch.. ouch), I thought it would be a good time to talk about the only investment strategy that really works.  Yes, it is easy. Yes, it is boring.  Yes, it works.

Ever since I finished my Bachelor's in Economics (10 years ago), I have been consumed with following financial markets and investing any shred of money I come upon.  I've had ups and downs, but I like to consider myself a pretty savvy investor.  My career as a software engineer has also kept me close to finance.  I worked in institutional financial services for 8 years as a developer/tester.  I helped develop trading platforms, market research databases, quantitative analysis tools, buy-side/sell-side communication platforms, pre-trade negotiation messaging, etc.  I like to think that I have a pretty good idea of how markets work.

So in this huge multi-billion dollar game, how is the personal investor supposed to navigate his way to profit?

Well.. actually it's quite easy.

There are 2 simple questions you must first answer:
1. What is the time-frame in which you need access to your money? (next week? next year? 10 years? retirement?)
2. How much risk and volatility are you comfortable with?

The Answer:
Asset Allocation

... not fundamental analysis, not technical analysis, not market trending, not tips from brokers and analysts ... but straight up asset allocation.

There are numerous ways to allocation your assets:  Equities (Large Cap, Small Cap, Value/Growth, Domestic/International), Fixed Income, REITs, Money Instruments, etc.  How you choose to allocate depends on your answers to the questions above.

All The Reading You Need:

I've read dozens of investment books.  The majority of them are garbage.  If you want a good recommendation, pick one of the following books to read and study it thoroughly... it's as simple as that.

They are essentially the same book. They cover nearly identical material, history, commentary, and strategy.  They both highly favor the random walk theory and passive index investing.  Both authors are excellent, so just pick one or both.  Study these closely and you have all the information you will ever need.


and one parting tip:
If you are constantly worrying about the stock market, you are over-invested. Sell until you can sleep at night.

#    Comments [0] |
 Friday, August 24, 2007

Pylot - Dev Update #6 - Web Performance/Load Test Tool (Results Report and GUI)

(Pylot is the open source web performance/load test tool that I am developing)

When a test run is finished, a report is automatically generated to summarize the test results. It includes various statistics and graphs on response times and throughput from the run. A sample of the results report can be seen here:

http://www.pylot.org/samples/results/results.html

Pylot also writes results to CSV files so you can import them into your favorite spreadsheet to crunch numbers, generate statistics, and create graphs. I have been working


I have also been working on the GUI. Here is the latest:

http://www.pylot.org/samples/ui/pylot_ui_screenshot_2007_08_20.png



Related:

#    Comments [4] |
 Thursday, August 23, 2007

Scalability - TechCrunch Runs On 1 Web Server And 1 Database Server. Huh?

highscalability.com pointed out an article from Pingdom titled "What the Web’s most popular sites are running on", which shows the results from an infrastructure survey of 7 popular web "super sites" (TechCrunch, FeedBurner, iStockPhoto, YouSendIt, Meebo, Vimeo, Alexaholic).

There is some intriguing information in the survey, but one thing stood out.  Apparently, TechCrunch runs on 1 web server and 1 database server, with no server clustering:


I almost find this hard to believe.  They serve > 1 million unique visitors per month off of this?

#    Comments [3] |
 Wednesday, August 22, 2007

My Text Editor - What SciTE Says About Me

In a recent post: "What does your favorite text editor say about you", the author lists popular text editors and what they say about their users.  Here is the Editor or IDE I use with various programming languages:

Python:  SciTE
Perl:  SciTE
C#:  Visual Studio
Java:  Eclipse

I do all of my writing and a large portion of my programming in a plain old text editor.  Most of the code I write is in Python.  I love using a lightweight text editor instead of a big bloated IDE.  So... I pretty much live inside a text editor.

... and I love SciTE.  It rocks equally on Windows and GNU/Linux.  So what does this say about me?


SciTE:
"Your text editor is lightweight, full featured, extensible and cross platform. In addition, it can work as a stand-alone executable which requires no installation. Fits perfectly with all your other portable tools on your USB thumb drive. You also love how SciTE let’s you write Lua scripts to extend it’s functionality. You take your text editor choice very seriously. You like tinkering, and minimalistic, portable applications."

#    Comments [3] |
 Friday, August 17, 2007

Lines Of Code In Popular Open Source Code Bases

(via Matt Asay)

I found this pretty interesting.

Lines Of Code (LOC) in some popular Open Source code bases:

  • Linux Kernel: 6 million
  • Sun Java Development Kit: 6.5 million
  • Sun StarOffice: 9 million
  • Eclipse: 17 million
#    Comments [1] |
 Thursday, August 16, 2007

Linux Kernel Forecast (Roadmap)

Keeping up to date with what's going on in Linux kernel development and what to expect in the future isn't always easy.  The Linux Kernel Mailing List has very high traffic and is very technical.

Luckily, the Linux Foundation has provided the Linux Weather Forecast, which provides a high level roadmap of what's going on in kernel development and where it's all going.

Pretty handy for people depending on future features as well as casual observers that want to keep up to date with major kernel development activities.

#    Comments [0] |
 Wednesday, August 15, 2007

Good Riddance To SCO - Crushed On Wall Street

Earlier this week, SCO finally lost the infamous Linux copyright infringement case against IBM.  The judge ruled Unix copyrights belong to Novell, not SCO.  A lot of people have forgotten about this case; but when it was originally filed, it really spooked a lot of Free software developers and Linux advocates.

After the ruling, Wall Street punished SCO's stock price accordingly.

5-Day stock price chart for SCOX:

SCO Stock Chart

Ouch.  Decimated.  I'm actually surprised it didn't get hammered more... Time to short this rag?

#    Comments [0] |
 Wednesday, August 08, 2007

Pylot - Dev Update #5 - Web Performance/Load Test Tool (Graphs With MatPlotlib)

We performance practioners love our graphs!  Visualizing data is helpful in analyzing performance results.  Sometimes a quick glance at a graph provides better understanding than a mound of raw or summarized data.  Pylot's Results Reporting feature creates graphs of response times (latency) and Throughput.

For the graphing toolkit, Pylot uses Matplotlib to produce fancy graphs like these:

python matplotlib line graph

Matplotlib allows you to graph data from Python. Here is a simple script that gives a glimpse of how a line/marker graph is created as a png image:


#!/usr/bin/env python

from pylab import * # Matplotlib

def main():
# sequence of data points to graph (x, y coordinates)
points = [(1, 3), (2, 6), (3, 2), (4, 5)]
graph(points)


def graph(points):
fig = figure(figsize=(6, 2)) # image dimensions
ax = fig.add_subplot(111)
ax.grid(True, color='#666666')
xticks(size='x-small')
yticks(size='x-small')
x_seq = [item[0] for item in points]
y_seq = [item[1] for item in points]
ax.plot(x_seq, y_seq,
color='blue', linestyle='-', linewidth=1.0, marker='o',
markeredgecolor='blue', markerfacecolor='yellow', markersize=2.0)
savefig('graph.png')


if __name__ == '__main__':
main()

The output looks like this:

pylot matplotlib latency graph

Related:

#    Comments [0] |
 Friday, July 27, 2007

Recommended Reading For Learning Python

I have the opportunity to spread Python to some junior/newbie programmers. In doing so, I wanted to compile a concise list of reccomended learning materials. The intended audience is someone who has a basic familiarity with programming but no specific Python experience.

There are a ton of books and online materials available, but where should you start? Here is my very brief list:

First Book:

Python Tutorials Online:

#    Comments [5] |

C# - Simple TCP Server

Most of network programming I do is Web/HTTP oriented. So it has been a while since I had to work with TCP and Socket programming directly. Yesterday I needed to write a quick TCP Server. C# and .NET made this really easy to do:


using System;
using System.Text;
using System.Net;
using System.Net.Sockets;

public class TCPServer
{
    private static int port = 8001;

    public static void Main()
    {
        IPAddress ipAddress = IPAddress.Any;
        TcpListener listener = new TcpListener(ipAddress, port);
        listener.Start();
        Console.WriteLine("Server is running");
        Console.WriteLine("Listening on port " + port);
        Console.WriteLine("Waiting for connections...");
        while (true)
        {
            Socket s = listener.AcceptSocket();
            Console.WriteLine("Connection accepted from " + s.RemoteEndPoint);
            byte[] b = new byte[65535];
            int k = s.Receive(b);
            Console.WriteLine("Received:");
            for (int i = 0; i < k; i++)
                Console.Write(Convert.ToChar(b[i]));
            ASCIIEncoding enc = new ASCIIEncoding();
            s.Send(enc.GetBytes("Server responded"));
            Console.WriteLine("\nSent Response");
            s.Close();
    }
}

#    Comments [0] |
 Thursday, July 26, 2007

Microsoft - Patents and Open Source

Microsoft launched a new site which is intended to be the "gateway for information about open source engagements and activities across Microsoft."

From the FAQ:

"What is the Microsoft position on intellectual property (IP) and open source?

Intellectual property (IP) serves a vital role in maintaining a healthy cycle of innovation in the IT industry. IP concepts—including copyright, trademark, patent, or public domain—are useful for developers to define terms of use that enable their project or business to thrive, regardless of what development model they choose."

Sorry, but patents do *not* "serve a vital role in maintaining a healthy cycle of innovation in the IT industry".  Restricting ideas actually does the exact opposite.

So... I'm glad to see Microsoft taking steps towards Free software, but as of now they still don't really "get it".

#    Comments [3] |

highscalability.com - Building Bigger, Faster, More Reliable Web Sites

I stumbled across this site yesterday:  highscalability.com

"We started High Scalability to help you build successful scalable websites. This site tries to bring together all the lore, art, science, practice, and experience of building scalable websites into one place so you can learn how to build your system with confidence. Hopefully this site will move you further and faster along the learning curve of success."

This is really cool site/blog about building scalable architectures.  It contains lots of good info and overviews of some of the larger distributed systems on the net.  Definitely a regular stop for me.

#    Comments [0] |
 Wednesday, July 25, 2007

Google Architecture - King of Scalability

Awesome technical overview of Google's inner workings:

Google Architecture

"Google is the King of scalability. Everyone knows Google for their large, sophisticated, and fast searching, but they don't just shine in search. Their platform approach to building scalable applications allows them to roll out internet scale applications at an alarmingly high competition crushing rate. Their goal is always to build a higher performing higher scaling infrastructure to support their products. How do they do that?"

... a breakdown of Google's massive highly scalable architecture.
This is modern distributed computing at its finest.

#    Comments [0] |
 Tuesday, July 24, 2007

Pylot - Dev Update #4 - Web Performance/Load Test Tool (New Name and Defining Test Cases)

PyLT has been renamed to Pylot (some sort of abbreviation for "Python Load Test")

I realized that having a pronounceable name for a piece of software is pretty important :)

So...
As I develop my load test tool, I need a way to define test cases.  Here is my first attempt:


What Is A Pylot Test Case?

You must declare your test cases in an XML file. This is the format that the test engine understands. Editing XML may seem natural to some people, but awkward to others. The nice thing about this structure is that it will be very easy to create a more friendly user interface [sometime in the future] for defining test cases.

A test case is defined using the following syntax. Only the URL element is required.

<case>
<url>URL</url>
<method>HTTP METHOD</method>
<body>REQUEST BODY CONTENT</body>
<add_header>ADDITIONAL HTTP HEADER</add_header>
<verify>STRING OR REGULAR EXPRESSION</verify>
<verify_negative>STRING OR REGULAR EXPRESSION</verify_negative>
</case>

Below is an example of the simplest possible test case file. It contains a single test case which will be executed continuously during the test run. The test case contains a URL for the service under test. Since no method or body defined, it will default to sending an HTTP GET to this resource. Since no verifications are defined, it will pass/fail the test case based on the HTTP status code it receives (pass if status is < 400).

<testcases>
<case>
<url>http://www.example.com/foo</url>
</case>
</testcases>

Related:

#    Comments [0] |
 Thursday, July 19, 2007

Something I Need To Remember...

people are more important than technology
#    Comments [3] |
 Friday, June 29, 2007

PyLT - Dev Update #3 - Web Performance/Load Test Tool

(Update: PyLT has been renamed to Pylot)

(PyLT is the open source web performance/load test tool that I am developing)

A quick update on PyLT development...

The load generating engine is looking pretty solid and seems to work really well so far. It uses threading for concurrency and seems to scale well (though I haven't put it through its paces enough yet).

The GUI is evolving more and starting to look like a real performance/load testing tool:

This is my first project using wxWidgets and wxPython.  I am finding it to be very powerful and relatively straight forward to design nice user interfaces.  However, this is a big jump for me.  The past few years I have mostly done web programming and work with distributed systems.  It took a bit to get my head back into traditional GUI application development and event-driven programming

More to come...

Related:

#    Comments [0] |

C# - Convert ASCII String To Hex

C# method to convert an ascii string to hex:

public string ConvertToHex(string asciiString)
{
    string hex = "";
    foreach (char c in asciiString)
    {
        int tmp = c;
        hex += String.Format("{0:x2}", (uint)System.Convert.ToUInt32(tmp.ToString()));
    }
    return hex;
}

#    Comments [0] |
 Wednesday, June 27, 2007

Launch of GNU GPLv3

It's Official...

From the FSF press release:

"On Friday, June 29, at 12 noon (EDT), the Free Software Foundation will officially release the GNU GPL version 3.  Please join us in celebration as we bring to a close eighteen months of public outreach and comment, in revision of the world's most popular free software license."

GPLv3 has been a long time coming.  This is a big moment in Free Software.

#    Comments [0] |
 Friday, June 22, 2007

OSI Standing Up To Those Flagrantly Abusing The Term 'Open Source'

Michael Tiemann (President of the Open Source Initiative):

"When is the OSI going to stand up to companies who are flagrantly abusing the term 'open source'?"
The answer is:  starting today.

Read more:  Will The Real Open Source CRM Please Stand Up?

#    Comments [0] |
 Friday, June 15, 2007

PyLT - Dev Update #2 - Web Performance/Load Test Tool

(Update: PyLT has been renamed to Pylot)

(PyLT is the web performance/load test tool that I am developing)

A quick update on PyLT development...

This week I rewrote the GUI using wxPython.  It still needs a *lot* of work, but here is what it's starting to look like:


Related:
PyLT - Dev Update #1 - Web Performance/Load Test Tool
PyLT - Scratching My Itch - New Web Performance/Load Test Tool (Open Source)

#    Comments [0] |
 Tuesday, June 12, 2007

Does Python Meet The Definitions Of An OO Programming Language?

Who cares.  After all, we are all consenting adults here.  Python is most definitely a multi-paradigm language.  This flexibility is one of Python's great features.

Tim Peters responding to accusations of Python not being a "true OO programming language" (1998):

Jeff:
> So how does Python implement encapsulation? From
> what I have seen it does not, and therefore may contain
> many OO concepts, but cannot be considered a
> true OO programming language.

Tim Peters:
Indeed, and because it doesn't support closures, it's not a true
functional programming language either. And because you have to import
all sorts of modules to do the simplest things (e.g., regular
expressions), neither is it a true scripting language. Indeed, because
it doesn't support labeled break or continue statements, it's not even
a true structured programming language.
#    Comments [0] |
 Monday, June 11, 2007

PyLT - Dev Update #1 - Web Performance/Load Test Tool

(Update: PyLT has been renamed to Pylot)

A quick update on PyLT development...

I have a working version of the guts of my tool (the multi-threaded load generator).  I have now started working on the user interface.  My initial idea was to use Tk for the GUI Toolkit.  I started developing a minimal GUI and quickly realized I need a Toolkit more powerful than Tk.

My original justification for using Tkinter (from blog comments):

"I will probably eventually move to a richer toolkit (like wxPython) if I take this thing far. For right now, Tk works. It comes distributed with core python, it's super fast and light, it's easy to use, and I know it pretty well. Though it looks like crap and is limited in many ways."

As of today I am rewriting the GUI with wxPython, which uses the wxWidgets Toolkit.  This should give me the ability to create a rich cross-platform UI for my tool.

[For posterity] Here is what the original prototype of the Tk UI looked like:


R.I.P. Tk... Hello wxWidgets


Related:
PyLT - Scratching My Itch - New Web Performance/Load Test Tool (Open Source) 

#    Comments [2] |
 Friday, June 01, 2007

PyLT - Scratching My Itch - New Web Performance/Load Test Tool (Open Source)

(Update: PyLT has been renamed to Pylot)

I have started development on a new web performance/load testing tool.  It is targeted at testing Web Services.


Here is some Q&A with myself:


You know you are reinventing the wheel, right?

Yes, I know.  There are already open source web load testing tools available (OpenSTA, JMeter, Grinder, WebLOAD, etc).  I have used all of these as well as proprietary tools for years.  I am a performance engineer and I feel like I need a tool set that I am intimately familiar with.  I need the ability to easily alter and tweak the tool at will.  I don't have the time, budget, or patience enough to wait on vendors when I need something.  I also want a tool that is fun to hack and adapt.  For this, I need to understand the code base deeply.

What language are you using?

Python.  The initial GUI uses Tk, but this may be changed down the road. I use Python's threading module for concurrency. If this doesn't scale well enough, I will be exploring other models of concurrency (perhaps generator based coroutines).

Why do you think you can write a tool like this?

I have worked in performance testing for nearly 10 years.  I have written many tools that work with various protocols to do distributed load generation and testing.  Creating a simple HTTP load generator is sort of my Hello World 2.0 for each language I try (I have written these from scratch in Python, Perl, Java, and C#).  This tool takes that basic concept and organizes it into a robust application.

Will it be Free and Open Source?

Of course!  Licensed under GNU GPL.



For an early look, check out the source repository at:  http://pylt.googlecode.com/svn/trunk

More details to come.

-Corey

#    Comments [6] |