Sunday, February 21, 2010

Quiz program updates

I've added some new functionality to the japanese quiz program.

1. New history items are added to the top of the history list, not the bottom.
2. Chapter 3 vocabulary.
3. Minor improvements to the graphical layout (centering, sizing).
4. Corrected spelling error ("inorrect").
5. Added JQuery dialog on last quiz option that shows missed items and resets using only the missed items (last option only right now).

Todo:

  • Add the ability to dynamically add and remove words/questions.
  • Get the checkbox/tag filtering system working
  • Add freehand drawing as an answer style. Allow it to be manually graded.
  • Double check that the JQuery dialog works on a phone. 
  • Add the JQuery dialog to all options.

The freehand drawing is going to require another javascript library. I've been poking at processingjs a bit, and it looks like the way to go, unless I wish to tie myself to Flash or Silverlight, and I don't.

Telling IIS to serve up a file as a download

I created a virtual directory in IIS.
I put the file that I wanted others to download in it. In this case an *.apk file.
I turned on directory browsing.
I clicked on the file and got a 404 error.

I added the mime type *.apk, application\android to Mime-types in IIS.
I clicked on the file and it downloaded.

Week 8: Hello Android World

I wrote my first android program. It pops up a window that alerts you every time the gps coords of the device change. Okay, this isn't particularly impressive, especially since I copied the bulk of the code from this link. However, getting eclipse installed and the android environment working was a chore.
  • Download Eclipse
  • Download the Android SDK
  • Tell Eclipse where to find the android downloads
  • Tell eclipse about what Android Virtual Device you wish to use.
  • Figure out how to do anything in Eclipse.
  • Wait patiently for the Virtual Device to boot up. 
Getting the application signed for the first time was also a bit of a chore. It requires running two command line tools jarsigner and keytool. Keytool is used to create a keystore that contains the private key which is used by jarsigner to sign the application. After the first time though, the eclipse environment recognized the keystore and I did not have to repeat most of the steps. Once the application was built, copying it to my phone and installing and running it was easy. I had installed Astro File Manager and just clicked on the built file. It then prompted me to install it and then it ran it. Quite smooth.

The compiled application is located here.

Tuesday, February 9, 2010

Calling powershell from MSBuild

I don't understand MSBuild. I'd rather use a versatile language like powershell to do my work rather than a narrow xml-based language, that is unwieldy and non-transferable knowledge. Once you know MSBuild... well you just know MSBuild. Powershell can be used nearly anywhere.

This link shows how to do it:
http://blog.brianhartsock.com/2009/10/20/using-powershell-scripts-from-msbuild-scheduled-tasks-etc/

Week 7: Japanese Quiz Program

Currently it is here: http://www.ogresoft.com:83/MVC/HTML/Japanese111-1.htm.

There is no webservice - ajax stuff in here, the program, other than script includes, is self-contained. Of course, I used JQuery extensively. It was interesting to observer that most of the file is javascript, followed by css, and very little html.

From here, I need to add voice options: first converting the stock *.wav files into several *.mp3 files. The two *.mp3 files that I use for success and failure were converted from *.wav files using Sound Converter 1.4.4 in Ubuntu Linux. I made a few feeble attempts to download a useful freeware windows tool to do the conversion, but that didn't work. +1 linux; -1 Windows.

I made the viewable quiz area such that it would fit well on a cell-phone browser screen (landscape mode).

If I can get these programs to run well in a cell-phone browser, is there much use in creating cell-phone OS specific applications that do exactly the same thing, but in only a slightly more fluid manner? Probably not.

Week 6: Powershell Daemon

This is a program that runs a powershell script. It will put a notify icon in the task bar while the script is running. If you run a powershell script with a continuous loop in it, in order to monitor something, like the event log, this will do that without cluttering up the desktop with these "daemon" scripts. It clutters up the taskbar icons instead.

Some technical notes:

Get the powershell assembly reference from here: C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0

Instructions on how to run powershell from C# here: http://www.codeproject.com/KB/cs/HowToRunPowerShell.aspx

How to put a NotifyIcon in Wpf: http://www.codeproject.com/KB/WPF/wpf_notifyicon.aspx

The appropriate way to deploy this program is with ClickOnce. However, I was unable to get ClickOnce operational with this program (VS 2010). There were some cryptic notes on what could be going wrong, but the correct course of action for a lazy person, such as myself, is to wait for the next version of visual studio to come out and hope that they fix it.

Once that happens there is still something to do: Associate the *.daemon extension with this program so that double clicking a *.daemon script will launch it. This bit is simple enough to do using the registry, but I'm going to wait for the click once stuff to get straightened out before I waste time on installers.

Sunday, January 31, 2010

Week 5: Internet Stratego

There was a bit more of a leap between tic-tac-toe and stratego than I anticipated. I'm tired. I coded furiously, knowing that I had probably overpromised myself in choosing the project for this week. I could feel myself slowing down as the effort began to wear me down.

I typically don't go for mental marathons. I can feel my mind get tired and become less effective. I believe that everyone's mind does, but that most others who brag about their long hours are either in denial or can't judge the difference in their own work between when they are tired and when they are at their peak.

I'm lazy, you see. I don't want to waste more time than I have to on any particular task. My silly endeavor, 52 weeks of coding, has two purposes. One, to do in coding what is analogous to a long line in fishing. To bait the waters of business with 52 distinct pieces of possibility, and see which, if any, of them get bites. And two, to perfect the art of efficient coding. I want to get these projects done fast. I want to reduce, as much as possible, the time between when I have an idea, and the time when it is tangible enough to show to other people.

So marathon coding represents room for improvement. Next time, I will do it faster.

But lets go over some of the other things that I learned this week:

JQueryUI

This is where I got the drag and drop functionality. Very nifty, very concise.

Firebug

OK, I already knew about firebug, but the Console and the Debugger made this week possible. Yeah, they're that cool.

JQuery attribute selectors.

delete arrayName[elementIndex];

$('someselector').droppable('destroy')