Tuesday, May 24, 2011

Javascript: converting string to uppercase and lowercase

// to lowercase  
var sometext=”This is some text.”;
var casechanged=sometext.toLowerCase();


// to uppercase 
var sometext=”This is some text.”;
var casechanged=sometext.toUpperCase();


Source:
http://www.developertutorials.com/tutorials/javascript/javascript-lower-case-upper-case-051019-1020/

Javascript window.open : opening a new window and call a URL

function open_new_window(URL)
   {  
   NewWindow = window.open(URL,"_blank","toolbar=no,menubar=0,status=0,copyhistory=0

                                                    ,scrollbars=yes,resizable=1,location=0,Width=1500,Height=760") ;
   NewWindow.location = URL;
   }


open_new_window('http://www.google.com');

Reference:
http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

Thursday, May 19, 2011

Comments in .ini file


Use ";" :

[http]
server.socket_host      = localhost
server.socket_port      = 10005
server.thread_pool      = 256
socket.queue_size       = 10 ; some comments
server.environment      = production        ; some comments
tools.encode.on         = True ; some comments
tools.decode.on         = True
;tools.gzip.on           = True ; some comments and commented parameter
;log.screen              = False ; some comments and commented parameter
[mail]
serveraddress = 172.16.9.8
smtp          = 172.16.9.8:25
pop3          = 172.16.9.8

References:
http://www.autohotkey.com/forum/topic40720.html
http://en.wikipedia.org/wiki/INI_file

Wednesday, May 18, 2011

Java: convert array of integers to Integer Array List an viceversa

//  convert array of integers to Integer Array List
public ArrayList<Integer> convertToIntegersArrayList(int[] mensaje)
    {
        ArrayList<Integer> returnArray = new ArrayList<Integer>();      
        for (int i=0; i < mensaje.length; i++)
        {
            returnArray.add((Integer)mensaje[i]);
        }
        return returnArray;
    }

//  convert  Integer Array List  to array of integers
public int[] convertToArrayOfIntegers(ArrayList<Integer> integers)
    {
        int[] ret = new int[integers.size()];
        for (int i=0; i < ret.length; i++)
        {
            ret[i] = integers.get(i).intValue();
        }
        return ret;
    }

Java: comparing chars

String messageText = "test";
char lastChar = messageText.charAt(messageText.length()-1);

if(lastChar!='e' && lastChar!='s' ){
      System.out.print("the last char is different of e and s , it's : "); // the last char is different of e and s , it's :
      System.out.println(lastChar); // t

}


Reference:
http://answers.yahoo.com/question/index?qid=20080914170215AAmVQQt

Java : get last char from String

String messageText = "test";
char lastChar = messageText.charAt(messageText.length()-1);
System.out.println(lastChar); // t

Reference:
http://download.oracle.com/javase/tutorial/java/data/manipstrings.html

Tuesday, May 17, 2011

Burning iso Images on Windows 7

1. Right click on the .iso file
2. Open with... > Windows Disc Image Burner.
3. Insert yout CD/DVD on your drive
4. Click on "Burn" button.

Wednesday, May 11, 2011

Ubuntu: installing java

- Install java JDK and JRE
apt-get install sun-java6-jdk sun-java6-jre

Do you want to continue [Y/n]? y
Get:1 http://my.archive.ubuntu.com hardy/main java-common 0.28ubuntu3 [78.2kB]
Get:2 http://my.archive.ubuntu.com hardy/multiverse sun-java6-jre 6-06-0ubuntu1 [6334kB]
Get:3 http://my.archive.ubuntu.com hardy/main odbcinst1debian1 2.2.11-16build1 [66.2kB]
Get:4 http://my.archive.ubuntu.com hardy/main unixodbc 2.2.11-16build1 [289kB]
Get:5 http://my.archive.ubuntu.com hardy/multiverse sun-java6-bin 6-06-0ubuntu1 [27.3MB]
Get:6 http://my.archive.ubuntu.com hardy/multiverse sun-java6-jdk 6-06-0ubuntu1 [9625kB]
85% [6 sun-java6-jdk 3208002/9625kB 33%]

- The final instalation directory is  /usr/lib/jvm/java-6-sun-1.6.0.06
- Ubuntu help to create a java symbolic link and put in /usr/bin for shortcut access
- type java -version to verify.

Post-Installation Setup

Set JAVA_HOME into environment variable

Copy following statement and append to the end of /etc/profile or .bashrc file, make system set JAVA_HOME into system environment variable:

export JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.06"

Source:
http://www.mkyong.com/java/how-to-install-java-jdk-on-ubuntu-linux/

Tuesday, May 10, 2011

Eclipse subversion error : 'Repository moved permanently' Visual SVN

This message means that you are using invalid repository URL. VisualSVN Server repository url looks like http://servername/svn/repos/path. I recommend you to use Copy URL command in VisualSVN Server Manager to get right URL.

Source:
http://serverfault.com/questions/80724/how-to-fix-repository-moved-permanently-to-using-visualsvn-subversion

Monday, May 9, 2011

Useful guide to install python 2.5 on Ubuntu 10.04


sudo apt-get update
sudo apt-get install build-essential gcc


cd Downloads
wget http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz
tar -xvzf Python-2.5.6.tgz
cd Python-2.5.6
./configure --prefix=/usr/local/python2.5
make
make test
sudo make install
sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5 


Reference:
http://welcometoubuntu.blogspot.com/2010/05/howto-install-python-255-on-ubuntu-1004.html

Ubuntu 11.04: finding the "Connect to server" option

Open the file browser, and when it's opened, go to the top where it says "home folder" and go to file -> Connect to server

Source:
http://ubuntuforums.org/showthread.php?t=1750656

Ubuntu 11.04 64bits : install adobe flash player

Objectice C: Change data of NSarray

NSMutableArray *tableContent = [[NSMutableArray alloc] initWithObjects:
                    [NSMutableArray arrayWithObjects:@"a",@"b",@"c",nil],
                    [NSMutableArray arrayWithObjects:@"d",@"e",@"f",nil],
                    [NSMutableArray arrayWithObjects:@"g",@"h",@"i",nil],
                     nil];

[[tableContent objectAtIndex:0] replaceObjectAtIndex:1 withObject:@"new object"];

Source:
http://stackoverflow.com/questions/2088679/objective-c-accessing-changing-array-elements-in-a-multidimensional-array-nsar

Wednesday, May 4, 2011

Iphone Modal View

Here is an excellent guide to implement a Model View:

http://useyourloaf.com/blog/2010/5/3/ipad-modal-view-controllers.html

objective C: convert from int to string

 
int numberYouAreTryingToConvert = 5;
NSString* convertedNumber = [NSString stringWithFormat:@"%d"
                                      ,numberYouAreTryingToConvert];
 
Reference:
http://stackoverflow.com/questions/1104815/how-to-...-example-code

Ubuntu 11.04 And Windows 7 Installation Steps

Total Disc Capacity 298,09GB

This is the desired distribution :
 - 100GB (Windows 7)
 - 100GB (SharedDisc)
 - 98,09 (Ubuntu11.04)

1. Resize you Windows (C:) partition to 100gb using ComputerManagement > Storage > DiscManagement
2. Run the ubuntu liveCD on the option "Run Ubuntu" and using "gparted":
    2.1 Create an 198,09GB extended partition
    2.2 Inside the recently created extended partition: create another 100GB NTFS logical partition called SharedPartition.

3. Run the ubuntu liveCD on the option "Install Ubuntu" and follow the instructions:
    3.1 On the "allocate drive space"screen select "Something else".
    3.2 Create the swap partition i.e. 4096MB
    3.3 Create the ext4 partition with the free space left with "/" mount point
    3.4 Click on "install now"

References:
http://www.datanoia.com/tutorial-como-instalar-ubuntu-9-04-sin-formatear-windows.html
http://www.killertechtips.com/2009/05/05/how-to-resize-partitions-in-windows-7/