Thursday, 23 May 2013

Writing a Windows Gadget is hard!

Windows Gadgets suck ... Microsoft has recently discontinued support for Windows Gadgets - in favour of Apps. So any Gadgets fans/freaks out there who might enjoy the challenge of writing a gadget ... like myself ... are out in the cold when it comes to sharing gadgets, or hoping for support on some Sidebar issues ...

Well, it's not like they dismantled Windows Sidebar in Windows 7 ... but it looks like there is no gadget support in Windows 8 ... which kind of sucks because gadgets filled the instinctive need of many computer users to clutter up their desktop with cool techno-looking bars and charts and dials and switches etc...


So, Microsoft, in their infinite wisdom, decided to integrate most of the popular gadget functionality into the actual OS, instead of these little unrelated boxes floating around causing havoc with system resources...

Well, disregarding everything I just wrote ... I decided to write my own gadget - it's still a work in progress, so don't laugh too hard... but I started by studying the gadget format - not too tough to master, basically a folder structure with some XML defining the main files...

Then there is the gadget syntax - specialized html tags to identify elements of the gadget .. not too bad...
Then there is the compulsory JavaScript - luckily I was already learning that... so not too bad there...

Then there is the docking functionality... let me start by telling you that all the examples on the internet have one or other subtle flaw which my SideBar doesn't like ... while debugging the docking code I suddenly "lost" my gadget and it would not appear in the SideBar anymore .. well, ok, I mistyped something - but it's still frustrating to not have anything to debug with besides the tools which come with Chrome ... Oh, and did I mention that gadgets rely on the ActiveX components built into Explorer?

That means that you can debug MOST of your gadget and Javascript code using Chrome ... but for all those Microsoft-specific things there is no actual way to DEBUG a gadget using Internet Explorer ... which is a shame because I rather enjoy playing with my TODOList gadget ... it's very simple, right now it can be docked - which shows a smaller list or undocked - which shows the same list in a larger view ...  fun times :-)
My main plan is to refine the todo list to the point where I enjoy using it - and it will be my default app, since I am a programmer and my mind is inordinately full and prone to dropping details after all these years of juggling crazy amounts of things around in short term memory - plus there are a lot of distractions all around me, since I am the only programmer IN THE COMPANY... which is kind of awesome, The Lone Coder lol!

Once the gadget has been refined to my liking, I would like to use it as a base for a gadget game I would like to write ... something like the old NES Star Force ... which is another mission on its own - but well worth the fun...

So, gadgets suck, but the joy they bring definitely makes it worth the time and effort that goes into creating one...

Building web apps with Python

Well, as much as coding sucks, I love it -so much in fact, that I spend an inordinate amount of time doing crazy things using the incorrect tools for the job at hand - just for the kick of getting it to work!

Well, recently, I have been prone to the urge to use different languages to augment my website - for those of you who don't know, I am a software developer, who does web development in his spare time... Actually, my new job involves copious amounts of web development - but that is another story.

Well, my current occupation allows me to do web development, and throw in "hardcore" programming languages into the mix - just for fun.

So, one day I decided that our company intranet needed a way of sharing files - not a Samba share (Shared folder on Windows), not an FTP server - because FTP causes too much back and forth network traffic.... and certainly not using anything "standard" like PHP or JavaScript!

No, I opted to use Python... So, I set up Apache, and got cracking ... mind you, it was not as simple as I thought it would be, but as it turns out, Python is quite capable of this task- with relatively little code ... It's quite simple, you edit your httpd.conf file to include python files to run as cgi scripts, which can then run in any folder... then you get cracking writing your python script...

Of course, you would need a fixed IP for the server to be of any use, but it is rewarding enough to crank up your browser and see a web page that your Python code spat out...

 I have included a screenshot of the web app running - along with the tools which were created with it:

*note that the image was doctored slightly to remove company information ... but the layout and look and feel are 100% correct. The left side shows the home page which lists all the services this app provides, and the right page is the "download" service running in my chrome browser window.

Well, let me tell you that Python is quite a dream for writing web apps - especially to a C/C++ programmer who is used to banging out 1-3000 lines of code before morning coffee... This entire web app, with all associated services comes in at under 3000 lines of code - without refactoring to remove common code!

Anyone interested in building web apps with Python should be aware that there are numerous security risks which Python is addressing as I type this. In the near future we might see python becoming the dominant web 2.0 language of choice for building awesome web apps.

Have fun ... my next project is to write a Windows Gadget Game using JavaScript and some clever DOM tricks I picked up along the way...

Wednesday, 22 May 2013

Coding Sucks ... I Love It!

Well, I have been coding since 2002 ... not too long, yes, but in that time empires have risen and fallen, billions of lines of code have been written, and I have learned one thing:

Coding Sucks ... I Love It!

Seriously, I can't get enough of it... I have written projects in Java, Python, C, C++, PASCAL, assembly (win32) ... most recently JavaScript ... each language (or scripting language) has it's dizzying highs and abysmal lows, but one thing is consistent:

They all suck

Yes, that is a cruel statement, but let's face it - all languages suck in one way or the other, templates in C++, no-classes in C, the ease with which Python allows you to destroy your project ... the inane simplicity of PASCAL (and lack of true graphics support + hardware accel.) ... There are pitfalls to any language - and yet I have coded in many of them, for one simple reason....

The feeling of triumph when I accomplish a milestone...

Or better yet - that feeling of relief when I complete a project.

So, I might rant, and I might rave, but I have been coding for a long time - several of those years was as a Senior Developer at a software production firm, and I loved every second of the code - not the politics...

I am a programmer, and this is my blog.