Friday, July 27, 2012

Mac OS X Internals: A Systems Approach

If you want to know more about Mac OS X buy this book "Mac OS X Internals: A Systems Approach".

You must have it!
http://www.amazon.com/Mac-OS-Internals-Systems-Approach/dp/0321278542

Wednesday, July 11, 2012

Java Collection Set to Array


If you want to change your Set implementation to Array this is the way you can make it:

Set<String> set = new HashSet<String>();
String[] array =
set.toArray(new String[set.size()]);

Tuesday, May 1, 2012

Android: How to refer to the current activity inside of a listener.


Instead of this use YourActivityName.this where YourActivityName is the class name of your Activity subclass.
Explanation: You are creating an anonymous inner class when you use this part of your code: "new OnClickListener() {". Anonymous inner classes have a reference to the instance of the class they are created in. It looks like you are creating it inside an Activity subclass because findViewById is an Activity method. Activity's are a Context, so all you need to do is use the reference to it that you have automatically.
Refer to this link for more explanation.

Thursday, April 19, 2012

How to run GWT test with Maven

If you want to run just one test do this:

1. Go to the module where your tests live. In my case it is here:

MBPro-2:ui-common apple$ pwd
/Users/apple/Documents/workspace/svn/TRT-1##9/t0-mvn/ui-common
MBPro-2:ui-common apple$ 


2. Then run the test
mvn -Dtest=HostlistExprTestGWT test

HostlistExprTestGWT is the name of the test without its extension.

Thursday, March 22, 2012

Java and Python password generators resources

Python password generator code:
#!/usr/bin/python
import random, string
myrg = random.SystemRandom()
length = 10
# If you want non-English characters, remove the [0:52]
alphabet = string.letters[0:52] + string.digits
pw = str().join(myrg.choice(alphabet) for _ in range(length))
print pw

Java password generator resource:

import java.security.SecureRandom;
import com.Ostermiller.util.RandPass;

public class PasswordGenerater {
public static void main(String[] args) {

SecureRandom sr = new SecureRandom();
RandPass rp = new RandPass(sr);
System.out.println(rp.getPass());
}
}

Tuesday, February 28, 2012

How to set new environment variable on Mac

In order to instal on your Mac a new environment variable like HOME or PATH edit your profile file.

How to edit your profile see in this post or this one the last one is best choice.

Tuesday, February 21, 2012

Indent tool for the HTML

If you look for a tool that will check indents and etc of your HTML use HTML TIDY 

Online version: http://infohound.net/tidy/

In VIM you can use the command gg=G in order to correct your indention.

Friday, January 27, 2012

Maven Repository site with dependencies for Pom.xml

You could find the dependency you need for your Maven pom.xml on this site:
http://mvnrepository.com

Just enter in search field of Home page the library or jar you need and then you will get the list of links you can choose.


Wednesday, January 18, 2012

How to login in Linux with X11 GUI


If you want login in Linux in graphical user interface X11 start to edit the inittab:

sudo vi /etc/inittab 

Then change number 3 in this line id:3:init:default: on 5 like this id:5:init:default: 
Restart Linux. That's all.