Archive for the 'How To' Category

Aurora Feint: Recovered

Friday, August 1st, 2008

Aurora Feint won’t start.

I’ve been playing Aurora Feint on the iPhone, and all of the sudden, it quit working. The game, not the phone. I’d go to start it, and then get returned to the main menu. Seems other people were having a similar problem. Some were lucky to get the game working again, others lost data.

Here’s how I recovered mine, preserving game play. Your mileage may vary.

0. Back up your iPhones by syncing it with iTunes.
1. Hold down the Aurora Feint button until the icons jiggle.
2. Press the (X) delete button over the Aurora Feint icon.
3. Acknowledge that you’re deleting the game and that all game files may be lost.
4. Hold down the power button on the phone, slide to Power Off.
5. Power phone back on.
6. Immediately go into App Store, select Search, enter Aurora Feint, and Install.
7. Acknowledge dialog that you already purchased this item and want to install again.
8. Let the game download and install.
9. Again, hold down the power button on the phone, slide to Power Off.
10. Power phone back on. For me the phone went through a very long boot cycle with the Apple logo.
11. Press the Aurora Feint icon to start the game.
12. For me, the screen went blank and stayed there — tap the center of the screen, movie controls appeared.
13. Unpause movie intro and let play to completion.
14. After a moment, I was returned to the map.

I’ve found that I always have the best of luck restoring the game when I’m at the map. Exiting while at the character page or in the middle of a mining activity does work, but not always; this causes the game to be fussy and exit prematurely to the main screen after start (unless you can intercept with a tap in the upper right corner).

Good luck.

Hibernate Schema Update Problems

Saturday, July 5th, 2008

I’ve been using Hibernate for relational persistence for a while now, and I have to say it’s been working out pretty well.

That was, until I went to do a SchemaUpdate.

The moment I did an alternation of a table, or created a new entity, things went sour, and I was unable to read my old data. Was it me, or was it Hibernate?

could not initialize a collection
PSQLException: ERROR: permission denied for relation newtablejustadded

It was me.

Turns out Hibernate’s update was working just fine. There was no magic versioning or class hashing going on, detecting the change to the database.

The problem was the ACL was blank for the newly created entity table (I was using Postgres).

By issuing this command, all was fine again:

GRANT INSERT, SELECT, UPDATE, DELETE, REFERENCES ON newtable TO GROUP agroupIwasusing;

Since it took a while to figure out what was going on, I thought I’d post this to help others that follow a similar, yet frustrating, path.

Macbook Pro Screen Goes Dark on Wakeup

Friday, June 13th, 2008

Today I learned that there’s a nifty little utility called Maintenance 3.8 out on Apple’s site. You can find it by going to Apple / Mac OS X Software…, and when the web page pops up, type Maintenance in the search box.

It’s an automator script to repair permissions, verify preferences, updating prebindings, do cleanup, update databased, rebuild indexes, empty Trash, and so forth. My guess is it’s much like Onyx.

Deciding to give it a try, I downloaded it, opened the .DMG file, and double clicked the automator icon, selecting Restart when done. And while I got a very little in the confirmation department that things were working, I saw a lot of CPU activity running utilities I was familiar with.

So, with the laptop plugged in, I left to to chug away. I heard the restart sound several minutes later. And, I ignored it.

Later, I picked up my laptop and went to login.

Nothing.

The “breathing LED” on the front was off, and nothing was responding keyboard or mouse wise. The screen was black.

So, I decided to check the battery. Full power.

But then I noticed something. At the steep angle, in the near pitch black of my LCD screen, I saw the login window. What was happening: the backlight wasn’t coming on. Fiddling with the brightness control didn’t help either.

Sure enough, I could make out the cursor once I located where it was.

I tried opening and closing the lid. Nope. Backlight still off.

So, I restarted (as I mentioned, it was operational, I could barely make out the GUI).

The machine sprang to life, showed me the blue background, and right before it went to the login screen, the backlight cut out again, leaving me in pitch black.

Titling the screen back again (with the keyboard sticking up in the air and the screen flat on the table), again I could make out the login box and mouse. I did a restart again.

This time I held down Command-V as it booted. And I watched as it came up, lots of normal diagnostic messages, and then the blue background, and right as the login screen appeared, back to pitch black.

Annoying. But now I’m wondering if all the times I’ve ever woken my laptop after a case where the lid didn’t quite clasp perfectly, was this what was happening — could the machine be up, but the backlight off?

So, one last time, I restarted. Only I held down Command-Option-P-R (four fingers) to reset the power management settings. Several chimes later, I let go, and the machine booted perfectly, and the login box appeared, backlight and all.

I’m hoping that my experience may lead to an additional piece of the puzzle about the Mac waking up funny. I would have never have noticed anything on the screen if I looked at it dead on, as I always do.

It’s fairly well known that if you close the Mac’s lid, but down engage it fully, the lid will pop back up, but not after putting the machine to sleep. At that point, it becomes a little dance with the lid, trying to get the lid back down, so that the machine can see it re-open, and that usually wakes it. But sometimes the screen is still dark, and you have to play with the power button (and if frustrated, hold it down to restart).

Sometimes this same problem manifests when you wake the machine, enter your password, and suddenly everything goes dark. You wiggle the cursor and hit the keys and nothing happens. Caps Lock toggles, but it feels like it’s gone back to sleep.

Well no more. From now on, I’m going to tilt my screen back and see if I’m operational. That way I won’t lose data from an unnecessary restart.

Firefox Slow Page Load - Solved

Friday, March 28th, 2008

A co-worker showed me an interesting problem with Firefox today. He loaded a page from our application (running on localhost) and the page content loaded instantly, but the page load itself didn’t end until a time out 20 seconds later. Literally.

Everything we saw a measured from the browser or from the sending application showed that the content was sent in milliseconds, and the page load was just sitting there doing nothing. We were even using the latest Firefox beta.

Other browsers had no such problem.

Turns out, we figured out what was going on using the Tamper Data add-on.

Turns out there was a Connection: keep-alive in the header. When we changed it from keep-alive to close, the browser behaved as expected. That is, it loaded the page instantly.

A little web investigation showed that when you use the keep-alive attribute, you must also use Content-Length: header, which the sending application wasn’t doing.

A quick application tweak to send the content length, and everything ran super spiffy.

Now, if you don’t have access to the application that’s sending you web pages, you can twiddle with the about:config and change the network.http.keep-alive setting to false.

SQLite Functions

Tuesday, March 25th, 2008

Seems silly, but I’ve been using SQLite and was having the darnedest time try to convert an integer into a time. Problem was, I knew the functions for Sqlite3 had to be out there, but all I kept getting from search engines and exploring the developer Wiki were the C/C++ API functions, not the ones needed for SQL. I guess the way the pages are indexed, the source pages score higher than the user manual pages.

Anyhow, located the SQL functions and wanted to document their location for myself so I could locate them again later.

Seems they are called Core Functions.

They hide under the language expression page, which is under the SQL language page.

I was thrilled to find that the SQLite C Interface allowed the creation of your own functions. Brilliant!

Turns out, that the date and time functions were hiding in a different part on the Wiki.

The magic I wanted, given a time stored in an integer, was:
SELECT datetime(timevalue, 'unixepoch', 'localtime');

iChat Problems: Fixed

Saturday, December 15th, 2007

iChat and Parallels
While trying to iChat using Leopard to a system running Tiger, I ran into a problems that I never had using OS X 10.4 before: bad video quality to downright refusing to connect.

With a little research, I ran across this article and that was enough to resolve the problem.

Here’s how to get iChat working on OS X 10.5
…if you’re running Parallels.

See, turns out that Parallels, I’m using 3.0 Build 5582 (Dec 5, 2007), appears to be running some services, even when the virtual machine is active, that gets in the way of iChat.

Get out of iChat.

Go to Apple / System Preferences…, select Network, and click on Parallels NAT and change the Configure drop down to Off; then go to Parallels Host-Guest an change the Configure drop down to Off. Press Apply.

Get back into iChat and try again. For me, it instantly fixed the problem.

Reasonable Trial Durations: 30/30/30

Friday, October 19th, 2007

30/30/30While doing Java development, I was looking for a new IDE for Windows. Naturally, my hunt ended with IntelliJ, with Eclipse and NetBeans close on its heels.

What started the whole chain of thought for me, though, was IntelliJ’s trial period. Frankly, I really respect a company that has enough faith in their products that they let you use them, unencumbered, for a month in order to make an informed purchasing decision.

Oddly enough, though, it wasn’t enough. Allow me to explain.

The purpose behind a trial period is to allow end users to “log enough flight time” with the product that they know whether or not it meets their needs.

And here’s the problem. I have an existing code base of inter-related projects that I need to import into the IDE. And, since this is for work, my schedule is fairly swamped. I can only come up for air to do an evaluation once every week or two just for an hour or so.

What inevitably happens is this: I install the software, validate it installs, then a week or so later, I try to import; it fails, so I table the project until I have more time. A week or two goes by, and I try again, getting closer. Then, when I come up for air and try to get a bit further, the evaluation period is over. I’ve realistically had about less than three hours using the software, and none of it in the IDE writing code.

This happened to me last year as well.

And, what’s the natural conclusion at this point? I don’t know if it will meet my needs or not. Thus, a purchase doesn’t happen.

From marketing’s perspective, they think that the following scenario is the norm: a user downloads the project, tries creating a project, slings a bit of code, gets married to the IDE, and is willing to pay to keep the experience. In fact, I’ve done just this, and I really love IntelliJ.

But, no matter how much love I have for the product, if I can’t move our corporate applications into it from an existing source base, I can’t justify the site-wide purchase. End of story.

Oh sure, I could talk with the kind folks at JetBrains and ask for an extension, and I’m sure they’d give me one.

But that isn’t the point.

Being a software provider myself, I see this as a generic problem. What if I want to produce trial software that’s fair. I can’t have my customers not being able to make a well informed decision for running out of time.

Here’s my solution… 30 days, 30 invocations, 30 hours - Whichever Comes Last

Here’s how it works:

  • You’re guaranteed at least a month of physical time.
  • You’re guaranteed at least 30 invocations.
  • You’re guaranteed at least 30 hours.
  • When all three of the above goals are hit, stop the trial.

Implementing this isn’t be hard at all. It’s also quite fair and balanced.

If you are doing real work, making use of the application for 30 days, then you’re going to quickly chew through the 30 invocations and 30 hours.

If you have just haven’t even tried the software enough, you get 30 attempts.

Finally, the 30 hour rule recognizes if you haven’t had time to actually experience the software.

I’d like to see vendors start taking this approach. It’s a good one, too. It would certainly result in more sales.

Vista DeFrag Sucks

Wednesday, September 26th, 2007

Well before Vista was even real, I wrote about the problematic issues, bad practices for customers, and locked in formats that would make Apple Mac a highly attractive option. Pretty much most of the things people said couldn’t or wouldn’t happen have. It’s no wonder that the US Government would rather keep XP than move to Vista, that students on college campuses are reporting terrible problems interfacing with the IT departments and campus infrastructure, and that even Office formats are in dispute.

Even in our own offices, Vista has been one disaster after another, causing us all kinds of heart ache and productivity loss.

We thought the nightmare was over when we found a clever hack to make Vista think our networked HP LaserJet was a local printer (and we’d given up on being able to even use sound). However, we’ve been getting terrible disk performance on a laptop with Vista installed. Turns out the drive is badly fragmented.

Obviously, an XP user would simply run Disk Defrag and let that be that.

Not so with Vista. Sure, it has the program, but it provides no indicator of how much work needs to be done, and no visual interface at all about what’s being done. All you get is a stupid message that says the operation could take minutes to hours to complete.

So, we let Vista run overnight. And performance didn’t improve. At all.

You’ve got to see the conversation over on the Microsoft Developer Network about Vista’s defrager.

It seems that Microsoft expects you to leave your machine running all the time, and at some time like 2am on Wednesday, it will run the defrag automatically for you. Whether you want it to or not. And it will do the same crappy job.

If you’re running an enterprise service, you do not want to take an I/O channel hit “just because.” If you’re an IT administrator, you don’t want to screw with scheduling. If you’re a laptop user, you don’t want to leave your machine running.

Now I know I said I wasn’t going to give Microsoft support anymore. But I occasionally will share tips.

Grab the free version of Auslogic’s Disk Defrag. It will impress you. It’s clean, crisp, visual, astoundingly fast, and most importantly: it solved our fragmentation problems.

Overcoming Writer’s Block

Tuesday, September 25th, 2007

Recently I discovered that one of my favorite authors put out a book on writing, called Weinberg on Writing: the Field Stone Method.

Well, on a lark, I decided to purchase the book from Amazon, and I have to say, not only have I not been able to put the book down, but it has truly inspired me about writing in ways that no English book ever could.

Basically, Weinberg draws parallels of building a wall with field stones (no mortar) to that of writing. He starts by stating that how we read, sequentially, is not necessarily how we write. Additionally, when we see today’s electronic medium, full of indexes and hyperlinks, this is merely presentation, and, again, has no bearing on the writing process.

Instead, he points back to a time in his life when he became addicted to morphine from some nasty surgeries and broke the addiction. He explains that addition is a very clever and evil process. It requires that you do something in the short term that makes you feel better, but with the side effect that it actually makes you feel worse in the long term. So, you do the activity again, and you feel better, but then after it passes, you feel even worse. Quickly you run into a terrible spiral.

However, smart and creative people can break that cycle. How so? By finding something else that makes them happy. Instead, they don’t end up with feeling worse; they simply build upon repeated successes.

He then discusses how when he’s faced with a project that’s not going well, or a deadline, or even writer’s block, that he’d distract himself (”to unblock himself”) by going for a walk, drinking a beer, having sex, watching television, cleaning out the garage, whatever. Only the problem was, when the break was over, he’d be in even a worse pickle, and have even less time. …sounds an awful lot like addition, doesn’t it?

So, he started looking for a smart and creative way to break the cycle, and he now claims he never gets writer’s block. Writers block comes from three things: not having enough ideas, having too any ideas, or having just the right amount. If there’s not enough, he goes “looking for flag stones”. If there’s too much, he organizes them. If things are just right, he polishes and shapes them. Volia, writer’s block is gone.

But what is this “looking for flagstones” he’s talking about? Turns out when you’re building a wall, like a retaining wall out of stone, the quick “city” way is to purchase a ton of rocks. However, in the country, you go out into fields, looking for stones that are the right size, shape, and color. You collect them, and after a number of years, you have your wall.

Problem is, if you just flat out collect for the wall, you run into two problems. One is that as time presses on, it gets harder and harder to find wall-specific stones. You can’t just say “I’m going to find five today.” That doesn’t work. Second, sometimes you come across other stones that have practical value or some emotional connection, but you have no immediate use for them. He says to collect those and start different piles. And with this advice, he points out with modern day cheap storage, it’s possible to collect a lot of ideas and then organize them later. Also, he spends considerable time telling how to capture ideas that might get lost such as when you’re dreaming or in a social context where it doesn’t seem appropriate at first.

Weinberg points out that a “good stone” is an idea that moves you strongly emotionally. When a passage stands out, when a well worded sentence is found, when a thought sticks out, when someone says something, when you get a flash of insight or perspective on the world, and so forth, these are good stones. Weinberg has made a career out of collecting ideas, and with it, he’s never out of material or inspiration for writing. He encourages the reader to do the same, through a series of simple observational exercises he applies in his writing classes, and I have to say… it works. My own set of blogs have been stepping up in the number of entries; I’m seeing far more reader email and comments than ever before.

Weinberg pointed out that upon a friend of his giving a review to another author’s book, praise was given that it was a gold mine. And when Wienberg asked his close friend why he never got that kind of praise. Weinberg’s friend thought and said a gold mind is something where you have to move a lot of earth, and if you’re lucky, you get a nugget. Then he proceeded to say that Weinberg’s books were more like coal mines. Continuing, that every shovel full is valuable.

And, I’d have to agree.

Weinberg draws on tons of deep and clever concepts, thoughts, and expressions, weaving them into folds of comedy and information, conveying his points effortlessly and concisely. He illustrates how the “Fieldstone Method” works for fiction, non-fiction, and technical material. And, it really does.

This simple blog entry represents my personal synopsis of the first five chapters in a twenty chapter book. I strongly encourage you to get your hands on it and read it. It will take you no time what-so-ever, as it’s less than 200 pages and quite thin. In no way does it discuss grammar, technicalities of the English language, or pseudo-science positive thinking crap.

Wienberg in the course of 40 years has produced 40 well known books and over ten times that in articles. His students are cranking out books and articles. His methodology is quite an eye opener, especially if you want to become more prolific.

Hibernate: Duplicate Mapping and Imports

Tuesday, September 25th, 2007

<GEEK BLOG ENTRY>
I ran into a very frustrating problem this evening, causing me to stay much later than I had intended, and to miss out on some fun socializing event that I was looking forward to. Unfortunately, there was little to no useful information on the Internet as Google was coming up with few and useless results.

I hope this post saves some poor soul from the same fate.

The Problem


I’m using the Hibernate library for persistence with a JBoss EJB using JPA. My code is sprinkled with annotations, my hibernate.cfg.xml file is clean, and I have no *.hbm.xml files. My code compiles. And it runs.

However.

When I try to access something that uses the Hibernate library, I get an odd message about “Duplicate Collection Role Mapping“.

The class in question contained a Set interface and a HashSet implementation for a member.

So, I commented out this container and tried again, hoping to simplify the problem.

This time I was greeted with a “[Mappings] duplicate import” and a “DuplicateMappingException: Duplicate class/entity mapping” set of error messages.

The only related web pages was a handful of archive with people asking similar questions in various online forums.

Almost always these fell into one of three responses:

  1. You’ve got a problem with the mapping element in your hibernate config file.
  2. You’ve got annotations and and class.hbm.xml file doing something wrong.
  3. This is an old bug in JBoss.

None of the symptoms existed in my case.

Here’s How I Solved It


Turns out that Hibernate makes the recommendation that you build a HibernateUtil helper class. Inside it, you’re supposed to make a singleton of the SessionFactory (and in the case of JBoss, you should use JNDI).

A co-worker had refactored the AnnotationConfiguration() to store a single copy, however, the routine that returned it happened to call .configure() on it before returning it each time. An honest mistake, which got integrated silently into my code when I pulled the latest version from version control.

Because .configure() was being called twice, to Hibernate it did look as if I had duplicate mapping directives in my hibernate config file.

Correcting the HibernateUtil method, which handled setting up and returning the AnnotationConfiguration solved the problem.

</GEEK BLOG ENTRY>


Bad Behavior has blocked 1931 access attempts in the last 7 days.