Friday, September 28, 2007
Monday, September 24, 2007
Two years ago, I was in a logic course at WWU. The class was interesting, but some of the assigned online work was a bit repetitive. I did enjoy proving theorems, but filling out the truth tables was not exciting.
So, after some thinking, I quickly wrote a script called "logic.js" which can evaluate prepositional logic. I thought of how to do this from scratch (looking back on it there are probably better ways to do evaluate infix notation). For compound expressions, the idea was to use regex to find the innermost operation and evaluate it, replacing it with the result. Then this process would be repeated until there was only one value.
For fun, I wrote a similar program for a ProbStat course, at around the same time, for Set Diagrams. None of these are "finished" finished, but they work well enough.
For larger scale projects, XAML is pretty interesting too. I used it at work this summer.
Why I like it:
- Compilation step isn't a hindrance - it is fast and catches many mistakes.
- GUI designer is helpful but it's easy to code your own layout.
- .NET library comes with a lot.
- Sweet language features make it feel more flexible and fun than Java.
On the other hand, here are the reasons why I still believe .NET is not the answer:
- Not really portable to Linux. (Yes, Mono, but still).
- Requires a huge framework. There isn't a way to "static link" your programs. This means that Joe User might have to download lots of megabytes to even run your program, which I know I would be reluctant to do. And what if he is on dial-up?
- Memory management and performance - it's pretty good, but watch out for certain things (GC, deep inheritance, reflection, and UI drawing). It is sometimes hard for me to accept that: "My C# program looks and behaves the same as one written in C++. But it is slower and takes more memory." The only answer is developer time. Of course, I am glad that there are simpler languages like C#, and they have benefited me, but this tradeoff is probably partially responsible for today's software bloat.
Thursday, September 20, 2007
Wednesday, September 19, 2007
Read the "tips." There will be some handy keyboard shortcuts. (Did you know you can hold down Control to select many taskbar items? Also, when confirming file actions, Shift+No will mean "No to All."
Under Internet Explorer, you can set the loading-page animation, which I used to great effect. (When I use IE, now I have a running Mario icon when a page loads). I also changed a registry setting so that "Internet Explorer, brought to you by Mario" is in the title of each window.
Finally, under Templates you can edit the entries in the Windows "New file" menu. (This is under the file extension in HKEY_CLASSES_ROOT). I added a "Rich Text Document RTF" entry by pointing to a new .rtf file on my hard drive. Wordpad can be a good lightweight editor if you want simple formatted text. (And, you can use Paste Special/Unformatted to strip formatting). So I always associate .rtf files with Wordpad.
No, rtfm is not a manual in rtf format. It means something else.
Saturday, September 8, 2007
First, I made a grayscale image of my face. I wrote a little Python script using the Python Imaging Library to make a list of all pixel coordinates that were white. I then wrote an AutoIt script to simulate mouse-clicks at all of those screen locations (hacktastic).
Not perfect, but still visible.
AutoIt is a pretty cool program for Windows automation. It can simulate keyboard and mouse events.
The actual reason I did this is that I wanted to learn about image processing in Python. It's usually not trivial in most languages / libraries to get pixel access of a PNG image, but PIL seems to do well. Stay tuned for my upcoming ultimate Image Processing lab.