Wednesday, May 25, 2011

How to restart network service on Mac without reboot

If your network connection got some failure
(for instance VPN does not work) do this command in CML (Terminal):

Choice #1
sudo killall racoon

Choice #2
launchctl stop com.apple.racoon
launchctl start com.apple.racoon

Saturday, May 14, 2011

A good one Python Tutorial

Here is the simple and the best Python tutorial I have ever seen.
Won't forget this link )) http://www.tutorialspoint.com/python/index.htm

Matrix effect code in Python

Here is kind of Matrix effect of random numbers running on the screen.
If you know Matrix movie you'll understand what I'm talking about. It is my first and I hope not last try of coding on Python )).

#!/usr/bin/python

import random

start = 11
stop = 99
i = 0

def buildNumberTable(j):
        i = 0;
        list = []
        while i <= j:
                a = random.randrange(start, stop)
                list.append(a)
                i += 1;
        for b in list: print b,
print "\r"

while (i <= stop):
    buildNumberTable(66); #the parameter 66 fits to 15.4" screen if you have 13" put dif. number
    i += 1
    if i == stop:
i=0




Wednesday, May 11, 2011

How to check TABS and SPACES in NetBeans 7

In order to check Tabs and Spaces in NetBeans 7 do this:

1. Go to View tab on Top Menu.
2. Check Show Non-printable Characters

How to install GWT SDK and SmartGWT on Mac

Install GWT on Mac like this:
1. Download GWT SDK from this site http://code.google.com/intl/uk-UA/webtoolkit/download.html

2. Unzip it and move it to Applications folder on your Mac.

Install SmartGWT on Mac like this:
1. Download  SmartGWT from this site http://www.smartclient.com/product/download.jsp

2. Unzip it and move it to Applications folder on your Mac.

In Terminal set GWT_HOME and GST_HOME like this:
Open in Terminal with Vim .profile: vi ~/.profile
Add these lines:
export GWT_HOME=/Applications/gwt-2.1.1 (put here your version of gwt)
export GST_HOME=/Applications/smartgwt-2.4 (put here your version of smartgwt)
Restart your Mac and in Terminal check path to GWT_HOME and GST_HOME:
echo $GWT_HOME
echo $GST_HOME


That's all. 

Tuesday, May 10, 2011

How to Copy directory in Linux

Here is the command in Linux or Mac (in Terminal) that will make one directory to be copied into another:

cp -r one_directory other_directory.

Important add is the argument -r


Check this link about copy command in Linux.

VIM on Mac

When someone first trying VIM editor he will wondering how to finish VIM :) Here is how to do it.

HOW to save and close VIM on Mac:
Type only two characters: ZZ


Check this link for further instruction about commands of VIM.

Monday, May 9, 2011

Enter svn with username

svn --username login@domain.com list http://domain_of_repository

Install Maven (mvn) on Mac

First of all check version of Maven on your Mac with this command:
mvn --version


MacOS goes with Maven 3.0.2 preinstalled. If you will need mvn 2.2.1 go to this http://www.apache.org/dyn/closer.cgi/maven/binaries/apache-maven-2.2.1-bin.zip 
and download BINARY (!!!) NOT SRC (!!!) file of maven.


Create in ~/usr a new directory local.
Put into ~/usr/local/ this downloaded binary Maven.
Add to ~/.profile this line: 
export PATH=/usr/local/apache-maven-2.2.1/bin:$PATH


IMPORTANT!!! Reboot Mac. Then check again mvn --version and there should be maven 2.2.1.


Here is where to you should to set PATH for JAVA_HOME:


~/.profile


DON'T forget to changes properties of Maven version in IDE!
Here is example where to do it in NetBeans 7:







How to call command ifconfig in Linux CentOS

If the command ifconfig could not be found try to call this command with explicit path to it e.g.:

/sbin/ifconfig