Tuesday, August 24, 2010

HTC SENSE experience

While using my htc desire, I realized that there are times that the widgets don't update..

I found a solution for that.. Go to applications search the app that does not update. Open it then clear cache..

after that you can now receive updates again..

Enjoy!
Published with Blogger-droid v1.5.5.1

Saturday, July 3, 2010

S>My Rooted T-Mobile G1 with complete accessories and Add-Ons

I'm selling my ROOTED T-Mobile G1. In very good condition.
Contains All accessories. The box though does not have the phone holder.

Contents:
T-Mobile G1 Phone ( Android OS Cyanogenmod 4.2.15 Donut )
8GB Class 6 SDHC card partitioned with SWAP and EXT4
Desktop Charger
4 PCS Silicon Case (Black, White, Blue, Pink)
USB Data Cable
Body Globe Protector
Leather Case with Belt Clip
Extended Battery with back plate.


Tuesday, April 27, 2010

Android Development: Netbeans Free-Form Project

I've been trying to use the Android plugin for netbeans but it is not yet furnished to compare it to Eclipse.
My colleague taught me how to do this using the free-form project in netbeans. I would like to share it
as this will also remain as my back up of the process flow. :)

Let's consider that Java, Netbeans and android SDK are already installed on your machine.

You can either create a new project via command line, "android create project" command or use
existing projects.

If you are using existing projects use "android update project" command to update your project.

Updating your project.

1. Go to your project folder.
2. type "android update project -p ." don't forget to add the dot "." it refers to your current directory.
this will create a local.properties file and a build.xml file.
3. type "ant -p" to view the available commands that you can use on the instructions below. (photo is attached)




On Netbeans,

1. Create new Java Free-Form Project.

2. Browse Project.
3. The build.xml file will be on the Build Script field.
4. Name your project.
5. Click Next.
6. On the Build and Run actions specify the following based on the ant commands of the project.
Build Project: debug
Clean Project: clean
Run project: install



--------------------------------------------------------------------------



7. Click next.
8. On the Source Packages folder click next.
9. On the Java Sources Classpath, uncheck Separate Classpath....
10. Click add jar/folder
11. Search for your android.jar specified for the target you selected.
12. Click next.
13. Click Finish.

If you want to share your project change the classpath on the project.xml file
and replace the home directory of your android SDK with ${sdk.dir} which is located
on the local.properties file. Then add the local.properties file on the properties tag as a property-file.
View images below..

project.xml file:




located on this part:





-------------------------------------------------------------------





located on:


If you want to view the Android Javadocs:

Create a new Library, add the android.jar, and add the javadoc from ${ANDROID_SDK_HOME}/docs/reference.

To create a library in Netbeans:
1. Click Tools > Libraries
2. Click Create New Library
3. Name: Android
4. Classpath: locate the android.jar that you added on your project.
5. Javadoc: locate the ${ANDROID_SDK_HOME/docs/reference folder. (Note that ANDROID_SDK_HOME depends on your machine)
6. To add sources: download the source from android's open source project according to your target version.
Then add the ${SOURCE_LOCATION}frameworks/base/core/java (e.g. /Users/user/android-donut/base/core/java)
7. Click Ok.

Then you can open the javadoc window (Window > Other > Javadoc)

Voila you have a free-form Android Project.

Credits To: Edward Samson

Wednesday, December 9, 2009

Glassfish 2.1 vs Glassfish 2.1.1

I recently encountered an error on deployment for Glassfish v2.1.1. I developed my WAR on v2.1 and works properly.. Maybe there are just some libraries that are incompatible with 2.1.1. :) IASDeploymentException FTW!

Thursday, November 12, 2009

Mercurial and #!CRUNCHBANG Linux

I thought getting this to work was difficult regarding the HG VIEW command. Well it seems not.
Here is how I got it to work.

Download mercurial

sudo apt-get install mercurial

Download wish

sudo apt-get install tk8.5

Add a ~/.hgrc file and add the following code:

[extensions]
hgk=

having hgk have an empty value allows it to search for the path itself.

Then go to your repository and type in

hg view

and there you go!

Tuesday, November 10, 2009

Quartz and Google Guice

Got a really hard time looking for resources from the net regarding its integration. But good thing i found this really helpful link from another blog. quartz&guice

Also, I needed to get the injections working within my job. Also took me time to realize what to really search for.. My workaround was to pass the Injector object to the jobDataMap of the jobDetail.


jobDetail.getJobDataMap().put("Injector", jobFactory.guice);


And within my Job class, i can use the getInstance of the injector. :)


Injector guice = (Injector) arg0.getJobDetail().getJobDataMap().get("Injector");


So those objects that handle my Storage and some of my utils are done like this.


mailSender = guice.getInstance(MailSender.class);
loadersStorage = guice.getInstance(LoadersStorage.class);


Here's what my quartz code looks like.


QuartzScheduler


public class QuartzScheduler {

private final Scheduler scheduler;

@Inject
public QuartzScheduler(final SchedulerFactory factory, final GuiceJobFactory jobFactory) throws SchedulerException, ParseException {
scheduler = factory.getScheduler();
scheduler.setJobFactory(jobFactory);
//...
JobDetail jobDetail = new JobDetail("myJob", null, FileWatcherJob.class);
jobDetail.getJobDataMap().put("Injector", jobFactory.guice);
CronTrigger trigger = new CronTrigger("myCronTrigger", "cronGroup");
trigger.setCronExpression("your cron expression");
trigger.setStartTime(TriggerUtils.getEvenMinuteDate(new Date())); // start on the next even minute
trigger.setName("myTrigger");
scheduler.scheduleJob(jobDetail, trigger);
// scheduler.start();
}

public final Scheduler getScheduler() {
return scheduler;
}

public void shutdown() {
try {
scheduler.shutdown();
} catch (SchedulerException e) {
// ... handle it
}
}

public void start() {
try {
scheduler.start();
} catch (SchedulerException ex) {
Logger.getLogger(QuartzScheduler.class.getName()).log(Level.SEVERE, null, ex);
}
}


GuiceJobFactory


public class GuiceJobFactory implements JobFactory {

public final Injector guice;

@Inject
public GuiceJobFactory(final Injector guice) {
this.guice = guice;
}

public Job newJob(TriggerFiredBundle bundle) throws SchedulerException {
JobDetail jobDetail = bundle.getJobDetail();
jobDetail.getJobDataMap().put("Injector", guice);
Class jobClass = jobDetail.getJobClass();
Job job = (Job) guice.getInstance(jobClass);
guice.injectMembers(job);
return job;
}
}


Quartz Module


public class QuartzModule extends AbstractModule {

@Override
protected void configure() {
bind(SchedulerFactory.class).to(StdSchedulerFactory.class).in(Scopes.SINGLETON);
bind(GuiceJobFactory.class).in(Scopes.SINGLETON);
bind(QuartzScheduler.class).in(Scopes.SINGLETON);
}
}


My Job


public class FileWatcherJob implements Job {
//... declarations here
public void execute(JobExecutionContext arg0) throws JobExecutionException {
System.out.println("Execute");
try {
Injector guice = (Injector) arg0.getJobDetail().getJobDataMap().get("Injector");

mailSender = guice.getInstance(MailSender.class);
loadersStorage = guice.getInstance(LoadersStorage.class);
entityManagerFactory = guice.getInstance(EntityManagerFactory.class);
persistenceContextHelper = guice.getInstance(PersistenceContextHelper.class);
long newTimeStamp = file.lastModified();
if (FileWatcherJob.timeStamp != newTimeStamp) {
FileWatcherJob.timeStamp = newTimeStamp;
onChange(file);
}
} catch (NullPointerException ex) {
ex.printStackTrace();
}
}

public void onChange(File file) {
//some logic
}
//...
}

Monday, October 19, 2009

Blackberry Javaloader

For faster loading of apps for blackberry use this simple commands.

Pre-reqs: Set up environment variable for jde's bin folder.
1. Right Click on My Computer
2. Click Properties
3. Go to Advanced tab
4. Click Environment Variables
5. Go to System Variables
6. Select Path variable
7. Click on Edit
8. Add path of jde's bin folder (e.g. C:\Program Files\Research In Motion\bin)
9. Click Ok.

Now you can go to command line:
To load the cod file to the device:
javaloader -usb load .cod
To erase the cod file from the device:
javaloader -usb erase -f .cod
To get the event log for debugging:
javaloader -usb eventlog > dumpfile.txt


Note:
replace the to your apps file name
replace dumpfile with any file name you want.


Enjoy!