tag:blogger.com,1999:blog-31995705963241861382024-02-07T04:46:24.621-08:00SrinathBugzby Srinath GamageSrinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.comBlogger67125tag:blogger.com,1999:blog-3199570596324186138.post-39658072354159644512021-01-25T21:38:00.000-08:002021-01-25T21:38:27.655-08:00SVN commands compared to GIT <p><br /></p><p>CHECKOUT (git clone)</p><p>>svn checkout http://x.x.x.x.:18080/svn/branch </p><p><br /></p><p>Revert to specific revision </p><p>>svn up -rxxx</p>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-2803613217179108052021-01-25T19:00:00.000-08:002021-01-25T19:00:03.433-08:00 When you are stuck loading eclipse<p><br /></p><p><br /></p><p>you have tried even restarting the PC and still doesn't work ? </p><p>Do following form command line, it works </p><p><br /></p><p>>>eclipse -console -consoleLog -clean</p><p><br /></p><p>Ref: https://eclipsesource.com/blogs/2013/08/22/eclipse-command-line-options/</p>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-17223421002332391062021-01-09T20:43:00.004-08:002021-01-09T21:31:07.209-08:00Change mysql/mariadb root password <p> ><span color="rgba(0, 0, 0, 0.9)" style="background-color: #f7f7f8; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace, monospace; font-size: 16px; white-space: pre-wrap;">mysqladmin --user=root --password=oldpassword password "newpassword"</span></p><p><span color="rgba(0, 0, 0, 0.9)" style="background-color: #f7f7f8; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace, monospace; font-size: 16px; white-space: pre-wrap;">Change password for remote login as following </span></p><p><span color="rgba(0, 0, 0, 0.9)" style="background-color: #f7f7f8; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace, monospace; font-size: 16px; white-space: pre-wrap;">1. First login to mysql in command line </span></p><p><span color="rgba(0, 0, 0, 0.9)" style="background-color: #f7f7f8; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace, monospace; font-size: 16px; white-space: pre-wrap;">>mysql -u root -p</span></p><p><span color="rgba(0, 0, 0, 0.9)" style="background-color: #f7f7f8; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace, monospace; font-size: 16px; white-space: pre-wrap;">2. Then change password </span></p><p><span color="rgba(0, 0, 0, 0.9)" style="background-color: #f7f7f8; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace, monospace; font-size: 16px; white-space: pre-wrap;">>SET PASSWORD FOR 'root'@'%' = PASSWORD("NEWPASSSWORD");</span></p><p><span color="rgba(0, 0, 0, 0.9)" style="background-color: #f7f7f8; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace, monospace; font-size: 16px; white-space: pre-wrap;"><br /></span></p><p><span color="rgba(0, 0, 0, 0.9)" style="background-color: #f7f7f8; font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace, monospace; font-size: 16px; white-space: pre-wrap;"><br /></span></p>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-91704255669813696622021-01-09T19:41:00.002-08:002021-01-09T19:41:46.357-08:00Adding ssh key to ssh-agent so everytime you don't have to enter pass phrase for the rsa key <p> <span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;">Start</span><span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;"> </span><strong style="border: 0px; box-sizing: inherit; color: #242729; font-family: inherit; font-size: 15px; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">ssh-agent</strong><span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;"> </span><span style="background-color: white; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px;">if not started:</span></p><pre style="border-radius: 5px; border: 0px; box-sizing: inherit; color: var(--highlight-color); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: 1.30769; margin-bottom: calc(var(--s-prose-spacing) + 0.4em); margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px; vertical-align: baseline; width: auto;"><code style="border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;">$ eval `ssh-agent -s`
</code></pre><p style="background-color: white; border: 0px; box-sizing: inherit; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: var(--s-prose-spacing); margin-left: 0px; margin-right: 0px; margin-top: 0px; padding: 0px; vertical-align: baseline;">Add your <strong style="border: 0px; box-sizing: inherit; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">private key</strong> using <strong style="border: 0px; box-sizing: inherit; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">ssh-add</strong></p><pre style="border-radius: 5px; border: 0px; box-sizing: inherit; color: var(--highlight-color); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: 1.30769; margin-bottom: calc(var(--s-prose-spacing) + 0.4em); margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px; vertical-align: baseline; width: auto;"><code style="border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;">$ 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)
</code></pre><p style="background-color: white; border: 0px; box-sizing: inherit; clear: both; color: #242729; font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 15px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: var(--s-prose-spacing); margin-left: 0px; margin-right: 0px; margin-top: 0px; padding: 0px; vertical-align: baseline;">Check if the key is added (parameter is a lowercase L):</p><pre style="border-radius: 5px; border: 0px; box-sizing: inherit; color: var(--highlight-color); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: 1.30769; margin-bottom: calc(var(--s-prose-spacing) + 0.4em); margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px; vertical-align: baseline; width: auto;"><code style="border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;">$ 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)</code></pre>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-28858140387259327502021-01-09T17:56:00.003-08:002021-01-09T17:56:49.769-08:00Usefull commands to manage Docker<p></p><ol style="text-align: left;"><li>Checking Unix process > htop</li><li>Docker container resource usage > docker stats</li><li>Running containers > docker ps</li><li>Clean all unused containers volumes > docker system prune</li><li>Check log file size of docker containers > du -chs /var/lib/docker/containers/*/*json.log</li><li>Clean log of docker containers without container restart > truncate -s 0 /var/lib/docker/containers/*/*-json.log;</li></ol><p></p>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-56155674643194811402020-09-12T20:52:00.006-07:002020-09-12T20:52:58.834-07:00Creating a SVN branch from given commit id <p>Simple as following. {where <span style="font-family: courier; font-size: 13px;">123 is the revison number</span>}</p><p><br /></p><p><span style="font-family: courier;">><span style="color: var(--black-800); font-size: 13px; font-style: inherit; font-variant-caps: inherit; font-variant-ligatures: inherit; font-weight: inherit; white-space: inherit;">svn copy -r123 http://svn.example.com/repos/calc/trunk </span><span style="color: var(--black-800); font-size: 13px; font-style: inherit; font-variant-caps: inherit; font-variant-ligatures: inherit; font-weight: inherit; white-space: inherit;"> http://svn.example.com/repos/calc/branches/my-calc-branch</span></span></p>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-85411585082311283592020-09-12T20:48:00.004-07:002020-09-12T20:48:43.664-07:00Revert SVN commit - Most sure way to get it done<p>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 </p><p> You will have to use both svn command line and TortiseSVN to make it simple and clear. </p><p><span style="font-family: inherit;">1. First go inside the folder from command line and updae the code base to latest revison as following.</span> </p><p><span color="var(--black-800)" face="Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif" style="font-family: courier; font-size: 13px; font-style: inherit; font-variant-caps: inherit; font-variant-ligatures: inherit; font-weight: inherit; white-space: inherit;">>svn up -r HEAD # get latest revision</span></p><br />2. Then go to TortiseSVN "Show Log" and copy the revision ids(to notepad) that need to be removed from latest to oldest. <br /><br />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. <br /><br />4. Go to command line and revert 120 commit <p><span color="var(--black-800)" face="Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif" style="font-family: courier; font-size: 13px; font-style: inherit; font-variant-caps: inherit; font-variant-ligatures: inherit; font-weight: inherit; white-space: inherit;">>svn merge -c -120 . # undo revision 120</span></p><br /><br />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. <br /><br />5. Do the same for 118<pre style="border-radius: 5px; border: 0px; box-sizing: inherit; color: var(--highlight-color); font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: 1.30769; margin-bottom: 1.6em; margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px; vertical-align: baseline; width: auto;"><span style="font-family: courier;">>svn merge -c -118 . # undo revision 118</span></pre>Commit with TortiseSVN same as for commit 120. You don't have to use TortiseSVN for the commit. You can just use following command. <div><pre style="border-radius: 5px; border: 0px; box-sizing: inherit; color: var(--highlight-color); font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: 1.30769; margin-bottom: 1.6em; margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px; vertical-align: baseline; width: auto;"><span style="font-family: courier;"><code style="border-radius: 0px; border: 0px; box-sizing: inherit; color: var(--black-800); font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;">> </code>svn commit # after solving problems (if any) </span></pre></div><div>But I personally like to cross check the change from another tool before releasing to production. <pre style="border-radius: 5px; border: 0px; box-sizing: inherit; color: var(--highlight-color); font-family: consolas, menlo, monaco, "lucida console", "liberation mono", "dejavu sans mono", "bitstream vera sans mono", "courier new", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-east-asian: inherit; font-variant-numeric: inherit; line-height: 1.30769; margin-bottom: 1.6em; margin-top: 0px; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 12px; vertical-align: baseline; width: auto;"> </pre></div>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-9368997359148379062020-06-20T21:15:00.001-07:002020-06-20T21:15:20.566-07:00MySQL Tips - Before delete trigger for logging<br />
<br />
<br />
<ul>
<li>Before delete trigger for archiving <pre class="notranslate" style="background-color: #eff1f9; border-color: rgb(221, 221, 221) rgb(221, 221, 221) rgb(221, 221, 221) rgb(159, 167, 217); border-image: initial; border-radius: 4px; border-style: solid; border-width: 1px 1px 1px 5px; box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 15px; line-height: 1.42857; margin-bottom: 11px; overflow-wrap: break-word; overflow: auto; padding: 10.5px; white-space: pre-wrap; word-break: normal;">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</pre>
</li>
<li>Set auto-increment value (due to some change you want to do, need to skip some ids)<pre class="notranslate" style="background-color: #eff1f9; border-color: rgb(221, 221, 221) rgb(221, 221, 221) rgb(221, 221, 221) rgb(159, 167, 217); border-image: initial; border-radius: 4px; border-style: solid; border-width: 1px 1px 1px 5px; box-sizing: border-box; color: #333333; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 15px; line-height: 1.42857; margin-bottom: 11px; overflow-wrap: break-word; overflow: auto; padding: 10.5px; white-space: pre-wrap; word-break: normal;">ALTER TABLE contacts AUTO_INCREMENT = 50;</pre>
</li>
</ul>
<br />
<br />Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-27674321056372178842019-11-14T23:34:00.000-08:002019-11-14T23:59:41.155-08:00ORA-28000: the account is locked - FIX## unlock oracle user account of my_user<br />
>Login as SYSTEM <br />
SQL>ALTER USER my_username IDENTIFIED BY my_new_password ACCOUNT UNLOCK;<br />
<br />
##check password lifetime<br />
SQL>SELECT resource_name, limit FROM dba_profiles WHERE profile = 'DEFAULT' AND resource_type = 'PASSWORD';<br />
##Change default limit to unlimited in ORACLE<br />
SQL>ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-86854271816694691362019-10-16T00:31:00.002-07:002019-10-16T00:31:43.981-07:00Git, how to do a clean squash easy way Simple as following <br />
<br />
> git checkout bugfix/bugone<br />
//do 6 commits and push it upstream <br />
//now you want to squash all 6 in to one<br />
//do the sqashing by number of commits <br />
> <b>git reset --soft HEAD~6 &&</b><br />
> <b>git commit</b><br />
//force push the newly created single commit to upstream<br />
//make sure you are the only user of this branch<br />
> git push origin bugfix/bugone <b>--force</b>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-35060063144766626682016-08-19T20:12:00.001-07:002016-08-19T20:12:44.987-07:00Raspberry Pi Development Server for Home<br />
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. <br />
We know we can set it up, but how and the associated complexities keep us form really setting up a dev server for home.<br />
<br />
So let's see how we can do this on a Raspberry-pi. <br />
<b><br /></b>
<b>What you need</b><br />
<br />
<ul>
<li>Raspberry-pi - that's the whole point, right :) </li>
<li>A Micro USB charger - for the PI</li>
<li>An Ethernet cable - for initial connectivity. Later with a wifi dongle you can set-up a wifi connection. </li>
<li>A microSD card (minimum 8GB, and cards up to 32GB seem to work fine)</li>
</ul>
These will also come in handy during the initial setup:<br /><ul>
<li>A USB keyboard</li>
<li>An HDMI cable and monitor</li>
</ul>
<br />
<br />
<br />
<ol>
<li>Install Raspbian on PI.</li>
<li>Install remote desktop software on PI (it's easy to connect to PI this way than using mouse/keyboard/monitor whole setup)</li>
<li>setup ssh on PI</li>
<li>Install a web server</li>
<li>Setup access to your local server through internet. You can user <a href="https://ngrok.com/">NgRok </a>for that.</li>
<li>Install your preferred dev environment(java based/node.js based etc)</li>
<li>Setup a project on Bit-bucket</li>
<li>Setup access from PI to your Bit-bucket project</li>
<li>Configure PI to pull latest code from the Bit-bucket.</li>
<li>Now you are there push you code to Bit-bucket and build it on PI </li>
</ol>
<br />
<br />
So that's all you need to do. If you already got experience on this, you can set it up easily.<br />
Otherwise just see the detailed instructions on most of these steps on this blog post<br />
<a href="https://www.toptal.com/raspberry-pi/how-to-turn-your-raspberry-pi-into-a-development-server">How to Turn Your Raspberry Pi Into a Development Server</a> .<br />
<br />Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-41433126855981101522015-11-25T03:12:00.001-08:002015-11-25T03:12:02.440-08:00Make Raspberry Pi Serial port available over Ethernet<p class="title" style="padding-top:0pt;margin:0;color:#000000;padding-left:0;font-size:26pt;padding-bottom:3pt;line-height:1.15;page-break-after:avoid;font-family:"Arial";orphans:2;widows:2;text-align:left;direction:ltr;padding-right:0"><a name="h.tcox0hcbp8mt"></a><span>Make Raspberry Pi Serial port available over Ethernet </span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>To do this on raspberry-pi first install socat. </span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>Then run following commands. </span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;height:11pt;direction:ltr"><span></span></p><ol class="lst-kix_t8692cge9xdj-0 start" start="1" style="padding:0;margin:0"><li style="margin-left:36pt;padding:0;color:#000000;font-size:11pt;font-family:"Arial";margin-top:0;orphans:2;margin-bottom:0;widows:2;direction:ltr;margin-right:0"><span>On the raspberry-pi run following command to redirect tcp data on port 54321 to serial port ttyAMA0</span></li></ol><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="font-family:"Courier New"">sudo socat tcp-l:54321,reuseaddr,fork file:/dev/ttyAMA0, nonblock, raw, waitlock=/var/run/ttyAMA0.lock</span></p><ol class="lst-kix_u6cqsk9wqznj-0 start" start="2" style="padding:0;margin:0"><li style="margin-left:36pt;padding:0;color:#000000;font-size:11pt;font-family:"Arial";margin-top:0;orphans:2;margin-bottom:0;widows:2;direction:ltr;margin-right:0"><span>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. </span></li></ol><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="font-family:"Courier New"">sudo socat pty,link=/dev/ttyAMA0,waitslave tcp:10.42.0.3:54321</span></p><ol class="lst-kix_ry3qkk6urqo8-0 start" start="3" style="padding:0;margin:0"><li style="margin-left:36pt;padding:0;color:#000000;font-size:11pt;font-family:"Arial";margin-top:0;orphans:2;margin-bottom:0;widows:2;direction:ltr;margin-right:0"><span>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. </span></li><li style="margin-left:36pt;padding:0;color:#000000;font-size:11pt;font-family:"Arial";margin-top:0;orphans:2;margin-bottom:0;widows:2;direction:ltr;margin-right:0"><span>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. </span></li></ol><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="font-family:"Courier New"">sudo socat PTY,link=/dev/ttyAMA0 PTY,link=/dev/ttyAMA1</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;height:11pt;direction:ltr"><span></span></p><div style="width: 100%; padding: 24px 0 16px 0; background-color: #f5f5f5; text-align: center;"><div style="display: inline-block; width: 90%; max-width: 680px;min-width: 280px; text-align: left; font-family: Roboto,Arial,Helvetica,sans-serif;"><div style="display: block; padding: 0 2px;"><div style="display: block; background: #fff; height: 2px;"></div></div><div style="border-left: 1px solid #f0f0f0; border-right: 1px solid #f0f0f0;"><div style="padding: 24px 32px 32px 32px; background:#fff; border-right: 1px solid #eaeaea; border-left: 1px solid #eaeaea;" dir="ltr"><div style="font-size: 14px; line-height: 18px; color: #444;"><a href="mailto:srinathworks@gmail.com" style="color:inherit;text-decoration:none">Srinath Gamage</a> has attached the following document:</div><div style="height: 10px;"></div><div style="font-size: 18px; display: table;"><div style="display: table-row; border-bottom: 4px solid #fff;"><span style="display: table-cell;"><div style="height: 32px;"><img src="https://ssl.gstatic.com/docs/documents/share/images/services/document-4.png" aria-label="Document" style="vertical-align: middle; max-width: 24px;"/></div></span><span style="display: table-cell; padding-left: 12px;">Make Serial port available over Ethernet</span></div></div></div></div><table style="width: 100%; border-collapse: collapse;" role="presentation"><tr><td style="padding: 0px;"><table style="border-collapse: collapse; width: 3px;" role="presentation"><tr height="1"><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#e5e5e5" style="padding: 0px;"></td></tr><tr height="1"><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td></tr><tr height="1"><td width="1" bgcolor="#f5f5f5" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td></tr></table></td><td style="width: 100%; padding: 0px;"><div style="height: 1px; width: auto; border-top: 1px solid #ddd; background:#eaeaea; border-bottom: 1px solid #f0f0f0;"></div></td><td style="padding: 0px;"><table style="border-collapse: collapse; width: 3px;" role="presentation"><tr height="1"><td width="1" bgcolor="#e5e5e5" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td></tr><tr height="1"><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td></tr><tr height="1"><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#f5f5f5" style="padding: 0px;"></td></tr></table></td></tr></table><table style="padding: 14px 10px 0 10px;" role="presentation" dir="ltr"><tr><td style="width: 100%; font-size:11px; font-family: Roboto,Arial,Helvetica,sans-serif; color:#646464; line-height: 20px; min-height: 40px; vertical-align: middle;">Google Docs: Create and edit documents online.</td><td style="padding-left: 20px; vertical-align: middle;"><a href="https://drive.google.com" target="_blank"><img src="https://www.gstatic.com/images/branding/googlelogo/1x/googlelogo_tm_black54_color_96x40dp.png" width="96" alt="Logo for Google Docs" border="0"></a></td></tr></table></div></div>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-10345211364046355082015-11-23T17:43:00.001-08:002015-11-23T17:43:09.653-08:00Serial Communication Test on Raspberry-pi<p class="title" style="padding-top:0pt;margin:0;color:#000000;padding-left:0;font-size:26pt;padding-bottom:3pt;line-height:1.15;page-break-after:avoid;font-family:"Arial";orphans:2;widows:2;text-align:left;direction:ltr;padding-right:0"><a name="h.wl7c3aph1nl7"></a><span>Serial Communication Test on Raspberry-pi</span></p><ol class="lst-kix_2qv55psi5o5e-0 start" start="1" style="padding:0;margin:0"><li style="margin-left:36pt;padding:0;color:#000000;font-size:11pt;font-family:"Arial";margin-top:0;orphans:2;margin-bottom:0;widows:2;direction:ltr;margin-right:0"><span>First we have to disable OS from using serial port</span></li></ol><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 515.00px; height: 25.00px;"><img alt="1.png" src="https://lh6.googleusercontent.com/6XGmpQgP5Iab_htLZOt9BONeTa7sgALVJLdtLOMsQwB5NrayHcayoRcQaE98Jcc7iNlZBgrz7DWaj_KO9ZJNY4K_ipFGoGtgTFMzh9XdvZPt0fPNylmSyUH1pDjvFxsMpjul5GOH" style="width: 515.00px; height: 25.00px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title=""></span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 624.00px; height: 350.67px;"><img alt="2.png" src="https://lh5.googleusercontent.com/-FjSKqw0onHOt_B-F-yLARxJyIhBG3FjXMHEnaghc5zjl0CDCp_HTNITY-rD_JV_MpdYW0DeJC2EPUWaD-tXJDWpchJsjIvXk14PEUzPRnj7J3qQFtDWsFpEdredeRF_QL7OMI97" style="width: 624.00px; height: 350.67px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title=""></span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 624.00px; height: 350.67px;"><img alt="3.png" src="https://lh5.googleusercontent.com/lenAaHGi4MSX76EUR4gSmHb5wq48EGRbz1GYrC46I7oq5pvtxvhEhFEyZdEEglWzbOOmcUTwUcvWC14wABfgczKaBUImoy2Kyb9D8pQg8NCCw2uPDfQv6wee1A2V8ebHcyjsBiwd" style="width: 624.00px; height: 350.67px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title=""></span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 624.00px; height: 350.67px;"><img alt="4.png" src="https://lh3.googleusercontent.com/E5H2QjFuagXthXbfaYIW72iw_GNBxJmOvwNkNVWkk6sijHqoCXFtqRv9xLjUI7PqXTxVzPQPE60BWbwTThjCndTk9fo8ZllMJPiLgbXaPMux4IJ6HrDT8J7YW67xgcSwrP_Ct6ms" style="width: 624.00px; height: 350.67px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title=""></span></p><ol class="lst-kix_2qv55psi5o5e-0" start="2" style="padding:0;margin:0"><li style="margin-left:36pt;padding:0;color:#000000;font-size:11pt;font-family:"Arial";margin-top:0;orphans:2;margin-bottom:0;widows:2;direction:ltr;margin-right:0"><span>Just for the testing; Connect TxRx pin 8 and 10 on pin header with a jumper(cable).</span></li></ol><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 180.13px; height: 171.50px;"><img alt="8-10.png" src="https://lh5.googleusercontent.com/MfDdyL6iJyOy3kU30kxuyxMhHqIStPimlyaitVdoL5byRWkjJx2ezF9JaIoopZk8dn2TyCyNQroHLQR7Gk3GTlaJN6CVWYeBqpL2tQ6_mqMT5WZyClYPcC83fFgSkzHr0bqPQD_w" style="width: 180.13px; height: 171.50px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title=""></span></p><ol class="lst-kix_2qv55psi5o5e-0" start="3" style="padding:0;margin:0"><li style="margin-left:36pt;padding:0;color:#000000;font-size:11pt;font-family:"Arial";margin-top:0;orphans:2;margin-bottom:0;widows:2;direction:ltr;margin-right:0"><span>Then write to Serial port with following python code.</span></li></ol><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;height:11pt;direction:ltr"><span></span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>#!/usr/bin/env python</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>import time</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>import serial</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>ser = serial.Serial(</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> port='/dev/ttyAMA0',</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> baudrate = 9600,</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> parity=serial.PARITY_NONE,</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> stopbits=serial.STOPBITS_ONE,</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> bytesize=serial.EIGHTBITS,</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> timeout=1</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>)</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>counter=0</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>while 1:</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> print counter</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> ser.write('Write counter: %d \n'%(counter))</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> time.sleep(1)</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> counter += 1</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;height:11pt;direction:ltr"><span></span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 433.00px; height: 222.00px;"><img alt="write.png" src="https://lh3.googleusercontent.com/b8dS6vFFh3PYKoMwzF38t9s4U2nT-YmyGdAlBjUhDQFTdlMEyCwbzr32kBWsEo4gCON_x46iEqxdPJaOErR_J53PUNrasHeiiI6M8yh59c_xOQGXlcJU_kpfxh2jFqD0D9gsE8bN" style="width: 433.00px; height: 222.00px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title=""></span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;height:11pt;direction:ltr"><span></span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;height:11pt;direction:ltr"><span></span></p><ol class="lst-kix_2qv55psi5o5e-0" start="4" style="padding:0;margin:0"><li style="margin-left:36pt;padding:0;color:#000000;font-size:11pt;font-family:"Arial";margin-top:0;orphans:2;margin-bottom:0;widows:2;direction:ltr;margin-right:0"><span>Use following code to read it</span></li></ol><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;height:11pt;direction:ltr"><span></span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>#!/usr/bin/env python</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>import time</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>import serial</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>ser = serial.Serial(</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> port='/dev/ttyAMA0',</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> baudrate = 9600,</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> parity=serial.PARITY_NONE,</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> stopbits=serial.STOPBITS_ONE,</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> bytesize=serial.EIGHTBITS,</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> timeout=1</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> )</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>counter=0</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span>while 1:</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> x=ser.readline()</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span> print x</span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;height:11pt;direction:ltr"><span></span></p><p style="padding:0;margin:0;color:#000000;font-size:11pt;font-family:"Arial";orphans:2;widows:2;direction:ltr"><span style="overflow: hidden; display: inline-block; margin: 0.00px 0.00px; border: 0.00px solid #000000; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px); width: 427.00px; height: 306.00px;"><img alt="read.png" src="https://lh6.googleusercontent.com/c_hGR30-COsjL25-swwZTEfJfCXyabqkjoi1MO3Lh5oJF3Lc9wX-aTpMrV_uf7_NFYCJsO-_G0XowFuQQnmI5jkgb3U_Po2EyOWUz7vo11JCSobAE1ILr5Ut11oZJ8eFoibgtQ8B" style="width: 427.00px; height: 306.00px; margin-left: 0.00px; margin-top: 0.00px; transform: rotate(0.00rad) translateZ(0px); -webkit-transform: rotate(0.00rad) translateZ(0px);" title=""></span></p><div style="width: 100%; padding: 24px 0 16px 0; background-color: #f5f5f5; text-align: center;"><div style="display: inline-block; width: 90%; max-width: 680px;min-width: 280px; text-align: left; font-family: Roboto,Arial,Helvetica,sans-serif;"><div style="display: block; padding: 0 2px;"><div style="display: block; background: #fff; height: 2px;"></div></div><div style="border-left: 1px solid #f0f0f0; border-right: 1px solid #f0f0f0;"><div style="padding: 24px 32px 32px 32px; background:#fff; border-right: 1px solid #eaeaea; border-left: 1px solid #eaeaea;" dir="ltr"><div style="font-size: 14px; line-height: 18px; color: #444;"><a href="mailto:srinathworks@gmail.com" style="color:inherit;text-decoration:none">Srinath Gamage</a> has attached the following document:</div><div style="height: 10px;"></div><div style="font-size: 18px; display: table;"><div style="display: table-row; border-bottom: 4px solid #fff;"><span style="display: table-cell;"><div style="height: 32px;"><img src="https://ssl.gstatic.com/docs/documents/share/images/services/document-4.png" aria-label="Document" style="vertical-align: middle; max-width: 24px;"/></div></span><span style="display: table-cell; padding-left: 12px;">Serial Communication Test on Raspberry-pi</span></div></div></div></div><table style="width: 100%; border-collapse: collapse;" role="presentation"><tr><td style="padding: 0px;"><table style="border-collapse: collapse; width: 3px;" role="presentation"><tr height="1"><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#e5e5e5" style="padding: 0px;"></td></tr><tr height="1"><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td></tr><tr height="1"><td width="1" bgcolor="#f5f5f5" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td></tr></table></td><td style="width: 100%; padding: 0px;"><div style="height: 1px; width: auto; border-top: 1px solid #ddd; background:#eaeaea; border-bottom: 1px solid #f0f0f0;"></div></td><td style="padding: 0px;"><table style="border-collapse: collapse; width: 3px;" role="presentation"><tr height="1"><td width="1" bgcolor="#e5e5e5" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td></tr><tr height="1"><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#eaeaea" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td></tr><tr height="1"><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#f0f0f0" style="padding: 0px;"></td><td width="1" bgcolor="#f5f5f5" style="padding: 0px;"></td></tr></table></td></tr></table><table style="padding: 14px 10px 0 10px;" role="presentation" dir="ltr"><tr><td style="width: 100%; font-size:11px; font-family: Roboto,Arial,Helvetica,sans-serif; color:#646464; line-height: 20px; min-height: 40px; vertical-align: middle;">Google Docs: Create and edit documents online.</td><td style="padding-left: 20px; vertical-align: middle;"><a href="https://drive.google.com" target="_blank"><img src="https://www.gstatic.com/images/branding/googlelogo/1x/googlelogo_tm_black54_color_96x40dp.png" width="96" alt="Logo for Google Docs" border="0"></a></td></tr></table></div></div>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-86485051212278200562015-11-11T02:55:00.000-08:002015-11-11T02:55:05.281-08:00Add current RSA keys for password less login cat .ssh/id_rsa.pub | ssh remoteLoginUser@172.1.1.1 'cat >> .ssh/authorized_keys'Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-48949940045924798292014-08-04T23:42:00.002-07:002014-08-04T23:42:43.377-07:00How to Enable Hibernation in Ubuntu 14.04How to Enable Hibernation in Ubuntu 14.04<br />
<br />
Enable Hibernate<br />
------------------<br />
<br />
/var/lib/polkit-1/localauthority/50-local.d/hibernate.pkla<br />
<br />
<br />
[Re-enable hibernate by default in upower]<br />
Identity=unix-user:*<br />
Action=org.freedesktop.upower.hibernate<br />
ResultActive=yes<br />
<br />
[Re-enable hibernate by default in logind]<br />
Identity=unix-user:*<br />
Action=org.freedesktop.login1.hibernate<br />
ResultActive=yes<br />
<br />
<br />
Hibernate your laptop when lid is closed<br />
------------------------------------------<br />
sudo gedit /etc/systemd/logind.conf<br />
<br />
<br />
Change the line #HandleLidSwitch=suspend to HandleLidSwitch=hibernate<br />
<div>
<br /></div>
Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-37876682616207371272014-05-19T08:56:00.000-07:002014-05-19T08:56:48.312-07:00Some php stuff<br />
<ul>
<li>format datetime to date - date("Y-m-d", strtotime($row->created_date))</li>
</ul>
Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-6680517667439403342014-03-19T22:35:00.001-07:002014-03-19T22:35:33.074-07:00Password -less ssh / scp with RSA on ubuntu1. creare rsa on client [ssh-keygen -t rsa]<br />2. copy rsa to server [ssh-copy-id -i rsaformyserver.pub build@myserver]<br />3. Try ssh [ ssh -i rsaformyserver build@myserver ]<br />4. Do same on server sideSrinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-88649177461549093562014-03-09T21:11:00.002-07:002014-03-09T21:11:25.738-07:00MS SQL Server How to implement LPAD as in Oracleselect REPLICATE('0', 4 - DATALENGTH('234')) +'234'Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-58849657706666991952013-07-09T08:50:00.001-07:002013-07-09T08:58:31.059-07:00Campbell Biology-Concepts and Connections,7th Ed<span style="background-color: #d2b9a6; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; line-height: 14.546875px;">First download <a href="http://www.utorrent.com/downloads/complete/os/win/track/stable"><span style="color: blue;">uTorrent from here</span></a></span><br />
<span style="background-color: #d2b9a6; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13px; font-weight: bold; line-height: 14.546875px;">Then Click to download torrent <a href="magnet:?xt=urn:btih:1b651f6dbd14e1f31fc24b3f5aacad9ab2838270&dn=Campbell+Biology-Concepts+and+Connections%2C7th+Ed.%7BBBS%7D&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80&tr=udp%3A%2F%2Ftracker.istole.it%3A6969&tr=udp%3A%2F%2Ftracker.ccc.de%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337"><span style="color: blue;"><u>Campbell Biology-Concepts and Connections,7th Ed</u></span></a></span><br />
<br />
<pre style="font-family: 'Courier New', Courier, monospace; font-size: 11px; line-height: 10.796875px; white-space: pre-wrap; word-wrap: break-word;">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
<b><a href="http://www.amazon.com/Campbell-Biology-Concepts-Connections-Edition/dp/0321696816">Disclaimer </a></b></pre>
<pre style="font-family: 'Courier New', Courier, monospace; font-size: 11px; line-height: 10.796875px; white-space: pre-wrap; word-wrap: break-word;"><b><a href="http://www.amazon.com/Campbell-Biology-Concepts-Connections-Edition/dp/0321696816">If book seems useful you should buy it for nearly 100$ at amazon. Support the authors :) </a></b></pre>
Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-13580900138767206972013-06-16T00:12:00.003-07:002013-06-16T00:13:37.190-07:00SQL To insert content from Select Query<span style="font-family: Courier New, Courier, monospace;">INSERT INTO `garment`.`meta_my_sequence_table`</span><br />
<span style="font-family: Courier New, Courier, monospace;"> (`id`,</span><br />
<span style="font-family: Courier New, Courier, monospace;"> `sequence`)</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">SELECT 0,TYPE_CODE FROM meta_transaction_types WHERE type_code LIKE '%R' </span><span style="font-family: 'Courier New', Courier, monospace;">;</span>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-17279806536912660132013-01-03T03:33:00.002-08:002013-01-03T03:33:30.674-08:00Quickly Create a Copy of a Table using Transact-SQL<strong style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #333333; font-family: 'Segoe UI', Verdana, Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 18px; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">SELECT * INTO [some new table name] FROM [table to be copied]</strong><br />
<br />
<br />
<strong style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; border: 0px; color: #333333; font-family: 'Segoe UI', Verdana, Arial; font-size: 14px; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: 18px; margin: 0px; orphans: 2; outline: 0px; padding: 0px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><a href="http://technet.microsoft.com/en-us/magazine/dd401720.aspx">Reference </a> </strong>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-24636228006558768602012-11-16T00:56:00.000-08:002012-11-16T00:56:18.771-08:00Avoid auto formatting in Excel for CSV<br />
<pre style="background-color: #eeeeee; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-width: 0px 0px 0px 5px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px 5px 5px 10px; vertical-align: baseline; width: auto;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin: 0px; padding: 0px; vertical-align: baseline;">="11:00"</code></pre>
<pre style="background-color: #eeeeee; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-width: 0px 0px 0px 5px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; margin-bottom: 10px; max-height: 600px; overflow: auto; padding: 5px 5px 5px 10px; vertical-align: baseline; width: auto;">Add these [="][value]["] ; so it will be considered as an String. </pre>
Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-10417538258143620472012-09-06T04:07:00.001-07:002012-09-06T04:07:40.055-07:00Excel export With "save as Excel" Prompt from JSP<br />
<span style="font-family: Courier New, Courier, monospace;"><%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%></span><br />
<span style="font-family: Courier New, Courier, monospace;"><%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%></span><br />
<span style="font-family: Courier New, Courier, monospace;"><% </span><br />
<span style="background-color: yellow; font-family: Courier New, Courier, monospace;">response.setContentType("application/vnd.ms-excel");</span><br />
<span style="background-color: yellow; font-family: Courier New, Courier, monospace;">response.setHeader("Content-Disposition", "attachment;filename=\"report.xls\"");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;">%></span><br />
<span style="font-family: Courier New, Courier, monospace;"><sql:query var="result" dataSource="jdbcJNDI"></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> select * FROM </span><br />
<span style="font-family: Courier New, Courier, monospace;"> X</span><br />
<span style="font-family: Courier New, Courier, monospace;"> WHERE</span><br />
<span style="font-family: Courier New, Courier, monospace;"> X.y = ? and </span><span style="font-family: 'Courier New', Courier, monospace;">X.z = ?</span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> </span><br />
<span style="font-family: Courier New, Courier, monospace;"> <sql:param value="${param.from}"/></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <sql:param value="${param.to}"/></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </sql:query></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <table border="1"></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <!-- column headers --></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <tr></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <c:forEach var="columnName" items="${result.columnNames}"></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <th><c:out value="${columnName}"/></th></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </c:forEach></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </tr></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <!-- column data --></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <c:forEach var="row" items="${result.rowsByIndex}"></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <tr></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <c:forEach var="column" items="${row}"></span><br />
<span style="font-family: Courier New, Courier, monospace;"> <td><c:out value="${column}"/></td></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </c:forEach></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </tr></span><br />
<span style="font-family: Courier New, Courier, monospace;"> </c:forEach></span><br />
<span style="font-family: Courier New, Courier, monospace;"></table></span>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-525534468808455422012-09-06T04:01:00.000-07:002012-09-06T04:01:05.946-07:00CSV, how to avoid crappy auto-format in Excel<br />
Output date as a String as following<br />
<br />
"=\""+$F{dd/mm/yyyy date}+ "\"" (in jasper)<br />
<br />
<br />
"=""01/01/2012""" (finally following will be generated)<br />
Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0tag:blogger.com,1999:blog-3199570596324186138.post-75161056377067213552012-07-30T21:54:00.002-07:002012-07-30T21:54:31.461-07:00Win 7 ODBC<span style="background-color: white; color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; text-align: left;">In case drivers are not there in 64 bit ODBC</span><br />
<span style="background-color: white; color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; text-align: left;">Control Panel\System and Security\Administrative Tools\Data Sources (ODBC)</span>
<br />
<span style="background-color: white; color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; text-align: left;"><br /></span><br />
<span style="background-color: white; color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; text-align: left;">try 32 bit</span><br />
<span style="background-color: white; color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; text-align: left;">%windir%\SysWOW64\odbcad32.exe</span>
<br />
<span style="background-color: white; color: #333333; font-family: 'Segoe UI', Arial, Verdana, Tahoma, sans-serif; font-size: 13px; text-align: left;"><br /></span><br />
<a href="http://support.microsoft.com/kb/2721825/EN-US">http://support.microsoft.com/kb/2721825/EN-US</a>Srinath Gamagehttp://www.blogger.com/profile/02364094485799128849noreply@blogger.com0