tag:blogger.com,1999:blog-69973411799082100222024-03-13T13:27:57.903+05:30javanotes2allUnknownnoreply@blogger.comBlogger226125tag:blogger.com,1999:blog-6997341179908210022.post-26200797596291020982019-01-18T08:05:00.001+05:302019-01-18T08:05:46.973+05:30grant dbms_java.grant_permission<div dir="ltr" style="text-align: left;" trbidi="on">
<pre class="lang-sql prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; box-sizing: inherit; color: #393318; 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: inherit; margin-bottom: 1em; max-height: 600px; overflow-wrap: normal; overflow: auto; padding: 5px; vertical-align: baseline; width: auto;"><code style="border: 0px; box-sizing: inherit; 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;"><span class="kwd" style="border: 0px; box-sizing: inherit; color: #101094; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">begin</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
dbms_java</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">grant_permission
</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'SCOTT'</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'java.io.FilePermission'</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'<<ALL FILES>>'</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'execute'</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
dbms_java</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">grant_permission
</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'SCOTT'</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'java.lang.RuntimePermission'</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'*'</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="str" style="border: 0px; box-sizing: inherit; color: #7d2727; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'writeFileDescriptor'</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">);</span><span class="pln" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
</span><span class="kwd" style="border: 0px; box-sizing: inherit; color: #101094; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">end</span><span class="pun" style="border: 0px; box-sizing: inherit; color: #303336; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">;</span></code></pre>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-57583400400354779222019-01-18T08:02:00.002+05:302019-01-18T08:02:06.113+05:30Revoke DBMS_JAVA permissions<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 class="post-title entry-title" itemprop="name" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 22px; font-stretch: normal; font-variant-east-asian: normal; font-variant-numeric: normal; line-height: normal; margin: 0px; position: relative;">
<br /></h3>
<div class="post-header" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 1.6; margin: 0px 0px 1em;">
<div class="post-header-line-1">
</div>
</div>
<div class="post-body entry-content" id="post-body-2627877975446869352" itemprop="description articleBody" style="background-color: white; color: #444444; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 1.4; position: relative; width: 586px;">
<div dir="ltr" trbidi="on">
Revoke dbms_java permission<br /><br />Query the dba_java_policy table<br /><br />$sqlplus / as sysdba<br />SQL>select * from dba_java_policy<br /><br />KING GRANTEE TYPE SCHEMA TYPE NAME NAME ACTION ENABLED SEQ<br /><br />GRANT<span class="Apple-tab-span" style="white-space: pre;"> </span>XXPMS<span class="Apple-tab-span" style="white-space: pre;"> </span> SYS<span class="Apple-tab-span" style="white-space: pre;"> </span> java.io.FilePermission <span class="Apple-tab-span" style="white-space: pre;"> </span>*<span class="Apple-tab-span" style="white-space: pre;"> </span> read<span class="Apple-tab-span" style="white-space: pre;"> </span>ENABLED<span class="Apple-tab-span" style="white-space: pre;"> </span>178<br />GRANT<span class="Apple-tab-span" style="white-space: pre;"> </span>XXPMS<span class="Apple-tab-span" style="white-space: pre;"> </span> SYS<span class="Apple-tab-span" style="white-space: pre;"> </span> java.io.FilePermission <span class="Apple-tab-span" style="white-space: pre;"> </span>/-<span class="Apple-tab-span" style="white-space: pre;"> </span> read,write<span style="white-space: pre;"> </span>ENABLED<span class="Apple-tab-span" style="white-space: pre;"> </span>181<br />GRANT<span class="Apple-tab-span" style="white-space: pre;"> </span>XXPMS<span class="Apple-tab-span" style="white-space: pre;"> </span> SYS<span class="Apple-tab-span" style="white-space: pre;"> </span> java.io.FilePermission<span class="Apple-tab-span" style="white-space: pre;"> </span> /bin/ls<span class="Apple-tab-span" style="white-space: pre;"> </span> execute<span class="Apple-tab-span" style="white-space: pre;"> </span>ENABLED<span class="Apple-tab-span" style="white-space: pre;"> </span>180<br /><br /><br /><br />Using the SEQ value, you can run the following statement to revoke the granted java permissions<br /><br />eg: suppose you want to revoke SEQ 178<br /><br /><pre class="jive-pre"><code class="jive-code jive-java">begin
DBMS_JAVA.disable_permission(178);
DBMS_JAVA.delete_permission(178);
end;</code></pre>
</div>
</div>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-24172085964350154042018-04-28T21:20:00.002+05:302018-04-28T21:20:45.245+05:30List ciphers used by JVM<div dir="ltr" style="text-align: left;" trbidi="on">
<b>List ciphers used by JVM </b><br />
<b><br /></b>
<pre style="white-space: pre-wrap; word-wrap: break-word;">import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.net.ssl.SSLServerSocketFactory;
public class Ciphers
{
public static void main(String[] args)
throws Exception
{
SSLServerSocketFactory ssf = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
String[] defaultCiphers = ssf.getDefaultCipherSuites();
String[] availableCiphers = ssf.getSupportedCipherSuites();
TreeMap ciphers = new TreeMap();
for(int i=0; i<availableCiphers.length; ++i )
ciphers.put(availableCiphers[i], Boolean.FALSE);
for(int i=0; i<defaultCiphers.length; ++i )
ciphers.put(defaultCiphers[i], Boolean.TRUE);
System.out.println("Default\tCipher");
for(Iterator i = ciphers.entrySet().iterator(); i.hasNext(); ) {
Map.Entry cipher=(Map.Entry)i.next();
if(Boolean.TRUE.equals(cipher.getValue()))
System.out.print('*');
else
System.out.print(' ');
System.out.print('\t');
System.out.println(cipher.getKey());
}
}
}</pre>
<pre style="white-space: pre-wrap; word-wrap: break-word;">
</pre>
<pre style="white-space: pre-wrap; word-wrap: break-word;">
</pre>
<pre style="white-space: pre-wrap; word-wrap: break-word;"><a href="https://confluence.atlassian.com/stashkb/list-ciphers-used-by-jvm-679609085.html">Source</a></pre>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-49119450655746196732018-04-28T21:15:00.000+05:302018-04-28T21:15:32.459+05:30how to get the version of the Spring using Spring.jar<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Using below two ways we can find the Spring version:</b><br />
<b>Process 1: using java program</b><br />
<br />
import org.springframework.core.SpringVersion;<br />
<br />
public class VersionChecker<br />
{<br />
public static void main(String [] args)<br />
{<br />
System.out.println("version: " + SpringVersion.getVersion());<br />
}<br />
}<br />
<br />
<b><br /></b>
<b>Process 2: using md5</b><br />
<br />
$ md5sum spring-2.5.5.jar<br />
82a2134b227f717066da4f4b059925d3<br />
http://www.google.com/search?q=82a2134b227f717066da4f4b059925d3</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-25247099829875984662015-07-10T18:05:00.000+05:302015-07-10T18:05:04.928+05:30Redo keyboard shortcut for eclipse<div dir="ltr" style="text-align: left;" trbidi="on">
In Eclipse go to:<br />
<br />
<b>Window > Preferences > General > Editor > Keys</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizVUv_2R0WNVRhRtYEry3At_F9HYCp9TK788OEy9sBoOOjT-nrnCyxKlZ1tlDEjvPuloa-6N6N2jofT9PTxpMWnrIQ31uXUSz9rEmfOaN6qeI16nFlg1raj5XODj3adl0XjWKzq4AxR0o/s1600/mW9lP.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="305" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEizVUv_2R0WNVRhRtYEry3At_F9HYCp9TK788OEy9sBoOOjT-nrnCyxKlZ1tlDEjvPuloa-6N6N2jofT9PTxpMWnrIQ31uXUSz9rEmfOaN6qeI16nFlg1raj5XODj3adl0XjWKzq4AxR0o/s400/mW9lP.png" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Type filter text to <b>redo </b>then select command.</div>
<div class="separator" style="clear: both; text-align: left;">
<b>copy command</b> to give another shortcut to <b>redo</b></div>
<div class="separator" style="clear: both; text-align: left;">
--><b>Apply</b></div>
--><b>OK.</b><br />
<b><br /></b>
<b><a href="http://stackoverflow.com/questions/20231469/redo-keyboard-shortcut-for-eclipse">source</a>.</b></div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-12058507157553584212015-07-10T18:04:00.003+05:302015-07-10T18:04:54.662+05:30A fatal error has been detected by the Java Runtime Environment: in ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
$ sudo unlink /usr/lib/i386-linux-gnu/libsoup-2.4.so.1<br />
<br />
<a href="http://stackoverflow.com/questions/6448163/a-fatal-error-has-been-detected-by-the-java-runtime-environment-sigsegv-libjvm">souce</a>.<br />
<br /></div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-58681052173281915602015-07-10T18:04:00.002+05:302015-07-10T18:04:46.452+05:30The system not connecting the internet and network symbol not showing in ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<ul style="text-align: left;">
<li><span style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;">dhclient eth0</span></li>
<li><span style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;">apt-get --reinstall install network-manager</span></li>
</ul>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-85504946999806689312015-07-10T18:04:00.001+05:302015-07-10T18:04:30.737+05:30System Settings icons missing in 14.04<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;"><br /></span>
<span style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;">sudo apt-get install ubuntu-desktop</span><br />
<br clear="none" style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;" />
<span style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;">sudo apt-get install unity-control-center-signon gnome-control-center-unity</span><br />
<span style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;"><br /></span>
<span style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 19.9999942779541px;"><a href="http://askubuntu.com/questions/466720/system-settings-icons-missing-in-14-04">source</a></span></div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-47488648182739451982015-07-10T18:04:00.000+05:302015-07-10T18:04:16.885+05:30Ubuntu software center keeps crashing<div dir="ltr" style="text-align: left;" trbidi="on">
<strong style="font-family: Helvetica, Arial, 'Droid Sans', sans-serif; font-size: 14px; line-height: 1.428571em;">Ubuntu software center keeps crashing</strong><br />
<div>
<span style="font-family: Helvetica, Arial, Droid Sans, sans-serif;"><span style="font-size: 14px; line-height: 19.9999942779541px;"><b><br /></b></span></span></div>
<div>
<span style="font-family: Helvetica, Arial, Droid Sans, sans-serif;"><span style="font-size: 14px; line-height: 19.9999942779541px;"></span></span><br />
<div>
<ul style="text-align: left;"><span style="font-family: Helvetica, Arial, Droid Sans, sans-serif;"><span style="font-size: 14px; line-height: 19.9999942779541px;">
<li> sudo apt-get install -f</li>
<li> apt-get autoremove</li>
<li> sudo apt-get purge software-center</li>
<li> sudo apt-get update</li>
<li> sudo apt-get dist-upgrade</li>
<li> sudo apt-get install software-center</li>
<li> sudo dpkg-reconfigure software-center --force</li>
</span></span></ul>
<div>
<span style="font-family: Helvetica, Arial, Droid Sans, sans-serif;"><span style="font-size: 14px; line-height: 19.9999942779541px;"><a href="http://ubuntuforums.org/showthread.php?t=2033381">source</a>.</span></span></div>
</div>
<span style="font-family: Helvetica, Arial, Droid Sans, sans-serif;"><span style="font-size: 14px; line-height: 19.9999942779541px;">
</span></span></div>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-31975067112743652052015-01-14T14:19:00.000+05:302015-01-14T14:19:08.800+05:30How to include Java Source code within Eclipse?<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to include Java Source code within Eclipse?</b><br />
<b><br /></b>
In Netbeans, I can see the built-in sourse code of Java by clicking on LeftClick + Ctrl, and the .java file is shown:<br />
<a name='more'></a><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7OJwRJVsE0iw3wsJRO5XgcwCz8byEhQWyUcbWP8xZ8baBrUgHvCz9o-PD2eSXaqR43_5DxrwsyboB4ZdtPCSOh0lCGw1OeWwusTX5-n779gyahybv9852d7qTnoNq-qJgIOoE5Z4zsmg/s1600/43NIB.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7OJwRJVsE0iw3wsJRO5XgcwCz8byEhQWyUcbWP8xZ8baBrUgHvCz9o-PD2eSXaqR43_5DxrwsyboB4ZdtPCSOh0lCGw1OeWwusTX5-n779gyahybv9852d7qTnoNq-qJgIOoE5Z4zsmg/s1600/43NIB.png" height="186" width="400" /></a></div>
But when we do the same thing in Eclipse, the following is shown:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZWXyeeHXXPyFmTRf-rXBjrUwZIuAZXtdYwjUZK3x9JlAadsw8vjYjQXuKPyh4IFH59NSG4AIZstPyejIjYX75u_j4AVduYpfk9UPPigfzTjht0PQ8neVuxCbwQvvBIAPVOgJIAIVjCV4/s1600/v9eiS.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZWXyeeHXXPyFmTRf-rXBjrUwZIuAZXtdYwjUZK3x9JlAadsw8vjYjQXuKPyh4IFH59NSG4AIZstPyejIjYX75u_j4AVduYpfk9UPPigfzTjht0PQ8neVuxCbwQvvBIAPVOgJIAIVjCV4/s1600/v9eiS.png" height="297" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<b>Solution:</b></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<ol style="text-align: left;">
<li><span style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.8048000335693px;">Download the source from the </span><a href="http://download.java.net/openjdk/jdk7/" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.8048000335693px;">here</a><span style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 17.8048000335693px;">.</span></li>
<li><br /></li>
</ol>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-52779076881588954502015-01-13T20:36:00.004+05:302015-01-13T20:36:45.734+05:30android Error in http connectionjavajava.lang.SecurityException: Permission denied (missing INTERNET permission?)<div dir="ltr" style="text-align: left;" trbidi="on">
android Error in http connectionjavajava.lang.SecurityException: Permission denied (missing INTERNET permission?)<br />
<br />
solution:<br />
<uses-permission android:name="android.permission.INTERNET"></uses-permission></div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-75795704484608075812015-01-13T20:29:00.000+05:302015-01-13T20:29:14.885+05:30“appcompat_v7” project is created automaticaly after creating a new project in Eclipse<div dir="ltr" style="text-align: left;" trbidi="on">
“appcompat_v7” project is created automaticaly after creating a new project in Eclipse<br />
<br />
<b>Do as follows to overcome this issue, this works for me. Create project as usual than follow below steps</b><br />
<br />
<a name='more'></a><br />
<b>Step-1:</b><br />
Right Click on your Project -> Properties -> Android -> In Library panel, remove appcompat_v7 library, Apply and Ok<br />
<br />
<b>Step-2:</b><br />
In Project goto res -> values -> style.xml<br />
<br />
In line <style name="AppBaseTheme" parent="Theme.AppCompat.Light"> change parent value from <b>Theme.AppCompat.Light</b> to <b>android:Theme.Light</b><br />
<br />
<b>Step-3:</b><br />
In Project goto res -> values-v11 -> style.xml<br />
<br />
In line <style name="AppBaseTheme" parent="Theme.AppCompat.Light"> change parent value from <b>Theme.AppCompat.Light</b> to <b>android:Theme.Holo.Light</b><br />
<br />
<b>Step-4:</b><br />
In Project goto res -> values-v14 -> style.xml<br />
<br />
In line <style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar"> change parent value from <b>Theme.AppCompat.Light.DarkActionBar</b> to <b>android:Theme.Holo.Light.DarkActionBar</b><br />
<br />
Step-5:<br />
In Project goto menu -> main.xml remove these lines in menu tag:<br />
<br />
<b>xmlns:app="http://schemas.android.com/apk/res-auto"</b><br />
<b>xmlns:tools="http://schemas.android.com/tools"</b><br />
<b>tools:context="com.example.test.MainActivity"</b><br />
and in item tag change this line from <b>app:showAsAction="never"</b> to <b>android:showAsAction="never"</b><br />
<br />
In project, goto res -> layout -> delete fragment.xml<br />
<br />
<b>Step-6:</b><br />
In MainActivity extends Activity not ActionBarActivity and finally your MainActivity.java after remove unnecessary code, looks like this:<br />
<br />
package com.example.test;<br />
<br />
import android.app.Activity;<br />
import android.os.Bundle;<br />
import android.view.Menu;<br />
<br />
public class MainActivity extends Activity {<br />
<br />
@Override<br />
protected void onCreate(Bundle savedInstanceState) {<br />
super.onCreate(savedInstanceState);<br />
setContentView(R.layout.activity_main);<br />
<br />
}<br />
<br />
@Override<br />
public boolean onCreateOptionsMenu(Menu menu) {<br />
<br />
// Inflate the menu; this adds items to the action bar if it is present.<br />
getMenuInflater().inflate(R.menu.main, menu);<br />
return true;<br />
}<br />
<br />
}<br />
<br />
<br />
Enjoy:)</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-15948687738649700182015-01-13T16:54:00.007+05:302015-01-13T16:55:27.348+05:30Count number of Delimited value in Column in mysql<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Now i want count no of items in one particular row in one particular cell.<br />
<br />
i.e If i have 25,45,26,45,46 in a cell in table.<br />
I want the output like 5<br />
<br />
<b>Solution:</b><br />
<br />
<b> If data is end with delimiter then</b><br />
<b>Query:</b> SELECT LENGTH(yourColumn) - LENGTH(REPLACE(yourColumn, ',', '')) AS numberOfItemsInRow FROM yourTable;<br />
<br />
example:<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SELECT LENGTH('<b>123,123,</b>') - LENGTH(REPLACE('<b>123,123,</b>', ',', '')) AS numberOfItemsInRow;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>o/p: 2<br />
<br />
<b>If data is not end with delimiter</b><br />
<b>Query:</b> SELECT LENGTH(yourColumn) - LENGTH(REPLACE(yourColumn, ',', '')) + 1 AS numberOfItemsInRow FROM yourTable;<br />
<br />
example:<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>SELECT LENGTH('<b>123,123</b>') - LENGTH(REPLACE('<b>123,123</b>', ',', ''))+1 AS numberOfItemsInRow;<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span>o/p: 2<br />
<br /></div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-33815231824784735092014-11-08T11:22:00.001+05:302014-11-08T11:22:52.347+05:30APACHE TOMCAT VERTIONS NOT SHOWING IN ECLIPSE SERVER RUNTIME ENVIRONMENTS (KEPLER/LUNA INSTRUCTIONS)<div dir="ltr" style="text-align: left;" trbidi="on">
Following are the steps to install Apache Tomcat and add it into Eclipse Kepler or Luna:<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<ol style="text-align: left;">
<li>In Eclipse Kepler, go to Help, select ‘<b>Install New Software</b>’</li>
<li>Choose “<b>Kepler- http://download.eclipse.org/releases/kepler</b>” site or add it in if it’s missing. If you’re using Luna, choose “<b>Luna – http://download.eclipse.org/releases/luna</b>” site or add it in if it’s missing</li>
<li>Expand “<b>Web, XML, and Java EE Development</b>” section</li>
<li>Check <b>JST Server Adapters</b> and <b>JST Server Adapters Extensions</b></li>
<li>Once installed, in Eclipse, go to Window / Preferences / Server / Runtime Environments<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjugqIt1hDrci1r4qJDHG-gc8aPOJ7XdE4n4WzsgMElX0atTrMciCObw-wS8Y_t2RgpM2J1o9qjo-C5COPAkNsInQ_uY01zhQ7Es3Pb7dEKay5QcnfUT2UdbBFEBXlzuShSYqxVLOo4f18/s1600/3-24-2014-10-22-14-AM.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjugqIt1hDrci1r4qJDHG-gc8aPOJ7XdE4n4WzsgMElX0atTrMciCObw-wS8Y_t2RgpM2J1o9qjo-C5COPAkNsInQ_uY01zhQ7Es3Pb7dEKay5QcnfUT2UdbBFEBXlzuShSYqxVLOo4f18/s1600/3-24-2014-10-22-14-AM.jpg" height="313" width="400" /></a></div>
</li>
<li>Press Add button, select Apache / Apache Tomcat v7.0 or Apache Tomcat v8.∞<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif49jfkM-sFiVXc40PqOt0NGp1DeQmqbnsWW5nc_ntGfGZSFlptk2804nnp20GZdawSpFBRZh1oRwIvc7ondHgKeS9Gdo3n3d_emer3cHi7k421xnGE0ylzW5eG6OLT0bZblPXWEkOUpY/s1600/3-24-2014-10-26-35-AM-300x144.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEif49jfkM-sFiVXc40PqOt0NGp1DeQmqbnsWW5nc_ntGfGZSFlptk2804nnp20GZdawSpFBRZh1oRwIvc7ondHgKeS9Gdo3n3d_emer3cHi7k421xnGE0ylzW5eG6OLT0bZblPXWEkOUpY/s1600/3-24-2014-10-26-35-AM-300x144.jpg" height="192" width="400" /></a></div>
</li>
<li>Press Next, select location on the drive (i.e. c:\apachetomcat) for Tomcat installation directory. Make sure that the directory exist.</li>
<li>Then press ‘Download and Install’ button, accept terms and point to your installation directory (i.e. c:\apachetomcat) and press OK button</li>
<li>Apache TomCat v7.0 will install (you’ll see a progress in the status bar</li>
<li>Press Finish.</li>
<li>Apache Tomcat v7.0 or Tomcat v8.0 (depending on your selection) will show in the list under Server Runtime Environments now.<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-jAUNLOV1SfPJCjoR-Sg_1VCh6bCYZgUHt9cRdYJEg4tN_95_L2G-c8fol9oKgaYN_8cuW9ca8h-w2dhZIDk5Woi407drA6x_qBLrLRMGV1ghs5jmVkYdiHP8YF2ooMT34pllISZS7us/s1600/3-24-2014-10-32-08-AM-300x262.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-jAUNLOV1SfPJCjoR-Sg_1VCh6bCYZgUHt9cRdYJEg4tN_95_L2G-c8fol9oKgaYN_8cuW9ca8h-w2dhZIDk5Woi407drA6x_qBLrLRMGV1ghs5jmVkYdiHP8YF2ooMT34pllISZS7us/s1600/3-24-2014-10-32-08-AM-300x262.jpg" height="349" width="400" /></a></div>
</li>
</ol>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-76663996431353093112014-11-01T07:28:00.000+05:302014-11-01T07:28:48.733+05:30How to Install Oracle Java 8 In Ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
<b>Step 1: Install Java 8 (JDK 8)</b></h3>
<br />
Add the webupd8team java PPA repository in our system and install Oracle java8 using following set of commands.<br />
<br />
<b>$ sudo add-apt-repository ppa:webupd8team/java</b><br />
<b>$ sudo apt-get update</b><br />
<b>$ sudo apt-get install oracle-java8-installer</b><br />
<b><br /></b>
<br />
<h3 style="text-align: left;">
<b>Step 2: Verify JAVA Version</b></h3>
<br />
After successfully installing oracle java using above step verify installed version using following command.<br />
<br />
<b>$ java -version</b><br />
<br />
java version "1.8.0_25"<br />
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)<br />
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)<br />
<br />
<h3 style="text-align: left;">
<b>Step 3: Setup JAVA Environment</b></h3>
<br />
Webupd8team is providing a package to set environment variables, Install this package using following command.<br />
<br />
<b>$ sudo apt-get install oracle-java8-set-default</b></div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-44763989071844813412014-11-01T07:25:00.003+05:302014-11-01T07:26:00.177+05:30How To Install Java on Ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
<b>Installing default JRE/JDK</b></h3>
This is the recommended and easiest option. This will install OpenJDK 6 on Ubuntu 12.04 and earlier and on 12.10+ it will install OpenJDK 7.<br />
<br />
Installing Java with apt-get is easy. First, update the package index:<br />
<b>sudo apt-get update</b><br />
<b><br /></b>
Then, check if Java is not already installed:<br />
<b>java -version</b><br />
<b><br /></b>
If it returns "The program java can be found in the following packages", Java hasn't been installed yet, so execute the following command:<br />
<b>sudo apt-get install default-jre</b><br />
<b><br /></b>
This will install the Java Runtime Environment (JRE). If you instead need the Java Development Kit (JDK), which is usually needed to compile Java applications (for example Apache Ant, Apache Maven, Eclipse and IntelliJ IDEA execute the following command:<br />
<b>sudo apt-get install default-jdk</b><br />
<b><br /></b>
That is everything that is needed to install Java.<br />
All other steps are optional and must only be executed when needed.<br />
<br />
<b>Installing OpenJDK 7 (optional)</b><br />
<b><br /></b>
To install OpenJDK 7, execute the following command:<br />
<b>sudo apt-get install openjdk-7-jre</b><br />
<br />
This will install the Java Runtime Environment (JRE). If you instead need the Java Development Kit (JDK), execute the following command:<br />
<b>sudo apt-get install openjdk-7-jdk</b><br />
<b><br /></b>
<b>Installing Oracle JDK (optional)</b><br />
The Oracle JDK is the official JDK; however, it is no longer provided by Oracle as a default installation for Ubuntu.<br />
<br />
You can still install it using apt-get. To install any version, first execute the following commands:<br />
<b>sudo apt-get install python-software-properties</b><br />
<b>sudo add-apt-repository ppa:webupd8team/java</b><br />
<b>sudo apt-get update</b><br />
<b><br /></b>
Then, depending on the version you want to install, execute one of the following commands:<br />
<br />
<b>Oracle JDK 6</b><br />
This is an old version but still in use.<br />
<b>sudo apt-get install oracle-java6-installer</b><br />
<br />
<b>Oracle JDK 7</b><br />
This is the latest stable version.<br />
<b>sudo apt-get install oracle-java7-installer</b><br />
<br />
<b>Oracle JDK 8</b><br />
This is a developer preview, the general release is scheduled for March 2014. This external article about Java 8 may help you to understand what it's all about.<br />
<b>sudo apt-get install oracle-java8-installer</b><br />
<br />
<h3 style="text-align: left;">
<b>Managing Java (optional)</b></h3>
When there are multiple Java installations on your Droplet, the Java version to use as default can be chosen. To do this, execute the following command:<br />
<b>sudo update-alternatives --config java</b><br />
<b><br /></b>
It will usually return something like this if you have 2 installations (if you have more, it will of course return more):<br />
<br />
There are 2 choices for the alternative java (providing /usr/bin/java).<br />
<br />
Selection Path Priority Status<br />
------------------------------------------------------------<br />
* 0 /usr/lib/jvm/java-7-oracle/jre/bin/java 1062 auto mode<br />
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode<br />
2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1062 manual mode<br />
<br />
Press enter to keep the current choice[*], or type selection number:<br />
You can now choose the number to use as default. This can also be done for the Java compiler (javac):<br />
<b>sudo update-alternatives --config javac</b><br />
<b><br /></b>
It is the same selection screen as the previous command and should be used in the same way. This command can be executed for all other commands which have different installations. In Java, this includes but is not limited to: keytool, javadoc and jarsigner.<br />
<br />
Setting the "JAVA_HOME" environment variable<br />
To set the JAVA_HOME environment variable, which is needed for some programs, first find out the path of your Java installation:<br />
<b>sudo update-alternatives --config java</b><br />
<b><br /></b>
It returns something like:<br />
<br />
There are 2 choices for the alternative java (providing /usr/bin/java).<br />
<br />
Selection Path Priority Status<br />
------------------------------------------------------------<br />
* 0 /usr/lib/jvm/java-7-oracle/jre/bin/java 1062 auto mode<br />
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode<br />
2 /usr/lib/jvm/java-7-oracle/jre/bin/java 1062 manual mode<br />
<br />
Press enter to keep the current choice[*], or type selection number:<br />
The path of the installation is for each:<br />
<br />
/usr/lib/jvm/java-7-oracle<br />
<br />
/usr/lib/jvm/java-6-openjdk-amd64<br />
<br />
/usr/lib/jvm/java-7-oracle<br />
<br />
Copy the path from your preferred installation and then edit the file /etc/environment:<br />
<br />
<b>sudo nano /etc/environment</b><br />
In this file, add the following line (replacing YOUR_PATH by the just copied path):<br />
<br />
JAVA_HOME="YOUR_PATH"<br />
That should be enough to set the environment variable. Now reload this file:<br />
<br />
source /etc/environment<br />
Test it by executing:<br />
<br />
echo $JAVA_HOME<br />
If it returns the just set path, the environment variable has been set successfully. If it doesn't, please make sure you followed all steps correctly.</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-61496933807579387642014-09-09T15:00:00.001+05:302014-09-11T07:30:24.111+05:30Switching between installed Java versions in ubuntu<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
Switching between installed Java versions can be accomplished using the update alternatives command.<br />
<br />
<ul style="text-align: left;">
<li> To get a list of your installed Java platforms, run the following command from the terminal:</li>
</ul>
<br />
<b>sudo update-alternatives --config java</b><br />
<br />
This will give you a list output similar to this:<br />
There are 2 choices for the alternative java (providing /usr/bin/java).<br />
Selection Path Priority Status<br />
------------------------------------------------------------<br />
0 /usr/lib/jvm/java-6-oracle/jre/bin/java 1070 auto mode<br />
1 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1051 manual mode<br />
* 2 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1069 manual mode<br />
Press enter to keep the current choice[*], or type selection number:<br />
<br />
In this case, the Open JDK 6 version is running. To switch to the Open JDK version 7, you would select option <b>1</b> at the prompt and press the <b>Enter</b> key.<br />
<br />
You will now be running the OpenJDK 7 version. No other changes will be needed to switch your Java versions.<br />
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-3684355005447728692014-08-30T13:28:00.001+05:302014-08-30T13:28:50.041+05:30Temporarily disable Eclipse plugins in load-on-startup<div dir="ltr" style="text-align: left;" trbidi="on">
Temporarily disable Eclipse plugins in load-on-startup<br />
<br />
Eclipse :Windows-->Preferences-->General-->Startup and Shutdown<br />
<br />
De-select unwanted plugins.<br />
Select Apply-->Ok.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLQQYQAyBCI0GuXCWZKp04AtCRlb2dSezKOQOLXf5Q1OnzNob5nw5jpj64FYwmhM03rl4RUsz6nztWxiJ-vyfpYeyZUU5Gyfh8C0k6jHppETOipYJJxlWh8gYWymhpzHyh5CpGhyphenhyphenjWhKo/s1600/20100606-tq5b87s8nbybc74fm47si9g2kf.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLQQYQAyBCI0GuXCWZKp04AtCRlb2dSezKOQOLXf5Q1OnzNob5nw5jpj64FYwmhM03rl4RUsz6nztWxiJ-vyfpYeyZUU5Gyfh8C0k6jHppETOipYJJxlWh8gYWymhpzHyh5CpGhyphenhyphenjWhKo/s1600/20100606-tq5b87s8nbybc74fm47si9g2kf.gif" height="345" width="400" /></a></div>
<br /></div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-82189408859819016082014-07-03T10:15:00.000+05:302014-07-28T21:40:02.711+05:30Running GWT's Super Dev Mode<div dir="ltr" style="text-align: left;" trbidi="on">
Super dev mode is one of the feature given in GWT after 2.5 version.<br />
<br />
<a name='more'></a><br />
Follow these steps.<br />
<ul style="text-align: left;">
<li>Download the GWT 2.5 RC2, and put it somewhere...I put it in my eclipse/plugins directory. <a href="http://google-web-toolkit.googlecode.com/files/gwt-2.5.0.rc1.zip">link</a></li>
<li>In Eclipse, add GWT 2.5 to the Project -> Properties -> Google -> Web Toolkit -> Configure SDKs screen, and select the 2.5 version that you have added to the directory in the step above.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbUKKWlU3OovAE5kKgHdvRKcX7JklQ5XmoV2kxf4kYBOmDf8rGosnRKuWU6FO9qsX8T5r11Vm-Vts5iUf35_zUjxtVFoB226urrJHJZjcVbjWDrg_2jN5R5xg1dxddaDttfd95s6BQ9AA/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbUKKWlU3OovAE5kKgHdvRKcX7JklQ5XmoV2kxf4kYBOmDf8rGosnRKuWU6FO9qsX8T5r11Vm-Vts5iUf35_zUjxtVFoB226urrJHJZjcVbjWDrg_2jN5R5xg1dxddaDttfd95s6BQ9AA/s1600/2.png" height="348" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAj-_04G0hkqK7TqCSuHJa5fVrYRE5lswuU_JssBte7uudA-XvWbFnDOSYm1WuH1O44MMKA6n94BlRvIGj1e0kqTjRBiI9WvGflfJiF69rOT_cJL8rbDvn6BbkDes31JfKpD5Lzj9ljAM/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAj-_04G0hkqK7TqCSuHJa5fVrYRE5lswuU_JssBte7uudA-XvWbFnDOSYm1WuH1O44MMKA6n94BlRvIGj1e0kqTjRBiI9WvGflfJiF69rOT_cJL8rbDvn6BbkDes31JfKpD5Lzj9ljAM/s1600/1.png" height="200" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
<br /></div>
<ul style="text-align: left;">
<li>Create the gwt project</li>
</ul>
add following code in .gwt.xml file<br />
<!-- Changing the linker is only necessary if you want to try out SuperDevMode --><br />
<add-linker name="xsiframe"/><br />
<set-configuration-property name="devModeRedirectEnabled" value="true"/><br />
<br />
<ul style="text-align: left;">
<li>Right click on the project in Eclipse, go to its Run Configurations window, and create a new "Java Application", name it something like "SDM".</li>
</ul>
<br />
While in the Run Configurations window, do the following:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYrpe2tjLDV-wpcUfbxNsDo-gope-tTWjRnJaK1e9ZzPj7Gx7k4PEJp1gpTWrGWMT0DZvt9tqz-QFEKZkwt_oX24rHxnvjEHjT-GmSwu5_l0wZUfk3DCX69olH4QDH4lHcmicu-T-eAdE/s1600/4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYrpe2tjLDV-wpcUfbxNsDo-gope-tTWjRnJaK1e9ZzPj7Gx7k4PEJp1gpTWrGWMT0DZvt9tqz-QFEKZkwt_oX24rHxnvjEHjT-GmSwu5_l0wZUfk3DCX69olH4QDH4lHcmicu-T-eAdE/s1600/4.png" height="313" width="400" /></a></div>
<br />
<br />
<ul style="text-align: left;">
<li>Set the project based on your project name, and type in the main class as com.google.gwt.dev.codeserver.CodeServer</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNuCBym7CpaEAbH_aCfwkVkIAQdrBUp1SMlV2Wta-gQMUbXhS6SLBVXqv5XZrgOYVKmtGLEYPet_mIgae93rIIcKPBQW3X_XS1Ne5fer6se1m5w9iSTH5x9DxaVWaRKQoA_KoVZjC-ZzA/s1600/5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNuCBym7CpaEAbH_aCfwkVkIAQdrBUp1SMlV2Wta-gQMUbXhS6SLBVXqv5XZrgOYVKmtGLEYPet_mIgae93rIIcKPBQW3X_XS1Ne5fer6se1m5w9iSTH5x9DxaVWaRKQoA_KoVZjC-ZzA/s1600/5.png" height="223" width="400" /></a></div>
<br />
On the Classpath tab, click user Entries, then click Add External JARs, navigate to the GWT 2.5 directory, and find the gwt-codeserver.jar, and click "Open" (and other external libraries).<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUL6iCHqW5tTO-O2eHu1F8LRthBlCS1ZcovM8qYe1GV_xOhPaKvMJrmAxwnQrCOvbtNvH3uVOrQuL8lgNqOzOkSaHE3KEA7dE_5jXdxTbahGELKyfNZ18aM6OeVRyxiTlwnv8VZK1oRUo/s1600/9.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiUL6iCHqW5tTO-O2eHu1F8LRthBlCS1ZcovM8qYe1GV_xOhPaKvMJrmAxwnQrCOvbtNvH3uVOrQuL8lgNqOzOkSaHE3KEA7dE_5jXdxTbahGELKyfNZ18aM6OeVRyxiTlwnv8VZK1oRUo/s1600/9.png" height="247" width="400" /></a></div>
<br />
<br />
<br />
<ul style="text-align: left;">
<li>In the Arguments tab, add -src src/ *SOURCE PATH OF YOUR PROJECT* to Program arguments, and add optional -Xmx1024m to VM arguments.</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc-2E8s-oTyhEOFZLqAPfdAD_zoHotNp2w8i8VsCuPQiZqGN-QrWu7m_3q-ycRN2A11W1UY5ilOMkmDNRW2jz8XbFVdFXV8oMxlw1HwLY_zQTKqhaS5MY5AONdnIHPBaBKLiQqliVAte8/s1600/6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhc-2E8s-oTyhEOFZLqAPfdAD_zoHotNp2w8i8VsCuPQiZqGN-QrWu7m_3q-ycRN2A11W1UY5ilOMkmDNRW2jz8XbFVdFXV8oMxlw1HwLY_zQTKqhaS5MY5AONdnIHPBaBKLiQqliVAte8/s1600/6.png" height="223" width="400" /></a></div>
<br />
<br />
<ul style="text-align: left;">
<li>Click Apply, then go ahead and Run the project.</li>
<li> After this you will get a URL like, localhost:9876/</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP7rXUyWuUk8QtybzpHkkTT6VI1bijsKnBrGv5kcR3S7gxMp9HltQOCX9Y9TIzjbXyGmWLi9nyT5lIubSqY_tRbY2oczb5uRM_4A6c4VONIza_S6yjpcdiVOP6ZYwj13BzVSW4lSatV54/s1600/15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiP7rXUyWuUk8QtybzpHkkTT6VI1bijsKnBrGv5kcR3S7gxMp9HltQOCX9Y9TIzjbXyGmWLi9nyT5lIubSqY_tRbY2oczb5uRM_4A6c4VONIza_S6yjpcdiVOP6ZYwj13BzVSW4lSatV54/s1600/15.png" height="223" width="400" /></a></div>
<br />
<br />
<ul style="text-align: left;">
<li>Goto that URL, and bookmark, Dev Mode ON and Dev MOde Off then run your code by drag the bookmarks to browsers bookmars bar.</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJWQeZNWOeQ7OS3olH8l71LExCu-6Y35jUDqfB_ZgCvrpgx7OrV2BHZH6Mw7Ghx0hjCAEwDrozKsw5m2oLxCfSQTMnbDeO3yxayp0rP8RNNAeEvOBiCgSsVHtHCx_WBRGJNgzCDxn0axI/s1600/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJWQeZNWOeQ7OS3olH8l71LExCu-6Y35jUDqfB_ZgCvrpgx7OrV2BHZH6Mw7Ghx0hjCAEwDrozKsw5m2oLxCfSQTMnbDeO3yxayp0rP8RNNAeEvOBiCgSsVHtHCx_WBRGJNgzCDxn0axI/s1600/12.png" height="203" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<ul style="text-align: left;">
<li>Right click on project and runas-->Webapplication.</li>
</ul>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeyYuAwrZufndKiYc9elKtfJM-GCa3HO_tNOPPX6TUzZJGTq5Q3uBvHrn5vu2n_KKMM5D62MDO1ckAEgvuDuv4rJSZ_rfti4Wq-UZXZTktFv9w6W9kgCYmp9i_R1R1qzxHPUUZM6iYbE4/s1600/Screenshot+from+2014-07-03+10%253A11%253A21.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeyYuAwrZufndKiYc9elKtfJM-GCa3HO_tNOPPX6TUzZJGTq5Q3uBvHrn5vu2n_KKMM5D62MDO1ckAEgvuDuv4rJSZ_rfti4Wq-UZXZTktFv9w6W9kgCYmp9i_R1R1qzxHPUUZM6iYbE4/s1600/Screenshot+from+2014-07-03+10%253A11%253A21.png" height="77" width="400" /></a></div>
<ul style="text-align: left;">
<li>Take the url from the devmod and remove <span style="background-color: #eeeeee; 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: 17.804800033569336px; white-space: pre-wrap;">?gwt.codesvr=127.0.0.1:9997.</span></li>
<li>Then run bookmark from same url of project.</li>
<li>If u have any change in serverside code then click refresh in devmod<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1IDfVaPag3ghfEIwijIFQwprx6LZLpf7gZpet4ttc20Rh38o8qaoSSCZ2DRlgxow7fEnBu0gf0d8DCQMSNMOJY2YdPBcnFJ5fUOiGEHLpF2qLdlbP08r-y3ouS-xsSxBsD4VL6RDAMmM/s1600/Screenshot+from+2014-07-03+10%253A11%253A35.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1IDfVaPag3ghfEIwijIFQwprx6LZLpf7gZpet4ttc20Rh38o8qaoSSCZ2DRlgxow7fEnBu0gf0d8DCQMSNMOJY2YdPBcnFJ5fUOiGEHLpF2qLdlbP08r-y3ouS-xsSxBsD4VL6RDAMmM/s1600/Screenshot+from+2014-07-03+10%253A11%253A35.png" height="55" width="400" /></a></div>
</li>
<li>If u have any change in client side code then run devmodon bookmark again.<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyE9jcaQSkJbxbFxw0TaKFjLbj8vrTrgSaVa6ZAfmIg87JgFrvFGxYcSp4WbxGxjCZUqBk93ORlrX5mud22p9mDXQOzcJFc63sDs358V_pDmIwsrHU4wPDar96cgZXju60ja-leaQ6jME/s1600/13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyE9jcaQSkJbxbFxw0TaKFjLbj8vrTrgSaVa6ZAfmIg87JgFrvFGxYcSp4WbxGxjCZUqBk93ORlrX5mud22p9mDXQOzcJFc63sDs358V_pDmIwsrHU4wPDar96cgZXju60ja-leaQ6jME/s1600/13.png" height="325" width="400" /></a></div>
</li>
</ul>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-7329607942476688702014-06-19T18:15:00.000+05:302014-06-19T18:15:17.646+05:30How do upgrade GWT in Eclipse<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How do upgrade GWT in Eclipse</b><br />
<br />
<ul style="text-align: left;">
<li></li>
<li>Download the GWT SDK(s) you need from https://developers.google.com/web-toolkit/versions</li>
<li>Extract it anywhere you like</li>
<li>In Eclipse Preferences > Google > Web Toolkit, use the "Add..." button and navigate to the GWT SDK directory</li>
<li>Then, in each Eclipse project's properties page (Project > Properties > Google > Web Toolkit), you can choose one of your installed SDKs. </li>
</ul>
<a href="http://stackoverflow.com/questions/11691575/how-do-upgrade-to-gwt-2-5-in-eclipse">source</a></div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-6084903706458005752014-06-14T21:11:00.000+05:302014-06-14T21:13:35.031+05:30Eclipse (ADT) crash Failed to write core dump. Core dumps have been disabled<div dir="ltr" style="text-align: left;" trbidi="on">
I found my problem here: how to fix “Failed to write core dump. Core dumps have been disabled” error while running java and here: Eclipse crashing on startup and here: Eclipse continue crash<br />
<a name='more'></a>This is the problem:<br />
<br />
# A fatal error has been detected by the Java Runtime Environment:<br />
#<br />
# SIGSEGV (0xb) at pc=0x00007fa434ffc2a1, pid=6989, tid=140346763503360<br />
#<br />
# JRE version: Java(TM) SE Runtime Environment (7.0_55-b13) (build 1.7.0_55-b13)<br />
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.55-b03 mixed mode linux-amd64 compressed oops)<br />
# Problematic frame:<br />
# C [libsoup-2.4.so.1+0x6c2a1] soup_session_feature_detach+0x11<br />
#<br />
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again<br />
#<br />
# If you would like to submit a bug report, please visit:<br />
# http://bugreport.sun.com/bugreport/crash.jsp<br />
# The crash happened outside the Java Virtual Machine in native code.<br />
# See problematic frame for where to report the bug.<br />
<br />
I did this: To enable core dumping, try "ulimit -c unlimited" before starting Java again and also not help;<br />
<br />
<b>To solve this issue</b>, try to put this line (slightly different from -Dorg...)<br />
<br />
org.eclipse.swt.browser.DefaultType=mozilla<br />
<br />
at the end of this file<br />
<br />
eclipse/configuration/config.ini<br />
<br />
<a href="http://askubuntu.com/questions/457506/eclipse-adt-crash-failed-to-write-core-dump-core-dumps-have-been-disabled">source</a>.</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-866924096844480112014-05-20T17:19:00.001+05:302014-06-14T21:12:22.092+05:30replace() vs replaceAll()<div dir="ltr" style="text-align: left;" trbidi="on">
Both replace() and replaceAll() replaces all the occurrence found. However, there is difference in the type of arguments they accept.<br />
<br />
<a name='more'></a><br />
replace() works on CharSequence, where as replaceAll(), accepts regex, so you can do a regular expression based pattern matching. The later is more flexible, but might result in a bit of performance overhead of compiling the regex and then do a matching. For smaller String replacements, you might not need to think much. <br />
<br />
<span style="font-family: Arial, Helvetica, sans-serif;">String replace(CharSequence target, CharSequence replacement)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Replaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> String replaceAll(String regex, String replacement)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Replaces each substring of this string that matches the given regular expression with the given replacement.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> String replaceFirst(String regex, String replacement)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"> Replaces the first substring of this string that matches the given regular expression with the given replacement.</span><br />
<br />
PS: CharSequence is one of the interface implemented by String class.<br />
<br />
If you see the Java Doc for String class, String implements Serializable, CharSequence and Comparable<String>.<br />
So, dont get confused by CharSequence, normally you can pass String as input to replace() function because of above reason.<br />
<br />
And yes, for repacling only the first occurance of a char sequence, you can use replaceFirst(String regex, String replacement) method of String class.<br />
<br />
<div>
<br />
<pre style="background: white; border: 1px solid #ccc; height: 500px; margin: 0 0 1em 0; overflow: auto; padding: 10px 20px; width: 450px;"><code style="font-size: 12px;">
package com.javanotes2all.java.string;
public class ReplacevsReplaceAll {
public static void main(String[] args) {
<b>/*
* Example1- For normal string both are same
*/</b>
String s="javanotes2all";
System.out.println("For one character replace");
System.out.println("replace(): "+s.replace("a", "-"));
System.out.println("replaceAll(): "+s.replaceAll("a", "-"));
System.out.println("\nFor more characters replace");
System.out.println("replace(): "+s.replace("av", "-"));
System.out.println("replaceAll(): "+s.replaceAll("av", "-"));
<b>/*
* Example2- For Regular expressions both are different
*/</b>
s="javanotes2all_$_prabhu _java $ notes";
System.out.println("\nFor Regular expressions");
/*
* replace method replaces all characters match
*/
System.out.println("replace(): "+s.replace("_$_", "-"));
/*
* This is not replacing
*/
System.out.println("replaceAll(): "+s.replaceAll("_$_", "-"));
/*
* This is replacing characters
*/
System.out.println("replaceAll(): "+s.replaceAll("\\_\\$\\_", "-"));
}
}
</code>
</pre>
</div>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-70389715460988503092014-05-15T18:40:00.002+05:302014-06-14T21:12:22.087+05:30What is the size of ” null ” Operator in Java ?<div dir="ltr" style="text-align: left;" trbidi="on">
When you write<br />
<br />
String st1 = null;<br />
You create a reference “str1″ to an object that still does not exist in the heap, but when you type :<br />
<br />
<a name='more'></a><br />
String st2 = "" ;<br />
You create a reference “str2″ to a string object that is already allocated in the heap which preserves the string object size.<br />
<br />
if you do that expression<br />
<br />
str1 == str2 ;<br />
It should evaluate to false, because you are comparing reference values, which will not be equal.<br />
<br />
if you do that expression<br />
<br />
if(str1.equals(str2) ){ }<br />
It should throw a NullPointerException because you are trying to access the method equals on a null object ( str1 )<br />
<br />
but if you try that expression<br />
<br />
if(str2.equals(str1) ) {}<br />
It should return false, because the value of ( str2 ) is an empty string not null object.</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-41112797826128024172014-04-30T17:21:00.003+05:302014-04-30T17:21:57.178+05:30COALESCE FUNCTION IN PLSQL<div dir="ltr" style="text-align: left;" trbidi="on">
The Oracle/PLSQL COALESCE function returns the first non-null expression in the list. If all expressions evaluate to null, then the COALESCE function will return null.<br />Syntax<br /><br />The syntax for the Oracle/PLSQL COALESCE function is:<br /><br />coalesce( expr1, expr2, ... expr_n )<br /><br /><br />Example<br /><br />The COALESCE function can be used in Oracle/PLSQL.<br /><br />You could use the coalesce function in a SQL statement as follows:<br /><br />SELECT COALESCE( address1, address2, address3 ) result<br />FROM suppliers;<br /><br />The above COALESCE function is equivalent to the following IF-THEN-ELSE statement:<br /><br />IF address1 is not null THEN<br /> result := address1;<br /><br />ELSIF address2 is not null THEN<br /> result := address2;<br /><br />ELSIF address3 is not null THEN<br /> result := address3;<br /><br />ELSE<br /> result := null;<br /><br />END IF;<br /><br />The COALESCE function will compare each value, one by one.</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-6997341179908210022.post-16017212080081189992014-03-07T10:37:00.003+05:302014-03-07T10:38:00.207+05:30Handling multiple updates in Mysql<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 style="text-align: left;">
<span style="color: #3d85c6;">Handling multiple updates in Mysql </span></h3>
<div>
<div>
UPDATE yourtable</div>
<div>
SET updatefield = CASE id</div>
<div>
WHEN 1 THEN 'new value'</div>
<div>
WHEN 2 THEN 'new value'</div>
<div>
WHEN 3 THEN 'new value'</div>
<div>
END</div>
<div>
WHERE id IN (1,2,3)</div>
<div>
<a name='more'></a>To update more then 1 column</div>
<div>
<br /></div>
<div>
UPDATE yourtable</div>
<div>
SET updatefield1 = CASE id</div>
<div>
WHEN 1 THEN 'new value'</div>
<div>
WHEN 2 THEN 'new value'</div>
<div>
WHEN 3 THEN 'new value'</div>
<div>
END,</div>
<div>
updatefield2 = CASE id</div>
<div>
WHEN 1 THEN 'New 1'</div>
<div>
WHEN 2 THEN 'New 2'</div>
<div>
WHEN 3 THEN 'New 3'</div>
<div>
END</div>
<div>
WHERE id IN (1,2,3)</div>
</div>
</div>
<div class="blogger-post-footer"><!-- Lockerz Share BEGIN -->
<a class="a2a_dd" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_171_16.png" width="171" height="16" border="0" alt="Share"/></a>
<script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>
<!-- Lockerz Share END --></div>Unknownnoreply@blogger.com0