Wednesday, September 27, 2017

Jasper Server in Docker

One of the functionality in our system is can able to generate a report using Jasper report.  We have a Jasper server setup in another ip address.  I was wondering how they set up the server but there is no chance to know how exactly they configure it.

So I pop up the browser trying to get some luck if there's an image from docker for Jasper and voila, there is!

https://github.com/retrievercommunications/docker-jasperserver

It's very simple setup

docker run -d --name jasperserver -e DB_TYPE=mysql -e DB_HOST=db -e DB_PORT=3306 -e DB_USER=root -e DB_PASSWORD=mysql --link jasperserver_mysql:db -p 8080:8080 retriever/jasperserver

but since we are using Postgres, I changed some parameters.

docker run -d --name jasperserver -e DB_TYPE=postgresql -e DB_HOST=db -e DB_PORT=5432 -e DB_USER=admin -e DB_PASSWORD=admin --link postgres9.3:db -p 8080:8080 retriever/jasperserver




Eureka!



Sunday, September 24, 2017

Hassle free mp3

My wife emotionally loves the song "Perfect" by Ed Sheeran and actually, she cried to hear this song last night. So I pop up the browser and browse if I can download the song and remember that I can download it from google chrome browser with some simple script.

Here's the script below:

"Perfect" -inurl:(html|htm|php|pls|txt) intitle:index.of "last modified" (mp3)


Eureka!



Friday, September 15, 2017

GVIM color it

I really like VIM even I'm still not yet a master... hehe.

One way you use VIM in windows is to install GVIM and you can download it from official page.

As I don't like the default colorscheme in GVIM, I found a way to change it and they also provide a lot of color scheme to available for us.

You can download the color scheme in this site
http://vimcolors.com/

Save it in folder
C:\Program Files (x86)\Vim\vim80\colors

and finally, add in the last line in _vimrc found in C:\Program Files (x86)\Vim
eg.
colorscheme carbonized-dark


Eureka!


Wednesday, September 13, 2017

Reset Visual Paradigm - Hacker way!

In my current company, I'm using Visual Paradigm for my documentation task. If you go there site, you can either download community and evaluation edition. The problem with community edition is it doesn't have DFD diagram or Data Flow Diagram. So I was forced to download the evaluation copy with 30 days grace period.

But there's a hacker way to reset the 30 days grace period.

go to folder:

C:\Users\lynard\AppData\Roaming\VisualParadigm

and delete all files inside. Eureka! that's it. so simple but thanks who share this tip from someone.

Reference:
https://www.youtube.com/watch?v=33scaPXe4wU




Thursday, September 7, 2017

ls command

Friday I'm in Love, Yes! it's Friday and I'm good as I was so early at work. I saw 2 bosses already sitting.

As I was looking around through my files. I realized that I always use "ls" command. It is a very helpful command in Linux so I decided to google up and search more other useful things from it.

One from the tips is very useful it will not only list all items under the folder but also list down every item in every folder.

$ ls -R




References:
https://www.tecmint.com/15-basic-ls-command-examples-in-linux/

More detailed and advanced
https://www.tecmint.com/linux-ls-command-tricks/



Tuesday, September 5, 2017

The Power of VIM


h   move one character left
j   move one row down
k   move one row up
l   move one character right
w   move to beginning of next word
b   move to previous beginning of word
e   move to end of word
W   move to beginning of next word after a whitespace
B   move to beginning of previous word before a whitespace
E   move to end of word before a whitespace


0   move to beginning of line
$   move to end of line
_   move to first non-blank character of the line
g_  move to last non-blank character of the line

gg  move to first line
G   move to last line
ngg move to n'th line of file (n is a number; 12G moves to line 12)
nG  move to n'th line of file (n is a number; 12G moves to line 12)
H move to top of screen M move to middle of screen L move to bottom of screen
zz scroll the line with the cursor to the center of the screen zt scroll the line with the cursor to the top zb scroll the line with the cursor to the bottom
Ctrl-D move half-page down Ctrl-U move half-page up Ctrl-B page up Ctrl-F page down Ctrl-O jump to last (older) cursor position Ctrl-I jump to next cursor position (after Ctrl-O) Ctrl-Y move view pane up Ctrl-E move view pane down
n next matching search pattern N previous matching search pattern
  • next whole word under cursor
  1. previous whole word under cursor
g* next matching search (not whole word) pattern under cursor
gd  go to definition/first occurrence of the word under cursor
g#  previous matching search (not whole word) pattern under cursor
%   jump to matching bracket { } [ ] ( )

fX  to next 'X' after cursor, in the same line (X is any character)
FX  to previous 'X' before cursor (f and F put the cursor on X)
tX  til next 'X' (similar to above, but cursor is before X)
TX  til previous 'X'
;   repeat above, in same direction
,   repeat above, in reverse direction



References:
http://vim.wikia.com/wiki/All_the_right_moves


Morning headache with Postgresql

While I'm doing python exercise. Suddenly, my database connection was down for no reason. It takes me 2 hours to fix the issue and I almost gave up. Damn it! actually, I didn't say that until now. haha

But I learn new stuff today especially postgres commands, like:

To check the database server status

/etc/init.d/postgresql status


As usual, my friend google help me find out the solution and took me a while to find it. Here's the link https://askubuntu.com/questions/50621/cannot-connect-to-postgresql-on-port-5432




First purge the old postgres install.

sudo apt-get remove --purge postgresql-9.3

Now simply reinstall

sudo apt-get install postgresql-9.3




Now, when I run my odoo. My username "devlynard" was not found it is because I reinstall the postgres. So, I just add it back. 




Eureka!





Python Rocks!

I have a transfer knowledge today with my colleague as he will be leaving soon. While listening to him I look at his code on how to write the INI file in python. I was wondering how he did it. I know in Java before and I can't really remember the code. So to make it short, I google it and try to learn by my self.

I found this site and it's really straight forward.
https://martin-thoma.com/configuration-files-in-python/

you can create a variety not only INI file but also JSON,YAML and XML. wow, that's great!

It's all about VIM

Move the cursor from the two (vertical) split window in Vim.

By holding the the Ctrl, press w two times do the magic.


Ctrl-w w or type :wincmd w to move the cursor between the two windows/buffers.


Eureka!

References:
https://stackoverflow.com/questions/6071266/how-to-flip-windows-in-vim

Monday, September 4, 2017

Change File Permission in Linux

I have encountered this issue when I tried to edit the file postgresql.conf and pg_hba.conf. Both are with read-only permission. So I was digging on the internet and finally found a solution.

chmod 066

The syntax:
$chmod 066 filename

$chmod 066 postgresql.conf

Eureka!


References:
http://www.filepermissions.com/directory-permission/066

free online comma separating tool

https://delim.co/#