He provides software contract services, efficency consulting work, automation of your current processes, and computer repair.
Boise Code Camp 2010
I had a blast at the Boise Code Camp this year. It was at Boise State University on Saturday, March 27 and Sunday, March 28 this year.
I attended some pretty good sessions, had some free beer, free pizza, and was able to really geek out with some great technical minds. This year I was also a presenter. I presented a topic on Black Box testing. Topics I attended were:
- 10 Reasons Drupal Rocks
- Pentesting Web Applications
- Powershell for Programmers
- Membership sites with Wordpress
- SQL best practices for Functions, Triggers, and Stored Procedures
- jQuery and jQuery Validator
- Black Box Testing
- Virtualization
- SLAMPP, Developing a Linux Distro
Content (GPL) © 2010, written by Matthew Kunzman
Are bandwith hogs a myth?
ISP's are limiting users that "use more than their fair share" of data. In doing so, they are limiting the freedom of the Internet. However, are power users really harming the experience of other users at all?
Not very many people have questioned the ISP's right to limit these users. The consensus has been that if these users are ruining it for everyone, then they should be banned. Do these users really limit access to the Internet to others though? Is the bandwith hog a myth?
http://www.fiberevolution.com/2009/12/whats-a-bandwidth-hog-.html
"TCP/IP is by definition an egalitarian protocol. Implemented well, it should result in an equal distribution of available bandwidth in the operator's network between end-users; so the concept of a bandwidth hog is by definition an impossibility. An end-user can download all his access line will sustain when the network is comparatively empty, but as soon as it fills up from other users' traffic, his own download (or upload) rate will diminish until it's no bigger than what anyone else gets."
For those of you interested in networking, TCP/IP is a protocol suite. Although it involves TCP from the transport layer and IP from the Internet layer (or Network Layer in OSI model), it is commonly misrepresented as just pertaining to those two layers. It really refers to the entire TCP/IP model which includes the Link, Internet, Transport, and Application layers. Basically, it's an alternative naming convention to the OSI model, just with a misleading name.
To simplify it, it basically combines the OSI's Application, Session and Presentation layers into an application layer and Physical and Data Link Layers into a Link layer. So compared to the OSI it would be something like this...
TCP/IP
Application layer: Examples... HTTP,FTP,IRC
Transport layer. Examples... TCP, UDP (Yup you can use udp in TCP/IP...ug, I know)
Internet. Examples... IP, ICMP
Link. Examples... ARP, NDP
OSI
Application Layer Examples... HTTP,FTP
Presentation Layer Examples... MIME, XDR
Session Layer Examples... NetBIOS, SAP
Transport Layer Examples... TCP, UDP
Network Layer Examples... IP, ICMP
Data Link Layer Examples... ARP, NDP
Physical Layer Examples... Ethernet, POTS, DSL, 802.11g
So why would I bother going through that long explanation of networking? I really wanted to separate in your minds the commonly misguided concept of the TCP/IP model and TCP or IP by themselves.
Why? Well because people are on the net arguing asinine comments like "What about the users of Voice over IP? They use UDP instead of TCP. Wouldn't that change everything?" Well, no it wouldn't. This is because TCP doesn't have to be used in TCP/IP.
All in all, this is a wonderful article, which I highly suggest. I especially recommend it to us that can be users of higher bandwidth than the average user.
Content (GPL) © 2009, written by Matthew Kunzman
Check to see if a file exists in Perl
If you are going to manipulate files, check the size of files, or otherwise work with an existing file it is good to check to see if it exists first. This will save you a lot of time and headache. A good way to check this is in a simple conditional statement.
Here is a sample way to do this in Perl. First set a variable with the path to your file, and then check to see if it exists with a -e.
#!/usr/bin/perl
$filename = '/pathTo/yourFile.doc';
if (-e $filename) {print "File Exists!";}
Content (GPL) © 2009, written by Matthew Kunzman
Connecting to an SQL database in Perl
Using the DBI module in Perl can connect you to a database quite quickly. It is fairly easy to perform SQL actions. The major problem with this method is that you have to put the password in your php file. This isn't a huge security flaw, because if a user views the source this code will not be in there. However if the user has access to view the php file from the server you will be giving out your password to them.
In the business world, this can be a simple and effective method though.
#!/usr/bin/perl
use DBI;
my $dsn = 'DBI:mysql:database=YOUR_DATABASE_NAME:host=YOUR_HOST_NAME';
my $username = 'username';
my $password = 'password';
my $connection = DBI->connect($dsn,$username,$password);
if ($connection)
{
my $sth = $connection->prepare("DELETE FROM table");
$sth->execute();
}
Content (GPL) © 2009, written by Matthew Kunzman
SourceForge, Inc. changes its name to Geeknet, Inc.
For those of you that host code on SourceForge or use code from SourceForge, this is BIG news. SourceForge changed its name today from SourceForge to Geeknet. The new website is located at Geek.net. Below is the offical press release from SourceForge:
SourceForge, Inc. Changes its Name to Geeknet, Inc.
MOUNTAIN VIEW, California, Nov. 4, 2009 – SourceForge, Inc. (NASDAQ: LNUX) today announced that it has changed its name to Geeknet, Inc. to more accurately reflect the company's business and the growing market it serves. The name change also supports the company's intention to expand the reach of its online advertising services into new categories.
"Renaming the company Geeknet is the latest step in our rapid transformation," said Scott L. Kauffman, President & CEO of Geeknet. "Our new name is a more accurate articulation of our business. With Geeknet as our calling card on Madison Avenue, we are now able to clearly define the audience we serve and more effectively capture the business opportunity that we are addressing."
The Geeknet network, which includes SourceForge, Slashdot, ThinkGeek and Ohloh, among others, serves a global community of nearly 40 million geeks each month. These tech-savvy professionals and enthusiasts are affluent, well-educated and command significant spending power.
Kauffman continued, "The geek demographic is bigger than most people realize, and it is growing every day in both scope and influence. Its product appeal extends beyond servers and slide rules to include video games, soft drinks, automobiles, fast food, fashion, entertainment, consumer electronics and other goods. We call this phenomenon the 'geekification' of the world, and we believe that our network provides the best platform for advertisers to reach this highly coveted audience."
To support the new brand, the company is immediately launching a series of programs to raise awareness of Geeknet.
About Geeknet
Geeknet is the online network for the global geek community. Our sites include SourceForge, Slashdot, ThinkGeek, Ohloh and freshmeat. We serve an audience of nearly 40 million users* each month and provide the tech-obsessed with content, culture, connections, commerce, and all the things that geeks crave. Want to learn more? Check out geek.net.
(* September 2009 Unique Visitors 38.9M. Source: Google Analytics and Omniture)
Geeknet is a trademark of Geeknet, Inc. SourceForge, Slashdot, ThinkGeek, Ohloh and freshmeat are registered trademarks of Geeknet, Inc. in the United States and other countries. All other trademarks or product names are the property of their respective owners.
NOTE REGARDING FORWARD-LOOKING STATEMENTS: This press release contains forward-looking statements within the meaning of the Private Securities Litigation Reform Act of 1995. These statements are based on our current expectations, and involve risks and uncertainties. Forward-looking statements contained herein include statements regarding the potential benefits of our corporate rebranding for us and advertisers interested in our target market, growth strategies and prospects for our online media and e-commerce businesses, and our initiatives to raise awareness of our corporate rebranding. Actual results may differ materially from those expressed or implied in such forward-looking statements due to various factors, including: our ability to attract and retain qualified personnel; success in designing and offering innovative online advertising programs; decreases or delays in online advertising spending, especially in light of current macroeconomic challenges and uncertainty; our effectiveness at planning and managing our e-commerce inventory; our ability to achieve and sustain higher levels of revenue; our ability to protect and defend our intellectual property rights; rapid technological and market change; unforeseen expenses that we may incur in future quarters; and competition with, and pricing pressures from larger and/or more established competitors. Investors should consult our filings with the Securities and Exchange Commission, sec.gov, including the risk factors section of our Annual Report on Form 10-K for the year ended July 31, 2008, and our Quarterly Report on Form 10-Q for the quarter ended June 30, 2009, for further information regarding these and other risks of our business. All forward-looking statements included in this press release are based upon information available to us as of the date hereof, and we do not assume any obligations to update such statements or the reasons why actual results could differ materially from those projected in such statements.
Content (GPL) © 2009, written by Matthew Kunzman
Matt's Blog is now available on Google Reader
For all of you Google Reader fans, Matt's Blog is now available on Google Reader. All you have to do is the following:
Step 1) Click on "Add a Subscription" link on the top left of the page. (Hint: It has a + sign next to it)
Step 2) Type or past the following into the text field that appears:
http://www.mattkunzman.com/index.xml
Step 3) Click the "Add" button to the right of the text field.
Content (GPL) © 2009, written by Matthew Kunzman
Putting values from checkboxes into an SQL database
Putting values from checkboxes into an SQL database isn't that difficult. It's easy if you put them in an array. Let's say you have a checkbox vith the name "value". A quick and dirty way to insert the values would be to just count the array and do a for loop to insert.
Just remember to make the checkbox with the name as an array with the array brackets. ie <input type="checkbox" value="value" name="value[]" />
<?php
extract($_POST);
$size= count($value);
$dbh=mysql_connect ("your.server.com", "username", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("databaseName");
for($i = 0; $i < $size; $i ++)
{
$query = "INSERT INTO table (columnName) VALUES ('$value[$i]')";
$result = mysql_query($query);
}
?>
Content (GPL) © 2009, written by Matthew Kunzman
Replace in all opened documents
My favorite development tool is Notepad++. It is free, open source, and really easy to use. This might sound like a commercial for Notepad++, but I swear I do not know this company and have never recieved any money or notoriety from them. I just like their product.
I really like all of the languages they support and the colored text makes things easier, so does the ability to write add-ons to parse text, and the ability to switch between unix and windows formatting with the click of a button.
My favorite feature is the one that saves me the most time though. The replace in all opened documents feature. I just used it today to replace a line of text in 20 opened documents using a regular expression all at the click of a button. Woo hoo. Man how I love that.
Content (GPL) © 2009, written by Matthew Kunzman
Simple javascript to check for browser type
Have you ever worked on a bunch of activeX content at work only to get some bonehead to say it doesn't work in his non-company approved web browser? You can't code for every browser in the world, and you shouldn't waste the manhours testing in an enviornment that isn't company approved.
It would be nice to download and test in every possible browser, or to code perfectly to open web standards, but sometimes that just isn't possible. The best way to deal with this is just to alert people that they are using the wrong browser for your program.
The simplest code I have found for this is below. It is javascript and checks just the program and ignores the version. I really like this simple code.
{
alert("You're not using the Internet Explorer browser.\n This webpage uses ActiveX content and will not work properly for you.")
}
Content (GPL) © 2009, written by Matthew Kunzman
Printing the date and time in Perl
I haven't found a lot of code to easily display the date and time in perl. The Time() funtion is unix epoch based and that can cause problems converting. Without using a module, getting the time can be difficult. Here is the easiest way I have seen.
my $dateTime = sprintf("%4d-%02d-%02d %02d:%02d:%02d\n", $year+1900,$mon+1,$mday,$hour,$min,$sec);
The year rolled over to past 100 because of the Y2K bug. That is why you have to add 1900. After 1999 the year went to 100. For example, this year shows up as 109 even though it is 2009. It's a silly bug that I hope will be fixed with future versions of Perl.
The output for this will be in this format. (2009-05-11 09:50:22) It works quite well. Obviously, you can also change your print statement to print differently or use sprintf to print to a variable.
Content (GPL) © 2009, written by Matthew Kunzman
Regular expression $1 technique
In Perl and some other languages you can save a chunk of a regular expression
using the $1 variable. Using the parenthesis, Perl will save the first set as
$1, the second as $2 and so on. For example if the regular expression was:
m/^...(...)...(...)/g and the comparison was abcDEFghiJKLmno then $1 would be DEF
and $2 would be JKL.
This works really well with arguments. For example if you ran the file
printName.pl and used the arguments -firstName=Matt -lastName=Kunzman
you could use the following code to pull the two variables out really
easily.
{
if ($arg =~ m/-firstName=(.*)/g){$firstName = $1;}
elsif ($arg =~ m/-lastName=(.*)/g){$lastName = $1;}
}
print "$firstName $lastName";
Content (GPL) © 2009, written by Matthew Kunzman
Random Numbers Without Duplicates
Well here it is almost May. Man, the months are flying by.
A buddy of mine was having trouble with a keno program he was trying to make.
He wanted random numbers to come up, but he didn't want any of the numbers to repeat.
I thought I would throw down some lines of code for a random number generator.
A common way to generate random numbers without having duplicates is to throw
them into the keys of a hash. Since the keys of an associative array have to be
unique, it will not let you add the number more than twice. This will get a
unique set of random numbers. The following will print an ascending sorted
list of numbers. If you don't want the numbers sorted you could just print
using print join(' ',keys %list);.
use strict;
use warnings;
my @numbers = (1..80);
my $limit = 20;
my %list = ();
while (keys %list < $limit) {$list{$numbers[rand @numbers]}=1;}
print join(' ', sort {$a <=> $b} keys %list);
Content (GPL) © 2009, written by Matthew Kunzman
Software and Copyright Law
Another week of programming, and my discussion on topics discussed at the 2009 Boise Code Camp continues. This time it is on Software and Copyright law. I am not a lawyer, but I met with Brad Frazer and he talked about how Copyright law works pertaining to software.
Boise native Brad Frazer is a 1985 cum laude graduate of Brigham Young University (Provo) and a 1988 graduate of the University of California, Hastings College of the Law, where he earned a position on the College's law review. After law school, he received his Masters of Business Administration degree from the University of Utah. From 1989 to 1997, Brad worked at the Boise law firm Elam and Burke, becoming a shareholder in 1997. In 1997, Brad accepted an in-house position as Senior Intellectual Property Counsel with Micron Electronics, Inc., and remained with Micron Electronics through its merger with Interland, Inc., (now Web.com), the nation's largest web hosting company, eventually becoming Deputy General Counsel to Interland.
From June 2003 to February 2006, Brad was with MPC Computers, LLC, in Nampa where he also served as Deputy General Counsel. Brad is now Of Counsel to Hawley Troxell Ennis & Hawley, LLP, where his practice areas include Internet law, e-commerce, technology and software licensing, trademarks and domain names, copyright and content rights, media law, computer law, trade secrets, and related transactional work and litigation.
Brad provided an introduction to copyright law as it applies to software and code writers, including topics such as copyright authorship, ownership, assignment, registration, and enforcement. Software has certain esoteric copyright characteristics that Brad introduced and highlighted to make sure we were able to own and protect the fruits of our labors. The interactive discussion also included an overview of copyright issues that arise from using open source code.
Summary of Brad's Discussion
Patents - A patent protects ideas and methodology. The result of an output is patentable.
Copyrights - Copyrights don't need © (circle c) and mailing yourself you code doesn't do anything. A copyright is automatically created when a unique document is created on a tangible medium.
Contractors own the copyright to the code they create unless it states otherwise in the contract. They are able to use the code or pieces of it in other projects freely.
Employers own the copyright to code created by an employee. This is code created for the business. (It gets a little fuzzy here)
Object code - You cannot copyright object code. 1 and zeros etc., it must be readable.
Source code - You can copyright source code.
- Copyrights are looks at line by line so changing the language is common to make it significantly different.
- Reverse engineering is legal unless you sign an agreement that says you won't. This is because it promotes creativity.
Content (GPL) © 2009, written by Matthew Kunzman
Baseball Season means stat programs
As a fan of math and statistics, baseball is by far my favorite sport. Opening day is today. That means warm brats, cool beer, hot peanuts and some time by the PC coming up with a good statistical database program.
It's time to start tracking the wins and losses of my favorite team (the Seattle Mariners). Yeah I know they suck, but the best part is figuring out the odds and watching the statistical probability of a championship dwindle as the post season comes closer. I'm hoping for a season with a slim chance of a playoff berth at least until the All-Star break. We shall see how early in the season my hopes are crushed this year. I'm hoping for the best, but if they lose again I'll have some spicy brats and cold beer ready to drown my tears in.
Content (GPL) © 2009, written by Matthew Kunzman
Time Management for the Technologist
Welcome to another blog post. This week I will continue my discussion of the 2009 Boise Code Camp. My third class of the day was a class on time management in the workforce.
The Time Management for the Technologist class was very interesting. In fact, I think it was the most useful class that I went to this camp. In this class they talked about managing tasks rather than time. There was talk of prioritizing tasks and performing unscheduled tasks only if they could be completed in less than two minutes. Anything else that took longer or that you forgot how to do, you needed to schedule.
There was some interesting discussion on "the zone". All of you coders know what I am talking about when I talk about "the zone". It is that nirvana in coding when we are undisturbed and completely focused. It is when we sit down to code, forget to eat lunch and code through the day without realizing it. It is that peaceful tranquil spot where everything is magical and compiles on the first try. I love "the zone".
In this class we talked about this zone. We talked about what gets us in the zone and what takes us out of the zone. We need to schedule some "Zone time" every day in order to get things done. Also there was talk on schedule priority and how to organize everything to get more work done at work and at home. I found it easier to prioritize my work tasks. With a wife and two kids it was much more difficult to get away from them and get some "zone time" to work on projects at home. I am working on putting all of my information into tooledo. Toodledo is a free web based organizational program. It has functions to easily import and export your schedule.
Content (GPL) © 2009, written by Matthew Kunzman
The New F# Programming Language
This week the discussion on the 2009 Boise Code Camp continues. The second class I took was on F#. F# is a new .NET language by Microsoft.
Quote:
"F# (pronounced F Sharp) is a multi-paradigm programming language, targeting the .NET Framework, that encompasses functional programming as well as imperative object-oriented programming disciplines. It is a variant of ML and is largely compatible with the OCaml implementation. F# was initially developed by Don Syme at Microsoft Research but is now being developed at Microsoft Developer Division and will be distributed as a fully supported language in the .NET Framework and Visual Studio ecosystem as part of Visual Studio 2010."
The presenter from Microsoft had some interesting things to say about iterations. He was talking about that the future of coding is to lose things like variable addition and move everything into modules and foreach loops. His argument is that the common X++; is really X=X+1, which really isn't mathematically possible at all. His argument is interesting, but I'm not quite sure if I agree with him. Incrementing variables can make many tasks much easier and assigning variables is just that and is not supposed to actually be equal on both sides. I think it is more like saying X <- X+1. It is an interesting concept though and an idea that I may have to wrap my head around some more for a little while.
This intro to F# was an interesting class, and it was fun to get a sneak peak at this new language.
More information on F# can be found at the Microsoft F# Development Center.
Content (GPL) © 2009, written by Matthew Kunzman
WPF and XAML
I went to the Boise Code Camp today. It was very interesting. The keynote speaker Bob Lokken talked about inflection points in the technology industry. My first session was a class on WPF and XAML. XAML is an XML based language that can create stand alone programs. It has "styles", which are like CSS style sheets. It is not a RAD (Rapid Application Development) program, but there were some pretty cool features about it. The presentation and sample code can be found at the presenter's blog brianlagunas.com.
Content (GPL) © 2009, written by Matthew Kunzman
New Website
Well, the website is up. Work has been really busy and my personal projects have taken a back burner. I didn't have a lot of time to make it look perfect, but I'm trying to keep some content up here. There isn't any php, asp or JavaScript yet, but I'll get some up as soon as I get some time.
Content (GPL) © 2009, written by Matthew Kunzman