Category Archives: WEB Programming

Putty automatic reconnect after internet interruption

I love working on my servers via SSH by using Putty. I think it’s a great SSH client.

However there’s one thing that annoys me the most: when my internet connection gets interrupted or when after I wake up my computer from sleep, all my Putty instances get disconnected. I have to log in again to all of them, make the initial commands in each of them, etc, etc.

I’ve recently discovered another Putty-fork client, called Putty Tray which you can find here: https://puttytray.goeswhere.com/.

The best new thing added by Putty Tray to the old and best classic Putty are two new options in the Conenction tab, targeting automatic reconnecting after interruptions: “attempt to reconnect on network failure” and “attempt to reconnect on system wake-up”. You can see them on the screenshot below:

putty-tray

 

Useful Postgres SQL Example Codes

1. create basic demo table in postgres sql with an ENUM column and an auto-increment one


-- we create an enum type
CREATE TYPE demo_enum AS ENUM ('item1', 'item2', 'item3');

-- we create a sequence
CREATE SEQUENCE demotable_id_seq;

-- we create the actual table and we'll use the sequence for autoincrement column
-- and the type for an enum-type column
CREATE TABLE demo_table
("id" integer NOT NULL DEFAULT nextval('demotable_id_seq'),
start_date timestamp,
end_date timestamp,
demo_choice demo_enum,
demo_extern integer,
status smallint DEFAULT 1,
PRIMARY KEY ("id"));

-- we alter the sequence
ALTER SEQUENCE demotable_id_seq OWNED BY demo_table.id;

-- we add a foreign key constraint
ALTER TABLE demo_table ADD FOREIGN KEY (demo_extern) REFERENCES demo_other_table(demo_extern_column);

How to make NetBeans 8 for PHP look more like Notepad++

Writing on the same subject here as the last 2 articles (line-spacing and python support) on NetBeans.

Little back-story, for the past 7 years I worked and I’m still working all my web-related projects in Notepad++. I’ve tried all the IDEs out there, didn’t liked any of them for reasons more or less logical (Yes, sometimes I listen my feelings/emotions when making choices, for example “I like this editor or not” :p )

Recently I decided to give another try at NetBeans (following my colleagues persistence 😀 ) and first thing I wanted to do was to make it look more like my notepad++. Especially when it comes to color highlight and syntax.

I found the same question being asked here. One of the answers gave a full solution to the case: a download offering all the color-configs for making the NetBeans IDE show PHP codes colored like Notepad++ does.

You can download it from the following link: Notepad++ Theme for NetBeans 6.7.x

1. Unzip file
2. From menu go Tools/Options then click on Import button in the shown dialogue browse the unzipped folder
3. From the shown tree check “Fonts & Colors” and click on OK button.
4. After restarting IDE again from menu goto Tools/Options select Fonts & Colors tab and from Profile combo box select “Notepad_plusplus”
have a nice time.

Since I have no idea if the download link will work forever (probably not :p) or if the original poster will take it down, etc, etc, I am uploading the source on my blog as well and provide it for download from the link below. Again, all the credits go to the original author and to the user who posted the solution on the askubuntu.com forum: Saeed Zarinfam (I don’t know if the author of the config files is the same person with the author of the post, whomever they are, many thanks!)

Download directly: Notepad_plusplus_Theme_for_NetBeans_6.7.x_(php5-html-css)

How to increase line-height (line spacing) in NetBeans 8

Being a Notepad++ veteran user, the differences in code coloring, highlight and editor display in NetBeans IDE kinda put me off.

So first thing I wanted was to increase the line-height of the text (code, to be precise :p ) which is shown in NetBeans’ editor.

Luckily for me, I was not alone, other people asked the same question on google and some even answered it :))

The best answer by far is the one given by user pengemizt from stackoverflow.com on the question you can find here. That question was asking about NetBeans 7 but I just tried it on NetBeans 8 and it works ok.

I’m gonna copy/paste the answer here (all the credit going, like I’ve said above, to user pengemizt)

1. Find org-netbeans-modules-editor-settings-CustomPreferences.xml in ~/.netbeans/x.x/config/Editors/Preferences where x.x is your netbeans version.
In my case, this was C:\Users\Andrei\AppData\Roaming\NetBeans\8.0\config\Editors\Preferences\org-netbeans-modules-editor-settings-CustomPreferences.xml

NOTE.: By trial and error I found that this file is generated only after you first run NetBeans first time. I’ve just installed it on my home computer and decided to do all the changes first, and this file was nowhere to be found on my pc, so I had to run first netbeans and then edit the xml config file.

2. Add this xml markup just above </editor-preferences> or anywhere if you know what you doing.

    <entry javaType="java.lang.Float" name="line-height-correction" xml:space="preserve">

        <value><![CDATA[1.4]]></value>

    </entry>

 

And I may add, restart NetBeans. The solution above gave as example setting the line-height to 1.4 but in my tests I found that a value of 1.2 works better (for me).

How to set up Netbeans with Python support

Recently I had to work with some python-powered codes and one of my colleagues pointed me to a nice tutorial on how to enable support for Python on Netbeans IDE.

Since I’m a 7-years-old Notepad++ veteran user :p I was glad to get some help on my new “still in tests” IDE of use 😀

So here’s the tutorial’s link. Enjoy!

BTW, although the tutorial is for Netbeans 7.1, I can confirm it works on NetBeans 8 as well.

https://blogs.oracle.com/geertjan/entry/python_in_netbeans_ide_71