Saorrento

Tag: C#

my own little corner of self worth on the web

by admin on Aug.16, 2010, under Personal

Isn’t this what blogging is all about? At the end of the day what do social network sites, blogs and YouTube video posts bring to us? If ’self worth’ isn’t at the very top of your list than you are only kidding yourself. There should be no denial in admitting it. After all, for you bloggers, that is the number one drive in posting a article in the first place.. and for the social net workers out there; the behavioral pattern associated with you logging in 5 times in the space of an hour to see who commented on your photos or status, if that is not a pursuit of self worth than I don’t know what is.

Now I am not saying that is a bad thing, it is ’somewhat’ important for you to care about what other people think of you - but also important enough that when the going gets tough that you value you yourself high enough to carry yourself through the lows. Perhaps in someway the introduction of the Internet especially for GenY has also created a new outlet of vanity, and the desire to be noticed?

With all that said, it is time for me to boast about my own happiness and creative spurts of late, the creations I value that attribute to my own self worth.

The first of which, is an idea that has taken me by storm - the development of a touch-screen navigated home automation system. The initial intention being, a tablet that easily allows you to control music that is played through various areas of the house, with each applicable room having ceiling mounted speakers.

You simply touch the room in the house you want to toggle, select from a playlist or album and play the music. Further music navigation allows you to select tracks, adjust the volume and control music in multiple rooms from one device.

The original scope of this project has then continued to expand; most recently I have added a local 4 day weather forecast service to the application, and have further intentions to Sync Microsoft Outlook Calendar events to it for alarms and warnings.

The application is intended to be very Microsoft friendly; the play lists that the application uses and creates are compliant with Windows Media Player 12.


This is the initial display screen, simply choose a quadrant of the house to toggle music settings. In addition the current time and weather report is given. Clicking on the weather will display the four day forecast. Clicking on the time will display a calendar/organiser displaying events.


Close up preview of the Four Day Weather Forecast using XML data provided by the Bureau of Meteorology of Australia (www.bom.gov.au)


The playlists and albums contain the MP3 Info Tag data, including Album covers for convenience.

Overall the challenges with this application have been making the interaction compatible with touch devices. In the instance of the scroll bar arrows, mouse down events were required for response to a finger being pressed and held on the touch screen. In addition the overall display had to be colorful and pleasing to the eye; the MP3 Album Cover artwork has been utilized for the carousel of albums to achieve this.

The project is still under development, with the Calendar organizer yet to be implemented along with the deployment method of playing sound to various rooms from one device which prompts the yet unanswered question of, can I use a single PC with multiple sound cards to achieve the result or should I look into WCF extensions and communicate directly with individual computer nodes in each zone, or are Windows 7 stereo devices a alternative? We shall see…

That’s enough of the geek for a moment, and on a completely unrelated topic, my girlfriend’s birthday was last Friday, and this of course meant that after last years successful Garfield and Odie cake, I felt somewhat compelled to create Michelle a birthday cake for this year too. With this in mind and wanting to challenge myself with new boundaries pushed I decided upon creating a 3D cake.

Similar to last year’s birthday cake, this years was also preceded by a test case ‘Bob-omb‘ from the Nintendo gaming universe. I declared the cake itself an epic fail, but learnt enough that I was confident to do the birthday cake justice. And thankfully, I was right, may I present King Boo (also from the Nintendo gaming universe)

Happy Birthday Michelle! x


8 Cake mixes used in total, the cake of choice being Butter Cake, with butter frosting.


It was at this point I started to relax, the cake was coming together nicely.


I turned away from using icing pens on King Boo as opposed to the Garfield cakes last year. The reason being unless you have the steady hands of a surgeon you will not achieve the smooth result you set out for. Instead this time I created lines and shapes using thick icing. With a bowl of icing sugar, simply add a few teaspoons of water and color to suit and mix the icing together with your hands. Where necessary add in more icing sugar or water to achieve the right constancy similar to as if you were making scone dough, except instead of adding flour add icing sugar. Once the icing is holding well (it should be like playdough) roll out or mold the shapes as required on baking paper and set in either the fridge or freezer.

This is how I achieved the eyes, eyebrows, teeth and crown for King Boo.


A tip with the frosting, ensure the butter is at fridge temperature, not room, it may make it harder on the beaters at this temperature but a hell of a lot easier to apply to the cake!


The end result, crown and all at the Broken Hill Pub

Leave a Comment :, , , more...

Visual Basic is the equivalent to Duplo in the Lego world.

by admin on Apr.30, 2010, under Personal, Philosophy, Soft-Dev

I feel privileged in the fact that I have a job that I both love and loath and challenges me on a daily basis. Metaphorically, I wear so many various hats throughout the day I would warrant my own hat stand. I am a marketing designer, project manager and first and foremost a software engineer, who spends better parts of the day inventing engineering feats that often come to mind during my morning slumber through peak hour traffic each day to work. Today was no different.

If I was to sacrifice all dignety that the title Software Engineer brings by using high-level development suites such as Visual Basic than this post wouldn’t exist, and the problems that I am challenged with on a daily basis would only be momentarily trivial, solved within moments with a frolic on Google. My daily work takes me to the depths of the Windows world, the world of the Win32 API using C/C++, a world that is now shrouded by fancy Frameworks and Foundation Classes.

Where Google may provide solutions a plenty for higher level programming delemas, when it comes to Win32 API in C, even the Microsoft MSDN library becomes vague with suggestions, and the majority of reliable documentation comes from software development books published back in 1995.

This does more often than not lead to frustration, and in fact is responsible for my embrace of the C# language; the simplicity of Visual Basic, but so much more powerful and integral than its Visual counterpart. No matter how voluptuous C# may seem at times, in a Software security sense, it doesn’t stand a chance against C, which is why no matter how tough times may seem, I power on in my dimly lit world.

When things go right, it is just as Hugh Jackman portrayed in Swordfish, and no, I am not referring to the scene where a hot blonde was going down on him whilst he was attempting to hack into the Military of Defense systems, rather the adrenaline rush you experience discovering you have solved a day or two long problem, doing a little victory dance to the beat of the music playing in the background and toasting your brilliance with a glass of wine or in my case tonight, Jack Daniels.

My day ended with the epifany: It is such hard work getting fancy results from a C application… I feel like I work in the boiler room of some steam ship, covered in Microsoft legacy crap, when all the squeaky framework apps like C# sit in first class with their tea and bickie!

To which a friend queried ‘Then where does Visual Basic stand?

A smug grin formed across my face as I replied ‘in the form of the large duplo lego bricks that toddlers play with.’

Leave a Comment :, more...

Thought of the day:

by admin on Apr.30, 2010, under Soft-Dev

It is such hard work getting fancy results from a C application… I feel like I work in the boiler room of some steam ship, covered in Microsoft legacy crap, when all the squeaky framework apps like C# and C++ sit in first class with their tea and bickie!

Programming is 10% science, 20% ingenuity, and 70% getting the ingenuity to work with the science.

Leave a Comment :, more...

Filetype association in C#

by admin on Dec.10, 2009, under Soft-Dev

By night I keep myself occupied with travelling, seeing concerts or even sitting back with a bottle of Jacks philosophically reflecting on life. By day I am a software engineer, working for a R&D company developing software for driving rotary and laser engravers. I specialize in a wide variety of programming languages from the depths of the Windows API in C and C++ to the I don’t want to cause self harm way of C-Sharp (those who are familiar with both these lower and upper levels of programming will understand).

With each day innovatively programming and pushing through new barriers in my own programming experience, I like many others turn to the net in times of need, websites of the likes of msdn.microsoft.com/forums, codeproject.com and for more general terms Google.

Although some online research can easily span a great many hours, and possibly the occasional plea on a MSDN forum I feel compelled to give something back to the community, so Google bots, if you’re out there, please link this, it could save a great many people out there who want to ‘Associate filetypes programmatically for Windows 7, Vista and XP’. I couldn’t believe how difficult it was to find relevant information regarding this on the net, solutions not shrouded by DLLs, just a basic run of the mill C# solution that does what it says on the box. So here it goes:

This came about for the need to automatically associate files of a particular type in an installer I was developing for a software product. Here is the snippet related specifically to associating a filetype of your choosing.

private const int HWND_BROADCAST = 0xffff;
private const int WM_WININICHANGE = 0×001a, WM_SETTINGCHANGE = WM_WININICHANGE, INI_INTL = 1;

[DllImport("user32.dll")]
private static extern int SendMessage(int hWnd, uint wMsg, uint wParam, uint lParam);

public void CreateExtension(string ExtensionType)
{

string AppType = ExtensionType + "_auto_file"; // ie abc_auto_file
string FileName = "cipher2.exe";

string InstallPath = @"C:\Program Files\Cipher Technology\symmetry\";
string InstallString = InstallPath + FileName;

Registry.ClassesRoot.CreateSubKey("."+ExtensionType).SetValue("",AppType);

Registry.CurrentUser.CreateSubKey(@"Software\Classes\."+ExtensionType).SetValue("",AppType);

Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\."+ExtensionType).SetValue("",AppType);
Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\."+ExtensionType+@"\OpenWithList").SetValue("a",FileName);
Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\."+ExtensionType+@"\OpenWithList").SetValue("MRUList","a");
Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\." + ExtensionType + @"\OpenWithProgids").SetValue(AppType, new byte[] { 0 }, RegistryValueKind.Binary);

Registry.ClassesRoot.CreateSubKey(AppType+@"\shell\open\command").SetValue("","\""+InstallString+"\" \"%1\"");
Registry.ClassesRoot.CreateSubKey(AppType+@"\shell\open\command").SetValue("(Default)","\""+InstallString+"\",\"%1\"");
Registry.ClassesRoot.CreateSubKey(AppType+@"\shell\open\command").SetValue("InstallPath",InstallPath);

Registry.CurrentUser.CreateSubKey(@"Software\Classes\"+AppType+@"\shell\open\command").SetValue("","\""+InstallString+"\" \"%1\"");
Registry.CurrentUser.CreateSubKey(@"Software\Classes\"+AppType+@"\shell\open\command").SetValue("(Default)","\""+InstallString+"\",\"%1\"");
Registry.CurrentUser.CreateSubKey(@"Software\Classes\"+AppType+@"\shell\open\command").SetValue("InstallPath",InstallPath);

string UsersPath = "";
string[] arinfo = new string[4];
string PathExt = "";
arinfo = Registry.Users.GetSubKeyNames(); // Get a list of all Sub Key Names in HKEY_USERS
for (int keyid = 0; keyid <= arinfo.Length; keyid++) // For each key
{

if (arinfo[keyid].Length > 12) // If the Key Name is over 12 Characters long
{
              PathExt = arinfo[keyid].Substring(arinfo[keyid].Length - 12, 12); // Get the last 12 characters of the SubKey Name
              if (string.Compare(PathExt, "1000_Classes") == 0) // Does it end in 1000_Classes?
              {
                          UsersPath = arinfo[keyid]; // This subkey is the key we’re looking for
                          break; // exit loop
              }
}
    

}
if (UsersPath.Length > 0) // If we have a valid SubKey name, do the create the following Keys
{
              Registry.Users.CreateSubKey(UsersPath+@"\."+ExtensionType).SetValue("",AppType);
              Registry.Users.CreateSubKey(UsersPath+@"\."+ExtensionType+@"\shell\open\command").SetValue("","\""+InstallString+"\" \"%1\"");
              Registry.Users.CreateSubKey(UsersPath+@"\."+ExtensionType+@"\shell\open\command").SetValue("(Default)","\""+InstallString+"\",\"%1\"");
              Registry.Users.CreateSubKey(UsersPath+@"\."+ExtensionType+@"\shell\open\command").SetValue("InstallPath",InstallPath);
}

UsersPath = "";
arinfo = new string[4];
PathExt = "";
arinfo = Registry.Users.GetSubKeyNames(); // Get a list of all Sub Key Names in HKEY_USERS
for (int keyid = 0; keyid <= arinfo.Length; keyid++) // For each key
{

if (arinfo[keyid].Length > 4) // If the Key Name is over 4 Characters long
{
              PathExt = arinfo[keyid].Substring(arinfo[keyid].Length - 4, 4); // Get the last 4 characters of the SubKey Name
              if (string.Compare(PathExt, "1000") == 0) // Does it end in 1000?
              {
                          UsersPath = arinfo[keyid]; // This subkey is the key we’re looking for
                          break; // exit loop
              }
}
    

}
if (UsersPath.Length > 0) // If we have a valid SubKey name, do the create the following Keys
{
              Registry.Users.CreateSubKey(UsersPath+@"\Software\Classes\."+ExtensionType).SetValue("",AppType);
              Registry.Users.CreateSubKey(UsersPath+@"\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\."+ExtensionType+@"\OpenWithList").SetValue("a",FileName);
              Registry.Users.CreateSubKey(UsersPath+@"\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\."+ExtensionType+@"\OpenWithList").SetValue("MRUList","a");
              Registry.Users.CreateSubKey(UsersPath + @"\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\." + ExtensionType + @"\OpenWithProgids").SetValue(AppType, new byte[] { 0 },                             RegistryValueKind.Binary);
              Registry.Users.CreateSubKey(UsersPath+@"\Software\Classes\."+ExtensionType+@"\shell\open\command").SetValue("","\""+InstallString+"\" \"%1\"");
              Registry.Users.CreateSubKey(UsersPath+@"\Software\Classes\."+ExtensionType+@"\shell\open\command").SetValue("(Default)","\""+InstallString+"\",\"%1\"");
              Registry.Users.CreateSubKey(UsersPath+@"\Software\Classes\."+ExtensionType+@"\shell\open\command").SetValue("InstallPath",InstallPath);
}

// Refresh Registry
SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, INI_INTL); // Force Windows to Re-Load the Registry

}

1 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!


Saorrento Stats