nebulousWeb

Developing a PhoneGap Android app using NetBeans

For some time, I have been interested in PhoneGap, a technology to build native apps for all major mobile platforms (Android, iPhone, Blackberry, …). When I actually sat down and tried to start working with it, every tutorials out there explained how to set up a PhoneGap project in Eclipse. I actually did make the PhoneGap test app work using Eclipse, but I was rather disappointed at Eclipse’s poor support for the web technologies used while developing a PhoneGap app a.k.a. HTML5, CSS3, JavaScript and some server side language like PHP or RoR.

Looking all over the Internet, I actually had a hard time finding instructions on how to make PhoneGap work in NetBeans, so here I am providing the steps I used to make PhoneGap apps using NetBeans.

Creating a PhoneGap project

Before looking into how to make it work in NetBeans, we first need to install PhoneGap and all its dependencies.

The official documentation isn’t that clear for anybody not so well versed in command line utilities. That post does a good at explaining how to install all the dependencies for PhoneGap.

Basically, you need to install the latest JDK, Apache Ant and the latest Android Development Kit (the ADT bundle is not necessary). And make the following command lines work properly: java, javac, ant, adb and android.

Once every command lines above are working, you can attempt to create your first PhoneGap app project. To do so, you need to download the latest PhoneGap release and install it somewhere on your computer (spaces in the path to PhoneGap are to be avoided). Now, using your favorite command line utility, navigate to the path where PhoneGap was installed, and go into “lib/android/bin”, you are now ready to create your first project, the command line to use is the following: create <project_folder_path> <package_name> <project_name>project_folder_path is the path to your new project (must not already exist). package_name is the name of your app package usually something of the likes of com.company.appName (hyphens and spaces are not allowed). project_name is the name of your app (hyphens and spaces are not allowed).

Congratulations! You just created your first PhoneGap project. Oh wait, we can’t actually use it, we need to set up NetBeans.

Setting Up NetBeans for our PhoneGap Android App

One plugin is actually all that’s needed to be able to develop your PhoneGap app: the Android plugin. The problem is that it is not an official NetBeans, you can’t find it on NetBeans Site. You can install it using the following instructions on the plugin’s site: http://www.nbandroid.org/p/installation.html.

Once the plugin is installed, you just need to open your project in NetBeans. You don’t need to create it, the project was already created using the PhoneGap command line and is automatically recognized by NetBeans. You can now run the project by right-clicking it in your project panel and selecting Run. A prompt will ask you which device (AVD) you wish to use to run your project, select one.

You are now ready to get started developing PhoneGap Android apps with NetBeans.


Don’t register your custom post type each time in WordPress

WordPress is really easy to hack into to get things done fast, but tricks to optimize WordPress aren’t that easy to find. I am here to help you optimize your code with easy to do tips.

Prevent WordPress from registering your post type on each page load

There is a function called post_type_exists( “post_type_name” ) that checks if the post type exists, it returns a boolean.

It could be used like that:

WordPress will then create (or register) the post type only once and therefore, we don’t run code that doesn’t need to be run each time someone access your site.


Week 1 Review: Routines

Last week objective was to implement 2 routines: one for mornings and one for nights. I wrote two posts on the subject: The Importance of the Sleep Routine and The Guide to a Great Morning Routine. Defining my routines was done well during the week, but I pretty much failed at implementing it due to a lack of focus on the routines. I think I chose about the worst time to do this challenge as I’m under a load of work at my regular job.

Learned Lessons

  • Changing habits shouldn’t be done when you’re under a lot of stress due to lack of time to do everything you have to do because it becomes difficult to focus on correcting your habits.
  • It’s not because you’re really stressed out that you should lose focus about your priorities.
  • Sleeptime shouldn’t be cut off in order to get more done, you will end up doing less.
  • Being tired can lead to complete lost of control over your stress, you could begin to freak out as I experienced it.
For the remaining of the month, I will do my best to integrate my routines in daily life. I know it won’t be easy as my load of work will keep me well too occupied for the entire month of November.
Last week was a failure, but failures exist so that you can learn from them, and I’ll do my very best to not make the same mistake this week.

The Importance of the Sleep Routine

Having trouble falling asleep is quite common in our stressful lives. Have you ever struggle so much over one thought that you couldn’t fall asleep? I’ve been there many times in the past, it was partly due to my inconsistent sleep schedule, but also sometimes because I was worrying over something just as I got into bed. The thought kept coming back to my mind and kept my mind well too awake for me to be able to sleep, so I had to trick my mind to stop this dreadful thought from occuping all my attention.

I have now a much more consistent schedule and I don’t have that many problems falling asleep anymore. Over time, I continued to test different sleep routines to help my body recover more energy over a night of sleep. I finally settled on one that seems to work great for me, but as everyone is different, it may work as efficiently for you.

Gearing up to sleeptime

The first thing I do in my sleep routine is getting ready to go to bed, I put my pajamas on, brush my teeth and shower if I didn’t have the time to do so earlier in the evening (I like to take my shower soon after I return from work as I feel energized after getting out of the shower).

Before I used to go to bed right after this step and read some manga chapters or a few pages from a book on my ereader to relax my mind. You could also use this time to write in your diary about your day. The important thing is to stay away from those backlit screens, get into your bed comfortably in your blanket under a dimmed light and read a bit or write. You should soon start to feel more relax and perhaps tired if you had a long day, it’s time to call it a day, turn the lights off and enter dreamland.

The Mind Cleaner

Sometimes, you may have to add an extra step to be able to get a good night of sleep. This step is what I call the Mind Cleaner. It’s a bit of brainstorm, but you don’t have to search for ideas. You just have to think about your day and collect any thought coming your way into your favorite notetaking device. It’s important to let go of the thought once it’s written down, you can always return to your notes to elaborate the following day. The main objective of the Mind Cleaner is to clear your head of any thought before going to sleep, so that you don’t end up in bed thinking and worrying about everything you should remember for the next day.

It’s possible that some days you won’t need to do a Mind Cleaner, but if you feel stressed before going to bed, make sure you do one, it will help you a lot by removing all the noise created by thoughts constantly invading your mind and breaking your sleep.

When to Go to Bed

When to go to sleep is an answer only your body can tell you. If you’re an early bird like me, your sleeping hour is probably around 22h. There’s one thing that can help: sleep at regular hours as much as possible to set your internal clock in sync with your life schedule.

Finally, just remember that there is no one-fits-all magic routine to help recover energy. The few tips I can give you is to listen to your body and to remove all your brain noise before going to bed.

And so, good night!


The Guide to a Great Morning Routine

Many people don’t have a morning routine, they just run through their mornings by waking up late and trying to make up for their tardiness. Those people will surely get though their day, but with an increase amount of stress as soon as they wake up. Waking up sooner helps jumpstarting the day by completely waking you up before you start getting things done.

A morning routine can help you wake up on time, relax and feel conscious all day long, you won’t just rely on your autopilot to get through the day.

The First Step: Waking Up

The first step of a morning routine should be composed of a few everyday habits like taking a shower, dressing yourself up, eating breakfast, making your lunch. My first steps are in this order: dressing myself, washing my face, eating breakfast and making lunch (when I have to work).

Dressing yourself up: I find this little step really important. After having dressed myself up, returning to bed just doesn’t feel right.

Washing my face: Many showers in the mornings, but I prefer to save my time for other things as taking a shower takes me at least 15 minutes. So, I just wash my face with cold water to wake myself up a bit more.

Eating breakfast: I know a lot of people who don’t eat breakfast. For me, it’s impossible not to eat breakfast, as soon as I wake up, I start to starve and need to eat immediately. I wasn’t always like that before I could skip breakfast easily, but as I made breakfast an habit, my body started to want to eat as soon as I wake up. As always, habits are powerful and important.

Making lunch: I scarcely eat out at work. Bringing your own lunch helps saving money and eating healthy. My main dish is some leftover from the week or something I made the night before. So making my lunch is just grabbing a few snacks (fruits, some nuts or chewy bars).

Second and Last Step: Activating then body and mind

The first step is more or less done on autopilot, you don’t have to think that hard to get through, but it helped you get out of the bed. Now that you’re out of bed, you have to activate your body and brain. This step should include an activity that activates your body and/or brain. You can exercise, meditate, do some Yoga or simply brainstorm on some of your projects or ideas. I have yet to try meditating or doing Yoga, but I have done the exercising and want to try to brainstorm.

Exercising in the morning was a way for me to relax before going to the stressful environment that work is. It was also the only time I wanted to go to the gym because after my day at work, the only thing I want is to go home and relax. Surely, it was difficult the first few times, but I am now happy I started doing some exercise in the morning as I feel much more energized throughout the day.

I think the biggest difference was waking up early and actually do things before going to work. Before I used to wake up 30 minutes before going to work and I was just barely able to complete my routine (that didn’t include step 2) and ended up rushing it so I don’t miss my bus. Now, I wake up at least 1h30 before going to work and I feel like I can do much more in one day which is surely due to the fact that I actually do something before going to work (I at least complete step 2) and sometimes I have a bit of time for leisure which helps boost my morale for the day.

Final Important Fact: Purpose your day

I always found that the days I had more energy where those when I knew the night before what I had to do the next day. So, I strongly suggest that every night you think about what you should absolutely do the next day. Waking up with a purpose is easier than waking with nothing to do. Without a purpose, it’s easy to just sleep longer, but if you have a reason to wake up early, it will be a lot easier.


November Challenge: Changing myself

The process already began a few months ago as I started to wonder how to kill my procrastination habit. Since, I’ve almost completely stopped putting things off to tomorrow and I’ve started going to the gym, one of the things I was procrastinating about for a few years.

But, in the last week, I noticed I was slowly reverting back to my old self. The cause was that I had tired myself out as I tried to do too much at the same time. The result: I was half-assing everything I was doing, this blog included.

The plan to change myself

Week no. 1 Goal: Getting my energy back by creating daily routines and sleeping well

The first step to getting back on track is to get my energy and routine back because a lack of energy leads me to laziness which leads me to procrastination. So the goal here is to get to bed by 22h (or 10pm) and waking up at 5h30. It may seem early for some of you, but give it a try for a few weeks and maybe you will discover like me that you are an early bird.

I will also create my morning routine to jumpstart the day and my sleep routine to prepare myself for the night, thus helping my body get used to my sleeping schedule.

Week no. 2 Goal: Reorganizing myself through a bit of GTD

Not being organized can lead to a lot of stress and a lost of productivity, especially when you have a lot to deal with and that’s exactly my problem. During the second week, I will create my own GTD system. Look forward to the second week if you want to learn more about GTD, also known as Getting Things Done.

Week no. 3 Goal: Getting healthier by creating good habits

Health is everything for a living thing. Health makes you live longer and gives you more energy. To get healthier, I will concentrate on changing some of my bad habits including laziness and sweets (I’m eating them like crazy right now since it was Halloween yesterday).

I will eat more fruits and vegetables and stay clear of fast foods, chocolate, chips and sweets. I will also make sure to put time aside to go to the gym.

Week no. 4 Goal: Merging everything learned

The last week will be used to solidify the links between everything I learned in the challenge to never revert back to my old lazy self. As it is important to take the time to make sure that the recipe I used to change myself will last forever, I will concentrate the last week on making the habits stick in my lifestyle.


The origin of Nebulous Web

How did it come to Nebulous Web?

A random word generator gave me the idea by generating the word “Nebulousness”.

As it appeared before my eyes, I thought that it was a fitting word to describe the Web. It’s so enormous that it’s almost impossible to fully comprehend it. So, I thought that “Nebulous” was somehow a great word to describe the Web and all its grandeur (sorry, my french is taking over me) and mysteries.

Welcome to Nebulous Web, the blog that helps you uncover the web mysteries!


Hello world!

Every developer should know about this custom of “Hello World!” as the first output of a project.

So, here is mine!

Hello World!

NebulousWeb is here to help you uncover the web mysteries! So, tune in regularly.