Thursday, July 15, 2010

using codeigniter autocomplete in eclipse helios

UPDATE FOR CODEIGNITER 2


Paste the codes in /system/core/controller.php and /system/core/model.php instead.


I was able to get my eclipse autocomplete for codeignite in these two steps.

I use eclipse helios and codeigniter 1.7.2 and php5
  1. Create a new eclipse php project, choose project at existing location and choose path/to/codeigniter/system. I mean path to the codeigniter folder.
  2. edit codeigniter/Base4.php
    and insert the following before the constructor
            /**
    * @var CI_Config
    */
    var $config;
    /**
    * @var CI_DB_active_record
    */
    var $db;
    /**
    * @var CI_Email
    */
    var $email;
    /**
    * @var CI_Form_validation
    */
    var $form_validation;
    /**
    * @var CI_Input
    */
    var $input;
    /**
    * @var CI_Loader
    */
    var $load;
    /**
    * @var CI_Router
    */
    var $router;
    /**
    * @var CI_Session
    */
    var $session;
    /**
    * @var CI_Table
    */
    var $table;
    /**
    * @var CI_Unit_test
    */
    var $unit;
    /**
    * @var CI_URI
    */
    var $uri;
    /**
    * @var CI_Pagination
    */
    var $pagination;

Save it and you're done. Try using the autocomplete and if it doesn't show, force it by pressing Ctrl-Space.

Friday, June 4, 2010

A simple Calculator using Go Language with go-gtk

SCREENSHOT


You need to have Go and go-gtk installed.

You can install Go here

For go-gtk, download the source here, navigate to the directory and 'make example'.

Full source code of the calculator is available here.








Friday, April 23, 2010

gostrutils

gostrutils is a package for the Go programming language with StringTokenizer and StringBuffer similar to the ones in java.

project site is code.google.com/p/gostrutils.

Monday, April 12, 2010

gopages - my simple web framework for Go Programming Language

I'm used to php way of coding web pages where you embed your codes in <?php ?> tags. So I'm trying to emulate such feature in Go with gopages.



You can visit the project home at http://code.google.com/p/gopages.

All comments are welcomed.

Thursday, April 8, 2010

Compact Diary

Compact Diary is available for download at project site .

Just like the name, it is a password protected diary where you can store your daily toughts.

You can even publish to blogger with it.

You can check it out.

Ubuntu 10.04 LTS

Ubuntu 10.04 LTS beta 1 was released some days ago and I've been really impressed with everything, the theme, the booting speed and better performance with my ATI graphic card. But the only thing I missed is the absence of GIMP but it can still be installed with synaptic or apt-get.

My wireless wasn't recognised after installation but was fixed by just installing the bcmwl-kernel-source using synaptic and the 10.04 cd or iso as the repository.

Can't wait for the stable release








Friday, April 2, 2010

Google provides Protocol Buffers for Go Lang

Google Go Programming Language that was released last November has really impressed me and others worldwide if u've been monitoring it.

But the inclusion of the Protocol Buffer Library is a boost for people like me who prefers serializing to other technologies like XML. I believe I will have cleaner syntax with less lines of code compared to using XML.

For those interested in using Protocol Buffers with Go Lang, visit this link or if you prefer using it with other languages like Java, Python and C++, visit the project homepage here.


The simplest way to describe this is to see an example. Given file test.proto, containing


package example;

enum FOO { X = 17; };

message Test {
required string label = 1;
optional int32 type = 2 [default=77];
repeated int64 reps = 3;
optional group OptionalGroup = 4 {
required string RequiredField = 5;
};
}


The resulting file, test.pb.go, is:


package example

import "goprotobuf.googlecode.com/hg/proto"

type FOO int32
const (
FOO_X = 17
)
var FOO_name = map[int32] string {
17: "X",
}
var FOO_value = map[string] int32 {
"X": 17,
}
func NewFOO(x int32) *FOO {
e := FOO(x)
return &e
}

type Test struct {
Label *string "PB(bytes,1,req,name=label)"
Type *int32 "PB(varint,2,opt,name=type,def=77)"
Reps []int64 "PB(varint,3,rep,name=reps)"
Optionalgroup *Test_OptionalGroup "PB(group,4,opt,name=optionalgroup)"
XXX_unrecognized []byte
}
func (this *Test) Reset() {
*this = Test{}
}
func NewTest() *Test {
return new(Test)
}
const Default_Test_Type int32 = 77

type Test_OptionalGroup struct {
RequiredField *string "PB(bytes,5,req)"
XXX_unrecognized []byte
}
func (this *Test_OptionalGroup) Reset() {
*this = Test_OptionalGroup{}
}
func NewTest_OptionalGroup() *Test_OptionalGroup {
return new(Test_OptionalGroup)
}

func init() {
proto.RegisterEnum("example.FOO", FOO_name, FOO_value)
}


To create and play with a Test object:

package main

import (
"log"

"goprotobuf.googlecode.com/hg/proto"
"./example.pb"
)

func main() {
test := &example.Test {
Label: proto.String("hello"),
Type: proto.Int32(17),
Optionalgroup: &example.Test_OptionalGroup {
RequiredField: proto.String("good bye"),
},
}
data, err := proto.Marshal(test)
if err != nil {
log.Exit("marshaling error:", err)
}
newTest := example.NewTest()
err = proto.Unmarshal(data, newTest)
if err != nil {
log.Exit("unmarshaling error:", err)
}
// Now test and newTest contain the same data.
if proto.GetString(test.Label) != proto.GetString(newTest.Label) {
log.Exit("data mismatch %q %q", proto.GetString(test.Label), proto.GetString(newTest.Label))
}
// etc.
}