Sunday, August 8, 2010

DLINK DI-524 + MacBook Pro (Snow Leopard) + iPad Wifi problems?

iPad excitement was reduced upon discovering that it refused to connect to my wifi.

After some testing, the scoop is: use the WPA-PSK option in the type of security. That seems to solve the problem.

I kept getting issues with either one of the two devices not being able to connect to the network - MacBook wouldn't connect to WEP but worked with WPA-PSK/WPA2-PSK option and IPad was reverse of that.

Finally choosing the WPA-PSK with TKIP encryption seems to get both on.

Monday, October 5, 2009

Drupal unable to login due to crashed MYSQL table

For no apparent reason, our Drupal site refused to allow a regular login. The site itself seems to be working fine - but attempts to login into administration simply do not work and are redirected to the homepage.

(caveat: perhaps I've managed to hide some status/error messages being displayed in the process as I've changed quite a few things when it comes to the template files used).

Either way, I've ended-up looking in the watchdog table where I noticed the following most recent entries all the way at the bottom:
Table '.\database-name\sessions' is marked as crashed and should be repaired
query: INSERT INTO sessions
(sid, uid, cache, hostname, session, timestamp)
VALUES (....)
Seems like MYSQL table sessions is marked as crashed! Kind of makes sense why we're not able to login - new sessions are probably not being created due to the table crash.

Google quickly points to the REPAIR TABLE syntax for MYSQL which luckily runs without issues and we're back online being able to login again!

If that did not work? Probably delete and re-create the sessions table I guess.

Wednesday, June 24, 2009

Drupal Zen theme

My latest Drupal-based website is going to be based on the Zen theme. What a joy! If only I had discovered it earlier. Really simplifies things and makes the theme come to life quicker. At least for now it is (1st day of serious development work). So if you're clicking around finding a Drupal 5.x theme, might as well try Zen first.

Incidentally, I've stumbled upon the and its 960 grid system which looks fantastic for future work. Loved the way the grid is defined and controlled. Dead simple, works without hassle across browsers.

Oh. And I hope to finally start using reset.css as a standard way of "equalizing" browser behavior. 960 ship their code with reset.css based on (I think) Eric Meyer's original reset (or was it Dave Shea?). Life is great.

Drupal 6 and Panels

As I was starting out work on a new website to be implemented in Drupal, I was finally getting around the idea of using version 6 that everyone seems to be happily using for many months now.

My typical usage of Drupal consists of heavily relying on Panels and Views to pull-off the website's structure. It was somewhat of a shock to discover that Panels 2 is sort of abandoned in favor of Panels 3 for Drupal 6. That would be fine if it wasn't for the fact that Panels 3 is really still in heavy development. After several attempts to try and use it (followed by a patch from the 'dev' branch) I realized that I might end-up having a bit too many issues with Panels 3 to try and deploy it for this project. And since I still can't figure out what do people use if they're not using Panels to pull-off complicated structures I decided to go back to Drupal 5. Sigh. Sadly.

Wednesday, June 17, 2009

Switching to Mac

Very excited with my new MacBook Pro.

However, two steps forward one step back: I have a Rails application that reads MS Excel files via win32ole Ruby library. In Mac OS X that does not work and I now have effectively no way to run the application on my Mac until completely re-coding the part that deals with Excel! What a disaster.

Have found info suggesting the use of OpenOffice which should work on both OS X and Windows but that still is going to require coding time. *sigh*

C# UserControl not displayed in toolbox

Weirdest thing.

If you create a C# (VS2005) UserControl, ineriting UserControl and implement an interface that is defined in the same project in which the user control resides your toolbox will happily show your control. In addition, you can add it to various forms you may have. Everything is as expected.

However, if you attempt to implement an interface defined in a separate project (class library) referenced by the project where the user control resides everything falls apart. Forms that have been showing the user control will not load their designer and the user control tends to disappear from the toolbox.

I have no idea why this is so.

Thursday, April 9, 2009

Rails ActiveRecord update and Ruby Observable update in conflict?

In a recent project I've tried using Ruby's Observable module (from the Ruby standard library).I've created a Donation class (the subject) and a DonationObserver (the observer). 

As per the definition DonationObserver is supposed to provide a method called update to participate in the observer pattern. In my case, it had 2 parameters.

I also wanted to save these observers into the database and load them on demand. Hence, DonationObserver extended ActiveRecord::Base (it was one of my model classes).

Everytime an attempt is made to update (into the database) the runtime resolves that call to the update method defined for the purpose of the Observer pattern (in my DonationObserver). This produces a large stack trace complaining "wrong number of arguments (0 for 2)" and pointing all the way to line 2483 in base.rb where it says:
def create_or_update
raise ReadOnlyRecord if readonly?
result = new_record? ? create : update # line 2483 in base.rb
result != false
In other words, it appears that being the observer and an active record instance simply will not work together without some hacks. Perhaps I'd need to override the Observable's notify_observer method and call a different method in the target observer from the default update.

Am I missing something?

Well, a quick and dirty way out of this is to just simply override the add_observer and notify_observers methods from observer.rb. You'll need to change the:
unless observer.respond_to? :update
to checking for any other method you're going to use:
unless observer.respond_to? :update_observer
Similarly, change the notify_observers from:
for i in @observer_peers.dup
for i in @observer_peers.dup
And finally, the observer class (DonationObserver) would get a new method called update_observer(...) with some appropriate arguments.