Monday, January 25, 2021

SVN commands compared to GIT



CHECKOUT (git clone)

>svn checkout http://x.x.x.x.:18080/svn/branch 


Revert to specific revision 

>svn up -rxxx


Share Article : SVN commands compared to GIT
Share/Save/Bookmark

When you are stuck loading eclipse




you have tried even restarting the PC and still doesn't work ? 

Do following form command line, it works 


>>eclipse -console -consoleLog -clean


Ref: https://eclipsesource.com/blogs/2013/08/22/eclipse-command-line-options/


Share Article : When you are stuck loading eclipse
Share/Save/Bookmark

Saturday, January 9, 2021

Change mysql/mariadb root password


 >mysqladmin --user=root --password=oldpassword password "newpassword"

Change password for remote login as following

1. First login to mysql in command line

>mysql -u root -p

2. Then change password

>SET PASSWORD FOR 'root'@'%' = PASSWORD("NEWPASSSWORD");




Share Article : Change mysql/mariadb root password
Share/Save/Bookmark

Adding ssh key to ssh-agent so everytime you don't have to enter pass phrase for the rsa key


 Start ssh-agent if not started:

$ eval `ssh-agent -s`

Add your private key using ssh-add

$ ssh-add ~/.ssh/id_rsa_key  
Enter passphrase for /home/user/.ssh/id_rsa_key:  
Identity added: /home/user/.ssh/id_rsa_key   
(/home/user/.ssh/id_rsa_key)  

Check if the key is added (parameter is a lowercase L):

$ ssh-add -l  
2048 55:96:1a:b1:31:f6:f0:6f:d8:a7:49:1a:e5:4c:94:6f  
/home/user/.ssh/id_rsa_key (RSA)

Share Article : Adding ssh key to ssh-agent so everytime you don't have to enter pass phrase for the rsa key
Share/Save/Bookmark

Usefull commands to manage Docker


  1. Checking Unix process > htop
  2. Docker container resource usage > docker stats
  3. Running containers > docker ps
  4. Clean all unused containers volumes > docker system prune
  5. Check log file size of docker containers > du -chs /var/lib/docker/containers/*/*json.log
  6. Clean log of docker containers without container restart > truncate -s 0 /var/lib/docker/containers/*/*-json.log;


Share Article : Usefull commands to manage Docker
Share/Save/Bookmark

Saturday, September 12, 2020

Creating a SVN branch from given commit id


Simple as following.  {where 123 is the revison number}


>svn copy -r123 http://svn.example.com/repos/calc/trunk  http://svn.example.com/repos/calc/branches/my-calc-branch


Share Article : Creating a SVN branch from given commit id
Share/Save/Bookmark

Revert SVN commit - Most sure way to get it done


Say you got some old repo on svn, you hate that it is on svn but not git. Yet you want to revert a commit/s cleanly like you would do it in git 😃 This is how  

  You will have to use both svn command line and TortiseSVN to make it simple and clear. 

1. First go inside the folder from command line and updae the code base to latest revison as following.  

>svn up -r HEAD # get latest revision


2. Then go to TortiseSVN "Show Log" and copy the revision ids(to notepad) that need to be removed from latest to oldest.

3. Say revison 120 and 118 need to be removed. First we should remove 120 and commit it, then proceed to 118. Why ? So each commit related issued fixed individually. Clean and ATOMIC.

4. Go to command line and revert 120 commit

>svn merge -c -120 . # undo revision 120



Then go to TortiseSVN select commit, check the diff and see it is as intended, add a commit message like "revert of commit 120" and commit.

5. Do the same for 118
>svn merge -c -118 .  # undo revision 118
Commit with TortiseSVN same as for commit 120. You don't have to use TortiseSVN for the commit. You can just use following command. 
> svn commit           # after solving problems (if any) 
But I personally like to cross check the change from another tool before releasing to production.
  

Share Article : Revert SVN commit - Most sure way to get it done
Share/Save/Bookmark

Saturday, June 20, 2020


MySQL Tips - Before delete trigger for logging


  • Before delete trigger for archiving 
    CREATE TRIGGER ARCHIVE_ON_DELETE
    BEFORE DELETE
    ON TASK_SHEET FOR EACH ROW
    BEGIN
    
    INSERT INTO TASK_SHEET_ARCHIVE
    (id,task_id, asking_time, given, received, comments, status, last_updated, task_sheet_number, channel_id)
    
    
    
    SELECT id, task_id, asking_time, given, received, comments, status, last_updated, task_sheet_number, channel_id
    FROM  TASK_SHEET WHERE id=OLD.id;
    
    
    END
  • Set auto-increment value (due to some change you want to do, need to skip some ids)
    ALTER TABLE contacts AUTO_INCREMENT = 50;



Share Article :
Share/Save/Bookmark

Thursday, November 14, 2019

ORA-28000: the account is locked - FIX


## unlock oracle user account of my_user
>Login as SYSTEM 
SQL>ALTER USER my_username IDENTIFIED BY my_new_password ACCOUNT UNLOCK;

##check password lifetime
SQL>SELECT resource_name, limit FROM dba_profiles WHERE profile = 'DEFAULT' AND resource_type = 'PASSWORD';
##Change default limit to unlimited in ORACLE
SQL>ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;

Share Article : ORA-28000: the account is locked - FIX
Share/Save/Bookmark

Wednesday, October 16, 2019

Git, how to do a clean squash easy way


Simple as following

> git checkout bugfix/bugone
//do 6 commits and push it upstream
//now you want to squash all 6 in to one
//do the sqashing by number of commits
> git reset --soft HEAD~6 &&
> git commit
//force push the newly created single commit to upstream
//make sure you are the only user of this branch
> git push origin bugfix/bugone --force

Share Article : Git, how to do a clean squash easy way
Share/Save/Bookmark

Friday, August 19, 2016

Raspberry Pi Development Server for Home



We all got development server at our work. But we all like to have a dev server for our cool stuff we do at home. It may be freelance or pure technical interests.
We know we can set it up, but how and the associated complexities keep us form really setting up a dev server for home.

So let's see how we can do this on a Raspberry-pi.

What you need

  • Raspberry-pi - that's the whole point, right :) 
  • A Micro USB charger - for the PI
  • An Ethernet cable - for initial connectivity. Later with a wifi dongle you can set-up a wifi connection. 
  • A microSD card (minimum 8GB, and cards up to 32GB seem to work fine)
These will also come in handy during the initial setup:
  • A USB keyboard
  • An HDMI cable and monitor



  1. Install Raspbian on PI.
  2. Install remote desktop software on PI (it's easy to connect to PI this way than using mouse/keyboard/monitor whole setup)
  3. setup ssh on PI
  4. Install a web server
  5. Setup access to your local server through internet. You can user NgRok for that.
  6. Install your preferred dev environment(java based/node.js based etc)
  7. Setup a project on Bit-bucket
  8. Setup access from PI to your Bit-bucket project
  9. Configure PI to pull latest code from the Bit-bucket.
  10. Now you are there push you code to Bit-bucket and build it on PI 


So that's all you need to do. If you already got experience on this, you can set it up easily.
Otherwise just see the detailed instructions on most of these steps on this blog post
How to Turn Your Raspberry Pi Into a Development Server .


Share Article : Raspberry Pi Development Server for Home
Share/Save/Bookmark

Wednesday, November 25, 2015

Make Raspberry Pi Serial port available over Ethernet


Make Raspberry Pi Serial port available over Ethernet

To do this on raspberry-pi first install socat.

Then run following commands.

  1. On the raspberry-pi  run following command to redirect tcp data on port 54321 to serial port ttyAMA0

sudo socat tcp-l:54321,reuseaddr,fork file:/dev/ttyAMA0, nonblock, raw, waitlock=/var/run/ttyAMA0.lock

  1. On other connecting(client) linux machine run following command to create a virtual serial port and direct it to tcp port of the raspberry-pi 54321 port.

sudo socat pty,link=/dev/ttyAMA0,waitslave tcp:10.42.0.3:54321

  1. Now when you write to virtual serial port on the linux pc it get to the actual serial port of raspberry-pi over ethernet connection. However this seems to be a blocking the port.
  2. Checked on pi4j read/write on same port and read hangs. So as a solution to this create another virtual serial port on raspberry pi and map it to actual serial port. Then read/write to it. It fixed the problem.

sudo socat PTY,link=/dev/ttyAMA0 PTY,link=/dev/ttyAMA1

Srinath Gamage has attached the following document:
Make Serial port available over Ethernet
Google Docs: Create and edit documents online.Logo for Google Docs

Share Article : Make Raspberry Pi Serial port available over Ethernet
Share/Save/Bookmark

Monday, November 23, 2015

Serial Communication Test on Raspberry-pi


Serial Communication Test on Raspberry-pi

  1. First we have to disable OS from using serial port

1.png

2.png

3.png

4.png

  1. Just for the testing; Connect TxRx pin 8 and 10 on pin header with a jumper(cable).

8-10.png

  1. Then write to Serial port with following python code.

#!/usr/bin/env python

import time

import serial

ser = serial.Serial(

            port='/dev/ttyAMA0',

            baudrate = 9600,

            parity=serial.PARITY_NONE,

            stopbits=serial.STOPBITS_ONE,

            bytesize=serial.EIGHTBITS,

            timeout=1

)

counter=0

while 1:

            print counter

            ser.write('Write counter: %d \n'%(counter))

            time.sleep(1)

            counter += 1

write.png

  1. Use following code to read it

#!/usr/bin/env python

import time

import serial

ser = serial.Serial(

                   port='/dev/ttyAMA0',

                   baudrate = 9600,

                   parity=serial.PARITY_NONE,

                   stopbits=serial.STOPBITS_ONE,

                   bytesize=serial.EIGHTBITS,

                   timeout=1

               )

counter=0

while 1:

  x=ser.readline()

  print x

read.png

Srinath Gamage has attached the following document:
Serial Communication Test on Raspberry-pi
Google Docs: Create and edit documents online.Logo for Google Docs

Share Article : Serial Communication Test on Raspberry-pi
Share/Save/Bookmark

Wednesday, November 11, 2015

Add current RSA keys for password less login


cat .ssh/id_rsa.pub | ssh remoteLoginUser@172.1.1.1  'cat >> .ssh/authorized_keys'

Share Article : Add current RSA keys for password less login
Share/Save/Bookmark

Monday, August 4, 2014

How to Enable Hibernation in Ubuntu 14.04


How to Enable Hibernation in Ubuntu 14.04

Enable Hibernate
------------------

/var/lib/polkit-1/localauthority/50-local.d/hibernate.pkla


[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes


Hibernate your laptop when lid is closed
------------------------------------------
sudo gedit /etc/systemd/logind.conf


Change the line #HandleLidSwitch=suspend to HandleLidSwitch=hibernate


Share Article : How to Enable Hibernation in Ubuntu 14.04
Share/Save/Bookmark

Monday, May 19, 2014

Some php stuff



  • format datetime to date -   date("Y-m-d", strtotime($row->created_date))

Share Article : Some php stuff
Share/Save/Bookmark

Wednesday, March 19, 2014

Password -less ssh / scp with RSA on ubuntu


1. creare rsa on client [ssh-keygen -t rsa]
2. copy rsa to server [ssh-copy-id -i rsaformyserver.pub build@myserver]
3. Try ssh [ ssh -i rsaformyserver build@myserver ]
4. Do same on server side

Share Article : Password -less ssh / scp with RSA on ubuntu
Share/Save/Bookmark

Sunday, March 9, 2014

MS SQL Server How to implement LPAD as in Oracle


select REPLICATE('0', 4 - DATALENGTH('234')) +'234'

Share Article : MS SQL Server How to implement LPAD as in Oracle
Share/Save/Bookmark

Tuesday, July 9, 2013

Campbell Biology-Concepts and Connections,7th Ed


First download uTorrent from here
Then Click to download torrent Campbell Biology-Concepts and Connections,7th Ed

Cutting edge information that connects biology to your life. Campbell Biology: Concepts & Connections, Seventh Edition–Go Wild!

 

Campbell Biology: Concepts & Connections with MasteringBiology®, Seventh Edition–always accurate, always current, and always the most pedagogically innovative non-majors biology text. This bestselling text has undergone an extensive revision to make biology even more approachable with increased use of analogies, real world examples, and more conversational language. Using over 200 new MasteringBiology activities that were written by the dynamic author team, you will arrive for class prepared. The book and MasteringBiology together create the classroom experience that you imagined in your wildest dreams.
About the Author

Jane B. Reece has worked in biology publishing since 1978, when she joined the editorial staff of Benjamin Cummings. Her education includes an A.B. in biology from Harvard University (where she was initially a philosophy major), an M.S. in microbiology from Rutgers University, and a Ph.D. in bacteriology from the University of California, Berkeley. At UC Berkeley and later as a postdoctoral fellow in genetics at Stanford University, her research focused on genetic recombination in bacteria. Dr. Reece taught biology at Middlesex County College (New Jersey) and Queensborough Community College (New York). During her 12 years as an editor at Benjamin Cummings, she played a major role in a number of successful textbooks. She is lead author of Campbell Biology  and co-author of Campbell Essential Biology and Campbell Essential Biology with Physiology.

 

Martha R. Taylor has been teaching biology for over 35 years. She earned her B.A. in biology from Gettysburg College and her M.S. and Ph.D. in science education from Cornell University. She was assistant director of the Office of Instructional Support at Cornell for seven years. She has taught introductory biology for both majors and non-majors at Cornell University and is currently a lecturer in the Learning Strategies Center teaching supplemental biology courses. Based on her experiences working with students in classrooms, laboratories, and tutorials, Dr. Taylor is committed to helping students create their own knowledge of and appreciation for biology. She has been the author of the Student Study Guide for all nine editions of Campbell Biology.

 

Eric J. Simon is an associate professor in the Department of Biology and Health Science at New England College in Henniker, New Hampshire. He teaches introductory biology to science majors and non-science majors, as well as upper-level courses in genetics, microbiology, tropical marine biology, and molecular biology. Dr. Simon received a B.A. in biology and computer science and an M.A. in biology from Wesleyan University and a Ph.D. in biochemistry from Harvard University. His research focuses on innovative ways to use technology to improve teaching and learning in the science classroom, particularly for non-science majors. Dr. Simon is the lead author of Campbell Essential Biology and Campbell Essential Biology with Physiology.

 

Jean L. Dickey is a professor of biology at Clemson University. She had no idea that science was interesting until her senior year in high school, when a scheduling problem landed her in an advanced biology course. Abandoning plans to study English or foreign languages, she enrolled in Kent State University as a biology major. After receiving her B.S. in biology, she went on to earn a Ph.D. in ecology and evolution from Purdue University. Since joining the faculty at Clemson in 1984, Dr. Dickey has specialized in teaching non-science majors, including a course designed for pre-service elementary teachers and workshops for in-service teachers. She also developed an investigative laboratory curriculum for general biology. Dr. Dickey is author of Laboratory Investigations for Biology  and co-author of Campbell Essential Biology and Campbell Essential Biology with Physiology.
Product Details

    * Hardcover: 928 pages
    * Publisher: Benjamin Cummings; 7 edition (February 19, 2011)
    * Language: English
    * ISBN-10: 0321696484
    * ISBN-13: 978-0321696489
Disclaimer   
If book seems useful you should buy it for nearly 100$ at amazon. Support the authors :) 

Share Article : Campbell Biology-Concepts and Connections,7th Ed
Share/Save/Bookmark

Sunday, June 16, 2013

SQL To insert content from Select Query


INSERT INTO `garment`.`meta_my_sequence_table`
            (`id`,
             `sequence`)

SELECT 0,TYPE_CODE FROM meta_transaction_types WHERE type_code LIKE '%R' ;

Share Article : SQL To insert content from Select Query
Share/Save/Bookmark