Wednesday, April 6, 2016

AWK Scripts - Examples

Example 1:

{
  if (match($0,/stat\.X[0-9][0-9][0-9]/)) tab = substr($0,RSTART+6,RLENGTH-6);
  if (tab + 0 >= 70 && tab + 0 <= 120) { print tab; }
}

Script does:
  • For every line like statA.X023, sets the variable 'tab' to the number, here 023
  • outputs the number if it is between 70 and 120

Friday, January 1, 2016

Playing an Audio ISO and Burning it into a CD

Tools that worked nicely for me:


  • To install the ISO on Windows to platy and copy MP3 of it: VirtualCloneDriver 5.4.9.0 (downloaded from SkySoft Download)
  • To burn: CyberLink Power2Go v. 5
What didn't work:
  • MicroSoft Virtual CD-ROM Control Panel v. 2.0.1.1
    Problem: driver installation; it's a tricky piece of software, doesn't see the driver file even it was placed where told to - file was there but the software filtered it out, somehow, even when run an admin
Environment: Windows 7

Thursday, November 12, 2015

Update in PostgresSQL Using the Command Line Tool - PSQL

The command:

psql -h hostname -d database -U username -W --echo-queries -f script-file-name.sql

where:

-W - to request psql to ask for password (rather then assume no-password)-h  - PostgreSql server host name or ip
-f  - file with the SQL script to execute on the database
 --echo-querries - shows the currently executed query for easier debugging of the script

Wednesday, October 28, 2015

Install Puppy Linux on my Old ThinkPad R60

Version: Slacko Puppy 5.7

  • Problem: Wi-Fi not working. Solution:
  • First: rfkill list
  • if it says softblock yes, try Fn F5. If it doesn't help do: sudo rfkill unblock wifi; sudo rfkill unblock all
  • Then:

# cd /lib/firmware/
# cp iwlwifi-3945-2.ucode iwlwifi-3945-1.ucode
# ifconfig wlan0 up

And try to connect.

Monday, September 21, 2015

IntelliJ IDEA - Keyboard Shortcuts And More for An Ex-Eclipse User

Since, couple years ago, JetBrains made available its IntelliJ IDEA to users for free (yes, only its Community Edition), it became an interesting alternative to Eclipse IDE.  While Eclipse is a great IDE, people looking for something more (even if just a little more), may be tempted to switch to IDEA, so here's something for them from another developer tempted to switch as well.

I have bolded out the actions I tend to use all the time in Eclipse.


Basic Shortcuts:

  • C-N - open class
  • C-S-N - open any file
  • A-F7 - find all usages of the object in the workspace
  • C-Q - quick doco (info) about the object under cursor
  • C-click - go to definition/implementation
  • C-F12 - show quick outline of the class
  • C-Space - auto complete
  • C-S-Space - power auto complete (Tan and Enter - both select, but differently)
  • A-Insert - code generate
  • C-/ - comments with //
  • C-S-/ - comments with /*...*/
  • C-D - duplicates the selection
  • C-S-BckSpc - move back in change-history locations
  • C-S-F7 - highlight an identifier; F3 and S-F3 move to next/prev usage; Esc - de-highlight
  • Code | Optimize Imports - from menu
  • C-E - recent files list
  • call tree of the current method: C-A-H
  • locate the current file in the project tree: there is an icon in the project viewer
  • move selected statements up or down the file: C-S-up and down
  • go to declaration of the object: C-B 
  • go back in the browsing history (as opposed to change history):
    C-A-left and right or C-[
  • synchronize a file or a project against the SVN repo: see Version Control tool
Legend: C means Control, S - Shift and A - Alt

Advanced Shortcuts:

  • S-F6 - refactor: rename
  • Esc - in a tool window - moves focus to editor (S-Esc - also hides the tool window)
  • F12 - opposite to Esc
  • C-A-T - surround it
  • C-W - extend the selection
  • C-A-V - refactor: extract variable
  • Tab - live templates (np. itar Tab)
  • Local History | Show History - from file or directory shows and lets  revert to any version all changes in this file or directory

Create a New Project from Sources in IntelliJ: 

  • Open from sources or from SVN/GIT
  • Open Project Structure dialog (Ctrl+Shift+Alt+S) and specify which are source folders using the Module item from the left-hand panel

Friday, August 14, 2015

pgAdmin

Copy just the schema of a database: do Backup, with any format other than Plain (it requires pgsql to import it) and on the Option tab page select Schema Only.  It runs pg_dump behind the scene.  You will need pgAdmin newer than 1.16 which allowed schema-only option with Plain format only.
The problem is, version 1.20, for example, copies the whole database even if I check Schema-Only.

Back to Plain format.  In pgAdmin we choose a plain format and options as above or use comand line in CMD in folder where pgAdmin was installed as below:

pg_dump.exe --host myhost --port 8035 --username "myuser" --format plain --schema-only --no-owner --no-privileges --verbose --file "filename" "mydbname"

After generating it, in CMD run:

psql -d my-db-name -f "c:\aaa\my-exported-schema-file" -U postgres 

It will ask for the password.  The tool psql comes bundled with pgAdmin, at least it does in version 1.20.

Saturday, July 18, 2015

I Need Web Hosting Service - Small Size

Intro

I decided to host my genealogy tree using TNG software.  And so, I need webhosting service.  Small. Neither my tree is big, nor do I expect havey traffic to it, since I plan to open it only to my extended family.

First Impressions from Market Search

First, skip all companies advertising $2 hosting a month.  Haven't found one, that has a similar price for more than a first month.  Second, you may skip the so-called unlimited hosting.  At best, they will shutdown your service when when you generate more than average traffic from and to it.  Then, there are companies that squeeze so much from their hardware, that their server response is terrible, although basically everything works.  After this, you get prices of some $5 a month or more.  And this with only 500MB of disk space.  This was US market.

If you speak Polish, or are adventurous, go for polish web hosting.  They're still a jungle, but I have found a opinion based ranking of polish web hosting services at webhostingtalk.pl.  That website has also filterable collection of over 4K older and recent user opinions, So, you can easily check just opinions, for linuxpl, which is the company that seem to make my cut. It seems, for 2GB disk space with 50GB transfer (monthly) they charge about $13 a year.

Closing

I'll report on progress and my experience as I go.