2012 in review

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

600 people reached the top of Mt. Everest in 2012. This blog got about 3,000 views in 2012. If every person who reached the top of Mt. Everest viewed this blog, it would have taken 5 years to get that many views.

Click here to see the complete report.

Thanks to all the people who came to see my blog, I’ll try to post more and things that are even more interesting, happy new year πŸ™‚ .

Some tips in Java

You are programming in Java and you want to know some simple but new things? So read this post and maybe you’ll know some new things πŸ™‚ .

The first tip is about the focus. What is a focus? If you have a JTextField and you want to have the cursor automatically activated in it when you open the window, you put a focus. Here is the code :


jtf.setFocusable(true);

SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
jtf.requestFocus();

}

});

pan.setVisible(true);

Here the JTextField name is jtf and you have to do this like this if you want to put the pan.setVisible(true); after the focus (for example if you want to put the “visibility” at the end of the code).

Now you have a grid of buttons and you want to know which one is clicked. It’s very simple, you just have to set a name to your buttons :


JButton[][] myGrid = new JButton [10][10];

for(int i = 0; i < myGrid.length; i++ ) {
for(int j = 0; j < myGrid[0].length; j++ ) {
myGrid[i][j] = new JButton();
myGrid[i][j].setSize(30,30);
myGrid[i][j].setBackground(Color.BLUE);
myGrid[i][j].setLocation(50+30*i,80+30*j);
myGrid[i][j].setName("" + i + j);
pan.add(myGrid[i][j]);
}

}

Here I put the name with myGrid[i][j].setName("" + i + j); and the name will be 00 for the first button and so on. And now if you want to have the name, you must do this in a listener :


String name = ((JButton) ev.getSource()).getName();

int a = name.charAt(0)-48;
int b = name.charAt(1)-48;

And here you have the name and you can use it as you want.

A last very little tip (it’s pretty sure you already know it), how to unactivate a button. It’s very simple, when you’ve created your button, just put this :


button.setEnabled(false);

You have to change button with the name of your button.

It’s the end of this post. If you have any question, feel free to ask. Hope it will help you and I’ll try to make an other post about tips in Java.

How to run little java programs in MobileTerminal

Here is a new little tutorial that shows you how to run littles Java programs in MobileTerminal.

Needed for this tutorial :

  • A jailbroken iDevice
  • MobileTerminal installed on it

First, go in Cydia. Be sure to have the developer “profile” turned on (Manage –>; Settings –>; Developer). Now, you have to search this :

  • iPhone/Java (it will install others needed packages).
  • Jikes.

20121229-011323.jpg

20121229-011331.jpg

Just install these packages. Now, you have to do a Java file. For example, you can just type this in the file (name it test.java in this case) :

public class test{
public static void main (String args[]){
System.out.println("Hello World!");
}
}

You can do it on your iDevice if you have iFile or any other file manager or you can do it on your computer and then transfer it with iFunBox (in this tutorial, I put the file in /var/mobile).

Now that you’ve made all what is written, open MobileTerminal. Type jikes test.java -cp /usr/lib/rt.jar (or the name_of_your_file.java).

20121229-011743.jpg

Type on the “return” button. You have now to type java test (or the_name_of_your_file), just type one more time on the “return” button, wait a bit and it will show the message πŸ™‚ .

20121229-011845.jpg

If you have any tip or problem, you can post a comment πŸ˜‰ .

MobileTerminal, some commands

You have a jailbroken iDevice and you have MobileTerminal installed on it? So read this post to learn (if you don’t already know what I’ll explain) some things that are important when you use MobileTerminal.

 

MobileTerminal

 

If you want to download it, you can download here.

Once you’ve downloaded it, you can put it in the autoinstall folder of Cydia or put it in a random folder and install it via iFile (if you have it).

Now you’re ready to use MobileTerminal. The first thing to do is to change the root password. So type :

suΒ  orΒ  su root

Then, type the default password : alpine (you won’t see what you type, it’s normal).

To change this password, type passwd . Now type your new password and you have to retype it. Now you’ve changed it.

We will see some commands.

killall Terminal : it closes the Terminal app.
killall SpringBoard or respring : it does a respring.
reboot : it does a reboot.
help : it shows you some help.
dir : it lists the directory files.
cd or cd ~ : it goes to the home directory.
cd /directory name : it goes to the directory name you type.
apt-get update : it updates the Cydia packages (like in Cydia).
apt-get upgrade cydia : it installs any upgrade that is availible for you packages on Cydia.
apt-get install cydia : it installs the latest version of Cydia if it isn’t installed.
apt-get autoclean : it cleans up files if it’s needed.
apt-get autoremove : it removes unused or broken files.
apt-get -fix-missing : it checks if there’s some files missing and it fixes it.
dpkg -list>packages.txt : it creates a list of the installed packages in Cydia.
dpkg -i packageID : it installs .deb files (you have to change packageID with the name of the package you have).
dpkg -r pacakgeID : it uninstalls a .deb file installed (you have to change packageID with the name of the package you want to uninstall).

I will make at least one other post about MobileTerminal as soon as possible πŸ™‚ .

ActiSearch, search in Cydia, Twitter, Facebook and others

I’m presenting a tweak that is very usefull and which was made by iMast777.

20121216-100320.jpg

With this tweak you can search in multiple differents websites, like Twitter, Facebook, Wikipedia, Yahoo, Baidu, eBay, Google, YouTube and Cydia.

If you search in any website, it will open in Safari, but if you search in Cydia, it will open in the Cydia app.

20121216-100214.jpg

20121216-100240.jpg

20121216-100247.jpg

20121216-100259.jpg

20121216-100306.jpg

20121216-100312.jpg

You can purshase ActiSearch on the ModMyi repo on Cydia for only 0.99$.