poniedziałek, 24 lutego 2014

Restore ubuntu boot screen

root@lapek:~# sudo update-alternatives --config default.plymouth
Są 2 dostępne alternatywy dla default.plymouth (dostarczające /lib/plymouth/themes/default.plymouth).

  Wybór       Ścieżka                                                Priorytet  Status
------------------------------------------------------------
* 0            /lib/plymouth/themes/kubuntu-logo/kubuntu-logo.plymouth   150       tryb auto
  1            /lib/plymouth/themes/kubuntu-logo/kubuntu-logo.plymouth   150       tryb ręczny
  2            /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth     100       tryb ręczny

Proszę wcisnąć Enter, aby pozostawić bieżący wybór[*]; albo wpisać wybrany numer: 2
update-alternatives: using /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth to provide /lib/plymouth/themes/default.plymouth (default.plymouth) in tryb ręczny
root@lapek:~# sudo update-initramfs -u
update-initramfs: Generating /boot/initrd.img-3.5.0-46-generi

środa, 19 lutego 2014

Resource leak - java eclipse

good way:

When you write a code like bellow:


import java.util.Scanner;

public class userio
{
    public static void main(String[] args)
    {
      
        Scanner input = new Scanner(System.in);
      
        System.out.print("Enter a line of text: ");
      
        String line = input.nextLine();
      
        System.out.println("you entered: "+line);
    }
}

in marked line you always have warning when you write your code in eclipse.
Eclipse suggest you that you have resources leak. To eliminate this problem use case like bellow


import java.util.Scanner;

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

            Scanner input = new Scanner(System.in);
            try
            {
                System.out.print("Enter a line of text: ");
                String line = input.nextLine();
                System.out.println("you entered: "+line);
            }
            finally
            {
                input.close();
            }
    }
               
}

--------------------------



piątek, 14 lutego 2014

eclipse shortcut

usefull shortcut to use alternativly to: System.out.println() in java:

type Sysout or syso and press ctrl+space



nmcli fedora20

[marek@localhost log]$ nmcli connection show active
NAZWA              UUID                                               URZĄDZENIA  DOMYŚLNE  VPN  GŁÓWNA-ŚCIEŻKA 
Połączenie Orange  079fa768-31c6-421f-9a0e-b29e654588f1  ttyACM1                    tak       nie  -


nmcli connection up/down id "Połączenie Orange"

czwartek, 13 lutego 2014

connection test

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

GET /index.html HTTP/1.0

HTTP/1.1 200 OK
Date: Thu, 13 Feb 2014 10:17:11 GMT
Server: Apache/2.4.6 (Ubuntu)
Last-Modified: Thu, 13 Feb 2014 10:16:24 GMT
ETag: "b1-4f246fb464b2b"
Accept-Ranges: bytes
Content-Length: 177
Vary: Accept-Encoding
Connection: close
Content-Type: text/html

<html><body><h1>It works!</h1>
<p>This is the default web page for this server.</p>
<p>The web server software is running but no content has been added, yet.</p>
</body></html>
Connection closed by foreign host.


python substitute:

#!/usr/bin/python

import socket

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("www.google.pl",80))
s.send("GET /index.html HTTP/1.0\n\n")
data = s.recv(10000)
print "received data: ",data
s.close()



python socket practice

#!/usr/bin/python

import socket
host = ['www.google.pl','www.onet.pl','www.facebook.com','www.redhtube.com','www.youtube.com']
for h in host:
        ip = socket.gethostbyname(h)
        print "ip: ",ip ,"host:",h

wtorek, 11 lutego 2014

use deb package in Fedora/Redhat distros

Remeber you always can install and use alien but

for this purpse i use:

ar - create, modify, and extract from archives

output:

[root@localhost Pobrane]# ar vx ubuntu-wallpapers-saucy_13.04.0+13.10.20130823-0ubuntu1_all.deb
x - debian-binary
x - control.tar.gz
x - data.tar.gz