Wednesday, October 27, 2010

Rhosync Compile Errors–Rake Log File

Standard behaviour to run a Rhosync webserver requires running the following command in the folder containing your Rhosync server app (talking windows here):

   1:  rake rhosync:start

which will run in a new cmd window. Problem is if there is a compile error, this window will close before you get to see the error. I was expecting to see errors in logs somewhere, but my limited searching turned up nothing.

Easy fix is to just call rake instead. e.g.

 

   1:  rake

Probably easy for most people to work out, but for us linux noobs simple things can sometimes seem very difficult :(

Tuesday, October 26, 2010

Android <3 – 5 Best Apps

Purchased a Samsung Galaxy S a couple of months ago after trying to hold out for a Windows Phone 7 … phone. Never made it and my Samsung Omnia was getting a bit long in the tooth (though custom roms from XDA made it bearable). For various, probably unreasonable, reasons I was reluctant to but another samsung phone. Bit the bullet, and I’m glad I did. Phone is awesome yada, yada, yada. Just thought I’d share my top 5 favourite apps:

Launcher Pro Plus – US$2.99

LPPLauncher app to replace Samsung’s iPhone-ish TouchWiz Launcher. I can’t give LauncherPro Plus enough wraps, smooth, powerful, intuitive, customizable. The ability to create shortcuts on your home-screens is invaluable. Not just app shortcuts though, webpages, contacts, activities(i.e. message a contact, navigate to a destination, etc). Really makes this phone fun to use. Free Version is full-featured but I recommend purchasing the app to help out the developers.

 

 

 

 

Handcent SMS – FREE

Hancent

Replaces the standard android/samsung messaging app. Again really nice app to use, highly customizable, fast, etc. Best feature would have to be the “Quick Reply” popup that allows you to reply to an SMS without having the entire messaging app open up.

 

 

 

 

 

BRUT Mod – FREE

brutWorldwide navigation using Google Maps Directions, map tiles caching on SD card, etc. ‘nuff said

 

 

 

 

 

 

 

AppBrain – FREE (Ad supported)

appbrainReplacement market app. Manage you apps online. Hot apps, recommendations, backups, app lists. It’s got them all. Fast clean, interface. I would probably purchase this to get rid of the ads, but they seem to only have a donate option :S

 

 

 

 

 

 

Winamp – FREE

winampOnly just installed this, but it looks like it will be my number one music player for the foreseeable future. It’s got playlists, it’s fast, it’s smooth, has a great homescreen widget and best of all a lock screen widget. Not sure I could ask for much else in a media player.

 

 

 

 

 

 

It’s not really surprising that all these apps are just replacements for existing functions on the Galaxy S which are all severely hindered in some way. Next time I’ll look at apps that actually add features…

Monday, October 25, 2010

Node != Nodejs

Recently built a new Ubuntu 10 VM to test out a few Node.js ideas. While support for windows is improving, it just isn’t ready for prime time. I’m very much a linux noob so I just tried following the various guides out there.

I’ve followed these steps successfully recently so it came as a surprise when running:

   1:  neil@ubuntu:~$ cd node
   2:  neil@ubuntu:~/node$ ./configure

resulted in:

   1:  neil@ubuntu:~/node$ ./configure: 4: autoconf: not found
(or some other such error)

Now trying to brute my way through the install I pushed on and ran:

   1:  neil@ubuntu:~/node$ make
   2:  neil@ubuntu:~/node$ sudo make install
furthers errors ensued…

However then running:

   1:  neil@ubuntu:~/node$ node

gave me the oh so informative:

   1:  The program 'node' is currently not installed.  You can install it by typing:
   2:  sudo apt-get install node

DO NOT RUN sudo apt-get install node

As this will install the node module. Confused? Well node != nodejs. node is apparently a Amateur Packet Radio Node program. Not what we want unless you’re into ham radios… Attempting to run node will usually result in something along the lines of:

   1:  axconfig: port 1 not active 
   2:  axconfig: port 2 not active 

 

How to fix all this? Well thanks to stack-overflow and the nodejs group at least I knew where to start:

First remove the node package:

   1:  sudo apt-get remove --purge node
   2:  sudo apt-get clean

 

And then run the following to get a stable version of nodeJS running (e.g. v0.2.4):

   1:  sudo apt-get install build-essential
   2:  cd node
   3:  git checkout v0.2.4
   4:  ./configure
   5:  make
   6:  sudo make install

 

You should now be able to run nodeJS scripts. YMMV

Thursday, August 19, 2010

Visual Studio – Tip #1

 

Like a lot of people, I find F1 in Visual Studio practically useless. I did read a suggestion to remap F1 to Debug->Run just so it did something useful.

Not wanting to waste a precious key I’ve decided to remap F1 to run the currently selected unit test in Resharper’s Unit Test Sessions window via the ReSharper_UnitTestSession_RunProcess command. Only problem is that windows needs to be selected before RunProcess will work. Visual Studio Macros to the rescue:

   1:      Sub Run_Current_Session()
   2:          DTE.Windows.Item("{B2BC9916-E3E6-43A8-AD5F-3BDB95F53DB5}").Activate()
   3:          DTE.ExecuteCommand("ReSharper_UnitTestSession_RunProcess")
   4:      End Sub

Moving on I’ve applied the same tactic to map F6 to ReSharper_UnitTestSession_DebugProcess. The productivity increase has been quite noticeable.

More random tips soon…

Thursday, March 11, 2010

ASP.NET MVC2 RC2 Areas Namespace Conflict

While converting an MVC1 app to MVC RC2 I created an Area and moved my existing controllers into said area. Resharper identified the “Namespace does not correspond to file location, should be: AAA.Areas.BBB.Controllers” as expected. A simple “Move declarations to namespace ‘AAA.Areas.BBB.Controllers’” was sufficient to alleviate the issue.

At this point I also realised I needed to change my default namespace for the project to “XXX.AAA” and hence the namespace of my controller needed to change to “XXX.AAA.Areas.BBB.Controllers”. No problem.

Tried to navigate to said controller and received http 404, “The Resource cannot be found”. Debugged and found the route was being registered via AreaRegistraion.RegisterArea but the controller constructor wasn’t being hit.

Fix 1 (The hard way) : context.MapRoute(name, url, defaults, namespaces) allows you to specify the controller’s namespace/s as outlined by haacked.

Fix 2 (The easy way): make sure the area registration uses the same namespace as the controller i.e. “XXX.AAA.Areas.BBB” instead of the original “AAA.Areas.BBB”.

Now everyone’s happy :)

Thursday, December 24, 2009

Devil’s in the details : typeof Generics C#

Been a while since I’ve posted but thought this tidbit was interesting.

Given the types:

class X {}
class Y<A>{}
class Z<A,B>{}

The following statements are legal:

var tx = typeof (X);             //simples
var ty1 = typeof (Y<int>);       //fine
var ty2 = typeof (Y<>);          //and again
var tz1 = typeof(Z<int, int>);   //easy enough

Interesting behaviour starts occurring when you working with generics based on multiple types:

var tz2 = typeof(Z<>);       //ruh-roh!!  Error: Using the generic type 'Z<A,B>' requires '2' type arguments
var tz3 = typeof(Z<int,>);   //Error: Type expected
var tz4 = typeof (Z<, int>); //Same again
var tz5 = typeof (Z<,>);     //Great success!

 

So it seems you either have specify ALL the types or NONE of the types, which made me wonder why the need to put the comma in tz5? Answer is because it is perfectly legal to have multiple types use the same class name e.g.

class Z {}
class Z<A> {}
class Z<A,B>  {}

Effectively the generic parameters (or lack thereof) are part the class signature.

Thursday, September 3, 2009

Work Smarter Not Harder

Lately I’ve been getting into the habit of writing down the little snippets of goodness I happen upon in my daily web traversing. It’s kinda like twitter but on paper, I force myself to write one “item” per line, e.g. “Use mocks as a last resort, stubs as standard. 95% of testing is state-based, 5% interaction – Roy Osherove”.

I’ve found it really useful of late as they tend to be important things to remember that I don’t want to lose in the bookmark/tag cloud. Writing them down also helps me remember them in the first place.

Onto the title of this post however… I was doing some Asp.Net MVC work today when I half remembered something along the lines of “if you’re doing x, then you should use y”. I was doing x but for the life of me couldn’t remember what y was. I chastised myself for not writing it down on my “twitter-sheet” and spent half an hour re-finding the quote which I promptly wrote down.

Turns out I had previously written it down. Two lines above my fresh version. Live and learn…