Friday, December 9, 2011

UML free drawing programs for Mac

Some of my colleagues developers use these programs for UML drawing:

First of all, try this UML drawing application ONLINE:
http://www.diagram.ly/

DIA http://projects.gnome.org/dia/
ArgoUML http://argouml.tigris.org/ (the most popular, but some say it is for a geeks)
MagicDraw https://www.magicdraw.com/ (those who think ArgoUML is for a geeks wants try this one)

Just use ArgoUML, that's it ))

Monday, December 5, 2011

Friday, November 25, 2011

How to use AppleScript menu lets

Check this link if you want to know about how to use AppleScript menulets, http://www.geekymac.com/?p=216
I'm going to add some comments later on this subject.

Friday, November 11, 2011

How to use Eclipse plugin for Maven

Read this post:
http://googlewebtoolkit.blogspot.com/2010/08/how-to-use-google-plugin-for-eclipse.html

Wednesday, November 9, 2011

Monday, November 7, 2011

How to add CODE block to Blogger post

If you want to add some code snippet to your post on Blogger just copy code snippet you need and go to this site http://www.simplebits.com. It has tools that will configure your snippet  (it will change some signs).


How to hide and show div block with Javascript

1. Javascript
Add to the header the script that will hide/show div you need

<script language="JavaScript">
    function toggle(id) {
        var state = document.getElementById(id).style.display;
            if (state == 'block') {
                document.getElementById(id).style.display = 'none';
            } else {
                document.getElementById(id).style.display = 'block';
            }
        }
</script>

2. CSS
In order to hide your div at the beginning add this to your CSS style:

#div1 {
        display:none;
}

HTML
In your HTML add hyperlink that will trigger the script for the id with the specific name:

<a href="#" onclick="toggle('div1');">Your text is here</a>

<div id="div1">
The content of this div will be hidden or shown after click on the link above.
</div>

Thursday, November 3, 2011

Tuesday, November 1, 2011

How delete all data from MySQL table

There are two ways to delete all the data in a MySQL database table.

TRUNCATE TABLE tablename; This will delete all data in the table very quickly. In MySQL the table is actually dropped and recreated, hence the speed of the query. The number of deleted rows for MyISAM tables returned is zero; for INNODB it returns the actual number deleted.

DELETE FROM tablename; This also deletes all the data in the table, but is not as quick as using the "TRUNCATE TABLE" method. In MySQL >= 4.0 the number of rows deleted is returned; in MySQL 3.23 the number returned is always zero.

Read more about it in this post:

How to list all tables in MySQL

If you want to see all tables created in your DataBase list them using this commands:

1. Enter to your DB
mysql db; (where db is the name for your DataBase)

2. Type
show tables;

How to reorder or rename logical interface names in Linux

Here is the link where you can read about this topic.
http://www.science.uva.nl/research/air/wiki/LogicalInterfaceNames

How to change permission in Linux

If you want to change the permission for some files or directories in Linux do this:


sudo -s
cd /dir1
find dir1/ -type f -perm 555 (if you just want to see that files)

find dir1/ -type f -perm 555 -exec chmod 644 {} \;
find dir1/ -type d -perm 555 -exec chmod 755 {} \;
ls -l

Wednesday, October 26, 2011

How to create TGZ archive with TAR

First of all: extension *.tar is the as tar.gz

Create tgz Archive with this command:
tar -cvzf newArchive.tgz sourceFileOrFolderNameForArchive


What is -cvzf:
c - "create" it means you want to create this archive
- "verbose" if you want to see the process... it shows details about the results of running tar.
- "zip" it means you want to compress file. tar will use the `compress' program.
- "filename" it means you  want to name archive with the specific name.

If you want to read the TAR manual in Terminal type in Terminal man tar
Or read this here http://ss64.com/bash/tar.html

TextWrangler is the Python Free Editor for Mac

TextWrangler is a good free Python Editor for Mac made on the base of TextEdit.
TextWrangler knows how highligh the syntax of Python (Simultron don't) etc.

The link for download of TextWrangler is this http://www.barebones.com/products/textwrangler/download.html

Open files from the Terminal with the appropriate application


open foo.jpg

open -a Preview foo.jpg

open -a "Adobe Photoshop 10.0" foo.jpg

Refer to this link http://hints.macworld.com/article.php?story=2004012218171997

Tuesday, October 25, 2011

eclipse error unbound classpath variable m2_repo

Everything was great until I changed workspace in Eclipse for other directory. When I opened th project I've got a bunche of errors "unbound classpath variable m2_repo". In this case do this:

1. Go to Preferences/Java/Build PAth/Classpath Variables
2. If there is no such variable as M2_REPO - add it (press New...)
3. Ussually a correct path for this variable is ${user.home}/.m2/repository

That's all.

How to extract *.tgz archives on Mac

If you need make archive *.tgz etc use a good wrapper archiver application for Mac - GUI Tar. It could execute complicated UNIX operations of Extracting and Compressing files.

Here is the link for download http://www.macupdate.com/app/mac/14503/gui-tar

How to login to the new Dynamic view of Blogger

I've changed view of my blog iPaniov.blogspot.com for a new dynamic view which I really like it, but there is no way to login. I spent some time until I understood that this view is for READERS only, so this why there is no login form. So in order to login to your blog on bloodspot.com you should go to the Blogger.com and do login there. Only this way you will be able administrate your blog.

I think there is the lack of clarification about this from the part of Google.

Monday, October 24, 2011

Top 10 Programming Fonts

This is the list of Top 10 Fonts for Programming:

1. INCONSOLATA (free) it is similar to TheSansMono. Author Raph Levin
2. CONSOLAS (comercial) from Microsoft
3. DEJA VU SANS MONO (download) Deja Vu font family
4. DROID SANS MONO (download) the best for Android
5. PROGGY (download)
6. MONOFUR (download) I think this is not the best choice as for me
7. PROFRONT (download) it is too small
8. MONACO is the default monospace font on the Mac
9. ANDALE MONO
10. COURIER all systems ship with a version of Courier

Some of my colleagues argued for other fonts e.g.:
* UBUNTU MONO (download)
* VERDANA all systems ship with a version of Verdana (for sure in Mac)

For more details and examples refer to this post "Top 10 Programming fonts":

Monday, October 3, 2011

How to copy whole directory with SCP

If you want to copy whole directory with scp command just add -r flag like this:
scp -r source-directory-path destination-directory-path

How to get files to your local Mac Desktop from remote server

In order to get files to your local Mac Desktop from remote server do this:


1. Make sure your VPN is working;
2. Use this command in Terminal:
scp root@ip-addres:/root/dir1/dir2/t0backend/dist/mw.rpm \~/Desktop/Icinga_rpms/

If you want to send some files from your local Mac Desktop to some OS (e.g. Linux) on DevVM do this:

1. Make sure your VM is running;
2. Use this command in Terminal:
scp ~/Desktop/Icinga_rpms/mw.rpm \devvm@192.168.188.130:~/Desktop

Thursday, September 29, 2011

What is Symbolic link and Hard Link and how to create it on Mac

Symbolic link is the one file on your file system (FS) that holds in itself only one string that is the link to the specific file/directory/archive/etc in your FS.
Hard link is also some file that holds link on some file, but it should be one file on the same partition (and only a file, not a directory or anything else).

In order to create the Symbolic link go to the Terminal and use this command:
ln -s source_file file_name

Notice that file_name will be created even if source_file is not exist yet.

You can check this topic in wikipedia: 

Wednesday, September 28, 2011

How to figure out in Terminal the process on a specific port

In order to figure out the current process on a specific port use this command (for example ports 8888 and 9997):


lsof -w -n -i tcp:8888
kill -9 enter here the PID


lsof -w -n -i tcp:9997
kill -9 enter here the PID

How to set MAKE command on Mac

Actually, the MAKE command should be already installed on your Mac if you have Xcode installed. But in my case MAKE have been disappeared after update from Snow Leopard to Lion OSX. By some reason PATH to MAKE was changed. So what you need to do in this case in order to make MAKE available - fix PATH e.g:

Apples-MacBook-Pro:t0-mvn apple$ make
-bash: make: command not found
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/
.DS_Store                    Documentation/               Icon^M                       SDKs/
About Xcode and iOS SDK.pdf  Examples/                    Library/                     Tools/
About Xcode.pdf              Extras/                      Makefiles/                   usr/
Applications/                Headers/                     Platforms/                   
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/usr/
X11/          etc/          lib/          llvm-gcc-4.2/ sbin/         
bin/          include/      libexec/      local/        share/        
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/usr/bin/
Display all 173 possibilities? (y or n)
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/usr/bin/ma
make            malloc_history  mapc            
Apples-MacBook-Pro:t0-mvn apple$ ls /Developer/usr/bin/make 
/Developer/usr/bin/make
Apples-MacBook-Pro:t0-mvn apple$  /Developer/usr/bin/make 
make: *** No targets specified and no makefile found.  Stop.
Apples-MacBook-Pro:t0-mvn apple$ export PATH=$PATH:/Developer/usr/bin/
Apples-MacBook-Pro:t0-mvn apple$ make
make: *** No targets specified and no makefile found.  Stop.


Then you probably will want to change your PATH variable in your profile configuration. Do this:


$ vi ~/.profile


////
export PATH=/opt/subversion/bin:$PATH:/Developer/usr/bin

Thursday, September 22, 2011

Where profile located on your Mac OSX

If you want to view/edit profile settings on your Mac try do this:
Open Terminal and execute this command:
vi ~/.profile

Sunday, August 21, 2011

What the difference in cunstruct String instance with and without new keyword

There are two different approach of how to create a new String instance. The first one uses keyword new, the second one without new.

For example:

String a = "Iron Man";
String b = new String("Andre");

There is a slight difference between these two approaches, and it is related to String pool memory. In the example above the first variable "a" will be created in string pool memory, and second "b" will be created in "non-pool" memory. Read more about this in linked post below:

Inheriting Java: Chapter 32: The String Class

About memory leak with substring() in class String

I've found a good post about memory leak that may happen during use of method substring() in class String.

Friday, July 22, 2011

If you want to buy ticket to USA and etc

Here is the one of the best site if you gona to buy tickets for airplane:

expedia.com

Tool for Drawing the diagrams

One of the best tool for drawing a diagrams is MagicDraw UML, here is the link.

How to list WS logs

/var/log/xyratex/wsgi_access.log
less ws... (-- log SOAP requests)

Wednesday, July 20, 2011

How to Skype with Privatbank in Ukraine

In order to Skype with PrivatBank.ua operator click icon of envelope (see screenshot) and then icon of Skype. That's it. Today (July 2011) I tried to skype with privatbank this way and I was frustrated, because click on this link opened for me window for "Download Skype", but not for making a call... oops...

Tuesday, July 19, 2011

Sunday, July 17, 2011

How to add JARs file to Eclipse

To be brief on it: if you want to add JAR file to Eclipse project do it trough adding it into Properties/Build Path/Libraries/Add JARs:

 If you want to know the different ways to add JARs file to your project in Eclipse check this link.

Friday, July 1, 2011

RESTful Web Services

What is RESTful Web Services?

Shortly it is REpresentational State Transfer (REST).

More about REST read this article.

Wednesday, June 29, 2011

Mysql commands

Show mysql td table process_stage
select * from process_stage;

Change the process stage
update process set stage_id = 7, process_type_id = 1;

How to skip tests in maven

Here is the command that excludes tests during mvn package:

mvn -Dmaven.test.skip=true package


or


mvn package -DskipTests


Consult this example from appach site: http://maven.apache.org/plugins/maven-surefire-plugin/examples/skipping-test.html


Thursday, June 23, 2011

How to get IP of Mouse

This command will get IP of Mouse:

nodeattr -c mds=secondary

How to start nodes on cluster from terminal

Check the state of all nodes on cluster:

[admin@client5544-oem ~]$ pm -q
on:      
off:     ssltest[00-05]
unknown:

Here all 6 nodes turned OFF. Now we now its name and we should turn it ON:

[admin@client5544-oem ~]$ pm -1 ssltest[00-05]

Now check the state of all nodes on cluster again:

[admin@client5544-oem ~]$ pm -q
on:     ssltest[00-05]    
off:
unknown:

Done

Links to examples of how to use Vector class in Java

Java class Vector example link #1:

http://webcache.googleusercontent.com/search?q=cache:R0E18-chhhoJ:www.roseindia.net/java/beginners/vectordemo.shtml+vector+java+example&cd=1&hl=ru&ct=clnk&client=safari&source=www.google.com


Java class Vector example link #2 (it is a bad example - anonymous constructor is written with small letter):



Java class Vector example link #3:

All links are results of the Google search, yep... that way )

Thursday, June 16, 2011

What is SAS and SSD disk

SAS stands for Serial Attached SCSI
SAS drive utilizes the same form factor as a SATA drive but has several high performance advantages. While typical SATA drives operate at 7200RPM, a SAS drive operates at 10000RPM or 15000RPM.
SAS drives are typically utilized in server and high-end workstation environments where speed and I/O frequency reign supreme.

SSD stands for Solid State Drive.
Two of SSD can be used in a RAID 0 (Redundant Array of Inexpensive Disks) for the boot and applications drive, but then for scratch disks/additional storage, would be good to have 3-5 or more SAS drives in a RAID 5 (best mix of redundancy and speed, with the addition of parity).

Where stability is concerned, the drives must be properly paired. If drives in a RAID array are not properly matched by Firmware version, the odds are that at least one of the drives will fall out of the array within the first year. Depending on the type of array chosen, this could simply mean the company has to foot the bill for higher hardware costs, or be as bad as catastrophic data loss.

The full post on this topic is here. Read comments as well.


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

Tuesday, April 5, 2011

Monday, April 4, 2011

Irregular Verbs

Это линк на страничку неправильных глаголов в английском языке.

Thursday, January 27, 2011

Linux commands to be reminded

LINUX
su - зайти под другим пользователем (пример: su devvm)
cat - создать новый файл с содержанием
touch - создать пустой файл
rm -rf - удалить (-r рекурисвно, -f принудительно)
vi /etc/inittab Что бы загрузиться в графическом интерфейсе надо поменять id:3:init:default: на id:5:init:default: цифра 5 указывает на уровень загрузки в графической оболочке X11


ps -x | grep safari Вывод процесса программы Safari (kill safari - посылает команду на завершение)
chmod +x netbeans-6.9.1-ml-linux.sh Установка инсталера для NetBeans (шаг 1)
./netbeans-6.9.1-ml-linux.sh Установка NetBeans (шаг 2)

vi editor
a - перейти в режим редактирования
esc - возвращает в режим просмотра

:wq - сохранить (записать) и выйти из vim (visudo)
:q! - выйти без изменений
Остальные подсказки по этому текстовому редактору смотреть ЗДЕСЬ.

настройка NS сервера
vi /etc/resolve.conf (nameserver присваивается DHCP. Если IP static, можно менять).
service network restart
system-config-network
sudo ifconfig eth0
vi /etc/hosts
nslookup google.com.ua
chattr +i /etc/resolv.conf делает содержание файла immutable
chattr -i /etc/resolv.conf отменяет команды immutable
Остальные подсказки (видео) по настройке NS сервера ЗДЕСЬ.

SVN
svn list http://domain/WW/Trinity/ проверяет содержание директорий
svn co http://domain/WW/Trinity/ делает чекаут (checkout/co) директорий
svn commit дает команду на обновление измененных файлов


svn copy http://www-site-com/WW/Trinity/trunk
         http://www-site-com/WW/Trinity/branches/TRT-322 \
         -m "TRT-322 Creating a private branch of trunk"


svn delete http://www-site-com/WW/Trinity/branches/TRT-322
         -m "TRT-322 Removing obsolete branch from the repository"



A Short SVN Tutorial ЗДЕСЬ и ЗДЕСЬ.

CAT
ctrl + D выйти из CAT (курсор должен быть на пустой строке)
Остальные подсказки по CAT ЗДЕСЬ.

PING
ping -c 4 paniov.com Если не указать в параметре команды Ping количество пингов (в данном примере я поставил -c 4 (-c от слова count)), она будет продолжать пинговать пока ей не дадут команду стоп.
ctrl + c (или delete) Эта команда останавливает в консоле процесс ping.



Wednesday, January 26, 2011

Single user mode with GRUB: how to login in Linux in Single mode and change password of root in Linux

Single user mode in GRUB Linux / change root password:

1. During the start press esc
2. Choose the parameter of the booting
3. Type "a"
4. Write at the end of the sentence "single"
5. Reboot
6. After Linux reboot the last line will be something like this: sh-3.2#
7. Type "chsh" (i.e. change shell)
8. You will see the line with this text:
            Changing shell for root
     New shell [/bin/bash]:
9. Type the new path to the shell: /bin/sh
10. Call for changing root password with the command: passed root
11. Type the new password and confirm it
12. Reboot Linux and login with the new password


А теперь то же самое на русском ))
1. При рестарте надо успеть нажать esc.
2. Выбрать параметр загрузки;
3. Нажать "а";
4. Дописать в конце строки "single";
5. Перезагрузиться;
6. Линукс загрузится, последней будет строчка: sh-3.2#
7. Ввсести в строке: "chsh"; (означает change shell)
8. Появятся строчки: Changing shell for root (1 первая строчка); New shell [/bin/bash]: (2 строчка)
9. Ввести новый путь к shell: /bin/sh
10. Запросить смену пароля рута: passwd root;
11. Ввести новый пароли и подтвердить его, например USXy___tex;
12. Перезагрузиться и зайти под новым паролем.