CodeIgniter and Netbeans 7.3 autocomplete

Published by:

CodeIgniter and Netbeans don’t work together out of the box. And as this lengthy bug-report suggests, there won’t be any support soon.
 

But we can get some of the code autocomplete working. This post will tell you how.
 

What we need is Netbeans 7.3 en CodeIgniter Version 2.1.3
 

Installing CodeIgniter
After you downloaded CodeIgniter, install it following these instructions. I followed these to the letter, doing what “For the best security, both the system and any application folders should be placed above web root” said. This proved to make matters complicated. I will try to point some pitfalls out.
 

Tutorial
You might want to follow the tutorial section to find out how CodeIgniter works.
 

Code Auto Complete
Early into the tutorial you will notice that auto completion doesn’t work. $this->… will throw “No Suggestions” at you. The problem is that Netbeans needs some extra configuration to get it up and running. Here is how:
 

We need to install the CodeIgniter plugin ( by Junji Takakura ) into Netbeans (optional more info: https://kenai.com/projects/nbphpci/pages/NBInstall)
 

1. Go to Tools – Plugins and select Settings tab. Then click “Add” to add the plugin. No files are needed, the plugin will be downloaded automatically.
22-05-2013 17-26-14
 

2.Put “CodeIgniter” (or something you recognize) in the name field and put the following URL in the URL text field:
https://kenai.com/downloads/nbphpci/Latest_NetBeans730/updates.xml
Click “OK”
 

3.Switch to the “available plugins” tab and search for PHP CI Framework and PHP CI Framework Repository. Check the checkbox in front of them and click “install”.
22-05-2013 17-33-19
 

4. Follow the instructions, click on continue when at the ‘validation warning’ (the following plugins are not signed:)…

 

 
So far so good. My folder structure is as follows. Note that I moved application and system out of the webroot, which in my case is “public_html”:
Source-Files
–>public_html
–>application
–>system

 
To get auto complete working, we need a (autogenerated) auto complete file. It is included in all your files, but not compiled. It’s only used by Netbeans internally so it can find the properties and methods to offer for autocompletion. In previous versions, we needed to put these in the (global) include folder. This version of the plugin does that for us, but we need to tell it where to find our application and system folders.

 

1. Right click your project and choose properties
 

2. Go to Frameworks -> CodeIgniter and check the checkbox to enable it. The click the “Add Folder” button to add the application and settings folders you have. (Note that in the screenshot I renamed them, but in your case they will be called application and system.)
22-05-2013 17-46-16
 

3. Click “OK”. If you did everything right, Netbeans automagically created a directory “autocomplete” and added it the the include path. In that directory is a file containing all the scenery code to make auto complete working, more or less like we want it.
22-05-2013 17-51-39
 

New Project
A bit off topic, but if you want to start a new CodeIgniter project, Netbeans can automatically get the files needed for the framework. To do that, we need to put the files somewhere, on a fixed place, and tell Netbeans where to find them. Here is how.
1. Download the CodeIgniter zipfile (downloads).
2. Save is some place where it can be used for all projects.
3. Tell Netbeans where it is: Go to Tools -> Options -> Choose the PHP icon on top -> Go to the CodeIgniter tab. Click “Add Zip” and browse to the zipfile containing the CodeIgniter framework.
22-05-2013 17-59-43
 

Some fine tuning
When going through the tutorial, you might find that the Auto Complete is not always working as expected.
 

For example:
When you are here ( http://ellislab.com/codeigniter/user-guide/tutorial/create_news_items.html ) to “create a newsitem” and you want to have “input” autocomplete in this line in the model:
$slug = url_title($this->input->post(‘title’), ‘dash’, TRUE);
you will find that is looks like this:
22-05-2013 18-02-02
 

This can be fixed by fiddling in the “__ci_auto_complete__.php” file. In that file you’ll note that every class, like CI_Controller, is preceded by @property statements for methods in them. You’ll notice that the list is for longer for CI_Controller than for CI_Model. The latter is missing the input method. So if you copy ” * @property CI_Input $input ” from the list on top and paste it into the list above CI_model, it will work. I’m still experimenting with this file, so I can’t tell you more.
 

If you have more tips, please add them to the comments section.

Bootstrap Datepicker format is ignored (bootstrap-datepicker)

Published by:

Well, sometimes the way they tell you how to do it, is wrong…

You make a nifty date picker, using the bootstrap-datepicker.js and you call the datepicker via javascript, something like this:

You end up having dates in “mm-dd-yy” format.

To change this to “dd-mm-yy” format, you should do it like this:

I suggest the nice people at eyecon.ro have some fixing to do. 😉 Cause they tell you to use format:… , which doesn’t work.

vSphere service console read only fstab

Published by:

If you “fstabbed” yourself on a guest operating system ( CentOS 6.3 ) running in VMware, you might be in for a surprise. After you edited the fstab ( and introduced an error ) the system won’t boot anymore.

This is the setup: A host OS that is running VMware. Two guest OS’s, on CentOS 5.3 and a CentOs 6.3
One of which I am in the process of preparing to be used with ISPConfig3. While doing that, I had to edit the fstab file. I reluctantly did that, but it later showed that the entry I put there was wrong. After a reboot of the guest OS it didn’t come back. To gain access I had to use vSphere to connect to the host. In vSphere Home->Inventory->Hosts and Clusters, I could reset the guest. Of course it didn’t boot. So I right clicked on the guest and opened the Console. This is a service console what mimics a screen. Another reset and I could see the GRUB options and the system boot. This ended in an error. I could choose between CTRL-D to continue, or enter my root password. I entered the password. Now I had access to the file system. But when I tried to edit the /etc/fstab file, it threw me an error, saying the files sytem was read-only, so I could not save the changes.

After some searching I found this page:
Bypassing Bad fstab Failure While Booting Linux

I did none of what it says, but only used this command in the service console:

Now I could open /ect/fstab for editing and I could save it. Reboot and the server was back in the air.

Hope this helps someone, because it took me a while to find out. 😛

Android : Stereo recorder for Samsung Note 2

Published by:

I have been searching for a tool that can record in stereo on the Note 2 from Samsung. This seems to be a rare feature giving developers some difficulties to efficiently implement. Especially because the Note 2 uses two separate microphones for stereo recordings.

The Samsung Note 2 (and maybe also the S3, I’m not sure) has two microphones, one on the front and another on the back. If you record video, the source of the sound is comming from both these microphones, so giving you stereo sound. But most (if not all) of sound recording apps will allow you to select one of them, both not both. Even though they advertise to be able to record in stereo, they will not allow you to bind the front mic to the right channel and the back mic to the left.

Until I found Easy Voice Recorder. ( pro version ).

Screenshot_2013-02-13-10-56-40

 
By using the “Sound input source” in the settings and selecting Camcorder microphone, the app will actually record in stereo using both microphones of your phone. The pro version gives you some extra features, worthwhile. You can choose bitrate and filetype, though mp3 is not supported — it uses AAC for compressed files.

Please post any comments or questions in the comment section below.

Bad Behavior has blocked 1393 access attempts in the last 7 days.