Advanced Windows Debugging

I’m going to bundle some quick reminders for myself here…

I went over to Reiter’s Books today because I’ve been coveting a particular statistics textbook. I was tempted by a couple other books that were new to me, but for the price - and with the thought of the groaning shelves back home - I managed to fend off temptation.

Well, I got a second book anyway: Another book that I had noticed on a previous visit: “Advanced Windows Debugging”. I didn’t pick it up then because it’s very technical, and I wanted to research it first… I’ve been very frustrated with Microsoft Windows. The other day, I saw an article with screenshots of the next version. I don’t know about you - perhaps I’m concerned with different matters - but, I couldn’t care less about the design of the graphic user interface - I thought those could be altered quite easily. I care mainly about system internals. Why do I see so many books that instruct me on how to use an interface that hasn’t changed fundamentally in years? Likewise, I think I remember how to drive a car, but I don’t know much about fixing them.

Presidential Debates

Friday I went out to the bar to watch the presidental debate. Those Octoberfest beers will be gone before you know it, and somehow it feels like an American tradition to talk politics with strangers in a bar. More than that, it’s possibly one of the foundations of democracy. One couple next to me was voiciferous - or at least the woman was. I heard some good, insightful heckling from all corners of the room.

But as the debate wore on - did it have anything to do with the beer? - I started to lose the thread.

Posted in books, programming, politics | no comments | no trackbacksPosted by Evan Bittner Sun, 28 Sep 2008 00:46:00 GMT

Hurricane Ike

My parents’ electricity went out. Apparently there was a hurricane in Ohio?!?!

Yes, of course, it was Hurricane Ike. I have a new favorite storm tracking site: The University of Dundee’s StormPulse. At one point, I was warning my Texas friend that it would strike Brownsville. I guess we still haven’t quite cracked the problem of weather prediction. And, I guess that’s what makes it so fascinating to me.

Because my parents live in central Ohio, the storm passed to the west of them. They got all wind and no rain. If you look at a good surface chart, you can visualize cogs turning - Here in the Northern Hemisphere it’s Clockwise H and Counterclockwise L. In between a H/L pair, you know which direction wind is blowing. Over the United States, these patterns are all basically moving West to East, so you can usually reckon how the map will look in the next day or two.

I find the hurricane prediction tracks are very helpful in visualizing how the whole chart will evolve over the course of the next few days. The size of a High or a Low is related to the strength, with the bigger, stronger systems pushing the weaker ones out of the way. Warm ocean water produces and sustains the hurricane, giving it size and power to weigh in against neighboring systems. Over land they tend to wind down and get pushed around.

I wonder if there is any provision for training the models to account for their past performance. Neural networks or Genetic programming sound crazy, but the parameters of these software models are just an educated guess to begin with - wouldn’t it be nice to let the models discover their own strengths and adjust their own parameters? This is part of what I wanted to talk about yesterday: The best predictions from a supercomputer probably come form models we can’t rightly explain, where the machine adapts to match the patterns it encounters. We certainly have lots of training data now, with new predictions every few hours and all the actual environmental data collected at that predicted time.

Posted in programming | no comments | no trackbacksPosted by Evan Bittner Mon, 15 Sep 2008 20:07:00 GMT

Javascript Stumbling Blocks

Inline Functions - I never learned about these functions for scripting webpages. I didn’t even know how they fit into the syntax. They are a sufficiently advanced form that you won’t learn the technique by cribbing from amateurs, which is something I find myself doing a lot. Or, maybe I should say, when I did see them in unexplained code, there wasn’t enough context for me to learn what was happening.

Posted in programming, web-craft | no comments | no trackbacksPosted by Evan Bittner Fri, 12 Sep 2008 23:45:00 GMT

Why Would I Want To Script Photoshop?

There are a lot of ideas that I get very interested in, only to forget about thirty minutes later. But there are also plenty of ideas that seem useful before I have worked out how practical or impractical they will be.

Writing scripts for Photoshop is one of those things…

With so many things I wish I could do without an interface, evaluating and modifying digital images is not one of those things. That’s a sure candidate for graphical user interface. I can’t blindly apply most exposure changes or special effects without looking at the image. So on second thought, scripting doesn’t seem all that useful. And I’ve got to get good at Javascript to do it. (Of course, maybe I should get good with Javascript…)

The problem that I had still needs an effective solution: rotating the photos I take in “portrait” format by tilting the camera on its side. It wasn’t too long before I taught myself to always tilt the same direction…. But, I still have to inspect the photos to see which ones need to be rotated back. (Too bad the camera can’t sense gravity or something… but then what would it do when I took a picture straight down.) And, so I think I will take one step into the land of scripting, to do this thing that Actions should have been able to do.

So, I’m trying to come up with more reasons to write scripts, and the only thing I can think of is “data visualization”: Having a Javascript API to Photoshop is interesting if I’m already writing programs that handle a lot of data, and I wish I could produce a graphic. At first glance, it doesn’t seem very efficient, because automating the workflow in Photoshop would mean writing an exacting description of the things I can accomplish much more quickly within the program - and, I’m monitoring the process for quality assurance purposes, too. But, here’s where it gets interesting. Some of the tools take numerical inputs, typed in boxes. And I might write little programs to output the numbers I want in those boxes. But there’s this clumsy oaf the User (man, I hate that guy…) standing between the two. Now, there’s a case for scripting.

Posted in computer-interface, programming | no comments | no trackbacksPosted by Evan Bittner Thu, 11 Sep 2008 19:19:00 GMT

Scripting

I’m not sure why I never investigated it further… There are a lot of abandoned lines of reasoning in my workshop. I heard about scripting for Photoshop, and I looked and found actions. I was, to say the least, disappointed. I sensed that something was wrong - this couldn’t be what they meant. I tried to write actions to do what I wanted, and I swear I got them to act on every file in a selection, but now I can’t get it to work anymore.

Today I searched and brought up some tutorials on scripting for Photoshop. It turns out I’ve got PDFs on my disk explaining it all. That’s great. Do you have any idea why I haven’t read everything on my hard drive? I am suddenly overcome with the visual image of my answer on a single sheet of paper - in a huge pile of papers.

Well that’s not the half of it… My installation has the scripts written in Javascript. The same Javascript I’m supposed to know for designing web pages. Hmmm… Well, I think I know how it works, but think again: It’s the same basic problem I’ve had with every single computer programming language I have ever tried to learn. Maybe this will sound familiar to some of you: The syntax seems simple enough, there might be a few tricks I haven’t learned yet, but there is so much environment, so much namespace and library. That’s the part I don’t usually know. It happens every time I sit down to write a small Windows application, it happens every time I need to manipulate the DOM in a web page, and it happens every time I need to read or write a file with Ruby. I had actually been thinking a lot lately about how the computer languages aren’t languages at all: They’re just grammars without vocabularies. You can bring your own - Actually, you must bring your own, or if you like, you can be forced to use somebody else’s. The grammar is actually pretty simple.

Developers seem to have noticed this problem, and created their own mildly popular vocabularies that have been added to the menu of possibility. With some effort, you can sweeten a lot of languages with some syntactic sugar - I can think of a few good ways to do it in C. Which makes it a little hard to get started - there is not one way to do a thing, there’s dozens. Writing the code might be easier for those who have mastered some specific vocabulary of identifiers, but which vocabulary should I learn? Nobody can really say.

I’ve heard great things about Javascript. Some people would have you believe it’s the only language you will ever need to know. Some people think it is both an excellent teaching tool and a reliable production idiom. After all, it is build into every web browser, and getting your code interpreted doesn’t require you to install new software (you might not have permission). But I’m still upset. I downloaded a copy of JQuery the other day and took a look. I didn’t get it. I’m shaky on the syntax, and I have to learn a whole new vocabulary of identifiers!

Okay, I’m not really complaining. I’ll do it, eventually. Complaining tends to sharpen my mind, that’s all.

Posted in programming | no comments | no trackbacksPosted by Evan Bittner Tue, 09 Sep 2008 02:08:00 GMT

JQuery

I started looking at a tutorial for JQuery yesterday, and now I’m convinced that it will be a good framework for some of the site work I need to do at Olsson’s. I have a suite of backend database manipulation pages I have to write because I need to spare some people the anguish of using the MySQL-PHP interface - It’s far too complicated for the limited interaction I need these people to have. Who am I talking about? Oh, they’re casual data entry clerks who have other things to do with their time than listen to me yell at them for deleting a database table by mistake. That interface is great for the all-powerful wizard - I use it to try out a lot of database design - but, I need to set up a whole middle level of interaction, and that means writing a bunch of PHP pages behind the password wall, with only the SQL queries my code allows.

And with that middle level, I am tempted to provide a lot of user-friendly features. Good feedback for when changes are made, fancy date selectors, collapse and expanding page elements. So it’s a whole mess of Javascript, right?

Not so Fast… This is about the time I read about JQuery. It’s a whole mess of Javascript! AHEM. It’s a prepackaged library of Javascript with simpler document object handling and a dot-chained syntax not unlike Ruby. Okay, a lot of you didn’t know how significant that is, but the main thing to take away from all this is that I think I will be able to learn JQuery very fast since it shares a certain look with Ruby that I am already comfortable with. I had been dreading what I assumed would be reinvention of the wheel, but now I’m not.

Posted in web-craft, programming, olssons | no comments | no trackbacksPosted by Evan Bittner Thu, 04 Sep 2008 22:35:00 GMT

Prove You're A Human

(Or, More Letters Home From The Turing Wars)

Statement Of The Case…

Spread out over the last week or so, we’ve been getting a rash of robotic spam form submissions on the server at work. This is nothing new, but the volume suddenly got taken to “a whole ‘nother level”. Mostly overnight, there would be about 150 form submissions with every field crammed full of random text. Back when these submissions were the rare exception, I thought it was in a non-Western script - like Chinese - but, I didn’t really think that, because it didn’t look quite like that either. I’ve seen plenty of Chinese/Japanese, two-byte, escape-sequence switched inline garbage, and it isn’t this:

Date: Sun, 13 Jul 2008 11:02:07 -0400
Message-Id: <200807131502.m6DF27Jr011874@vux.bos.netsolhost.com>
Content-Type: text/html
From: zvykfe@uxfteu.com
To: olssons@olssons.com
Subject: Website Contact Form

Website Contact Form Results:

Formtype = Mail Order Request
sourcepage = /mailorder.htm
Name = lqycwtz
Street = PNxLwkcb
Street2 = irCjUSMQRkAnVSE
City = ouKfcjAgA
State = ZpJcBWKg
ZIP = VXvQpwIHsNsyJUP
Country = ZjpNTNseqWVIkCwyyCN
email = zvykfe@uxfteu.com
Phone = ICASVfjZHBIxHkqZs
Fax = bdcAxUHI
Product = CD
Title = aAjpwjbcLFB
artist_author = lqycwtz
Questions = pogWS3 ...

They came in all night long, several nights, at ten minute intervals, not always just one at at time. It was relentless. I had them cleaned out of my inbox in a couple of minutes, but there are several people who monitor that email account, so it inconveniences more that just me - and I get copies at home and at work. Oh, and lest I forget: After my last round of trouble with the script, I started sending them all to a log file for backup. Now if I’m not careful, there can be a megabyte of junk in there.

Usually I would just ‘grin and bear it’, but how could I pass up the opportunity to install a Captcha box on the forms and maybe learn something valuable in the process?

And Then We Get To The Crux Of The Matter…

It seems like it ought to be very easy, but it isn’t. I appear to be hobbled by no permission to install Perl modules. If I even knew where to put them, I don’t have command line access for that server (we’ve been over this _so_ many times). I’ve got working Perl scripts on the server, but they can’t do anything beyond core modules, or whatever other wonderful things are secretly installed. The action script on those forms is a Perl script, and I stuck the module in a couple likely directories, but no dice: Merely adding the library call causes a server error. So that library isn’t in the right place, or in the right form, or something. This is one of those times where it probably doesn’t even help me to know the right answer - it will turn out to be something I don’t have the permission for anyway.

So then there’s PHP. It gets a little weird when I think about all the trouble these people went to write sample code when that code is the least of my worries. With a good manual page on the interface, I can write all the code I need. But, I also have to be able to effect a lot of behind-the-scenes magic. Like installing Perl modules. Bear with me while I brainstorm…

The original page with the form has to call out to the mothership for a freshly created random captcha box. I’ll need a strategy for this: either rename and re-link to a PHP file instead, or build the form in an IFrame. Pages that were happily static suddenly need to be dynamic. Is PHP passing all my HTML files? Could I have always included PHP code in all my static pages without renaming them? My guess is “NO”, because it would slow down every static page, but then there ought to be a way for me to switch this on and off - I might change my mind some day… It’s a hundred times faster for me to experiment then it would be to have someone answer my question…

And the answer is “NO”. I know from fussing with Apache settings on this server that I don’t have access to that sort of thing at work. So I won’t have PHP preprocess all the HTML files anytime soon.

I think of PHP as a toy. That’s because I have Perl. But Perl in this case is like a nice set of precision tools - they’re just locked away in a cabinet so I can’t injure myself. The toy label is probably unfair, but it’s time to see what the toy can do. Immediately I have to build the PHP version of the form. After that, I have to rewrite the action script, since I know I can’t make one work in Perl anyway. Hmmm… I’m not sure that I’ll get to that today.

Hey… I know you can’t see it yet, but this Captcha version I found at Carnegie Mellon has a color scheme just like ours. And now that I actually stopped to read the thing, it appears that the challenge-response process give them data-points for improving their OCR system for automated book scanning. Only this morning I was reading the part in “The Future Of The Internet” where Zittrain talks about the creative ways people have used Captchas for distributed efforts at OCR - or, more ominously, outsourced Captcha response to click-workers in a sweatshop somewhere so that their spam can go through anyway.

Posted in programming, web-craft, olssons | 2 comments | no trackbacksPosted by Evan Bittner Sun, 13 Jul 2008 18:47:00 GMT

The Future Of The Internet

I’ve got my copy of Jonathan Zittrain’s “The Future Of The Internet - And How To Stop It”. I have only read the introduction and one short chapter, so I can’t really tell you what you almost certainly want to know: What IS that future, and Why is it BAD?

The short answer is probably “Lockdown”. Users could be less able to participate in the design. If you don’t design anything, then I guess it won’t matter to you, but I was thinking along the lines of something Joeysmom said about toys:

A lot of people are going to find out too late that they are no longer free to create the way they once were.

I started programming computers in the 4th grade. My elementary school had one Commodore PET. The year was 1980. Just as some people bemoan the death of reading (easy to do in the book business), I bemoan the death of programming. Yes, there is a level of professionalism that is required for sensitive systems, but I’m talking about a much lighter pursuit: Using common computer languages to solve the little problems that come up instead of buying some over-engineered software package. Most people don’t even know that their computers are programmable. Languages like Java or Perl or Ruby snap in to most operating systems quite nicely, and provide a framework for trying out your own solutions - What Zittrain calls the “Generative” aspect of computing. When you’re stuck with the prepackaged tools, I believe a learned helplessness sets in. With a dynamic and uncertain future, I don’t think we want people to have this quality - waiting around for someone else to come up with ideas. It’s not healthy.

I’ll let you know what I learn from reading the book.

Posted in programming, books | no comments | no trackbacksPosted by Evan Bittner Mon, 07 Jul 2008 14:56:00 GMT

Toward A Photoset Gestalt

I’ve been practicing my Ruby scripting.

Submitted for your approval is scatterpic, a scattering of 18 random photos from my directory.

I was planning to do something a little less random with placement, but this should do as a first approximation. I’ve got a few ideas for setting them down better. In the meantime, this is all you have for serendipitous photo discovery from my collection.

The other day I was looking at Andrew Bush’s “Vector Portraits” with envy. I was already thinking of a script for putting a random selection of my photos in a grid. Oddly, it’s hard to get the HTML to play nice. At least, it is for me.

I’ve almost given up on the grid idea as not interesting enough. My next idea was to have them scatter close to a curve. The HTML specifies the location of the upper right corner of each picture. Most of the pictures are 150x200, but not all. I also thought I was keeping to a naming convention: “…_sm.jpg” for the thumbnails.

Today’s browsing is courtest of Wired New York Forum, which I noticed on Kottke.

Some other ideas for improving my scatterpic script: colors of the backdrop.

A final note: I’m curious about the behavior of the random number generator. It seems to produce duplicate photos quite often. This will probably be less of a problem as I add more thumbnails to the server, but it made me think about a procedure for knocking out the photos from the pool as they are used…

I have an idea already: I can use the “slice!” method on the array of file names to remove it from the list after it is selected.

Crap! It didn’t work. My manual says that “slice!” returns the indexed element of the array and sets it to ‘nil’, instead of merely returning the element. But in practice, that code gave me no photos at all. I should check the HTML with that code, but it’s too late now, I already switched it back. And I’m back to seeing a lot of duplicated photos.

Posted in photos, programming, web-craft | no comments | no trackbacksPosted by Evan Bittner Thu, 26 Jun 2008 23:15:00 GMT

Refactoring

I read about this book and it looked so good, I placed an order for it: Martin Fowler’s “Refactoring: Improving the Design of Existing Code”. All of the examples are in Java, and I’m a C++ wannabe, but it’s not so different. It would be nice to get a better feel for Java anyway - I could be doing more with Processing, a prepack of libraries for Java that I installed years ago in hopes of writing some soothing visual animations for my computer screen.

I don’t write a lot of C++ code from scratch - but I’ve got access to millions of lines of open source code. As an amateur programmer, the task of browsing code from other people’s projects is daunting, to say the least.

“Refactoring” refers to a set of strategies for transforming the methods and attributes of objects in Object Oriented Programming. OOP offers us the opportunity to write lines of code that come close to the comment you might use to explain it. I must have heard this a hundred times before, but I’ve come to see how it actually works.

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”

One catch to writing in OOP is that it helps to put a lot of thought into the design - but you can never really know how the design will be used in the future. A lot of existing solutions are appropriated to solve new problems. Eventually, the strain builds up in the code: There is a temptation to perform cosmetic surgery on that code when it really needs a deeper redesign. This is where making sense to humans comes in handy.

In “Refactoring”, the book, Fowler has presented a catalog of named strategies. It can be convenient to rewrite an existing program to accomplish something new - or additional. But it is rare for any of these alterations to take into account the inner workings of the code, or to rely on the strengths of OOP.

The strategies can be as simple as ‘Replace Magic Number with Symbolic Constant’… If you’re poring through thousands of lines of code, you may not know the significance of ‘3.14’, let alone ‘6’. Can you tell me why ‘6’ is scattered around in the code? When I need to update this value, will I be able to find every instance where it is used? Find and replace isn’t going to be very helpful on ‘6’, is it?

Some of the more subtle strategies require some trade-offs. Should a method of a class be moved up the inheritance tree? Would the code be easier to understand at a glance with polymorphism - the ability to send the same message to objects in related classes without having to know which class? Sometimes you need to break things down, and add a lot of seemingly unnecessary classes - creating some confusion - because each class method can be a pithy statement of logic, delegating details to other classes. If it’s done well, your intuition can serve you: Objects are true to their names and behave as you might expect.

Posted in programming, books | no comments | no trackbacksPosted by Evan Bittner Wed, 25 Jun 2008 20:09:00 GMT

Older posts: 1 2 3 4 ... 6