- Hotkeys of chromium, google-chrome and comodo dragon browser
- Google Chrome offline installer (Windows)
вторник, 21 декабря 2010 г.
Chromium and forks features
воскресенье, 28 ноября 2010 г.
Love free software!
- ClamWin - Win32 free antivirus
- Mozilla Thunderbird - free e-mail client
- Mozilla Firefox - free web-browser
- Pidgin - free ICQ client
- TuxGuitar - free tablature editor (Java)
воскресенье, 7 ноября 2010 г.
Sorting rubbish in downloads (linux)
#!/bin/bashRun this script in folder, where many files!
echo "Раскидываем помойку по категориям.."
test -d Documents || mkdir Documents
mv *.doc *.docx *.odf *.pdf ./Documents/
test -d Databases || mkdir Databases
mv *.sql ./Databases/
test -d Roms || mkdir Roms
mv *.7z *.gen ./Roms/
test -d Music || mkdir Music
mv *.mp3 ./Music/
test -d Package || mkdir Packages
mv *.deb *.rpm ./Packages/
test -d Text || mkdir Text
mv *.txt *.html ./Text
test -d Sources || mkdir Sources
mv *.tar* ./Sources/
test -d Archives || mkdir Archives
mv *.zip *.rar ./Archives/
test -d Images || mkdir Images
mv *.JPG *.PNG *.png *.jpg *.gif *.GIF ./Images/
test -d Video || mkdir Video
mv *.avi *.flv *.mp4 ./Video/
test -d ISO || mkdir ISO
mv *.ISO *.iso ./ISO/
понедельник, 1 ноября 2010 г.
MySQL: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Recently I got next exception:
I looking into google, but got no answer, except for "check your server", "check port of your server", "check localhost at /etc/hosts" and some other unavailing stuff.
Problem was in my code, I feel, that I'm Great Indian Coder, then detect it.
I wrote it too fast and I was distracted on something and don't noticed it. Correct code is:
because correct format of getConnection's parameters is:
I will be glad if it will help you.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
I looking into google, but got no answer, except for "check your server", "check port of your server", "check localhost at /etc/hosts" and some other unavailing stuff.
Problem was in my code, I feel, that I'm Great Indian Coder, then detect it.
Connection conn = DriverManager.getConnection("jdbc:mysql://" +
app.sql.settings.constants.getHost() +
app.sql.settings.constants.getPort() +
app.sql.settings.constants.getDb() +
app.sql.settings.constants.getUser() +
app.sql.settings.constants.getPassword());I wrote it too fast and I was distracted on something and don't noticed it. Correct code is:
Connection conn = DriverManager.getConnection("jdbc:mysql://" +
app.sql.settings.constants.getHost() + ":" +
app.sql.settings.constants.getPort() + "/" +
app.sql.settings.constants.getDb(),
app.sql.settings.constants.getUser(),
app.sql.settings.constants.getPassword());because correct format of getConnection's parameters is:
jdbc:mysql://host:port/db, user, password
I will be glad if it will help you.
воскресенье, 24 октября 2010 г.
MySQL & Cyrillic Symbols.
To work with Cyrillic symbols in MySQL:
Also create table code:
sudo gedit /etc/mysql/my.cnfAdd next settings in section [mysqld]:
default-character-set=utf8and this to section: [mysqldump]:
character-set-server=utf8
collation-server=utf8_general_ci
init-connect="SET NAMES utf8"
skip-character-set-client-handshake
default-character-set=utf8reboot mysql and enjoy!
Also create table code:
CREATE TABLE $tablename CHARACTER SET utf8
суббота, 23 октября 2010 г.
Java Samples 4. jFrame close confirmation.
...Also change defaultCloseOperation from EXIT_ON_CLOSE to DO_NOTHING_ON_CLOSE
main.this.addWindowListener(new WindowListener() {
public void windowClosing(WindowEvent event) {
Object[] options = { "Yes", "No" };
int n = JOptionPane.showOptionDialog(event.getWindow(), "Close Window?",
"Close Window?", JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, options,
options[0]);
if (n == 0) event.getWindow().setVisible(false);
}
public void windowActivated(WindowEvent event) {}
public void windowClosed(WindowEvent event) {}
public void windowDeactivated(WindowEvent event) {}
public void windowDeiconified(WindowEvent event) {}
public void windowIconified(WindowEvent event) {}
public void windowOpened(WindowEvent event) {}
});
initComponents();
...
суббота, 16 октября 2010 г.
Java Samples 3. Append Row to jTable
public static void addRow(JTable table, Object[] data) {
DefaultTableModel tbm = (DefaultTableModel) table.getModel();
tbm.addRow(data);
table.setModel(tbm);
}
суббота, 9 октября 2010 г.
Java Samples 2. SQL connections.
public static void voidName(String query) throws SQLException {
Connection connectionName = DriverManager.getConnection("url" /* хост:порт/база */, "user", "pass");
if (connectionName==null) {
System.exit(0);
}
Statement statementName = connectionName.createStatement();
ResultSet resultsetName = statementName.executeQuery("query");
while(resultsetName.next()) {
resultsetName.getString("columnName");
some_actions_with_columnName
}
}
воскресенье, 3 октября 2010 г.
Java Samples 1 (String & File)
/* Load file content to string */
/* Write text to file*/
public static String fileView(String filename) throws FileNotFoundException, IOException {
BufferedReader br = new BufferedReader(new FileReader(filename));
StringBuilder s = new StringBuilder("");
while (br.ready()) s.append(br.readLine()+"\n");
return(s.toString());
}
/* Write text to file*/
public static void writeToFile(String fileName, String text) throws IOException {
try {
File file = new File(fileName);
FileWriter fw = new FileWriter(file, true);
fw.append(text);
fw.close();
}
catch ( IOException ioException ) {
ioException.printStackTrace();
}
}
Java Samples 0 (String & ArrayList)
/* delete spaces around the string */
/* convert ArrayList to String */
/* convert String to ArrayList */
public static String deleteSpaces(String x) {
if (x.startsWith(" ")) x = x.substring(1);
if (x.endsWith(" ")) x = x.substring(0, x.length()-1);
return(x);
}
/* convert ArrayList to String */
public static String listToString(ArrayList list) {
String s = null;
if (!list.isEmpty) {
for (int i = 0; i < list.size(); i++) {
s.concat(list.get(i).toString()+"\n");
}
}
return(s);
}/* convert String to ArrayList */
public static ArrayList stringToArrayList(String string) {
String[] pieces = string.split("\n");
for (int i=pieces.length-1;i>=0;i--) {
pieces[i] = pieces[i].trim();
}
ArrayList a = new ArrayList(Arrays.asList(pieces));
return (a);
}
понедельник, 23 августа 2010 г.
How to find file with substring
Ubuntu 10.04
find -f *.php|while read filename; do cat $filename|grep theme && echo $filename; done
find -type f -name "*.css"|while read filename; docat $filename|grep fff & echo $filename;done
- find - search
- -type f - files
- -name "*.css" - with name contains ".css"
- |while read filename; do - while read this files
- cat $filename - write file-content
- |grep ddb - search substring "ddb" in file-contents
- & echo $filename; - write name of file
- done - close while
find -f *.php|while read filename; do cat $filename|grep theme && echo $filename; done
воскресенье, 22 августа 2010 г.
Sega
Debian i386 way.
1. sudo apt-get install dgen
2. dgen hxw
Debian x86_64 first way.
1. sudo gedit /etc/apt/sources.list
2. replace all "# deb" to "deb"
3. save
4. sudo apt-get update
5. sudo apt-get install ia32-libs
6. sudo apt-get install dgen
7. dgen HxW
Debian x86_64 second stupid but working way.
1. sudo apt-get install wine
2. sudo apt-get remove ttf-mscore-installer //as you get terrible fonts
3. Get emulator.
4. wine
6. Road Rash 3
четверг, 19 августа 2010 г.
Ubuntu LiveUSB:
Debian-way:
1. sudo apt-get install usb-creator2. usb-creator3. check "diskarded on shutdown".4. make startup disk.
Windows-way:
DIE BASTARD
пятница, 23 июля 2010 г.
среда, 21 июля 2010 г.
Correct ia32-libs install (Ubuntu 10.04)
I try to run LAMPP on my AMD64 and got next message:
“XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library”.
But ia32-libs was currently installed. In google I was find many tips like "install getlibs-all", and something like "reboot after install, install it with sudo, etc", sure, it didn't work. But here I was find good advice how to make ia32-libs correctly working:
sudo gedit /etc/apt/sources.list
uncomment all the lines “thats what i did because i am lame”, and
sudo apt-get updatesudo apt-get install ia32-libs
and now all work fine.
суббота, 17 июля 2010 г.
How to convert many images in console (Windows)
1. Get "GraphicsMagick" utility and install it.
2. Create batch-file (.bat) and paste:
echo offclsset /p sd="Enter source directory (example: C:\source directory\ ) : "if %sd:~-1%==\ (echo Ok) else (set sd=%sd%\)set /p d="Enter destination directory: (example: C:\dest directory\ ) : "if %d:~-1%==\ (echo Ok) else (set d=%d%\)set /p s="Enter source extension (example: .tif ) : "if %s:~0,1%==. (echo Ok) else (set s=.%s%)set /p n="Enter necessary extension: (example: .png ) : "if %n:~0,1%==. (echo Ok) else (set n=.%n%)xcopy ^"%sd%*%s%^" /s /i ^"%d%^"cd ^"%d%^"for /r %%1 in (*%s%) do gm convert ^"%%~dpnx1^" ^"%%~dpn1%n%^" & erase /f /q ^"%%1^"
3. Run it.
пятница, 9 июля 2010 г.
After Ubuntu 10.04 Installation
apt-get remove gwibber empathy evolution pitiviapt-get updateapt-get upgradeapt-get install avant-window-navigator openssh-server compizconfig-settings-manager gimp flashplugin-installer gstreamer0.10-ffmpeg lynx postgresql pgadmin3 eclipse unrar p7zip thunderbird startupmanager
Подписаться на:
Комментарии (Atom)