Joe Cincotta: Thoughts and such…

Icon

Nerdism for the masses.

We’re hiring

Click here to see more or apply: mycareer.com.au/5098411

Full Time .Net Developer :
Get on the Cutting Edge!

COMPANY PROFILE
Pixolüt Industries is a research and development company which incubates start-up companies to develop their ideas in to successful businesses. We also deal with mature businesses looking for technology partners when they want to expand in to new markets.

Position Overview
We need a very bright and motivated developer for a full time role. You get to work on a broad spectrum of projects using everything from web services to AJAX and the new WPF in .Net 3!

Work on the cutting edge of the Microsoft technologies, get time to experiment and research as well as work on several amazing systems for local and global clients.

We actively support open source projects and encourage contribution to the community from our ‘labs’ projects which are the maturing of some of our research and development.

You will come in to existing projects and work with a team of excellent developers and you would be lead by Joe Cincotta; which will provide you some great mentoring and learning opportunities. You would also get training on the job with these bleeding edge technologies and the skills and processes to back them up. We really want people who can learn as an ongoing process – we don’t expect people with loads of .Net 3.0 experience!

Working at Pixolüt you will be in a very casual environment in our lab located in Sydney’s south. Defninitely no suits or ties necessary. Its near the beach and we encourage a life/work balance – so you can take time to enjoy it… 

There is no peak hour traffic ever, its just a short walk to the train station and there is free all day parking too. Perfect! On average its a 30 minute commute from the city.

MAP LINK:
http://preview.tinyurl.com/2tm64d

SUBMISSION GUIDELINES
Please provide a concise resume in .DOC or .PDF format. Ensure your resume has evidence of education history and skills.

To be eligible to apply for this position you must have an appropriate Australian or New Zealand work visa.

Click here to see more or apply: mycareer.com.au/5098411

Filed under: agile development, Open Source, pixolut, Software Development

Norton says ‘No’ to Nopey

Looks like the days of Nopey are numbered! As of Friday last week, Norton Anti Virus signatures classified Nopey as a malicious hacking tool and the default action was to quarantine it. No doubt other vendors will quickly follow suit.

In reality, Nopey is a system management tool which is invaluable in performing low-level operating system actions using high level shell tools. For example, we used to use Nopey in our NSIS scripts to kill running instances of an application or force a PC restart. I can see how it is extremely powerful - and as such potentially dangerous, but the question has to be asked; at what point is a utility classified as malicious? And why would the classification for a freely available tool change now?

We have used Nopey in various guises in production installers for over three years and only now has its classification been changed. Admittedly, we have not used this application in our broadly released commercial application installers (for precisely the reason it has been reclassified by Symantec) and instead use more specific tools for the job like the ones from the guys at Beyond Logic.

How much control do security vendors really have over our desktop? Maybe too much.

Filed under: Industry Opinion, Open Source, Software Development

Why does my application throw up UAC dialogs?

We recently launched the iTOK HelpDesk R3 for all the wonderful supporters of iTOK. The new application has an integrated mini-app which removed a lot of complexity of the old application by setting up the customer account on its first use. This little wizard is not a setup application, its just called helpdesksetup.exe and is invoked from the helpdesk.exe core application when it cannot get login details.

The release of the HelpDesk R3 was released at the same time as the release of Vista. We have performed testing with several of the Microsoft release candidates to ensure compatibility prior to its deployment, but it certainly was not the focus of our testing. The testing did all seem to go well, so we finally went live. Then something strange happened. On Vista, the first time the application was run would throw up a UAC dialog. This never happened on the release candidates we had tested on and I was shocked. There was no reason this executable should throw a UAC dialog – it didn’t need admin privlegdes!

After much brow beating and consternation I accidentally stumbled upon the answer. I was listening to the fabulous PodCast called Security Now by Steve Gibson and Leo Laporte and I heard about the kludge which is how UAC treats installers… it checks the executables filename to determine if it should throw up the UAC dialog before executing it – even without knowing what the installer does.

h-e-l-l-o

All of a sudden the pieces fell in to place. If I simply RENAME MY EXECUTABLE it will no longer bring up the UAC dialog. I’m sorry, but that is pretty lame for a uni undergrad project let alone a commercial operating system.

[UPDATE]

There was another article on this issue in The Register which sparked furious debate. There is a comment and trackback to this article in there. 

Filed under: Industry Opinion, Software Development

A Practical Exmaple of Multi-Threading

I will briefly describe the way we improved performance using multithreading below, but first – please understand I was actually pleased that DevX are willing to do the ‘Gauntlet’ series on Intel home turf (their dev center on DevX) so the subterfuge was really referring to the general theme of Intel advertising aimed at developers lately and not this specific series. Please keep binging it on!

One thing you should realize though is that I honestly don’t think huge numbers of organizations are looking to optimize their code for multi-core architectures just yet – however the big selling point for many organizations right now is the immediate ROI for organizations in power savings both in computational efficiency per watt and also in reduced cooling and associated infrastructure costs when moving to multi-core. Its real.

Ok, iVisual performance improvements: let me explain a very brief overview of how we segment the system from a data-model perspective to help understand how we break down the threading model.

1: We have Customers
2: Customers have multiple Locations
3: Locations have multiple Displays

The thing which takes the time is the render pipeline and is the focus of this examination. There are three stages to the render pipeline:
1: The first stage downloads XML feeds from 3rd party data sources and homogenizes the data into a database
2: The second stage composites the data on to the customer-location templates and downloads third party images referred to in the data feeds
3: The system packages each location in to a compressed package for distribution

When we started in a small scale proof of concept the whole thing was sequential and as it scaled it took hours. Multithreading was the answer, but it needed a clear strategy and this is how we broke it down:

First we looked at the stages of the render pipeline and examined the code to look for immediate code optimization (not necessarily multithreading, just common sense performance improvements). Now, I don’t have a heavyweight profiler but I was still able to analyze my code without fancy tools – the answer is in two things, use Windows perfmon to watch relationships between CPU, Disk, Network and Database when running strenuous code and secondly, just by using Log4Net (The Apache open source logging project) and taking a DateTime.Now before and after a block of code which you suspect of being ‘hot’ you can easily see performance metrics and you optimize the code.

Once the optimization was done we look at where we can see a use for multithreading. The first download stage was really quite linear and the process of downloading a large chunk of data was the thing which took the most time, so we left it alone.

The second stage clearly could do with multi-threading, but how should we split it out. First, we changed the way images get downloaded – we started caching them as we parsed each template; but we used a common directory for storing files. The image caching engine would go and download an image when it doesn’t have it – so it would block the caller until it came. The ad-hoc nature of the process meant that we should really rearchitect the whole approach.

If we sequentially pre-cached every image before rendering we would know we had every image, but due to the blocking nature of the web calls to retrieve images – it would still take forever. We put the process of downloading an image out to a thread – but don’t just loop through every image and run the process of downloading to a thread as this will saturate your network and CPU and OS and nobody will want to play nice with you anymore. We use an ‘artificial’ thread-pool – that is our own round-robin model pool of thread where we control how many are running at once. This means we needed some fault tolerance in case of thread collissions where multiple locations for the same customer use the same image and we happen to try and download it at the same time. Its highly improbable, but as an aside, this is a good example of the sheer complexity which multihtreading adds to system design.

We also chose to set the parameters for determining the size of the thread pool as an application configuration parameter which means we can tweak performance of the system without recompiling.

If you’re really clever you will see how we chose to handle our logical breakdown of the system to suit multithreading. We used Locations as the target for the main threading model – so instead of looping through a list of locations and calling Location(i).Render(); we create a group of worker classes which contain references to each Location object and when run will Render() their location. Again, we use the artificial thread-pool design to manage how many locations are being rendered concurrently. Because a location deals with its own content in its own directory structure, we didn’t have to worry about any thread contention or race issues with rendering.

Finally, the CPU intensive process of compression was also moved to a thread-pool model and again it improved performance dramatically.

The change to multiple thread-pools running meant we needed to have an orchestrator which managed the seperate thread pools and ensured that only one was running at once and that they could not be invoked multiple times (through the web administration interface) so we ended up with a ‘Render Pipeline’ which was the only way to invoke on these three elements for added safety.

The really funny thing is that the most CPU intensive part of the process, the compression stage, is the fastest now – we use a quad-xeon with HT setup and it makes short work of these things.

The place where mutithreading really came to shine is in allowing our code to improve the overall load across the system – not just raw CPU improvements. We improved our caching speed by 10 times because our network was able to handle 10 concurrent connections to the content servers for precaching images.

Multithreading also allowed us to push the database server a little more during the rendering process which is both CPU intensive and massively IO intensive.

Bottom line: Multi-threading on Multi-core SMP architectures allows your code to get more than just extra CPU cycles – you can squeeze more power out of your whole system by removing latency and unnecessary waiting.

Hope this helps shine some light on a practical implementation of threading.

Filed under: agile development, Software Development

Multithreading Propaganda

I subscribe to DevX and they have some really great articles every week. There is, however, a disturbing subterfuge of propaganda permeating the developer community originating from the CPU vendors. A paranoid kind of evolve or perish mandate for going multi-threaded. Now, I understand their desire to encourage the developer community to move in the direction of the hardware community and this is healthy, however I have a feeling that just like its consumer marketing message, Intel has blundered somewhat on extolling the virtues of multicore architectures. Have a read of the article abstracts below:


THE GAUNTLET
Because there are two sides to every story, we’ve got two points of view on parallel processing to get us started. Read these two articles and then join the discussion in our new “open fire” forum!
* Intel’s James Reinders: Think Parallel or Perish For multi-core processors like the Intel Core 2 Duo, hardware is only part of the performance story. To take full advantage of the new processors directly in applications, developers will likely “thread” their applications so they run in parallel and take advantage of the multiple cores. That can be a daunting task for developers, but Intel has just made it a lot easier. James Reinders explains his theory, while making a disturbing claim that software developers have to learn to think differently.

* DevX’s Michael Singer: Parallel or Paralyzed?
Moving to a multi-threaded and parallel processing world means applications will eventually have to be written in a different manner… eventually. But not today. And the notion of Symmetric Multiprocessing (SMP) is something that some developers and their employers are paralyzed over because they are not completely ready to spend the time and manpower to invest heavily in a parallel universe.

I went on to read the articles. Sadly, they both missed the point. Here’s the thing; a lot of developers really don’t need to worry about multithreading – not because of the kind of library being used or the threading model – because they shouldn’t. We need to remember the old truths that have come from previous generations of software development trying to keep pace with hardware development. Abstraction… Hardware abstraction. And generally, this abstraction occurs in the operating system. People really don’t bother writing code to suit specific graphics cards, they use hardware abstraction layers to do the fiddly work for them – developers are worried about what they should be worried about – writing code to solve the problem domain.

Now, this is not to say that developers should not be allowed to use threading and multi-cores when they can, but this is when multi-threading is actually the right tool for the job.

Threading for the sake of threading is frivolity – honestly, you will get better performance from a multi-core platform running single threaded code in the real world simply because all the other stuff the operating system is trying to do at the same time can be happening on more than one CPU at once. Generally, computers – Windows and Un*x based – are already inherently designed to scale with more cores since they have multiple processes running synchronously.

It is worthwhile noting that when multi-threading is the right tool for the job, it can provide unbelievable performance improvements. When we developed the iVisual rendering pipeline originally, we had 24 displays being rendered sequentially and it took about 6 hours to render them all on a beefy 1Ghz Pentium III server. When we moved it to the quad 3Ghz Xeon server its running on now the time only reduced to 4 hours. Once we changed the render pipeline to be optimized (used thread-pooling) and also have multi-threading strategies for the rendering, the render time is now under 1 hour for about fourty displays!

Filed under: Industry Opinion, Software Development

No Green Lights For You!

Argh, I am seeing nUnit in my sleep. No green bars for you! Only red! Nooooohooohohohoo! Ah well, nothing this complicated should be easy to debug. Did I mention iTOK is about to hit V6! I can’t go in to details suffice to say that its a whole new beast and it should be on the streets soon.

Filed under: agile development, Software Development

Quick and Dirty Command Line Processor in .Net

Whack these functions in your command line app and then to check if a flag is set use GetFlag(“flagname”) and to get the value of a setting use GetArg(“argname”) and the command line invocation would look like this:
MyCommand -flagname “-argname=hello world”

    Private Function GetArg(ByVal name As String) As String
        Dim args() As String = Environment.GetCommandLineArgs()
        Dim action As String = ”-” & name.ToLower() & ”=”
        For i As Integer = 0 To args.Length - 1
            If args(i).ToLower().StartsWith(action) Then
                Return args(i).Substring(action.Length)
            End If
        Next
        Return ”"
    End Function    Private Function GetFlag(ByVal name As String) As Boolean
        Dim args() As String = Environment.GetCommandLineArgs()
        Dim action As String = ”-” & name.ToLower()
        For i As Integer = 0 To args.Length - 1
            If args(i).ToLower().StartsWith(action) Then Return True
        Next
        Return False
    End Function
    

Filed under: Software Development

The impact of scripting capabilities to code

Its testament to the power of extensibility and community. I love how people start to grow their own way of doing things with your product when you can build in extensibility through scripting.

After looking at how powerful even the most simple scripting engine can be in the hands of users (iVisual 5.x has a template scripting language which extends HTML with a dynamic data injection and data manipulation language).

iVisual is a trivial example though – look at what Mozilla has done with a well cultivated plug-in developer base. That is one of the prime reasons people switch to the Mozilla platform is that the browser can do things which the plain-jane flavour of the platform cannot. UI and usability customization, synchronization capabilities, data manipulation and introspection are but a few uses of the plug-ins which are being developed and they are just fantastic. They just go to add value to the core product.

The thing which is interesting though is that there is a level of insulation between the scripting environment and the imlementation language and code on most of these ‘scriptable’ platforms. After doing some reading about Mustang (JDK 6), It seems that the JSR 223 binds scripting to the language very closely indeed. I wonder what the impact of such immediate and low level scripting will mean for adding powerful product extensibility features. And what will it mean for code reliability? Does this binding make it harder for developers to create a happy insular plug-in model or is it really aimed at something else? The question must be asked… Read more about JSR 223 here

Filed under: Open Source, Software Development

Timezone Insanity!

What was the Australian government thinking?  The daylight savings dates changed by a week for NO REASON! They said it was for the Commonwealth Games, but the Commonwealth Games had already finished on the last night of (normal) daylight savings…

This change in daylight times combined with the FLAW in the windows update service which did not correctly identify all computers affected by the change has disrupted multiple systems which we maintain.

Unfortunately due to this discrepancy, some of Pixolüt developed software has had issues which have had to be resolved.

1. Agents using iVisual have had service disruptions for the last 2 days as the time sensitive service authentication system failed once the client PC time was out from the server time by an hour. Version 5.2.9 adds increased tolerance to time differentials whilst maintaining reasonably strong security against replay attacks. The MonitorMosaic software has auto updated to the latest version on all clients and the issue is now closed.

2. iTOK users based in Australia have had time discrepancies booking support tickets and scheduling support requests as the time zone records in iTOKCore needed to be patched for the new time zone. This has been updated and the issue is now closed.

Filed under: Industry Opinion, Software Development

Amazing what damage a singleton can do…

whilst developing the render engine for the iVisual system, I came across a very interesting problem. I had modelled a cache which would store keys of all the properties in the system and then as each rendering thread (which represented a single PC with multiple displays) would work away it would ask the cache for the next property – the cache would then track which properties have been dished out for that customer. The cache was a singleton and designed using a true singleton pattern methodology for .Net…

I had memory usage problems and a abysmal startup time due to cache population (reconstructing 10,000 XML documents is sorta slow) – but funilly enough even thought the structure was completely memory bound it was slow – so I made the caches databound (just cache the keys and look up the rest using BizBlox as needed) which massively reduced memory usage and improved startup time – expecting the performance to drop further but performance was the same – slowish.

The architectural model had to change when we changed some of the fundamentals about rendering properties so that each location (PC with multiple displays) maintained its own cache. I was scared that these duplicate caches would blow out memory usage again and possibly slow down the server which was performing the render (we have hundreds of concurrent threads with thousands of properties – each property with hunders of attributes)

But the biggest suprise came when I ran the render pipeline with the refactored caches… baboom – the whole thing FLEW and the power of multithreading seemed to come alive (Its a dual Xeon with HT – so effectively a Quad CPU machine). Database usage flew up (to proper levels) and memory usage was stable – no blow outs – what happened? SINGLETON was causing indirect thread contention and the .Net VM had to queue requests for the cache between the threads since there was TRUELY only one instance of the cache class. Vavoom… Pipeline unclogged!

Want a nice little thread-pool pattern; try this:


Public Sub PoolWork()

Dim engines(8) As Thread

Dim ThingCollection as MyCollectionOfThings ‘Stub
ThingCollection.Populate() ‘Stub

For i As Integer = 0 To ThingCollection – 1
Dim assigned As Boolean = False
While Not assigned
For x As Integer = 0 To engines.Length – 1
If Not assigned Then
If engines(x) Is Nothing Then
Dim w As New ThingWorker(ThingCollection(i))
engines(x) = New Thread(AddressOf w.start)
engines(x).Start()
assigned = True
Else
If Not engines(x).IsAlive Then
Dim w As New ThingWorker(ThingCollection(i))
engines(x) = New Thread(AddressOf w.start)
engines(x).Start()
assigned = True
End If
End If
End If
Next
Thread.Sleep(10)
End While
Next

Dim finished As Boolean = False
While Not finished
finished = True
For i As Integer = 0 To engines.Length – 1
If Not engines(i) Is Nothing Then
If engines(i).IsAlive Then finished = False
End If
Next
Thread.Sleep(100)
End While
End Sub

Filed under: Software Development

Follow

Get every new post delivered to your Inbox.