Punk-coder Blog

Technology

Migrating the Website

by on Dec.23, 2011, under Technology

I have migrated away from Godaddy in light of their stance on SOPA, for more information check the link below.

http://support.godaddy.com/godaddy/go-daddys-position-on-sopa/

if you don’t know anything about SOPA or why it’s evil, here is an excellent explanation of ProtectIP and SOPA… Click Here

Leave a Comment more...

Managing offshore work.

by on Dec.21, 2011, under Things I Wish I Learned in College

“Many hands make light work.” – Origin Unknown

“This statement is false” – Liars Paradox

There is an excellent lesson to be learned in working with others, and even greater lesson when working with people of a different culture. As you should be learning to spot business speak, you can tell that this ended horribly.  Otherwise there wouldn’t be a lesson involved.

So I landed at my clients office for the first time and I was settling down into my new desk, the project manager came in and talked with me about the project. The project was simple for the most part there were a couple of office documents that would need to be automated.  They needed to be tied up to a database so that the information could be reused across the departments.  To me this sounded like it shouldn’t be a problem.  I had done things like this before so there shouldn’t be anything difficult about it.  I was also informed that we had a very short deadline to work against but that this would be alleviated by adding two resources from off shore.

Enter Alice and Bob (not their real names).

So as we started, the management figured out that source control was too expensive so there was no budget for that, and that we were to transfer code from the US to offshore by email (Mistake #1, cost is never an excuse for not using source control).  In the beginning this was not a problem I would make my code changes during the day then would ship the offshore team our project by email, then they would return their updates from over night and I would review and integrate their changes.  This worked for about the first week then there were a couple of days where emails had gotten kicked back.  The resulting of this was that I had to spend a full day reviewing one set of changes and review the second set another day.

Bobs code for the most part looked good but childish, like someone who had never really programed in C# before. Alice’s code often contained compiler errors and required reworking to even be functional, a topic that we talked about on several occasions.  However since they were on lend from another department I couldn’t get them removed and I had to work through their work (Mistake #2, if someone is creating a hindrance and your direct management won’t solve the problem. Find some one who will). It finally go to the point where I was spending 8 hours working with their code and another 8 hours working on mine.  Then came the point where the real problem crept in.

Knowing that I had to have certain elements of the code that needed to function and work by a certain date I started cutting back the time that I was spending reviewing the code, switching it from working 4 hours on their code and 12 on the code that I was responsible for. (Mistake #3, don’t leave children alone in the garden).  Because of this code that contained inherent bugs started slipping into the code and there were hacks to fix the hacks in the hopes that this would eventually get to a point where the code was functional.

It never got there,  in the end I had a client that was upset with me.  A team that was upset with me, and I loathed being in that situation. The project completed from my side about a month and a half after it was planned to, and it counts as one of the black marks in an otherwise good year.  I’m offering this up as a cautionary tale about the lessons I learned in the hopes that others won’t have to experience them.

Leave a Comment more...

Encryptr

by on Dec.20, 2011, under Code

I had been fooling around with this idea for a long time, and I finally sat down and coded it.  The idea is simple, in the world of secret sharing you want to ensure that the fewest number of people have what is needed to expose the secret.  The problem is that in many cases when you hand over that information to a service or escrow you  have no idea if they are really keeping that infromation secure.  Classic example is that if you send email from one person to another the email, even though it may be sent across the wire using ssl, is more than likely sitting on the server in plain text. Even if it isn’t there are ways for the administrator to expose the contents of the email box.  So how do you pass a message and make sure that everything is secure.

You encrypt it on one end and decrypt it on the other end, without storing anything but the encrypted text on the server.  That’s what encryptr does.  It takes a message typed in by the user and encrypts it using javascript then sends only the encrypted information to the server. The only part of the message that is identifiable in the server is the id which is used to look up the message.

If you are interested in the project feel free to got to https://bitbucket.org/punkcoder/punkcoder.applications.encryptr

Leave a Comment more...

Things I Wish I Learned in College: Someone will be reading your code…

by on Jun.24, 2011, under Code, Technology

I came across this the other day in a piece of forgotten code. If you have been in programming for any period of time then you surely have seen it. Its the ‘well documented hack’ for example:

//This Item was created per the client
//Instructions to correct a legacy issue
// ...
//Do not delete this method

I know people who have written those lines of code,  as I am sure that there are some people out there that continue to write lines like this.  But I want to take a moment and think about this,  is this the type of code that has a place in your product?  This is the essence of hacked code.  In my current line of work I find code like this alot, programs and methods that have gained so much dust that the people who wrote them are no longer around to ask why they were important.

Which brings us to the point of all of this,  at what point to you attempt to fix the issues of time that has gone past?  How do you turn around a program rifled with code rot, and in the end is it really worth it? Many cases the applications that contain this type of code have millions upon millions of lines of code.  The only way to make certain that you don’t land yourself in this spot is to always approach code with the thought that someone forty or more years down the line will be reading your code. They will look at your prized application and they will not see the bleeding edge technology that you saw when you designed it.  They will see the hulking and aged behemoth that remains, they will look at it with very different eyes.  The only gift that you can give to that person is code that is clear, clean, and easy to read.

If you see a hack replace it with the corrected code, and don’t write any more hackish code. If you are intent on making software your craft, learn it, and exercise it to the best of your ability.

Leave a Comment :, , , , , more...

Stupid Developer Tricks : Proxy Settings

by on Dec.10, 2010, under Technology

Not too long ago I found myself working on multiple projects that had me switching back and forth between multiple different proxy settings based on the fact that I was working from either of the locations or working from the hotel room. They get to the point where setting all of the proxy settings every time I needed to open one of my browser’s was starting to drive me slightly batty. So I did what all of developers do I looked into what it would take to automate the process of setting my proxy settings, and I came up with this little script that I thought I would share:

Write-Host "Proxy Configuration Script"
Write-Host "  Select your proxy settings: "
Write-Host "   "
Write-Host " 1.> Proxy Off  "
Write-Host " 2.> Work  "
Write-Host " 3.> Hotel     "
Write-Host "   "
$selection = Read-Host "Selection"

if ($selection -eq "1")
{
	set-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -name ProxyEnable -value 0
	set-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -name AutoConfigURL -value ""
	set-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -name ProxyServer -value ""
}

if ($selection -eq "2")
{
	set-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -name ProxyEnable -value 0
	set-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -name AutoConfigURL -value "http://<YourCompaniesAutoConfig>"
	set-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -name ProxyServer -value ""
}

if ($selection -eq "3")
{
	set-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -name ProxyEnable -value 1
	set-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -name AutoConfigURL -value ""
	set-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings' -name ProxyServer -value "<Your Companies HardCodedServer:port>"
}
1 Comment more...

Review: Applied Architecture Patterns on the Microsoft Platform

by on Dec.10, 2010, under Technology

When I found out that Stephen Thomas was writing a book about the upcoming technologies with some of the experts in these technologies, I immediately thought to myself I need to read this book.  So after getting my hands on a copy of Applied Architecture Patterns on the Microsoft Platform I found myself with both some interesting reading material as well as a crash course on some of the architectural designs for upcoming and current Microsoft technology.

To start off I make my living as a software consultant and I pride myself on my knowledge of many areas of technology, currently in the Microsoft stack.  Because of this I think my view of the book has been slightly skewed, to further complicate things I also view myself as an early adopter oftentimes tinkering with the latest CTP of the developer tools for various new products.

The book starts by going across the architectural overview that attempts to set down the parameters for what the rest of the book is built against.  This section of the book is reserved for the youngest among the developer an architect crowd, and I would imagine would be the most skipped out of all the chapters.

The next section of the book deals with primers for each of the different technologies that they are working with including windows communication foundation and workflow foundation, app fabric, biz talk, SQL server (SSIS and SSSB) , and windows azure.  These particular chapters I found to be of little help, simply because I keep up with many of the technologies.  However if you are walking into a situation where you know nothing about these technologies, then you might find the primer chapters useful.

The next section of the book consists of problems that were picked so that they would meet the needs of the examples.  But while this is not an uncommon practice in the realm of technology education literature, it is slightly frustrating and let me to wonder exactly how well these technologies would perform under real-world circumstances.  The most informative part of the sections includes the side by side comparison of multiple solutions and the bare information provided to develop quick skills with the particular technologies.  In many cases I think the book would be useful in the instance that you needed to have a crash course on one of the technologies that was presented.

On the other hand there are some chapters in the book that deal with very specific instances of solving real issues that occur when working with the toolset.  At least one of the chapters in the book deals specifically with an issue that I have encountered before and stepping through the pages for that particular chapter were in many ways like reliving that assignment complete with the solution.

But in the end I don’t think most people will read the book the same way I did from cover to cover, and it may not be a great reference for someone looking to update their skills in a particular area.  However if you have been out of touch with the latest offerings from the Microsoft stack for more than two years you may find this book extremely helpful as it gives step by step instructions that will act as an introduction too much broader discussions.

In the end the book is a blend of content ranging from very specific instances that function more like a recipe than a tutorial to broad overviews of the technology.  I think that there is a little something for all architects and developers to pull out from this book, and the format allows you to pull out a specific portion of knowledge and digest it without having to go through the entire book.  In this way it represents more of a collection of loosely connected detailed articles than a tome of technical knowledge.  In the end I was not upset with the amount of time spent reading the materials.  I think much of the information that I gained I will be able to put to good use.

Pick up your copy at Packt Pub.

Leave a Comment :, , , , more...

The Upper Limit Number of Applications in BizTalk

by on Jun.02, 2010, under Technology

So we had an instance today where we wanted to know if BizTalk would be capable of handling a large number of applications. So we decided to run a small test that would allow us to see how the system holds up under these circumstances. Note that we know that this was not a conclusive test, but was instead designed to see if there was a preprogrammed upper limit.

The environment that we were using was a virtual machine, with 8 cores and 2gb of ram, with that we were able to get the number up over 1024 applications without BizTalk showing any issues. With that said we didn’t have any ports, orchestrations, or schema’s installed in the applications. So this is solely about the number applications.

The next step is to make the multi-threaded version of the app for adding it to the server so that I can go over the 1024 without having to wait for the hour and a half.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading;

namespace ApplicationAdder
{
    class Program
    {
        static void Main(string[] args)
        {
            bool isAdd = false;
            int length = 1024;

            for (int i = 0; i < length; i++)
            {
                if (isAdd)
                {
                    ExecuteCommand(@"BTSTask AddApp -ApplicationName:SampleAppNumber" + i, 300000);
                }
                else
                {
                    ExecuteCommand(@"BTSTask RemoveApp -ApplicationName:SampleAppNumber" + i, 300000);
                }
            }

        }

        public static int ExecuteCommand(string Command, int Timeout)
        {
            int ExitCode;
            ProcessStartInfo ProcessInfo;
            Process Process;

            ProcessInfo = new ProcessStartInfo("cmd.exe", "/C " + Command);
            ProcessInfo.CreateNoWindow = true;
            ProcessInfo.UseShellExecute = false;
            Process = Process.Start(ProcessInfo);
            Process.WaitForExit(Timeout);
            ExitCode = Process.ExitCode;
            Process.Close();

            return ExitCode;
        }
    }
}

Update: It appears that BTSTask.exe doesn’t handle multi-threading very well so this will have to stand in the event that someone decides to run this test any further I would really like to hear the results.

1 Comment : more...

An interesting use for Skype

by on May.10, 2010, under Hak-Simple, Technology

So over the past couple of months we have been adjusting to a new life with our dog. We both love her alot but one of the problems that we are having to deal with is the fact that she has some very serious issues with separation anxiety. While not as bad as some of the cases that I have read about on the internet, it has been a problem to the point where she has managed to destroy a couple of the items around the house.

  • a rug
  • several comforters
  • a multitude of caribeaners
  • a set of sheets
  • one medium dog kennel
  • one large dog kennel
  • finally, she took a bite out of our new bed.

Not one to be discouraged in handling the issue, We have managed to make some changes that I think have managed to get things a little more under control. First she goes for a thrity min walk every morning.  But a slightly more interesting partial solution to the problem is to be more near to her so I can calm her down.   It really seems to be working, but here’s the idea.  I have two laptops with mic’s and webcams.  One is my work laptop and the other is a really cheap netbook that I bought a couple of months back.  Since I am not using it while we are in town, I have set it up so that it sits on  a small nightstand next to my be pointed so that she can see the screen and so I can see her.  Part one done.

The second part of the trick is setting up two different skype accounts one for the netbook and the second for my work computer,  This is simple enough. Then on the netbook I set up the account to only accept calls from the people that are on the friend list, set it to automatically accept calls and to do full screen video.  So as soon as I call in the video goes full screen, with that she can see and hear me.  So the only thing that is left is for her to draw a connection to the image that she sees on the screen and the real person.

This one escaped me for a little while,  I noticed that I could eventually get her to listen to me after repeating ‘lay down’ several times, something that seems extremely strange in a work setting like I work in. Then I finally figured out how to make it happen when I was working from home.  For the first couple of times I would say it over the computer, then when she wasn’t listening I would storm over to the bedroom where her crate was located and I would be assertive in my direction.  It only took a couple of times before she began to realize that if she didn’t listen that there were negative consequences.  Luckily our dog is a people pleaser and responds very well to mild negative and positive reenforcement.

Now while I am at work I can keep her on in the background and I hardly have to say anything more than once, and I have noticed that she is becoming more and more mellow, hopefully this will help in the long run.  But we will find out.

2 Comments :, , more...

Parallel namespace in .NET 4.0

by on Feb.11, 2010, under Code

It was only a couple of months ago that I purchased a new laptop. A very shiny Dell Studio 15, with a core i7 in it.  I have been very happy with it.

But it wasn’t long before I started to notice a problem, when I would run programs it would max  out one maybe two of the cores and the rest of the computer would be idle.  For a machine that has 8 logical cores (4 Physical w/HT) that’s a whole lot of waste without a whole lot of return.  Then I started to think about the problems that come up with doing multi threading in code.  It’s flat hard, and in many cases if  its not something that you were thinking about from the very begining you are in for a world of hurt.  So you could imagine how happy I was when I heard about the Parallel namespace that is included in version 4.0 of the .net framework.

The idea was that because multithreading is difficult especially when you are talking about systems that are generally designed by people whom have little deep understanding about the technology that they are dealing with, it was refreching to see that the people in redmond were thinking about us.  Now it is as simple as working with a single namespace and making sure that your resources are properly taken care of.

How well does it work?  I decided to put together a little test to test the whole thing out. So I decided to create a small code segment that would simulate a thousand segments processing at 10ms a piece and the results were almost exactly what I expected, I tested this on my new laptop, so it’s splitting the work between 8 logical processors.

Single Console Run Time : 9990ms
Parallel Console Run Time : 1216ms

While this is not a super scientific task since we can see that the work that is being done is just putting the thread to sleep, it does effectively show that the framework for parallel core processing is working and can be implemented with little extra work.

Here’s the code so you can test and see what you come up with:

static void Main(string[] args)
{
int MaxCount = 1000;

System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();

timer.Start();
for (int i = 1; i < MaxCount; i++)
{
Syscode(i);
}
timer.Stop();
Console.WriteLine("Single Console Run Time : {0}ms", timer.ElapsedMilliseconds);
timer.Reset();

timer.Start();
Action sysDelegate = new Action(Syscode);
Parallel.For(1, MaxCount, sysDelegate);
timer.Stop();

Console.WriteLine("Parallel Console Run Time : {0}ms", timer.ElapsedMilliseconds);
Console.Read();
}

public static void Syscode(int x)
{
System.Threading.Thread.Sleep(10);
}
2 Comments :, , more...

Become the Media

by on Aug.14, 2009, under Technology

I remember listening to the words of Jello Biafra in high school, his spoken word works definatly help to shape me into the person that I am today. They allowed me to look at things in a way that I consider more intellegant than I think I would have otherwise been. While I don’t agree with everything that he said, the sensationalism really helped to drive the message home.

But there is one of the recordings that I go back to time and time again becuase I think it shares a particular relevance to todays world. The work is called Become the Media in this work he urges people who are disatisfied with the world around them to get out there and do something about it.

As a software professional I am contastantly wondering how I apply my special skills to this equation. Is bloging the correct answer, I really don’t think so. I realized long ago that I really don’t have the writing skills to become a serious writer, but what I do have is a voice and a set of skills.

So this is a solicitation, if you are interested in working on a project that may help others to ‘Become the Media’ please leave me a comment with you name and some way that I can get a hold of you. I have to review each of the comments before they are posted so I will make sure that your info doesn’t make it onto the site.

Technorati : ,
Del.icio.us : ,
Zooomr : ,
Flickr : ,

Leave a Comment :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...