Tuesday, December 13, 2011

The great convert tool of ImageMagick

It's of those days where you are just wondering why you are failing to program as usual. Your mind is sleepy, your thinking slow. While drinking a cup of coffee in order to awake your brain (even if you know that in such situations coffee just fails) you listen something not so important (as most things sound at the beginning). "I have a large pdf file how do I reduce its size?".
(I want to inform you now that this article is not about pdf resizing).
Then, as the coffee sinks in, along with this words, there is another question on the horizon. Can you reduce anything without losing something? Of course not. Anyway, that's not my point.

I decided to try and find how to do that, with linux, using scripts. After a couple of google searches I found ghostscript. It was quite a fail, since the pdf was at its minimum size that ghostscript could convert, so it made it bigger.

Then, I looked at my pictures. I always do this when I fail to find a solution for something. Great images, with high resolution. Hang on! What about making every pdf page as a jpg file and then reducing the resolution of those images, and after that putting all these images back as pdf pages?

If you have the knowledge of a normal user this could mean hours of work, especially if pdf has 100 pages. Imagine having at the end another bigger pdf file.

So, I realised that it was a lot of work. What about using a script to do that? Here it comes the convert of ImageMagick!

I might failed to find an optimised solution for the pdf problem, but I've found a great tool! Convert is a terminal program created by ImageMagick that can convert any image file into another by user's will. In addition, it is open source, written in C.

You can reduce your size of your images, transform them, skew them, flip them, change colours with mapping and more more advance image things! It's like having photoshop in a small program, without the heavy brashes and tools. Type the commands, you have your image converted. Just visit man pages on your linux. Or visit  http://www.imagemagick.org/script/convert.php to download a version with GUI or for a different operating system.

For the story, I used this to convert my pdf:
convert input.pdf -scale 500 output.pdf
And got a smaller file with a terrible resolution.
Anyone knows anything about it?

That's a story about how something irrelevant results to an exploration of another irrelevant thing (but useful).

So, even if you are going to fail, never mind, explore! Even if it's pangolins! :)

Monday, November 14, 2011

Computer Synesthesia

Synesthesia (also spelled synæsthesia or synaesthesia, plural synesthesiae or synaesthesiae), from the ancient Greek σύν (syn), "together," and αἴσθησις (aisthēsis), "sensation," is a neurologically based condition in which stimulation of one sensory or cognitive pathway leads to automatic, involuntary experiences in a second sensory or cognitive pathway. People who report such experiences are known as synesthetes. (http://en.wikipedia.org/wiki/Synesthesia)

Here, we are going to illustrate Synesthesia as a situation where a person (in this case the computer) hears images. I.e. instead of seeing them, the pathway goes from the eyes to the part of the brain that understands sounds (or something like that :))

How is it like to hear images? Let's hear one.

You have to have this tools:
A linux distribution
The pacat program (check if you have it, otherwise install it)
A little C (so we need gcc compiler)

Here is the code for reading a file. We are going to use it to read image files:

int main(int argc, char *argv[])
int t = 0;
FILE *input;
input = fopen(argv[1], "r");
while (t != -1)
{t = getc(input); putchar(t);}

Save it as sounds.c and compile it using gcc sounds.c -o sounds
Then use
sounds mypicture.png | pacat --format u8 --rate 8000

And you can hear your pictures and images :P Don't expect the sweetest melody :P

Saturday, June 11, 2011

C : thank you for the memories

C is in general a quite free language, in a sense that it usually compiles! However, when it comes to running, even the most experienced programmers get errors or values that they wouldn't expect.
The most common error is a segmentation fault. This happens when your program tries to write or read a memory location out of its bounds, so the operating system does not allow it.
In addition, sometimes, you get some unexpected values, because you accidentally read a wrong memory location that belongs to your program, so the operating system does not block it. Furthermore,somebody can write accidentally a piece of code that might cause the program to freeze:
Imagine you want to create an array of length 10 and initialise it with 0 values.
What would happen if you write this (by mistake of course)

int main()
    int a[10];
    int i = 0;
    for (;i<=10; i++)
            a[i] = 0;

Why your program freezes? What would happen if you read the array without putting initial values in it if you print it out?
Can you guess what would happen if you read a[10]?
Try it! It's really fun!
by VasLabs

Wednesday, June 8, 2011

Text File Encryptor

Here is the idea. Create a simple program that changes the bytes of a file using a passphrase in a such way that they can be revered to their initial state.
Of course this program is not suitable for commercial use because the encryption is very simple. But you get the idea.
The program is written in java and you can download the source code and the compiled program from there:

ByteReader source code
ByteReader byte code
ByteEncryptor source code
ByteEncryptor byte code
DataEncryptor source code
DataEncryptor byte code

The process is:
We have an object ByteReader that reads the contents of a text file using a BufferedReader which wraps a FileReader. It reads it line by line to avoid reading dumb null bytes (it happened when we used InputStreamReader, no idea why!
After that we convert each character of the line to an int! And then we store it in a variable such that b = object ByteReader and b.bytes[][] = thearray of ByteReader that keeps the bytes read.

Then we create another object, a ByteEncryptor which takes as one of its arguments the byte reader and according to another argument password and whether to subtract from the value of the bytes or add(i.e. 0 or 1) as another argument. It also takes the number of lines and the destination to store the encrypted data.

It encrypts each byte with the simplest calculation that exists!
for each byte
byte = byte + (passphrase.hashCode() % 91)
and decrypts
byte = byte - (passphrase.hashCode() % 91)

Some notes to have in mind!
1) Never use this program on important data! They might be corrupt! Use it only on test data that you don't mind to lose!
2) It fails to decrypt images, videos, pdf and similar formats. Do you suspect why?
3) Never use this program to encrypt data and feel safe! Can you think of a simple program that it can decrypt these data without knowing the password? If yes, let others know! (We know :) )

To run the program open a terminal the directory you saved the files and then run
java DataEncryptor yourFileYouWantToEncrypt destinationFile password 1/0

1 is for adding, ie encryption, 0 is for subtracting, ie decryption.
Do not run it the first time with the value 0, you may not be able to recover it, and also remember the notes above.
If you put less arguments you will get an ArrayIndexOutOfBoundsException, i.e. the program will crash.
You can make whatever changes you like on this program since it's just a simple silly one that aims to excite your imagination for building similar things, more sophisticated. So, it is not licensed and there is no copyright.


Tuesday, June 7, 2011

The MontyHallProblem

The Monty Hall problem is as follows(stated in wikipedia):
The Monty Hall problem is a probability puzzle based on the American television game show Let's Make a Deal that was originally hosted by Monty Hall. The problem, also called the Monty Hall paradox, is a veridical paradox because the result appears odd but is demonstrably true. The Monty Hall problem, in its usual interpretation, is mathematically equivalent to the earlier Three Prisoners problem, and both bear some similarity to the much older Bertrand's box paradox.

In a few words
Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?
 Furthermore the Monty Hall problem is briefly discussed in the movie "21 Blackjack".
The answer in the question switch or not is given but without a mathematical analysis.
The mathematical solution for this problem is based on Bayes' Theorem. This article, however, does not aim to explain Bayes' Theorem, but how we use it to create a program in java that will give us the best solution for N doors.
The steps is that you choose a door, and Monty Hall opens a door other that yours and the winning door. In each stage you choose to switch or stick to your choice. This process is until there's nothing left but two closed doors, yours and another one.

So let's say we have N doors. The prior probability of each door to have the car behind it is obviously 1/N

So, let's say D is the set of containing all closed doors, such that its initial value is
P(D) = 1
(That means that the car is behind of a closed door)
and card(D) = N
(that means that D has N elements)

         P(L) = 1/N
(this means that each door that is a closed door has probability be the right door of 1/N)

So now Monty Hall opens a door b other than your door you chose.
D = D-{b}
P(D) = 1

Now for every door that is closed the probability changes.
Let Oi be the event that Monty Hall opens a door i, and P(Oi | L) be the probability that
he opens door I by knowing that the right door is L.
so if L = "your door" ⇒ i is a door other than L

so P(Oi | L) = 1/(N-1)
Wonder why? think about it. He knows that you choosed the right door, so he has a range of N-1 doors to choose.
He wouldn't open the right door (that's the rules) and so if L = i ⇒ P(Oi | L) = 0
Now what happens if the door is not the door you chose?
if (L ≠ your door) and (L ≠ i) then
  P(L) = 1/(N-2)

If you still wonder why count how many doors left for Monty Hall to choose.

Now, we have to update our probabilities of belief for each door. We must forget the prior probabilities we begun because they have no meaning any more.

So we've found those probabilities of opening, how do we find the new probabilities for each door?

Using Bayes' theorem to find the probability that L is the right door under the event that Moonty Hall opened door i
P(L | Oi) = P(Oi | L)p(L) / (∑P(Oi | d)P(d))

So for each step you must do the same thing, and in the end you will have your probability.

You can ask for questions on facebook or below this article

If you find the solution in a language other than Java we would be glad to share it with us along with your name!

Solution is uploaded, you can find the source code here and the byte code there!

Monday, April 4, 2011

Windows 7 wireless problem: connecting with DNS server

This solution is for the below reported problem:
"When I connect wireless to my router I can't have internet access with my browser! Skype is working though! What's going wrong?"

The problem is that the machine doesn't get the correct DNS address, so the browser can't translate e.g. www.google.com to it's numeric IP address. If you put instead it should work!
To solve entirely this problem you have to change your network settings in order to get DNS automatically.
So you have to simply follow these steps:
1. Click on Start and then Control Panel.
2. Go to Networking and sharing center and then click on Change adapter settings.
3. Right click on Local Area Connection and choose properties.
4. Highlight Internet Protocol Version 6 (IPv6) and click on Properties.
5. Choose Obtain DNS server address automatically and press Ok (it might be already ok, see IPv4 as well).
6. Choose Obtain IP address automatically.
7. Repeat the steps for Internet Protocol version 4 (IPv4) as well.

Saturday, March 12, 2011

The Android Market and the Open Software

As we all know, android is a completely open operating system. It is also free, so when you by an android phone, you do not pay for the operating system.
This, of course is fine!
However, when someone looks for applications in the android market, he hardly finds free and good applications. You are gonna say know, what are you talking about, I have the best applications for free! Ha! You think so.
The concept of a free aplication, is that you can use it as you want and share it! In additions you do not need to see all those silly ads (which unfortunately we have also in the blogspot, but this is something temporary, and a site is completely different from an app!) which you will never intend to click on them, but sometimes you click one by accident.
Furthermore, android maybe is an open source OS but it lost that purpose! Take for example any Linux distribution! Have you ever looked for a professional level application and you didn't find it? Not me.
An operating system is not considered free if basic applications are not free! Why do I have to pay for a good task manager? Even in windows you find a free one! Why do I have to pay for password managers, talking simulators and stuff? Most applications that are not free have a poor level, and they have been programmed by stupid programmers!
Android has is based on a linux core. In linux I can find a good anti-virus and a firewall for free.

All developers have the right to sell their work! It's ok with me if the application is indeed a worth one! I would pay for a good game or a really good anti-virus! (I was paying for anti-virus for years)! But searching in the android market I have found only a couple of applications that worth money.
In conclusion Android Market is now a mess! For example compare Ubuntu software center with android market!
Where did the linux spirit go? Where did open source power go? Basic applications have to be free! And free means also free of ads!

Saturday, March 5, 2011

How to download all haiku source files in 5 minutes

Many of you emailed us to ask how to download haiku source files, since they are too many to click every one of them. The answer is quite simple though and it also shows the power of the bash again!
Use the script below

links=`less index.html | grep "href=*" | tr "=;<>" "\n" | tr -d '"' | grep ".xz"`
for lnk in $links; do 

wget "$link$lnk" 

And wait until all downloads are finished!!!


Well, we installed haiku on a virtual machine. We have tried it a bit and we present it to you!
At first we needed a virtual machine. So we installed virtual box and executed it:
#download virtual box
wget http://download.virtualbox.org/virtualbox/4.0.4/virtualbox-4.0_4.0.4-70112~Ubuntu~maverick_i386.deb
#install the package (if your linux distro is not debian this might be slightly different)
sudo dpkg -i virtualbox-4.0_4.0.4-70112~Ubuntu~maverick_i386.deb
#now execute it

 In addition the iso image file of haiku is needed.
#get haiku iso, you can visit http://haiku-os.org/get-haiku to choose a server
#the below is the server of the University of Crete
wget http://ftp.cc.uoc.gr/mirrors/haiku/releases/r1alpha2/haiku-r1alpha2-iso.zip

Then using Virtual Box wizard specify the allocated ram and hard disk sizes. Unzip the haiku iso and load it to the virtual machine. 

After you load haiku image it loads the OS live CD desktop, so you can try it out. Since it's on a virtual machine now, you can install it without affecting the rest of your system and try it later.
To install it simply choose install option. Then you should create a "partition" which is virtual, that will be used by the virtual machine to install haiku.
The installation progress is very easy.

After installation you have to restart it(not your pc, haiku that is on virtual machine, remember that you should not close the virtual machine
You can restart it with a terminal command or bu pressing the feather and choosing shutdown->Restart System
You can open the terminal with right click->Add-ons->Open Terminal
And then type the restart command:
shutdown -r

Or simply press shutdown:

Here are the rest of the photos after installation:

Haiku operating system

Haiku is an open source operating system currently in development that specifically targets personal computing. Inspired by the Be Operating System, Haiku aims to become a fast, efficient, simple to use, easy to learn and yet very powerful system for computer users of all levels.

The key highlights that distinguish Haiku from other operating systems include:
  • Specific focus on personal computing
  • Custom kernel designed for responsiveness
  • Fully threaded design for great efficiency with multi-processor/core CPUs
  • Rich OO API for faster development
  • Database-like file system (OpenBFS) with support for indexed metadata
  • Unified, cohesive interface

    The above information is from the official web-site of haiku!
    Of course it is still in its alpha release but:

    The best thing is that is open source of course, so now that haiku is on its birth, it's good for any programmer put his lines on it. There are many things that haiku still doesn't support, like
    wireless WPA.
    You can find its source code on: http://haiku-files.org/files/releases/r1alpha2/sources/

    Thursday, March 3, 2011

    The power of the bash

    I am going to show you a script that was found useful to me for testing a piece of code I wrote for a particular job.
    Actually, that job, takes some data and outputs a single result. It is not necessary for you to know what the program does, because it doesn't affect what I am going to show you.
    In addition this article shows the power of the command 'grep'! You can find about grep by typing 'man grep' on your terminal.

    Well, the piece of code I wrote it was nothing new. It actually exists on linux. So to test it I should get some data, give it to the linux program and to my program and compare the results. The data might be numbers, characters or whatever. So I need a program from linux that each time is called it outputs different data. That program is actually a game and is called 'fortune'.

    The code I wanted to test was written in java so the bash script I wrote was:

    0:   #!/bin/bash
    1:   for ((i=1;i<=10;i++)); do
    2:   data=`fortune`
    3:   myprogram=`echo "$data" | java myJavaProgram`
    4:   linuxprogram=`echo "$data" | name-of-linux-program`
    5:   similarity=`echo "$linuxprogram" | tr [:space:] \n | grep "$myprogram"`
    6:   if [ -z "$similarity" ]; then
    7:    echo "Program is wrong"
    8:   else echo "Program is right"
    9:   fi
    10: echo $myprogram   $linuxprogram
    11: done

    *lines was put for discription only
    Line 0: defining that the code will be executed with bash
    Line 1: a for loop which will be executed 10 times because this is the number of times I
    want to test my program.
    Line 2: the variable 'data' will curry the output of fortune
    Line 3: the variable 'myprogram' will curry the data of my programs output which will process the data from variable 'data'
    Line 4: the same with line 3 but this time with the finished linux program
    Line 5: 'linuxprogram' data is split with tr, and then grep is looking if my program result  matches linux program result. Remember, pipe ('|') sends the result of a program to the next as its input.

    Line 6-9: the if that checks if there is a similarity. if -z $similarity is true, it means that the similarity is empty, so my program's output is different than the linux one's
    Line 10: outputs the result of both programs, just to be sure that the script does the right thing

    I could add a couple lines of code and have a summarise of my results: i.e. In the end it would tell me program errors: 3, or no error found. 
    That would need a variable initialised to zero, and every time it finds an error it will be increased.
    And the script should be like that:
    for ((i=1;i<=10;i++)); do
    myprogram=`echo "$data" | java myJavaProgram`
    linuxprogram=`echo "$data" | name-of-linux-program`
    similarity=`echo "$linuxprogram" | tr [:space:] \n | grep "$myprogram"`
    if [ -z "$similarity" ]; then
     echo "Program is wrong"
     let errors+=1
    else echo "Program is right"
    echo $myprogram   $linuxprogram
    if [ $errors -eq 0 ]; then
     echo "No errors found"
     echo "Found $errors errors"

    Tuesday, March 1, 2011

    Vaslabs press announcement

    We have noticed in many android related sites that they have descriptions of our products and a profile description for Vaslabs. We may note that the correct profile of Vaslabs is:

    Vaslabs corporation is a mini software business created to offer freeware utilities. Here(in our blogspot) you can view all our news, release products for Android phones, linux or Windows and information about their updates and bugs.

    In addition some information about our products may be wrong, like the released version. Opap games 1.0 does not exist, the version now available is 2.3

    For official information, help, feedback and whatever you may contact vaslabs

    Vaslabs Press office

    Tuesday, February 22, 2011

    News for our MD5 cracker

    We have further improved brute force attack. See for yourself:

    And we keep improving!!!

    VasLabs press announcement

    Dear friends of VasLabs,
    We shall thank you all who are using our products. We are also pleased to announce our progress of our most important released products as follows:

    For Windows:


    Vaslook is a product that notifies you when you get an email. We are pleased that has over than 500 downloads, since it's an application only for yahoo emails. We know that this project fall behind, however you should expect some small updates and fixes by the end of March.

    File Engineer

    This product is in it's final version. It is the upgraded version of an older program called File Editor. The basic function that it does is hiding your files, but you can also use it for fast browsing through your files. It is fully stable and for that reason this project closed, but we still offer support on any problems you may have.

    For Android:

    Password Maker(Android Market)

    We could write whole books about this product. Although it didn't reach in downloads our expectations, it is a high level security solution for both creating AND managing your passwords. Consider how many viruses you have got until now, and how many data got stolen from your drives even if you don't know it. It is not hard for a hacker to decrypt the file that the Password Manager you use saves your passwords. However, with this application, no data will be stolen because there isn't any. The idea of managing your passwords, is that you use the same Master Password each time, then you put the reason you want it, e.g. for www.gmail.com you put gmail, and then the length of the password.
    We also use your phone data to produce unique passwords for each handset.
    Anyway, we expect you to use this product and be safer than ever(that will be useful to us, since less friends will ask us what to do for their hijacked account).


    Many people show their love for that application, especially Greeks. It is statistically the most popular application we ever made, having now more than 1500 downloads. You can expect an upgrade soon, that will contain more games collected from european countries.

    These were the news of VasLabs in the context of our Applications.
    We are creating a video advertisement too, and soon will be available on the blog and on youtube!

    Thank You
    The Manager
    Vasilis Nicolaou

    Sunday, February 20, 2011

    First succession with brute force attack!!!

    Our md5 cracker!

    Our md5 cracker is our new tool for recovering md5's. It will be available soon. For now look at that pictures and see its power:

    Friday, February 18, 2011

    Linux Lessons (another lesson) Aliases

    Aliases is a strong utility in linux arsenal, which benefits the using of your linux machine. With aliases you can create simple "key phrases" which execute complicated and/or long commands. You can have a file with your aliases, or just create instant aliases in the terminal with a short life (until you close your terminal).

    Let's see first how to create an instant alias, just for your current terminal session.
    All actions were made in Ubuntu with GNOME as the desktop environment.

    Open your terminal:
    We are going to create an alias for a simple command: the command that change directory to our video files!!!
    The path of the videos is: ~/Videos
    The command to go there is: cd ~/Videos

    We can just create an alias for going to that directory, with giving only the word videos. Like this:
    alias videos="cd ~/Videos"
    and press enter.
    Now try it:
    press enter

    Let's see another command which is longer and we would use it most of the times if it wasn't so big to write. The command that locks your screen which is (in gnome) :

    gnome-screensaver-command -l

    We've created this alias:
    alias lock="gnome-screensaver-command -l"

    Now try lock. (After that put your password and return here)

    These are good but they have a disadvantage: They live short. What if you want to use them e.g for ever?
    For this purpose you can create a file in your home directory with the appropriate name. The name of that file is found in another file in ~/.bashrc. Remember that you can view the file using less ~/.bashrc. The important part who says the name of the file is at the end of the .bashrc.
    Here it is in our case:

    It's name is .bash_aliases.
    Let's create that file. type:
    touch .bash_aliases
    Now your file is created but it's empty.
    Let's put the aliases we looked at(for every new line press enter:
    cat >>~/.bash_aliases
    or use
    nano >>~/.bash_aliases
    (if you
    alias videos="cd ~/Videos"

    alias lock="gnome-screensaver-command -l"
    (The previous was ctrl+d which means that you won't send any more data)

    Let us now give you some ideas for other aliases:
    your favourite website:
    alias vaslabs='firefox "http://www.vaslabs.blogspot.com"'
    the shutdown and restart commands:
    alias shutdown="sudo shutdown -P now"
    alias restart="sudo shutdown -r now"

    What other aliases can you think of? Send us if you want your aliases on vaslabsco@gmail.com

    Tuesday, February 15, 2011

    Triple test for Square!!!

    This is a suggestion from Cleanthis Metaxas who wrote us on his email to check whether Recursive Functions are fast.
    First we thing that they are usually slow, but we will check it for a specific problem: finding the square of an integer number.
    Before that we have to inform you that recursive function is a useful tool in a programmers arsenal, in order to use dynamic programming for solving complicated problems.

    We used 3 different pieces of code to find the fastest: Let's analyse them:
    public class StraightTest
    private static int sqr(int n)
    return n*n;

    public static void main(String[] args)
    This is a fast way of solving the problem and very very simple. It get's the number, multiplies it with itself and returns the result

    public class ForTest
    private static int sqr(int n)
    int result = 1;
    for (int i = 1; i<=2; i++) result *= n; return result; } public static void main(String[] args) { System.out.println(sqr(Integer.parseInt(args[0]))); } } ----------------------------------------------------------- This is a more general way of doing it in the aspect of finding any power of a number. Since we are looking for the square we need to loop only twice. public class RecursiveTest { private static int sqr(int n) { if (n == 0) return 0; else return sqr(n - 1) + 2*(n-1) + 1; } public static void main(String[] args) { System.out.println(sqr(Integer.parseInt(args[0]))); } } And this is the recursive function-> f(0) = 0, f(n+1) = f(n-1) + 2*(n-1) + 1
    So it calls repeatedly itself until the whole result is found.
    Seems slower than the others.

    Out experiment will be done using the following numbers for each one:
    0, 5, 100, 1000
    But we see for this problem the disadvantage of that recursive function, as well as the for: they cannot return the square of a negative number. But this is totally fixable by using absolute so we skip that.

    Let's observe our tests:

    Input = 0

    real 0m0.825s
    user 0m0.528s
    sys 0m0.244s
    real 0m0.891s
    user 0m0.564s
    sys 0m0.228s
    real 0m0.911s
    user 0m0.560s
    sys 0m0.220s

    The sys time is that we have to look. Since 0 returns 0 at once, recursive method was the fastest.
    However, somebody would expect for to be slower than just a multiplication. But maybe our results are not so accurate because of the println. Let't remove it and try again:

    real 0m0.774s
    user 0m0.528s
    sys 0m0.212s
    real 0m0.766s
    user 0m0.552s
    sys 0m0.180s
    real 0m0.782s
    user 0m0.576s
    sys 0m0.172s

    Well, recursive should be faster because it uses the less operations for finding zero. Now let's
    check the other numbers too:

    input = 5

    real 0m0.776s
    user 0m0.572s
    sys 0m0.168s
    real 0m0.781s
    user 0m0.548s
    sys 0m0.196s
    real 0m0.773s
    user 0m0.564s
    sys 0m0.176s

    Let's use a medium number let's say:
    input = 100

    real 0m0.773s
    user 0m0.576s
    sys 0m0.168s
    real 0m0.773s
    user 0m0.540s
    sys 0m0.196s
    real 0m0.782s
    user 0m0.540s
    sys 0m0.208s

    And use a big number:

    input = 1000

    real 0m0.780s
    user 0m0.568s
    sys 0m0.176s
    real 0m0.766s
    user 0m0.564s
    sys 0m0.168s
    real 0m0.773s
    user 0m0.548s
    sys 0m0.196s

    So in general all results are pretty close. We can't be sure what is the fastest from those results:
    All about computers are hypothesis if we do not know exactly how something works.
    Java is a language that has a lot of noise, in the sense that, it interprets its bytecode on its virtual machine. Then garbage collector is also used, we don't know what happens exactly.

    In our next experiment we'll use another language, so don't miss our article!

    We should thank Cleanthis Metaxas for his idea.

    You can also send us your experiments or ideas at: vaslabsco@gmail.com

    Thursday, February 10, 2011

    Counting time (another test)

    Continuing from yesterday we were curious to see if java is faster than python. we know that java is slower than languages that create executable files. But python runs code by interpreting line by line. The program is the same as yesterday.
    We also now that big programs may differ from the results, but we want to see just simple one's, because those that are complicated have several ways of writing.

    We wrote in python:
    #!/usr/bin/env python
    import sys

    c=a + b
    print c

    Save the file as Addition.py
    Make it executable:
    chmod a+x Addition.py

    And in java:
    Public class Addition
    public static void main(String[] args)
    int a = Integer.parseInt(args[0]);
    int b = Integer.parseInt(args[1]);
    int c = a + b;

    Surely python looks shorter. We run the script we mentioned yesterday:
    for python:
    time for ((i=1;i<=10;i++)); do
    Addition.py $i $i

    for java:
    time for ((i=1;i<=10;i++)); do
    java Addition $i $i


    real 0m0.156s
    user 0m0.080s
    sys 0m0.064s


    real 0m0.784s
    user 0m0.564s
    sys 0m0.200s

    On previous article we haven't explained time.
    The sys time is the important thing since it is the time that the process kept cpu busy.
    Python is faster. The difference is very well considered!!! Or was it the print out which is slow?
    Let's see again:
    We removed the print line of each code.

    Here are the results:

    real 0m0.164s
    user 0m0.112s
    sys 0m0.020s

    real 0m0.827s
    user 0m0.576s
    sys 0m0.188s

    Final conclusion:
    Print out takes an amazing amount of time.
    Python is amazingly faster than Java.

    What are your experiments? Share them with us on: vaslabsco@gmail.com

    Wednesday, February 9, 2011

    Counting in Labs (For hardcore programmers!!!)

    The below experiments were made in our labs, in order to count the time needed for a task to be completed in several ways.
    We used an Ubuntu 10.10 linux machine, but it can be probably done in every linux distribution.

    The target of our experiment was to watch the time needed for a simple operation to complete in several ways. Each unit was counted ten times using the script we created:

    time for ((i=1; i<=10;i++)); do
    java Addition $i $i

    That way the Addition program will be executed 10 times. We divide the final output by 10 so we have a representation of the time taken to complete an operation.

    We also created in java the program addition. We wanted to check first the use of functions, so we created two versions of the program, and got the results written below of each:

    public class Addition
    public static void main(String[] args)
    int a = Integer.parseInt(args[0]);
    int b = Integer.parseInt(args[1]);
    private static int add(int x, int y)
    return x + y;

    real 0m0.872s
    user 0m0.584s
    sys 0m0.228s

    divide each by 10
    real 0m0.087s
    user 0m0.058s
    sys 0m0.023s
    public class Addition
    public static void main(String[] args)
    int a = Integer.parseInt(args[0]);
    int b = Integer.parseInt(args[1]);

    System.out.println(a + b);

    real 0m0.870s
    user 0m0.584s
    sys 0m0.224s

    real 0m0.087s
    user 0m0.058s
    sys 0m0.22s

    Not much a difference. But we know that printing results out costs lots of resources.
    So we try again (just to be sure) with these two:

    public class Addition
    public static void main(String[] args)
    int a = Integer.parseInt(args[0]);
    int b = Integer.parseInt(args[1]);
    int c = add(a,b);
    private static int add(int x, int y)
    return x + y;

    real 0m0.869s
    user 0m0.556s
    sys 0m0.208s

    divide by 10
    real 0m0.087s
    user 0m0.0556s
    sys 0m0.021s
    The first thing we see is that printing in the system output cost's indeed lot of time for the system (look at the sys times). The user time also is smaller. Real time is not much of a difference, however note that small differences are still important in computers.

    public class Addition
    public static void main(String[] args)
    int a = Integer.parseInt(args[0]);
    int b = Integer.parseInt(args[1]);
    int c = a + b;


    real 0m0.864s
    user 0m0.604s
    sys 0m0.192s

    divide by 10
    real 0m0.086s
    user 0m0.060s
    sys 0m0.019s
    Conclusions until now:
    -In java functions take longer to output results.
    -Printing out results takes lot of time

    Send as your experiments and conclusions at: vaslabsco@gmail.com

    Saturday, February 5, 2011


    What is a hacker?

    The term hacker was once used to describe a clever programmer. Today, it’s applied to those who exploit security vulnerabilities to break into a computer system. You can think of it as electronic burglary. Hackers regularly break into both individual computers and large networks. Once they have access, they may install malicious programs, steal confidential data, or perhaps use compromised computers to distribute spam.

    What is a vulnerability?

    Today’s computer software is very complex, comprised of thousands of lines of code. Since software is written by humans, it’s hardly surprising that they contain programming mistakes, known as vulnerabilities. These loopholes are used by hackers to break into systems; they are also used by authors of malicious code to launch their programs automatically on your computer.

    How do I protect myself from hackers?

    Hackers are like electronic burglars, who use loopholes in your programs - vulnerabilities - to break into your computer system. You can protect yourself from hackers by using a firewall. A firewall program, which often comes as part of an anti-virus software package, protects a PC by detecting potential intruders and making the PC invisible to hackers.

    source: kaspersky

    Monday, January 31, 2011

    PasswordMaker For android: The Manual!

    PasswordMaker for android is out there! You can find it from android Market if you search vaslabs.security or PasswordMaker vaslabs or just passwordmaker.
    A complete manual can be downloaded from there!
    Don't let your accounts be hijacked!

    A powerful utility from VasLabs security team! Because we know our stuff!

    Password Maker for android

    VasLabs announces that a new product will be available by the start of February.
    Password Maker, a very useful utility for generating strong passwords, without the need of saving them will be available for android phones in about a week according to VasLabs.
    The new app will have the advantage of portability and easy to use, because comparing with the Perl-command prompt version, it will have a GUI.
    The new app will have the same features as the command prompt one:
    -generating strong passwords
    -different password for each mobile phone
    -managing passwords by reason you want them
    -should remember only one password

    Tuesday, January 25, 2011

    Make an exclusive-OR Gate by using NAND's

    A NAND B = ¬(AΛB)
    A XOR B = ¬AΛB + AΛ¬B

    We have to make XOR equation has the form of NAND.
    We will use De Morgan's Theorem: ¬AV¬B = ¬(AΛB)
    ¬AΛ¬B = ¬(AVB)

    ¬AΛB V AΛ¬B = ¬ (AV¬B) V ¬ (¬AVB)
    = ¬¬ ( ¬ (AV¬B) V ¬ (¬AVB) )
    = ¬ ( (AV¬B) Λ (¬AVB) )
    = ¬ ( (AΛB) V (¬AΛ¬Β) )
    = ¬(AΛB) Λ ¬(¬AΛ¬Β)
    = ¬(AΛB) Λ (AVΒ)
    = (¬(AΛB)ΛΑ) V (¬(AΛB)ΛB)
    = ¬¬((¬(AΛB)ΛΑ) V (¬(AΛB)ΛB))
    = ¬( ¬ ( ¬(AΛB) Λ Α ) Λ ¬( ¬(AΛB) Λ B ) )

    Now we have a NAND "¬(AΛB)" connected to a NAND with A as second
    input, connected to a NAND that has one input from the first NAND and B, and both are connected to a NAND.
    Note: V = OR, ¬ = NOT, Λ = AND

    Monday, January 3, 2011

    Joker, extra5, Keno and Lotto!

    Do you have android? Do you like joker, kino, lotto and other such games?Do you want to find numbers, probabilities, costs and combination in one second? This is for you!