agileaholic :)

Objective-C programming using mingw32 in Windows

Posted in objective-c by Prabhu Beeman on May 8, 2010

Following are the steps you need to follow to setup the environment and run your first program

S.No Description Link/Path/Command Note
1 Install mingw32 and its libraries http://www.gnustep.org/experience/Windows.html Make sure you install the first two packages provided in the link (in the same order mentioned)
2 Open mingw32 Start –> Programs –> GNUStep –> Shell  
3 Write our first program The command prompt location points to the following path:
%GNUStep_Directoy%/home/your_name/
(“D:\GNUstep\home\Prabhu B” for me)
FirstProgram.h
FirstProgram.m
(Refer below for the content of the .h and .m files)
4 Compile the program

gcc -o FirstProgram FirstProgram.m –I /GNUstep/System/Library/Headers/ -L /GN
Ustep/System/Library/Libraries -lobjc -lgnustep-base -enable-auto-import -fconstant-string-class=NSConstantString

 
5 Run the program ./FirstProgram  

 

FirstProgram.h FirstProgram.m

#import<Foundation/NSObject.h>

@interface FirstProgram:NSObject {

}

-(int) addNumber1 : (int) x withNumber2 : (int) y;

@end

#import "FirstProgram.h"
#import <Foundation/NSString.h>

@implementation FirstProgram 

-(int)addNumber1:  (int) x withNumber2:  (int) y {

       //add
        return(x + y); 

main() {
        FirstProgram *first = [[FirstProgram alloc] init];
        int total = [first addNumber1:20 withNumber2:30];
        NSLog(@"Total=%d",total); 
}
@end

   

Windows Live Writer – Already Installed Problem

Posted in Troubleshoot by Prabhu Beeman on March 16, 2010

When you are installing the Windows Live Essentials and wondering why Writer is under the ‘Already installed’ section, then you might be as surprised as me.

Reason: I had installed and removed but still the entries in the registry was creating the issue.

Solution:

To uninstall Windows Live Writer, click Start, then type/paste the following and press Enter:
msiexec /x {178832DE-9DE0-4C87-9F82-9315A9B03985}

Tagged with:

Grails Constraints

Posted in agile, grails, groovy by Prabhu Beeman on January 20, 2010

Consider the following domain
class User {
    String name,
    String email,
    String password

    static constraints = {
       password(size:6..32,blank:false),
       email(blank:false,email:true)
    }
}

Is there a way where I can validate only my password?
YES

if(user.hasErrors()) {
    if(user.errors.hasFieldErrors(“password”)) {
       println user.errors.getFieldError(“password”).rejectedValue
    }
}

Tagged with:

int value from param – groovy way

Posted in agile by Prabhu Beeman on January 20, 2010

In Java,
int paramValue = Integer.parseInt(request.getParameter(“paramName”));

In Grails.
int paramValue – param.int(“paramName”)

how sleek….

Xpressmark – Setting it up on prgmr.com

Posted in agile by Prabhu Beeman on November 26, 2009

I enjoyed an impressive service of that of slicehost for hosting xpressmark. But the annual cost of hosting it (a 256MB slice) comes at a price tag of 240 USD (-20 USD for an annual membership) which is a bit on the expensive side considering the fact that I don’t get any revenue out of it. Nevertheless I didnt want to bring it down either. The number of visitors to the site was always on the rise and I felt that people enjoy the service.
So I was looking for an alternative hosting solution (a VDS ofcourse). I came across another solution provider prgmr.com who provided the same solution at 40% of the price.That was pretty cool. And their tag We don’t assume you are stupid means you are on your own once you are given your slice. Though the same applies to slicehost, they have a pretty good console that helps you out in setting up your slice unlike prgmr.com. Rightly so they dont assume you are stupid.
I was successfully able to set it up, was able to setup the environment, bring the server up and migrate the data. But unfortunately couldn’t access the service outside the server, blame it on iptables, had to shut it down and then bingo… Xpressmark back to life in a brand new server (Yes, Luke and his team were in the process of configuring the box and the links to buy the slice werent even made public and I was lucky to get the slice pretty quickly after shooting a mail to them). I will post my experience with prgmr.com in the coming days. Hope it will be as good as slicehost.

126: The specified module could not be found – ../mysql.so

Posted in agile by Prabhu Beeman on September 29, 2009

I was trying my hands for the first time on RoR (Ruby on Rails).
(Netbeans 6.7 , Windows XP).

In the process, I got the following (misleading error)

126: The specified module could not be found – ../mysql_api.so

But mysql_api.so was in the path where ruby was looking for.
Solution:
Make sure your MySql bin path is in your PATH variable.

Tagged with: ,

AVAudioRecorder – iPhone Audio Recording

Posted in iPhone by Prabhu Beeman on September 23, 2009

I have been using the AVAudioRecorder class to record the audio. But it wasnt allowing me to play it back. I had to restart the application to play it. I had to toil hard with it for a few hours before I found the culprit.

Thanks to this link. The problem was in my AVAudioSession Category which was set to AVAudioSessionCategoryRecord while it should have been AVAudioSessionCategoryPlayAndRecord.

Link of the day: Pomegranate

Posted in link of the day by Prabhu Beeman on August 27, 2009

Link of the day: Air traffic in 24 hours

Posted in link of the day by Prabhu Beeman on August 16, 2009
Tagged with:

Link of the day: Four Perfectly Round Circles

Posted in link of the day by Prabhu Beeman on August 14, 2009
Tagged with:
Follow

Get every new post delivered to your Inbox.