tag:blogger.com,1999:blog-50738578383983981302024-03-04T22:17:35.915-08:00Things that Interest meJason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.comBlogger51125tag:blogger.com,1999:blog-5073857838398398130.post-26426900126656868942014-11-09T16:43:00.000-08:002014-11-24T16:35:16.439-08:00Java 8 ‘Stream’ Performance Test<p> </p> <p>I have been recently testing out new features in JDK8. I think one of the most interesting feature which is available other than Lamda is Stream (<a title="https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html" href="https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html" target="_blank">java-doc</a>). In summery it gives you a good way to do functional style of programming on Java collection, also it has something extra, it allows you to run operations in serial or parallel which in return allows developers to easily code parallel programming without needing to worry about complex programming logic.</p> <p>I wanted to test the Stream performance for that I’m going to use a simple loop counter (<a href="https://github.com/jasondevj/java-stream-performance-test" target="_blank">source-code</a>)</p> <p>1) Normal (Serial) <script src="https://gist.github.com/jasondevj/63086bd11645681dbfa7.js?file=Java8StreamTestSerial.java"></script></p> <p>2) Synchronized Object reference (Parallel) <script src="https://gist.github.com/jasondevj/63086bd11645681dbfa7.js?file=Java8StreamTestParallelObjSynch.java"></script></p> <p>3) Synchronised Array reference (Parallel) <script src="https://gist.github.com/jasondevj/63086bd11645681dbfa7.js?file=Java8StreamTestParallelArraySynch.java"></script></p> <p>4) Atomic (Serial) <script src="https://gist.github.com/jasondevj/63086bd11645681dbfa7.js?file=Java8StreamTestSerialAtomic.java"></script></p> <p>5) Atomic (Parallel) <script src="https://gist.github.com/jasondevj/63086bd11645681dbfa7.js?file=Java8StreamTestParallelAtomic.java"></script></p> <p>6) Stream (Serial) <script src="https://gist.github.com/jasondevj/63086bd11645681dbfa7.js?file=Java8StreamTestSerialStream.java"></script></p> <p>7) Stream (Parallel) <script src="https://gist.github.com/jasondevj/63086bd11645681dbfa7.js?file=Java8StreamTestParallelStream.java"></script></p> <p>8) If the Developer puts in the effort <script src="https://gist.github.com/jasondevj/63086bd11645681dbfa7.js?file=Java8StreamTestSmart.java"></script></p> <p>Following is the results when running it from my laptop</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOsaKo3EeVrxffZZ0HEr3fTRIDioAQzy18ndMaj4PfsZqeDxPDEOdqtCVGnlWIqO7LZjYND8mp6s-eT0AYAqUI7hCJl8ekLgBF231jfB1E6iEdDz7c6897k-a3j4AjGdMMk6zlWuaBijSx/s1600-h/image%25255B13%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsxHrunMqj__5ehuc2m8Bg9Co3WyzfhofxHvnEJ5dM5y2VKa-vu7TjUlassqD00kgKFX7UrzNbD1L09J8yHcBHy0vQZPnuFV83sLo4JgyJAEeZxJee9XKOqwkfA1ppELqWwEUVBa9ZQ7C5/?imgmax=800" width="402" height="123"></a></p> <p>As you can clearly see, a good developer can right a fast code, but its a game between <strong>Simplicity vs Performance. </strong></p> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com2tag:blogger.com,1999:blog-5073857838398398130.post-74250494916714271322014-03-27T23:13:00.001-07:002014-03-28T01:29:21.473-07:00Are You Senior or a Junior Software Engineer ??<p> </p> <style id="page-skin-1" type="text/css"><br /><br />.posthidden {display:none}<br />.postshown {display:inline}<br /><br /></style> <script type="text/Javascript"> <br /> function expandcollapse (postid) { <br /> whichpost = document.getElementById(postid); <br /> if (whichpost.className=="postshown") { <br /> whichpost.className="posthidden"; <br /> } else { <br /> whichpost.className="postshown"; <br /> } <br /> } <br /></script>This is a not a test, it’s just for you to understand how with experience your programming mind changes. <p>Background, couple of days ago I had to make an urgent fix on one of our legacy system, so I checkout the code and started looking at it. I did not have a local deployment and did not have any time to test it locally had to make the change and test it on staging server and deploy it.</p> <p>After I finished the changes I could not stop wondering how many places I could have gone wrong on the fix and messed up everything, I’m sure if I was just starting to programme I would have messed it up.</p> <p>I will take you through the code and the changes and every time before going to the next section spend some time and try to analyze the code to find any issues.</p> <p>Old code, Problem was on every element on the list we were doing a time consuming task.</p><pre style="font-family: ; padding-bottom: 6px; padding-top: 6px; padding-left: 6px; margin: 0px; padding-right: 6px; background-color: #ffffff" bgcolor="#ffffff"><font style="color: #000080"><b><span style="color: "><font style="font-size: 9pt">public void </font></span></b></font><font style="font-size: 9pt"><font style="color: #000000"><span style="color: ">doUpdate(List list) {<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">for </span></b></font><font style="color: #000000"><span style="color: ">(</span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">i = </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">; i < list.size(); i++) {<br /></span></font><font style="color: #000000"><span style="color: "> String sql = (String) list.get(i);<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">count = doSomethingTimeConsuming(sql);<br /></span></font><font style="color: #000000"><span style="color: "> System.</span></font><font style="color: #660e7a"><b><i><span style="color: ">out</span></i></b></font><font style="color: #000000"><span style="color: ">.println(count);<br /></span></font><font style="color: #000000"><span style="color: "> }<br /></span></font></font><font style="color: #000000"><span style="color: "><font style="font-size: 9pt">}</font></span></font></pre><br /><p>Solution : I was able to find a alternative method which takes a String[] as parameter which can do the job in a batch, the method requires none Null and none Null element array</p><pre style="font-family: ; padding-bottom: 6px; padding-top: 6px; padding-left: 6px; margin: 0px; padding-right: 6px; background-color: #ffffff" bgcolor="#ffffff"><font style="color: #000080"><b><span style="color: "><font style="font-size: 9pt">public void </font></span></b></font><font style="font-size: 9pt"><font style="color: #000000"><span style="color: ">doUpdate(List list) {<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> String[] array = </span></font><font style="color: #000080"><b><span style="color: ">new </span></b></font><font style="color: #000000"><span style="color: ">String[</span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">];<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">for </span></b></font><font style="color: #000000"><span style="color: ">(</span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">i = </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">; i < list.size(); i++) {<br /></span></font><font style="color: #000000"><span style="color: "> <br /></span></font><font style="color: #000000"><span style="color: "> String sql = (String) list.get(i);<br /></span></font><font style="color: #000000"><span style="color: "> array[i % </span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">] = sql;<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">if </span></b></font><font style="color: #000000"><span style="color: ">(i % </span></font><font style="color: #0000ff"><span style="color: ">100 </span></font><font style="color: #000000"><span style="color: ">== </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">) {<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">count = doSomethingTimeConsuming(array);<br /></span></font><font style="color: #000000"><span style="color: "> System.</span></font><font style="color: #660e7a"><b><i><span style="color: ">out</span></i></b></font><font style="color: #000000"><span style="color: ">.println(count);<br /></span></font><font style="color: #000000"><span style="color: "> }<br /></span></font><font style="color: #000000"><span style="color: "> }<br /></span></font></font><font style="color: #000000"><span style="color: "><font style="font-size: 9pt">}</font></span></font></pre><br /><p>Before looking down, spend some time and analyze the code</p><br /><p> </p><br /><p> </p><pre style="font-family: ; padding-bottom: 6px; padding-top: 6px; padding-left: 6px; margin: 0px; padding-right: 6px; background-color: #ffffff" bgcolor="#ffffff"><font style="color: #000080"><b><span style="color: "><font style="font-size: 9pt">public void </font></span></b></font><font style="font-size: 9pt"><font style="color: #000000"><span style="color: ">doUpdate(List list) {<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> String[] array = </span></font><font style="color: #000080"><b><span style="color: ">new </span></b></font><font style="color: #000000"><span style="color: ">String[</span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">];<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">for </span></b></font><font style="color: #000000"><span style="color: ">(</span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font color="#000000"><font style="background-color: #ffe4ff" bgcolor="#ffe4ff"><span style="color: ">i</span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> = </span></font></font><font style="color: #0000ff"><font style="bgcolor: "#ffffff""><span style="color: ">0</span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">; </span></font></font><font color="#000000"><font style="background-color: #e4e4ff" bgcolor="#e4e4ff"><span style="color: ">i</span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> < list.size(); </span></font></font><font color="#000000"><font style="background-color: #ffe4ff" bgcolor="#ffe4ff"><span style="color: ">i</span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">++) {<br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "><br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> String sql = (String) list.get(</span></font></font><font color="#000000"><font style="background-color: #e4e4ff" bgcolor="#e4e4ff"><span style="color: ">i</span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">);<br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> array[</span></font></font><font color="#000000"><font style="background-color: #e4e4ff" bgcolor="#e4e4ff"><span style="color: ">i</span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> % </span></font></font><font style="color: #0000ff"><font style="bgcolor: "#ffffff""><span style="color: ">100</span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">] = sql;<br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "><br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> </span></font></font><font style="color: #000080"><font style="bgcolor: "#ffffff""><b><span style="color: ">if </span></b></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">(</span></font></font><font color="#000000"><font style="background-color: #e4e4ff" bgcolor="#e4e4ff"><span style="color: ">i</span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> % </span></font></font><font style="color: #0000ff"><font style="bgcolor: "#ffffff""><span style="color: ">100 </span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">== </span></font></font><font style="color: #0000ff"><font style="bgcolor: "#ffffff""><span style="color: ">0</span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">) {<br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> </span></font></font><font style="color: #000080"><font style="bgcolor: "#ffffff""><b><span style="color: ">int </span></b></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">count = doSomethingTimeConsuming(array);<br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> System.</span></font></font><font style="color: #660e7a"><font style="bgcolor: "#ffffff""><b><i><span style="color: ">out</span></i></b></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">.println(count);<br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> }<br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> }<br /></span></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "> </span></font></font><font style="color: #808080"><font style="bgcolor: "#ffffff""><i><span style="color: ">// wright all the unwritten content<br /></span></i></font></font><font style="color: #808080"><font style="bgcolor: "#ffffff""><i><span style="color: "> </span></i></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: ">doSomethingTimeConsuming(array);<br /></span></font></font></font><font style="color: #000000"><font style="bgcolor: "#ffffff""><span style="color: "><font style="font-size: 9pt">}<br /></font></span></font></font></pre><br /><p> </p><br /><p> </p><br /><p>Were you able to identify the above issue?, okay lets continue to the next step, before going down spend some time and analyze the code even better</p><pre style="font-family: ; padding-bottom: 6px; padding-top: 6px; padding-left: 6px; margin: 0px; padding-right: 6px; background-color: #ffffff" bgcolor="#ffffff"><font style="color: #000080"><b><span style="color: "><font style="font-size: 9pt">public void </font></span></b></font><font style="font-size: 9pt"><font style="color: #000000"><span style="color: ">doUpdate(List list) {<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> String[] array = </span></font><font style="color: #000080"><b><span style="color: ">new </span></b></font><font style="color: #000000"><span style="color: ">String[</span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">];<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">for </span></b></font><font style="color: #000000"><span style="color: ">(</span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">i = </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">; i < list.size(); i++) {<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> String sql = (String) list.get(i);<br /></span></font><font style="color: #000000"><span style="color: "> array[i % </span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">] = sql;<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">if </span></b></font><font style="color: #000000"><span style="color: ">(i % </span></font><font style="color: #0000ff"><span style="color: ">100 </span></font><font style="color: #000000"><span style="color: ">== </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">) {<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">count = doSomethingTimeConsuming(array);<br /></span></font><font style="color: #000000"><span style="color: "> System.</span></font><font style="color: #660e7a"><b><i><span style="color: ">out</span></i></b></font><font style="color: #000000"><span style="color: ">.println(count);<br /></span></font><font style="color: #000000"><span style="color: "> }<br /></span></font><font style="color: #000000"><span style="color: "> }<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #808080"><i><span style="color: ">// wright all the unwritten content<br /></span></i></font><font style="color: #808080"><i><span style="color: "> </span></i></font><font style="color: #000080"><b><span style="color: ">final int </span></b></font><font style="color: #000000"><span style="color: ">remainder = list.size() % </span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">;<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">final </span></b></font><font style="color: #000000"><span style="color: ">String[] dest = </span></font><font style="color: #000080"><b><span style="color: ">new </span></b></font><font style="color: #000000"><span style="color: ">String[remainder];<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #808080"><i><span style="color: ">//avoid doing the task on already completed elements<br /></span></i></font><font style="color: #808080"><i><span style="color: "> </span></i></font><font style="color: #000000"><span style="color: ">System.</span></font><font style="color: #000000"><i><span style="color: ">arraycopy</span></i></font><font style="color: #000000"><span style="color: ">(array, </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">, dest, </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">, remainder);<br /></span></font><font style="color: #000000"><span style="color: "> doSomethingTimeConsuming(dest);<br /></span></font></font><font style="color: #000000"><span style="color: "><font style="font-size: 9pt">}<br /></font></span></font></pre><br /><p> </p><br /><p> </p><br /><p>Did you get why we needed to do that?, OK again, before clicking on next analyze the code for more improvements.</p><pre style="font-family: ; padding-bottom: 6px; padding-top: 6px; padding-left: 6px; margin: 0px; padding-right: 6px; background-color: #ffffff" bgcolor="#ffffff"><font style="color: #000080"><b><span style="color: "><font style="font-size: 9pt">public void </font></span></b></font><font style="font-size: 9pt"><font style="color: #000000"><span style="color: ">doUpdate(List list) {<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">if </span></b></font><font style="color: #000000"><span style="color: ">(list.isEmpty())<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">return</span></b></font><font style="color: #000000"><span style="color: ">;<br /></span></font><font style="color: #000000"><span style="color: "> <br /></span></font><font style="color: #000000"><span style="color: "> String[] array = </span></font><font style="color: #000080"><b><span style="color: ">new </span></b></font><font style="color: #000000"><span style="color: ">String[</span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">];<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">for </span></b></font><font style="color: #000000"><span style="color: ">(</span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">i = </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">; i < list.size(); i++) {<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> String sql = (String) list.get(i);<br /></span></font><font style="color: #000000"><span style="color: "> array[i % </span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">] = sql;<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">if </span></b></font><font style="color: #000000"><span style="color: ">(i % </span></font><font style="color: #0000ff"><span style="color: ">100 </span></font><font style="color: #000000"><span style="color: ">== </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">) {<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">count = doSomethingTimeConsuming(array);<br /></span></font><font style="color: #000000"><span style="color: "> System.</span></font><font style="color: #660e7a"><b><i><span style="color: ">out</span></i></b></font><font style="color: #000000"><span style="color: ">.println(count);<br /></span></font><font style="color: #000000"><span style="color: "> }<br /></span></font><font style="color: #000000"><span style="color: "> }<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #808080"><i><span style="color: ">// wright all the unwritten content<br /></span></i></font><font style="color: #808080"><i><span style="color: "> </span></i></font><font style="color: #000080"><b><span style="color: ">final int </span></b></font><font style="color: #000000"><span style="color: ">remainder = list.size() % </span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">;<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">final </span></b></font><font style="color: #000000"><span style="color: ">String[] dest = </span></font><font style="color: #000080"><b><span style="color: ">new </span></b></font><font style="color: #000000"><span style="color: ">String[remainder];<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #808080"><i><span style="color: ">//avoid doing the task on already completed elements<br /></span></i></font><font style="color: #808080"><i><span style="color: "> </span></i></font><font style="color: #000000"><span style="color: ">System.</span></font><font style="color: #000000"><i><span style="color: ">arraycopy</span></i></font><font style="color: #000000"><span style="color: ">(array, </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">, dest, </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">, remainder);<br /></span></font><font style="color: #000000"><span style="color: "> doSomethingTimeConsuming(dest);<br /></span></font></font><font style="color: #000000"><span style="color: "><font style="font-size: 9pt">}<br /></font></span></font></pre><br /><p> </p><br /><p> </p><br /><p> </p><br /><p>Someone might have even done the below code, but it depends on the system performance and the overhead of introducing a List will bring in. </p><pre style="font-family: ; padding-bottom: 6px; padding-top: 6px; padding-left: 6px; margin: 0px; padding-right: 6px; background-color: #ffffff" bgcolor="#ffffff"><font style="color: #000080"><b><span style="color: "><font style="font-size: 9pt">public void </font></span></b></font><font style="font-size: 9pt"><font style="color: #000000"><span style="color: ">doUpdate(List list) {<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">if </span></b></font><font style="color: #000000"><span style="color: ">(list.isEmpty())<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">return</span></b></font><font style="color: #000000"><span style="color: ">;<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">final int </span></b></font><font style="color: #000000"><span style="color: ">batchSize = </span></font><font style="color: #0000ff"><span style="color: ">100</span></font><font style="color: #000000"><span style="color: ">;<br /></span></font><font style="color: #000000"><span style="color: "> List tmpList = </span></font><font style="color: #000080"><b><span style="color: ">new </span></b></font><font style="color: #000000"><span style="color: ">ArrayList(batchSize + </span></font><font style="color: #0000ff"><span style="color: ">1</span></font><font style="color: #000000"><span style="color: ">);<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">for </span></b></font><font style="color: #000000"><span style="color: ">(</span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">i = </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">; i < list.size(); i++) {<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> String sql = (String) list.get(i);<br /></span></font><font style="color: #000000"><span style="color: "> tmpList.add(sql);<br /></span></font><font style="color: #000000"><span style="color: "><br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">if </span></b></font><font style="color: #000000"><span style="color: ">(i % batchSize == </span></font><font style="color: #0000ff"><span style="color: ">0</span></font><font style="color: #000000"><span style="color: ">) {<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">count = doSomethingTimeConsuming((String[]) tmpList.toArray());<br /></span></font><font style="color: #000000"><span style="color: "> System.</span></font><font style="color: #660e7a"><b><i><span style="color: ">out</span></i></b></font><font style="color: #000000"><span style="color: ">.println(count);<br /></span></font><font style="color: #000000"><span style="color: "> }<br /></span></font><font style="color: #000000"><span style="color: "> }<br /></span></font><font style="color: #000000"><span style="color: "> </span></font><font style="color: #000080"><b><span style="color: ">int </span></b></font><font style="color: #000000"><span style="color: ">count = doSomethingTimeConsuming((String[]) tmpList.toArray(</span></font><font style="color: #000080"><b><span style="color: ">new </span></b></font><font style="color: #000000"><span style="color: ">Object[list.size() % batchSize]));<br /></span></font><font style="color: #000000"><span style="color: "> System.</span></font><font style="color: #660e7a"><b><i><span style="color: ">out</span></i></b></font><font style="color: #000000"><span style="color: ">.println(count);<br /></span></font></font><font style="color: #000000"><span style="color: "><font style="font-size: 9pt">}<br /></font></span></font></pre><br /><p> </p><br /><p>Likewise I’m sure everyone with experience would think about all the usecases before even compiling the code.</p> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com1tag:blogger.com,1999:blog-5073857838398398130.post-25849477823035951672013-08-29T00:13:00.001-07:002013-08-29T00:13:22.105-07:00Programming Is An Art<p> </p> <p>When I started programming I used programming language as a tool to solve problems. I could care less about the architecture or the beauty of the solution I came up with; long as the programme worked I was happy and satisfied. </p> <p>After a few years everything changed I realized that programming is more than that. It is a way of expressing yourself. Every time you write a programme you put a bit of yourself into it, your proud of what you have written and it’s something you can call it your own. This is “ART” <i><strong>The expression or application of human creative skill and imagination</strong>. </i> <p>If you look at an experienced programmers code, you can see a structure, a pattern (not the dreadful design patterns), but how he is naming the variables, methods, classes, solutions he comes up with, how the flow works, so on. Over the years the programmer’s expression changes, even if he read a tons and tons of books about coding style, best practices and design patterns, his code will always have a personal touch, I have seen some of my colleagues code which I think is complicated but that does not mean it’s bad coding, it’s just a personal touch that he has, something that looks complicated for me would look different to another person. <p>Sure, all developers (most I know) we read tons and tons of best practices books, but none of us adopted a practice or style fully. I honestly think that our coding style and practice is a mix of things we learn and personal touch which we have gained over the years. <p>I sometimes wonder reading best practice books does it actually help us develop an efficient code or is it actually blocking us from being an Artist.</p> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com3tag:blogger.com,1999:blog-5073857838398398130.post-75095131205719337722013-07-14T23:50:00.001-07:002013-07-14T23:52:21.969-07:00Software Engineers Reactions<p> </p> <p>Thank you #Brayan for sharing the content.</p> <p><strong><font size="2">When I show the boss that I have finally fixed this bug</font></strong> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-07.gif" width="320" height="180"> <h5>When the project manager enters the office</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-30.gif" width="500" height="282"> <h5>When I'm deploying code to production</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-34.gif" width="480" height="253"> <h5>When I try to fix a bug at 3 in the morning</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-02.gif" width="475" height="240"> <h5>When my regex returned exactly what I expected</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-03.gif" width="270" height="130"> <h5>When a friend of mine asks me to fix his website built with Joomla</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-05.gif" width="245" height="285"> <h5>When I'm told that the module on which I have worked all the week will never be used</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-06.gif" width="320" height="240"> <h5>When the code that I have not tested on dev works perfectly in production</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-08.gif" width="400" height="154"> <h5>When the sales people announce they have sold our product to the customer</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-09.gif" width="300" height="168"> <h5>When I apply a new CSS for the first time</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-10.gif" width="320" height="250"> <h5>When sysadmin finally gives us the root access</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-11.gif" width="340" height="255"> <h5>When I launch my script for the first time after several hours of development</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-12.gif" width="400" height="225"> <h5>When I go off for the weekend while everyone else is still trying to fix bugs</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-13.gif" width="500" height="208"> <h5>When the app goes into beta and the first bug reports arrive</h5> <p><img src="http://www.topito.com/wp-content/uploads/2013/01/code-14.gif" width="300" height="225"> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com9tag:blogger.com,1999:blog-5073857838398398130.post-16037999753808800682013-07-10T00:30:00.001-07:002013-07-10T00:30:07.217-07:00Some of the new features in JDK 8<p> </p> <p>Oracle has really pushed for JDK 8 release, trying to keep to their word of releasing it within two years. We are currently at M7 <strong><em>(b94</em></strong>) which was released on <strong>2013/06/13 </strong>I think its right about time to talk a bit on some of the interesting new features which are available.</p> <ul> <li>Remove the Permanent Generation <li>Lambda expressions <li>Parallel Array Sorting <li>New Date & Time API <li>Define a standard API for Base64 encoding and decoding <li>New Javascript engine.</li></ul> <p> </p> <h4>Remove the PermGen</h4> <p>The PermGen (Permanent Generation) space has been completely removed and replaced by a new space called <strong>Metaspace</strong>. <p>The consequences of the PermGen removal is that the PermSize and MaxPermSize JVM arguments will be ignored with warning messages if present when starting the JVM <p>However that doesn't mean you won't have to worry about the class metadata memory footprint and it does not eliminate class and Classloader memory leaks (if there any). Most allocations for the class metadata are now allocated out of native memory. By default class metadata allocation is limited by the amount of available native memory. <p>I really think this is a bad idea, currently if do have a memory leak in PermGen we end up only crashing the JVM and we can easily restart the JVM but if we end up filling the native memory we might end up crashing the server, but a new flag is available (MaxMetaspaceSize), allowing you to limit the amount of native memory used for class Metadata. The Metaspace will dynamically re-size depending on the application demand at runtime. There is obviously some garbage collection involved but I don't think that there is much to worry about here unless you have a problem of Classloader memory leak. We just need to wait and see what are the new problems this is going to introduces. <p> <h4>Lambda expressions</h4> <p>This is something I was really looking forward to for couple of years now, I think this would be the Scala killer <img class="wlEmoticon wlEmoticon-winkingsmile" style="border-top-style: none; border-left-style: none; border-bottom-style: none; border-right-style: none" alt="Winking smile" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLGpiy373DZ_j_DmGuTYGvBG2tGku0UcSU5q_QzNrRSIZvGCgjkTav7mvW1hFCEghzG9Ke9uxJiNcPFfnzCNmJ8WzjQ_i0C2kP39I3gVcUsE4HuEbNDo4G7CPWa0Tv2oI85EkKL3xR2a2U/?imgmax=800"></p> <p>Lets get something straight here, Lambda does not let you do something new which cannot be done in JDK 7 < it just gives you a better (less lines) way to represent a block of code. Until JDK 8, the way to achieve processing of a method via another method is to pass an object. which is similar to a callback method or pass an anonyms override object.</p> <div class="csharpcode"><pre class="alt"><span class="lnum"> 1: </span>action.execute(<span class="kwrd">new</span> Runnable() { </pre><pre><span class="lnum"> 2: </span> <span class="preproc">@Override</span> </pre><pre class="alt"><span class="lnum"> 3: </span> <span class="kwrd">public</span> <span class="kwrd">void</span> handle(Event <span class="kwrd">event</span>) { </pre><pre><span class="lnum"> 4: </span> System.<span class="kwrd">out</span>.println(<span class="str">"Hi There !!"</span>); </pre><pre class="alt"><span class="lnum"> 5: </span> } </pre><pre><span class="lnum"> 6: </span>}); </pre></div><br /><p><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /></p><br /><p>The issue with callbacks is that it leads to verbose code. Like you would write 5 lines of code when the real job is in 1 of these 5 lines.</p><br /><p>With JDK 8 you will have something similar to the following :</p><br /><div class="csharpcode"><pre class="alt"><span class="lnum"> 1: </span>action.execute( </pre><pre><span class="lnum"> 2: </span> <span class="kwrd">event</span> -> System.<span class="kwrd">out</span>.println(<span class="str">"Hi There !!"</span>) </pre><pre class="alt"><span class="lnum"> 3: </span>); </pre></div><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /><br /><p>You can do method referencing, meaning you can pass a method as an argument to another method. Method references work differently between static and non static methods.</p><br /><div class="csharpcode"><pre class="alt"><span class="kwrd">public</span> <span class="kwrd">class</span> Utils implements Comparable<MyObject> { </pre><pre> </pre><pre class="alt"> <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">int</span> compareByLength(String <span class="kwrd">in</span>, String <span class="kwrd">out</span>){ </pre><pre> <span class="kwrd">return</span> <span class="kwrd">in</span>.length() - <span class="kwrd">out</span>.length(); </pre><pre class="alt"> } </pre><pre> </pre><pre class="alt"> <span class="preproc">@Override</span> </pre><pre> <span class="kwrd">public</span> <span class="kwrd">int</span> compareTo(MyObject obj) {</pre><pre class="alt"> <span class="kwrd">return</span> 1</pre><pre> }</pre><pre class="alt">}</pre><pre> </pre><pre class="alt"><span class="kwrd">public</span> <span class="kwrd">class</span> RunThis {</pre><pre> </pre><pre class="alt"> <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> main(String[] ar) {</pre><pre> String[] args = <span class="kwrd">new</span> String[] {<span class="str">"Microsoft: Rocks"</span>, <span class="str">"Linux: Wow"</span>, <span class="str">"Apple: Sucks"</span>} </pre><pre class="alt"> </pre><pre> Arrays.sort(args, Utils::compareByLength);</pre><pre class="alt"> Utils util = <span class="kwrd">new</span> Utils();</pre><pre> Arrays.sort(args, util::compareTo);</pre><pre class="alt"> }</pre><pre>}</pre></div><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /><br /><p>There are many other things to discuss about lambda, but that’s for another post.</p><br /><p> </p><br /><h4>Parallel array sorting</h4><br /><p><a href="http://openjdk.java.net/jeps/103">Arrays#parallelSort</a> this was introduced newly in JDK8</p><br /><p>Arrays#parallelSort uses Fork/Join framework introduced in Java 7 which assigns the sorting tasks to multiple threads available in a pool and joins them in the end</p><br /><p>Following methods are available :</p><br /><div class="csharpcode"><pre class="alt">parallelSort(<span class="kwrd">byte</span>[] a) </pre><pre>parallelSort(<span class="kwrd">byte</span>[] a, <span class="kwrd">int</span> fromIndex, <span class="kwrd">int</span> toIndex) </pre><pre class="alt">parallelSort(<span class="kwrd">char</span>[] a) </pre><pre>parallelSort(<span class="kwrd">char</span>[] a, <span class="kwrd">int</span> fromIndex, <span class="kwrd">int</span> toIndex) </pre><pre class="alt">parallelSort(<span class="kwrd">double</span>[] a) </pre><pre>parallelSort(<span class="kwrd">double</span>[] a, <span class="kwrd">int</span> fromIndex, <span class="kwrd">int</span> toIndex) </pre><pre class="alt">parallelSort(<span class="kwrd">float</span>[] a) </pre><pre>parallelSort(<span class="kwrd">float</span>[] a, <span class="kwrd">int</span> fromIndex, <span class="kwrd">int</span> toIndex) </pre><pre class="alt">parallelSort(<span class="kwrd">int</span>[] a) </pre><pre>parallelSort(<span class="kwrd">int</span>[] a, <span class="kwrd">int</span> fromIndex, <span class="kwrd">int</span> toIndex) </pre><pre class="alt">parallelSort(<span class="kwrd">long</span>[] a) </pre><pre>parallelSort(<span class="kwrd">long</span>[] a, <span class="kwrd">int</span> fromIndex, <span class="kwrd">int</span> toIndex) </pre><pre class="alt">parallelSort(<span class="kwrd">short</span>[] a) </pre><pre>parallelSort(<span class="kwrd">short</span>[] a, <span class="kwrd">int</span> fromIndex, <span class="kwrd">int</span> toIndex) </pre><pre class="alt">parallelSort(T[] a) </pre><pre>parallelSort(T[] a, Comparator<? super T> c) </pre><pre class="alt">parallelSort(T[] a, <span class="kwrd">int</span> fromIndex, <span class="kwrd">int</span> toIndex) </pre><pre>parallelSort(T[] a, <span class="kwrd">int</span> fromIndex, <span class="kwrd">int</span> toIndex, Comparator<? super T> c) </pre></div><br /><p><br /><style type="text/css">.csharpcode, .csharpcode pre<br />{<br /> font-size: small;<br /> color: black;<br /> font-family: consolas, "Courier New", courier, monospace;<br /> background-color: #ffffff;<br /> /*white-space: pre;*/<br />}<br />.csharpcode pre { margin: 0em; }<br />.csharpcode .rem { color: #008000; }<br />.csharpcode .kwrd { color: #0000ff; }<br />.csharpcode .str { color: #006080; }<br />.csharpcode .op { color: #0000c0; }<br />.csharpcode .preproc { color: #cc6633; }<br />.csharpcode .asp { background-color: #ffff00; }<br />.csharpcode .html { color: #800000; }<br />.csharpcode .attr { color: #ff0000; }<br />.csharpcode .alt <br />{<br /> background-color: #f4f4f4;<br /> width: 100%;<br /> margin: 0em;<br />}<br />.csharpcode .lnum { color: #606060; }<br /></style><br /></p><br /><h4>New Date & Time API</h4><br /><p>Nothing much to talk about here, but only the fact most of the current features available in JodaTime API is available natively in JDK8</p><br /><p> </p><br /><h4>Define a standard API for Base64 encoding and decoding</h4><br /><p>Again nothing much here everything available Base64 library (part of apache commons) So this feature is simply to implement a standard API for Base64 and to avoid people to have to use unsupported classes such as sun.misc.BASE64Encoder and sun.misc.BASE64Decoder.</p><br /><p> </p><br /><p><font size="3"><strong>New JavaScript engine</strong></font></p><br /><p>JDK 8 will juice JavaScript performance on the Java Virtual Machine using Project Nashorn, a Javascript engine that will use the JVM libraries and will replace the existing Rhino engine. Design and implement a new lightweight, high-performance implementation of JavaScript, and integrate it into the JDK. The new engine will be made available to Java applications via the existing <code>javax.script</code> API, and also more generally via a new command-line tool.</p> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com1tag:blogger.com,1999:blog-5073857838398398130.post-61439404082277422342013-06-02T22:30:00.001-07:002013-06-03T01:44:10.281-07:00Programmers vs Rockers <style><br /> #table {<br /> border:1px solid black;<br /> border-collapse:collapse;<br /> }<br /> table td {<br /> height:30px;<br /> border:1px solid black;<br /> }<br /></style> <p>One of my friend pointed out that I have stopped writing blogs for awhile, so this is me starting again.</p> <p>This is a comparison between <strong>“Rock Stars”</strong> and <strong>“Programmers”</strong> There was a blog post similar to this couple of years back but this is a more detailed comparison.</p> <p> </p> <table id="table" cellspacing="0" cellpadding="0" border="1"> <tbody> <tr> <td width="205"> <p><b>Comparison</b></p></td> <td width="252"> <p><b>Rock Star</b></p></td> <td width="214"> <p><b>Programmer</b></p></td></tr> <tr> <td width="205"> <p><b>Looks</b></p></td> <td valign="top" width="252"> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglh30ayCa_DSNrbQiBkY0jmRbGn7fasw5a5-u6cIACrfE28OyQt5issUblOLlqSuiTvi4kAPQ5tV-OaKArkttlD3dms27hH-NxEcX3RhvNfz6XnGi7SMoDhoNpgsYGPhbAow5V_cWD-wms/s1600-h/clip_image002%25255B10%25255D%25255B3%25255D.jpg"><img title="clip_image002[10]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image002[10]" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGtTyGlQv5Tu6r79vD8mW1JKlwIVtWqHyjay56yItcoAJ98JaPu6JbCwiJZMeGzkXpnHA3gSLoW187vq09IFA0cQRkqAf3_ONZLZvHmFu1f1heJXljuSMNwCuCmkYc8K9t5DRwByWCeQML/?imgmax=800" width="224" height="146"></a></p></td> <td valign="top" width="214"> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmP1CLG4ul6ay2uNoKVOlHtISXPdQk9A3efQgiRpxVXhrLWSSLJnE7RWEgIEvUpE25SlvCmWpL1xYiTamO_Onm07TII4Z5alXlevGgCIZxQSRMFSaV5k1hzf9HOzvquFp8h43bBkye9GjO/s1600-h/clip_image004%25255B10%25255D%25255B2%25255D.jpg"><img title="clip_image004[10]" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="clip_image004[10]" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBlSaxy8aTkNpnRWXksiYOxhT611VdYb06fyE_TtauU1ICODPKGbn23V4YD3adEJpHJ9JVhuGiIIjlqv0YSTMgtHndOJ5h6V8iBgAxHObK0EdmtZ4eH1E6vSA8fhAQB2fv5sJWijweRfeZ/?imgmax=800" width="200" height="145"></a></p></td></tr> <tr> <td width="205"> <p><b>Fashion Trend Setters</b></p></td> <td width="252"> <p>We start it</p></td> <td width="214"> <p>What is fashion trend? Never heard of it.</p></td></tr> <tr> <td width="205"> <p><b>Charisma</b></p></td> <td width="252"> <p>Yes</p></td> <td width="214"> <p>Yes</p></td></tr> <tr> <td width="205"> <p><b>People asking for Autograph at the street</b></p></td> <td width="252"> <p>Yes, all the time</p></td> <td width="214"> <p>Not likely</p></td></tr> <tr> <td width="205"> <p><b># of Twitter followers</b></p></td> <td width="252"> <p>Millions</p></td> <td width="214"> <p>Thousands, but we came up with Twitter.</p></td></tr> <tr> <td width="205"> <p><b>Friday nights</b></p></td> <td width="252"> <p>Night out drinking.</p></td> <td width="214"> <p>I have work tomorrow.</p></td></tr> <tr> <td width="205"> <p><b>Instrument</b></p></td> <td width="252"> <p>Microphone/Guitar/Drums/other</p></td> <td width="214"> <p>Microphone + computer + projector</p></td></tr> <tr> <td width="205"> <p><b>Mobile phones</b></p></td> <td width="252"> <p>My phone is not working; I’m buying a new one.</p></td> <td width="214"> <p>Boot the device in Safe mode and root the OS</p></td></tr> <tr> <td width="205"> <p><b>Writes</b></p></td> <td width="252"> <p>Lyrics</p></td> <td width="214"> <p>Code</p></td></tr> <tr> <td width="205"> <p><b>Shows/Talk attendance</b></p></td> <td width="252"> <p>Tens of Thousands</p></td> <td width="214"> <p>Hundreds</p></td></tr> <tr> <td width="205"> <p><b>Tour the world</b></p></td> <td width="252"> <p>Few months ago</p></td> <td width="214"> <p>Last year I think.</p></td></tr> <tr> <td width="205"> <p><b>Owns</b></p></td> <td width="252"> <p>Multiple cribs and a private jet</p></td> <td width="214"> <p>Multiple 24” LED displays with SSD hard disk with multi VM</p></td></tr> <tr> <td width="205"> <p><b>Way to the Top</b></p></td> <td width="252"> <p>X Factor / American Idol</p></td> <td width="214"> <p>Hard work for years (Simon Fuller, if you read this, what about a “Programming Idol” show?)</p></td></tr> <tr> <td width="205"> <p><b>Drugs</b></p></td> <td width="252"> <p>Yes a lot</p></td> <td width="214"> <p>No</p></td></tr> <tr> <td width="205"> <p><b>Earnings </b></p></td> <td width="252"> <p>Millions of Dollars</p></td> <td width="214"> <p>Thousands of Dollars</p></td></tr> <tr> <td width="205"> <p><b>Sex</b></p></td> <td width="252"> <p>So much, they regret it later</p></td> <td width="214"> <p>Private information</p></td></tr> <tr> <td width="205"> <p><b>Can bring the world to a standstill.</b></p></td> <td width="252"> <p>No</p></td> <td width="214"> <p>Yes, Who do you want us to hack?</p></td></tr> <tr> <td width="205"> <p><b>Has two eyes, one mouth one nose and two hands</b></p></td> <td width="252"> <p>Yes, most of them.</p></td> <td width="214"> <p>Yes</p></td></tr></tbody></table> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com1tag:blogger.com,1999:blog-5073857838398398130.post-28348194202011888502011-10-13T21:17:00.000-07:002011-10-13T21:17:56.102-07:00Java File Handling<br />
<br />
Lately I been working on a Java file manipulation project and I came across
an issue which I never expected.<br />
<br />
This is a sample code.<br />
<br />
<pre class="brush: java">public class FileReader {
public static void main(String[] args) throws IOException {
new FileReader().fileDelete();
}
public void fileDelete() throws IOException {
final String fileLocation = System.getProperty("user.dir") + "/test.txt";
File fileCreate = new File(fileLocation);
final boolean isFileCreated = fileCreate.createNewFile();
if (isFileCreated) {
System.out.println("File Successfully Created");
} else {
System.out.println("File Creation Failed");
}
final BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(fileLocation));
for (int i = 1; i <= 5; i++) {
bufferedWriter.append("Line : " + i + "\n");
}
final BufferedReader bufferedReader = new BufferedReader(new java.io.FileReader(fileLocation));
String line;
while ((line = bufferedReader.readLine()) != null) {
System.out.println(line);
}
File fileDelete = new File(fileLocation);
final boolean isDeleteSuccess = fileDelete.delete();
if (isDeleteSuccess) {
System.out.println("File Deleted Successfully");
} else {
System.out.println("File Deletion Failed");
}
}
}
</pre>
Assume the file test.txt does not exists when running the programme. Can
you predict the output of this programme? <br />
If you have thought it will print <br />
<br />
File Successfully Created<br />
Line : 1<br />
Line : 2<br />
Line : 3<br />
Line : 4<br />
Line : 5<br />
File Deleted Successfully<br />
<br />
<br />
If you have thought a bit more you might have predicted it will print<br />
<br />
File Successfully Created<br />
File Deleted Successfully<br />
<br /><br />
<br />
You’re completely wrong at least on a Windows, both the above outputs are
wrong. Actual output on windows is "File Deletion Failed". It took me
some time to actually realize the issue when my programme dint work as
expected. As for the part of the Line 1 .. 5 not printing that’s straight forward
I dint close the bufferedWriter. The problem here is that if you read or write
to a file and you don’t close the stream you cannot delete the file in windows.
Even when you’re actually creating a new File object it will still not let you
delete the file and to make things worse it does not give you any other explanation
except for Boolean false Imagine searching for this in thousands of line. So
guys whenever you’re reading or writing to streams always remember to close
them.<o:p></o:p><br />Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com5tag:blogger.com,1999:blog-5073857838398398130.post-22857079689184191982011-09-02T19:06:00.000-07:002011-09-02T19:08:45.749-07:00CSS Hacks For Every Browser<p>There are many CSS hacks that I have come across while developing web applications, mostly used one is the IE's conditional comments to apply classes to the body tag but there are some situation where you will want to add conditional CSS within the stylesheet, specially if your working with Vaadin <p>The following is a documentation of browser specific CSS style attribute I've seen. These CSS will help you better make specific changes to IE, Firefox, Chrome, Safari and Opera from within the CSS. <pre class="brush: css"><br><br>/***** Selector Hacks ******/<br> <br>/* IE6 and below */<br>* html #uno { color: blue }<br> <br>/* IE7 */<br>*:first-child+html #dos { color: blue } <br> <br>/* IE7, FF, Saf, Opera */<br>html>body #tres { color: blue }<br> <br>/* IE8, FF, Saf, Opera (Everything but IE 6,7) */<br>html>/**/body #cuatro { color: blue }<br> <br>/* Opera 9.27 and below, safari 2 */<br>html:first-child #cinco { color: blue }<br> <br>/* Safari 2-3 */<br>html[xmlns*=""] body:last-child #seis { color: blue }<br> <br>/* safari 3+, chrome 1+, opera9+, ff 3.5+ */<br>body:nth-of-type(1) #siete { color: blue }<br> <br>/* safari 3+, chrome 1+, opera9+, ff 3.5+ */<br>body:first-of-type #ocho { color: blue }<br> <br>/* saf3+, chrome1+ */<br>@media screen and (-webkit-min-device-pixel-ratio:0) {<br> #diez { color: blue }<br>}<br> <br>/* iPhone / mobile webkit */<br>@media screen and (max-device-width: 480px) {<br> #veintiseis { color: blue }<br>}<br> <br> <br>/* Safari 2 - 3.1 */<br>html[xmlns*=""]:root #trece { color: blue }<br> <br>/* Safari 2 - 3.1, Opera 9.25 */<br>*|html[xmlns*=""] #catorce { color: blue }<br> <br>/* Everything but IE6-8 */<br>:root *> #quince { color: blue }<br> <br>/* IE7 */<br>*+html #dieciocho { color: blue }<br> <br>/* Firefox only. 1+ */<br>#veinticuatro, x:-moz-any-link { color: blue }<br> <br>/* Firefox 3.0+ */<br>#veinticinco, x:-moz-any-link, x:default { color: blue }<br> <br>/* FF 3.5+ */<br>body:not(:-moz-handler-blocked) #cuarenta { color: blue; }<br> <br> <br>/***** Attribute Hacks ******/<br> <br>/* IE6 */<br>#once { _color: blue }<br> <br>/* IE6, IE7 */<br>#doce { *color: blue; /* or #color: blue */ }<br> <br>/* Everything but IE6 */<br>#diecisiete { color/**/: blue }<br> <br>/* IE6, IE7, IE8 */<br>#diecinueve { color: blue\9; }<br> <br>/* IE7, IE8 */<br>#veinte { color/*\**/: blue\9; }<br> <br>/* IE6, IE7 -- acts as an !important */<br>#veintesiete { color: blue !ie; } /* string after ! can be anything */<br> <br>/* IE8, IE9 */<br>#anotherone {color: blue\0/;} /* must go at the END of all rules */</pre> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com5tag:blogger.com,1999:blog-5073857838398398130.post-78467646457998422832011-05-26T12:59:00.000-07:002011-05-26T12:59:30.645-07:00Gnome 3 New Features and Does It Look Like Windows 7 ?<span class="Apple-style-span" style="font-family: 'times new roman', 'new york', times, serif; font-size: 16px;"></span><br />
<div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">As most of you all know <span class="yshortcuts" id="lw_1306434610_1">Gnome</span> 3 is released (<a href="http://gnome3.org/" rel="nofollow" style="color: #234786; outline-color: initial; outline-style: none; outline-width: initial; text-decoration: underline;" target="_blank"><span class="yshortcuts" id="lw_1306434610_2">http://gnome3.org/</span></a>) so as always<b> </b>I wanted to try it out, so I installed it on my fedora 14, and then wanted to check it out with fedora 15. After messing around with it for some time, It was okay but not that great, For the most part of it I could notice the similarities to Windows 7s normal theme. So went around searching to see what were others opinion about it, but tomy surprise there were NO or just a bit of talk about it, This gave me no other option but to write something for myself.</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">I'm not going to compare in detail and break down the things, maybe that's for another post. This will be a comparison between the major functionalities shown on the home page of Gnome 3 (you can checkout the videos)</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-size: large;">Feature 1: Instance Messenger Notification</span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">Who are you kidding?? I have not come across a messenger which actually distracts me while I'm working all the messengers<b> </b>I have worked with just gives a small notification on the right side corner<b> </b>with the beginning of the message. What is the use of putting this as a feature on Gnome 3 ?? I seriously don't get that. If any of you disagree with me on this think about a messenger which does not actually do this. I do get, Integrating the messenger to Gnome might be a good thing, but the problem is if all my messengers notification look alike its just going to be dull in the end. Sometimes it is nice to have your mind distracted with Messenger specific notification than having a black themed notification.</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-size: large;">Feature 2: <span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, sans-serif; line-height: 21px;">Easier Window Management</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-size: large;"><br />
</span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">The next video goes on to say if you drag the window to the top it gets maximized and if you drag it to the left it goes to left, ext.. First thing that pop into my head was 'This is just the same feature Windows 7 gives' So whats the big deal?</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-size: large;">Feature 3: <span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, sans-serif; line-height: 21px;">App-based Window Management</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, sans-serif; font-size: 14px; line-height: 21px;"><br />
</span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, 'Droid Sans', sans-serif;"><span class="yiv1472932478Apple-style-span" style="font-size: 14px; line-height: 21px;">There is nothing to be said on this. This is no other than 'Quick Launch' feature introduced in <span class="yshortcuts" id="lw_1306434610_3">Windows Vista</span>. I dint not see anything new here. Its just the same old thing.</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, 'Droid Sans', sans-serif;"><span class="yiv1472932478Apple-style-span" style="font-size: 14px; line-height: 21px;"><br />
</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-size: large;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, 'Droid Sans', sans-serif;"><span class="yiv1472932478Apple-style-span" style="line-height: 21px;"><span class="yiv1472932478Apple-style-span" style="font-family: 'Times New Roman'; line-height: normal;">Feature 4: </span></span></span><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, sans-serif; line-height: 21px;">Deeper Hardware Integration</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, sans-serif; font-size: 14px; line-height: 21px;"><br />
</span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><i style="font-family: Cantarell, sans-serif; font-size: 14px; line-height: 21px;">'We only show Suspend option if it's supported by you hardware' T</i><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, 'Droid Sans', sans-serif;"><span class="yiv1472932478Apple-style-span" style="font-size: 14px; line-height: 21px;">hat was there even on <span class="yshortcuts" id="lw_1306434610_4">Windows XP</span> which is more than ten years old. Showing options that are supported by your hardware was already available in Gnome 2. Firmware is not done by Gnome it just front ends it, so even how much support you have on this first the Firmware has to be updated if you want to use this at all.</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, 'Droid Sans', sans-serif;"><span class="yiv1472932478Apple-style-span" style="font-size: 14px; line-height: 21px;"><br />
</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, 'Droid Sans', sans-serif; font-size: large;"><span class="yiv1472932478Apple-style-span" style="line-height: 21px;"><span class="yiv1472932478Apple-style-span" style="font-family: 'Times New Roman'; line-height: normal;">Feature 5: </span>Create Workspaces</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, 'Droid Sans', sans-serif;"><span class="yiv1472932478Apple-style-span" style="font-size: 14px; line-height: 21px;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, 'Droid Sans', sans-serif;"><span class="yiv1472932478Apple-style-span" style="font-size: 14px; line-height: 21px;">Well this is actually good, but I still feel the static workspace is better. The problem with this is, I actually need to do another mouse move or a <span class="yshortcuts" id="lw_1306434610_5">keyboard shortcut</span> to see the workspaces that I have used. Anything that makes me do one more step is something thats not worth it.<span class="yshortcuts" id="lw_1306434610_6">Workspace</span> is something that we use a lot so I want to be able to see the free workspaces like on Gnome 2 without another command involved.</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-family: Cantarell, 'Droid Sans', sans-serif;"><span class="yiv1472932478Apple-style-span" style="font-size: 14px; line-height: 21px;"><br />
</span></span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="yiv1472932478Apple-style-span" style="font-size: large;">Where the Hell is the Task-bar ?</span></div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">At first<b> </b>you will see is that the task-bar is missing. Whats the point? I don't want to move my mouse or do a keyboard shortcut to see the programmes that are running I want to just see it in one glance when I want to, Its not worth to remove something just to save like 10 px of space. Again anything that makes me to something more is not worth it.</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">I'm not trying to persuade that all features are bad, there are some good features as well, but Gnome 3 was a disappointment for me. I was expecting more than what I received. Alas, none of the features were good enough for me to switch from Gnome 2 to Gnome 3.</div>Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com1tag:blogger.com,1999:blog-5073857838398398130.post-35469504809140001672011-05-17T22:30:00.000-07:002011-05-17T22:36:02.064-07:00Spring Security and CAS Integration with VaadinWe have been working with Vaadin for some time now. We have done multiple websites and admin applications. There was a customer who requested a SSO (Single Sign On) to be added to one of the new website we are creating. So we thought its not that big of a deal; we just needed to add Spring security and then do the CAS filter and we are all done. Well the solution is striaght forward but don't even try to search this on the web, there is not even one fully integrated working solution out there, so what I did was I sat down and did a Vaadin wrapper with spring security integrated. I have used Spring 3.0.5 so all spring security tags are written for that.<br />
<br />
This is how it looked like in the end<br />
<br />
<pre class="brush: js">public class SampleVaadinApplication extends VaadinApplication {
private UriFragmentUtility fragmentUtility;
private VerticalLayout layout;
@Override
public void init() {
final Window mainWindow = new Window("Vaadin Cas Sample");
fragmentUtility = new UriFragmentUtility();
mainWindow.setSizeFull();
mainWindow.addComponent(fragmentUtility);
layout = new VerticalLayout();
mainWindow.addComponent(layout);
setMainWindow(mainWindow);
}
}
</pre><br />
<pre class="brush: js">public void buttonClick(Button.ClickEvent event) {
final String path = getURL().getPath();
if (!hasAnyRole("ROLE_DEFAULT_ACCESS")) {
getMainWindow().open(new ExternalResource(path + "do-something/"));
} else {
fragmentUtility.setFragment("do-something");
}
}
</pre><br />
web.xml you just need to add this to be the wrapper (and of cos the spring tags ;) ).<br />
<br />
<pre class="brush: js"><servlet>
<servlet-name>vaadin-loader-with-cas</servlet-name>
<servlet-class>hailu.vaadin.authentication.core.VaadinApplicationServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>hailu.vaadin.authentication.sample.SampleVaadinApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>vaadin-loader-with-cas</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</pre><br />
<br />
I have hosted it in git you can have a look at the sample to get your self up and running.<br />
<a href="https://github.com/jasondevj/cas-integration-with-vaadin">https://github.com/jasondevj/cas-integration-with-vaadin</a>Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com6tag:blogger.com,1999:blog-5073857838398398130.post-26711757475789416382011-05-14T13:02:00.000-07:002011-05-14T13:16:07.531-07:005 Reasons Why I Changed from Linux to WindowsI'm sure the heading is going to make some people go, 'This guy is nuts' specially me being a Java developer. Let me explain why I chose to change from Linux to Windows.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">1) Hardware Support</span><br />
<br />
The biggest problem I had running Linux (I use Fedora 14) on my laptop is the hardware support. I agree Linux has come to a point where it supports most of the drivers (and yes Ubuntu has more support) the problem is the drivers are done by third party developers and companies and not from the actual vendors. The drivers work fine I'm not complaining about that, but it does not support the hardware fully to a point I would prefer it to. It is evident as the laptop heats up.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">2) Flash and Video Streaming</span><br />
<br />
One of the second most thing that I do when I'm not coding is streaming Movies and TV series. Have you even tried it? let me tell you what happens, It sucks your processor usage at-least to 70-80% I can check for prime numbers on Java programme and it still would not have to take so much, and yes I have tried it on Firefox 4 and Chrome 11 this is because of Flash. If you search for a solution regarding this on the net, you will see a lot of people have complained about this but there is no proper solution to this. Maybe this is because of the hardware support.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">3) Programmes and Games</span><br />
<br />
I am not much into games, but once in awhile (once in three months ;) ) I just like to play a game. With linux its not possible, just the option knowing I can is more then enough, and yes Linux has its games but nowhere close to the once you have on windows.<br />
<br />
yum and apt-get are really powerful and I'm definently going to miss this on Windows, but I'm sure I can download any programme that I want to install on Windows. I have still not come across programme that is available in Linux but not available in Windows (the functionality vice).<br />
<br />
<span class="Apple-style-span" style="font-size: large;">4) MS Office and Graphical Programmes</span><br />
<br />
Open Office is really good, but no where close to as MS Office, you can argue much as you want but if you use it couple of times you will feel the difference, and when specially all the customers documents are done using MS Office.<br />
<br />
Gimp is good, but not as Photoshop and other programmes like Dreamweaver and Flash you cant find it on Linux<br />
<br />
<span class="Apple-style-span" style="font-size: large;">5) Intellij Idea and Visual Paradigm</span><br />
<br />
As you guessed it correctly I use them more then any other programe. VP is defiantly faster on Windows than on Linux it's even faster if you run it on VMware on the same machine. Same applies to Idea, it runs faster on Windows but this has not as much differences as VP but it is defiantly faster.<br />
<br />
<br />
That raps it up. The above reasons are more then enough for me to switch to Windows. Definently there are some things I will miss in linux following are some ;)<br />
<br />
1) All shell commands and the linux terminal, windows powershell does not come close to it but cygwin will fix that.<br />
2) You can delete a file while its been executed on linux, specially commands like mvn clean and remove can be done without any problem in linux, but if you do that on windows there could problems like file been access by some other programme errors.<br />
3) I'm into bit of Ethical Hacking most of the hacking tools are in linux so that will be a definite disadvantage.<br />
4) Most spoken thing when comparing linux and windows is the boot time. linux could be couple of seconds faster, but until now I have never sat in-front of my laptop waiting it to start I have more than enough things to do at that time, and be honest with your self. when was the last time you shutdown your computer?<br />
<br />
<br />
Windows does all the things I need better than linux and some things that I cant do in linux. So why do I still need to be in linux?Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com2tag:blogger.com,1999:blog-5073857838398398130.post-19137455776236436602011-05-11T03:30:00.000-07:002011-05-11T11:04:51.415-07:00Clojure and VaddinI been working on Clojure and Vaadin for some time now and I think It's right about time I write a blog on how to do it. This is a really simple example for someone to get start on.<br />
<br />
First thing that we need to do to get things started is to create a servlet clojure file which will load the Vaadin application.<br />
<br />
<pre class="brush: js">(ns example.vaadin-servlet
(:gen-class
:extends com.vaadin.terminal.gwt.server.AbstractApplicationServlet
:name example.VaadinServlet))
(defn ^Class -getApplicationClass [this]
example.VApp)
(defn ^hms.appstore.ui.main.VApp -getNewApplication [this request]
(example.VApp.))
</pre><br />
This will be the servlet that you will add into the web.xml keep in mind the java class name will be example.VaadinServlet.<br />
<br />
Next is to create the Vaadin Application which would look something this.<br />
<br />
<pre class="brush: js">(ns example.vapp
(:gen-class
:extends com.vaadin.Application
:name example.VApp
:init cjinit))
(defn -cjinit []
[[] (ref {})])
(defmacro window [name caption container & body]
`(let [caption# ~caption
container# ~container
~name (com.vaadin.ui.Window. caption# container#)
~(symbol (str name "-" "container")) container#]
~@body))
(defn -init [this]
(println "=== Initiating Vaadin Application ==")
(let [comps (transient {})]
(window w "Clojure Vaadin Application" (com.vaadin.ui.VerticalLayout)
(.setSizeUndefined w-container)
(.setMainWindow this w)
(let [layout (com.vaadin.ui.VerticalLayout.)])
(.addComponent w-container layout)
(.addComponent layout (com.vaadin.ui.Label. "Test Message")))))
</pre><br />
Thats all. I have used a macro for the window can do without that as well.Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com3tag:blogger.com,1999:blog-5073857838398398130.post-64372483289485043422011-02-26T21:17:00.000-08:002012-05-23T22:56:51.913-07:00How to Access JBoss Queue with a Standalone Client<div dir="ltr" style="text-align: left;" trbidi="on">
In this post I'm going to talk about how to access a JBoss queue using a standalone client. I'm not going to talk about the basic details of creating a queue that you can find in JBoss documents.<br />
<br />
There is two steps to this<br />
<ol style="text-align: left;">
<li>Setup the JBoss queue</li>
<li>Setup the standalone client</li>
</ol>
Lets start with the JBoss queue, lets create a normal queue<br />
<br />
<br />
<pre class="brush: xml"><mbean <name="jboss.messaging.destination:service=Queue, name=Queue1" code="org.jboss.jms.server.destination.QueueService">
<attribute name="JNDIName">queue/Queue1</attribute>
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>
</mbean>
</pre>
Now lets setup the remote client. Make sure the JBoss necessary libraries are in the classpath.
<pre class="brush: java">public static Context getInitialContext( ) throws javax.naming.NamingException {
Properties p = new Properties( );
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES," org.jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
return new InitialContext(p);
}
</pre>
<br />
<br />
<div style="text-align: left;">
now lets setup the queue </div>
<br />
<pre class="brush: java"> String queueName = "queue/Queue1";
Context ic = null;
ConnectionFactory cf = null;
Connection connection = null;
QueueSession queueSession;
connectionFactory = (ConnectionFactory) ctx.lookup("/ConnectionFactory");
conn = connectionFactory.createQueueConnection();
queueSession = conn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queue = (Queue) ctx.lookup(queueName);
MessageProducer queuePublisher = queueSession.createProducer(queue);
</pre>
<br />
<br />
<span style="background-color: white; color: #333333; display: inline ! important; float: none; font-family: Georgia,'Bitstream Charter',serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">You can change the JNDI name of connection factory or you can create your own.</span><br />
<br />
<div style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; background-position: initial initial; background-repeat: initial initial; border: 0px; color: #333333; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; margin: 0px 0px 24px; orphans: 2; padding: 0px; text-align: -webkit-auto; text-indent: 0px; text-transform: none; vertical-align: baseline; white-space: normal; widows: 2; word-spacing: 0px;">
Now lets setup a listener.</div>
<pre class="brush: java">
MessageConsumer consumer = queueSession.createConsumer(queue);
conn.start();
consumer.setMessageListener(this);
</pre>
<span style="background-color: white; color: #333333; display: inline ! important; float: none; font-family: Georgia,'Bitstream Charter',serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">You can test the connection by sending simple message</span>
<pre class="brush: java">TextMessage message = queueSession.createTextMessage("Hello Sourabh Girdhar");
publisher.send(message);
</pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="background-color: white; color: #333333; display: inline ! important; float: none; font-family: Georgia,'Bitstream Charter',serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"> </span></pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="background-color: white; color: #333333; display: inline ! important; float: none; font-family: Georgia,'Bitstream Charter',serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;">To receive messages you will need to implement MessageListener interface and override the onMessage()</span><span style="background-color: white; color: #333333; display: inline ! important; float: none; font-family: Georgia,'Bitstream Charter',serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"> </span></pre>
<pre class="brush: java">public void onMessage(Message msg) {
TextMessage message = (TextMessage) msg;
String text = null;
try{
text = message.getText();
System.out.println("Message received - " + text);
}catch (JMSException jme){
jme.printStackTrace();
}
}
</pre>
<pre style="color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px;"><span style="background-color: white; color: #333333; display: inline ! important; float: none; font-family: Georgia,'Bitstream Charter',serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 24px; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"> </span></pre>
</div>Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0tag:blogger.com,1999:blog-5073857838398398130.post-80529819700319580422011-02-02T02:11:00.000-08:002011-02-02T02:12:50.235-08:00Harnessing Developer Communities for Telco AppsIt is no secret today that one of the imperative sources of innovation in the Mobile Industry are application Developers. The innovative potential can be derived from an average high school kid to the likes of Mobiquest, all of which contribute to this rapidly growing industry. Every mobile application developer dreams of building the next cutting edge application and monetizing it. The success of a mobile application is based upon creativity and relevance to its intended audience. Furthermore the uniqueness of the application, its functionalities and time-to-market add on to the foundations which contribute to its success. A major challenge for Telecom operators therefore is to channel the creation of these applications that monetizes network assets and accelerating the roll out of “Telco Apps” which undoubtedly adds value to their service offering. This creates a need for telecom operators to have a platform that can entice innovation starting from idea generation, necessary tools, best practices and also a test bed where application developers can endeavor their brainchild with utmost freedom.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">Enticing Developers</span><br />
<br />
According to Mobile Developer Economics 2010, a study by Vision Mobile, 75% of surveyed Developers opted for Market Penetration as the most important reason to choose a Developer platform against any of its favorable technical aspects. Compared to the makers of mobile devices or mobile operating systems, few operators have a “global blanket reach” but most of them possess the advantage of strong brands in their local markets, the ability to steer traffic via network capabilities and a great deal of local knowledge of subscribers enabling “targeted reach”. We believe this is a great opportunity to inspire developers based around their localities to come up with applications suited to their surroundings. The diversity of the market could play as much a role in attracting developers. It cannot be denied that device vendor apps and the mobile web have brought out a rich wave of sophistication enhancing user experience. However this doesn’t utilize the potential of reaching out to the diversity of the masses that GSM coverage has enabled today. Operators should exploit the advantages of its network capabilities with channels such as SMS made available on every mobile handset and it is one that nearly every mobile user understands how to use. This potential materializing should spark the possibility of apps serving various spectrums of a market and operators will therefore have the unique strength to attract low to very high-end application developers.<br />
The convergence of technologies that operators are engaged with today provides multiple interfaces for developers to reach out to their audiences via bundling, packaging, cross-product opportunities, location based services, segmentation and profiling capabilities amongst a few. The operator therefore becomes a unique and powerful channel to collaborate with, in providing applications. Pricing and charging are underlying drivers influencing the ambitions of applications. Developers of established application platforms have long been stuck with rigid pricing variants of the pay-per-download revenue model. The operator has the opportunity to provide an application its due flexibility with numerous options such as fixed price, recurring fee on usage, subscription based etc<br />
<br />
<span class="Apple-style-span" style="font-size: large;">Easing the Developer Task</span><br />
<br />
Of course the proof of the pudding is in the eating of it and the platform that operators provide have to be technically sound for what developers do best – to develop applications. The Vision Mobile report goes on to say that the learning curve of the Symbian Platform and the Anrdoid Platform is approximately 15months and 6 months respectively. This is a great opportunity for operators to exploit, provide a platform that reduces the learning curve significantly. Mobile application developers who thrive to unleash their creativity in the form of novel applications crave for a simple and streamlined application development process. They want to create applications with minimal intervention and understanding of the need to connect to the telecom operator’s backend, as well as their underlying protocols. Operator platforms aiming for “developer-friendliness” will be successful in harnessing abundant creative talent amongst those who possess ground-breaking ideas but are inhibited by the technical obstacles involved in materializing these ideas. In addition to “developer-friendliness” imperatives, the availability of useful resources that enhance the applications during the development process in the form of sample applications, development tool kits and guides will help inspire budding developers and boost the development process from rapid creation, deployment and commercialization of their mobile applications.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">Marketing of Telco Apps.</span><br />
<br />
Market Penetration was earlier highlighted as a key factor for Developers choosing platforms and this is exemplified by Operators being able to facilitate multiple interfaces when delivering applications to subscribers. Operator’s capabilities in providing the “Telco App store” as a web based, USSD Interface appeal to a larger and a more diverse audience rather than those only having smart phones. The power of identity management options such as user profiling information coupled with network capabilities such as location provides the opportunity for developers to customize apps for distinct subscriber segments. The Vision Mobile report highlights the key challenge Developers face is, marketing their own applications. There can be various reasons for this especially if the developer and his target audiences are geographically disconnected. With operators having There is now a better opportunity for developers to do so around their own communities and interest groups especially if they have deployed the app based on the area where they are present.<br />
<br />
<span class="Apple-style-span" style="font-size: large;">Birth of a Vibrant Telco Developer Community</span><br />
<br />
In a day and age where mash-ups are enriching consumer experience, the best-of-breed mobile applications are sometimes born out of collaborative ideas from many people from all walks of life. Fierce competition has led individual developers to be on the lookout for partnerships with larger communities of developers that can bring out better applications. This can be enabled with interactive online forums that are supported by technical counseling, developer workshops & networking sessions for idea generation, knowledge sharing & potential business partnerships, thus creating a vibrant developer community.<br />
<br />
<b><i>hSenid Mobile recently launched its state of the art Cloud Enabled Telco Developer Portal that is set to pave the way for a vibrant Developer Community with a simplified Development Path resulting in a Plethora of “Telco” Applications for Mobile Operators to provide its diverse subscriber base.</i></b>Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0tag:blogger.com,1999:blog-5073857838398398130.post-65283938204957074472011-02-01T22:38:00.000-08:002011-02-01T22:57:21.974-08:00Telco based SMS and MMS application using JAVA and .NET<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">AppZone is the Worlds first ever Telco based mobile application appstore launched by Etisalat Sri Lanka partnered with hSenid Mobile. This platform allows the users to browse the mobile applications and also gives the opportunity for application developers to create, test and sell their own unique applications.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">It helps developers to create application using Java , .NET or any other programming language (which supports HTTP) they prefer, to send a receive SMS and MMS to mobile phones. Which gives the opportunity for developers to get recursive revenue which is not available in downloadable application for mobile handsets.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: large;">Sample Code</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>public class SimpleSmsMt {</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String[] args) {</b></span><br />
<b><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"> try {</span></b><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>MchoiceAventuraSmsSender sender = new MchoiceAventuraSmsSender(new</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b> URL("http://appzone.server:8899/"), "SMS_6063",</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>"test");</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>// send message to a single destination</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>String message = "hi im jason";</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>String address = "+94969696969";</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>sender.sendMessage(message, address);</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>} catch (Throwable e) {</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>e.printStackTrace(System.err);</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>}</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-tab-span" style="white-space: pre;"> </span>}</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>}</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Use the API's to create your applications and services. The downloads you need are here, as well as the documentation and the community to speed things up.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><a href="http://appzone.lk/devzone.html">http://appzone.lk/devzone.html</a></span><br />
<ul style="font-family: Arial, Helvetica, sans-serif; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-left: 15px;"></ul><div style="font-family: Arial, Helvetica, sans-serif; text-align: left;"><br />
</div><div style="font-family: Arial, Helvetica, sans-serif; text-align: left;">If you have created the application its easy as to drop a mail to go live.</div><div style="text-align: left;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Drop a mail to support@appzone.lk to get your account details or if you want any clarification. </span></div>Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0tag:blogger.com,1999:blog-5073857838398398130.post-52781867715931536442010-09-30T22:23:00.000-07:002011-02-01T20:25:24.367-08:00Installing USB modem on Fedora (Mobile broadband, Dongal)<span class="Apple-style-span" style="font-family: Georgia, serif; line-height: 20px;">The other day I had to set up one of these 3G mobile internet USB modems on a Fedora 12 box. It didn't work out of the box, though in hindsight it should have. So for anyone who's googling around on how to set this up (or whether it can be set up at all), here's the gist. </span><br />
<span class="Apple-style-span" style="font-family: Georgia, serif; line-height: 20px;">After spending hours on it i found out that, this is actually a bug in Fedora (</span><span class="Apple-style-span" style="font-family: 'DejaVu Sans', 'Liberation Sans', sans-serif; font-weight: bold;"><b><a href="https://bugzilla.redhat.com/show_bug.cgi?id=582869" style="text-decoration: none;">582869</a></b></span><span class="Apple-style-span" style="font-family: Georgia, serif; line-height: 20px;">) and there is a work around to make it work.</span><br />
<span class="Apple-style-span" style="font-family: Georgia, serif; line-height: 20px;"> </span><br />
<span class="Apple-style-span" style="font-family: Georgia, serif; line-height: 20px;">The modem looks like a mass storage device. If you plug the modem in, dmesg has this to say:</span><br />
<span class="Apple-style-span" style="font-family: Georgia, serif; line-height: 20px;"> </span><br />
<span class="Apple-style-span" style="font-family: Georgia, serif; line-height: 20px;"></span><br />
<pre>usb 1-2: new high speed USB device using ehci_hcd and address 6
usb 1-2: New USB device found, idVendor=12d1, idProduct=1520
usb 1-2: New USB device strings: Mfr=3, Product=2, SerialNumber=0
usb 1-2: Product: HUAWEI Mobile
usb 1-2: Manufacturer: HUAWEI Technology
usb 1-2: configuration #1 chosen from 1 choice
scsi5 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 6
usb-storage: waiting for device to settle before scanning
usb-storage: device scan complete
scsi 5:0:0:0: CD-ROM Vodafone CD ROM (Huawei) 2.31 PQ: 0 ANSI: 2
sr1: scsi-1 drive
sr 5:0:0:0: Attached scsi CD-ROM sr1
sr 5:0:0:0: Attached scsi generic sg4 type 5</pre><pre></pre><pre><span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal;">As I said above, these modems look like mass storage devices or some times like a CD-ROM thats why it did not work and it needs to be switched to the actual modem mode. The nifty program usb_modeswitch does exactly that</span></pre><pre><span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal;">
</span></pre><pre><span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal;">only thing that you need to do is install this programme. you can use yum to do that.</span></pre><pre><span class="Apple-style-span" style="font-family: Georgia, serif; white-space: normal;"> </span><span class="Apple-style-span" style="line-height: normal; white-space: pre-wrap;">yum install usb_modeswitch</span></pre><pre><span class="Apple-style-span" style="line-height: normal; white-space: pre-wrap;">the following are the details about the programme.</span></pre><pre><span class="Apple-style-span" style="font-size: medium; line-height: normal; white-space: pre-wrap;"><span class="Apple-style-span" style="font-family: 'DejaVu Sans', 'Liberation Sans', sans-serif; font-size: small; white-space: normal;">
<pre class="bz_comment_text" style="font-family: monospace; white-space: pre-wrap; width: 50em;">yum info usb_modeswitch
[sudo] password for harald:
Loaded plugins: presto, refresh-packagekit
Installed Packages
Name : usb_modeswitch
Arch : x86_64
Version : 1.0.5
Release : 1.fc12
Size : 87 k
Repo : installed
From repo : fedora
Summary : USB Modeswitch gets 4G cards in operational mode
URL : <a href="http://www.draisberghof.de/usb_modeswitch/" style="text-decoration: none;">http://www.draisberghof.de/usb_modeswitch/</a>
License : GPLv2+
Description: USB Modeswitch brings up your datacard into operational mode. When
plugged
: in they identify themselves as cdrom and present some non-Linux
compatible
: installation files. This tool deactivates this cdrom-devices and
enables
: the real communication device. It supports most devices built and
: sold by Huawei, T-Mobile, Vodafone, Option, ZTE, Novatel.</pre><pre class="bz_comment_text" style="font-family: monospace; white-space: pre-wrap; width: 50em;"></pre><pre class="bz_comment_text" style="font-family: monospace; white-space: pre-wrap; width: 50em;"></pre><pre class="bz_comment_text" style="font-family: monospace; white-space: pre-wrap; width: 50em;">Even if your modem is not listed here it tends to work with other modems as well. I tried it with a Alcatel modem it worked ;)</pre></span></span></pre>Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0tag:blogger.com,1999:blog-5073857838398398130.post-82182784346942961762010-09-19T20:21:00.001-07:002010-09-19T20:21:24.921-07:00Web Alternatives to Desktop Software<div id="post-10153" class="post-10153 post hentry category-roundups tag-apps tag-desktop tag-software tag-web"> <div class="clearfix"> <div class="post_image"> </div> <div class="post_image"> </div> </div> <div class="entry clearfix"> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10156" class="wp-caption alignleft"><img class="size-full wp-image-10156" title="Panda Cloud Protection" alt="Panda Cloud Protection" src="http://web.appstorm.net/wp-content/uploads/2011/09/Panda-Cloud-Protection.jpg" width="200" height="81" /> </div> <h3 class="roundup_text"><a href="http://cloudprotection.pandasecurity.com/what/index.php">Panda Cloud Protection</a></h3> <p class="roundup_text">Panda Cloud Protection is a cloud based security solution, delivered in a SaaS model that provides complete protection services for the major threat vectors: endpoint, email and web.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Conventional AV suites like McAfee, Norton, Kaspersky etc. </li> <li><strong>Requirements:</strong> An Internet Connection </li> <li><strong>Developer:</strong> Panda Security </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10160" class="wp-caption alignleft"><img class="size-full wp-image-10160" title="LastPass" alt="LastPass" src="http://web.appstorm.net/wp-content/uploads/2011/09/LastPass.jpg" width="200" height="200" /> <p class="wp-caption-text">LastPass</p> </div> <h3 class="roundup_text"><a href="http://LastPass.com">LastPass</a></h3> <p class="roundup_text">LastPass is an online password manager which, with the help of your master password, remembers and stores all your passwords when you login to websites and facilitates — one click login after first use.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> KeePass, 1Password (Mac), Roboform etc. </li> <li><strong>Requirements:</strong> A modern web browser. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10161" class="wp-caption alignleft"><img class="size-full wp-image-10161" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Google-Docs.jpg" width="200" height="189" /> <p class="wp-caption-text">Google Docs</p> </div> <h3 class="roundup_text"><a href="http://docs.google.com">Google Docs</a></h3> <p class="roundup_text">Google Docs is an online office suite made available for free by Google and is capable of word processing, spreadsheets, presentations & more.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Microsoft Office & Open Office </li> <li><strong>Requirements:</strong> A modern web browser & a Google account. </li> <li><strong>Developer:</strong> List developer if you can find him/her </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10162" class="wp-caption alignleft"><img class="size-full wp-image-10162" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Splashup.jpg" width="200" height="114" /> <p class="wp-caption-text">Splashup</p> </div> <h3 class="roundup_text"><a href="http://Splashup.com">Splashup</a></h3> <p class="roundup_text">Splashup is a cloud based image editing tool with a great set of tools for image manipulation.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Adobe Photosop, Gimp etc. </li> <li><strong>Requirements:</strong> Adobe Flash Player </li> <li><strong>Developer:</strong> Faux Labs, Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10163" class="wp-caption alignleft"><img class="size-full wp-image-10163" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Google-Apps.jpg" width="200" height="197" /> <p class="wp-caption-text">Google Apps</p> </div> <h3 class="roundup_text"><a href="http://google.com/a">Google Apps</a></h3> <p class="roundup_text">Google Apps is an affordable enterprise communication suite complete with email, calenders, document editors and more.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Microsoft Exchange Server </li> <li><strong>Requirements:</strong> A domain name </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10164" class="wp-caption alignleft"><img class="size-full wp-image-10164" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Gliffy.jpg" width="200" height="124" /> <p class="wp-caption-text">Gliffy</p> </div> <h3 class="roundup_text"><a href="http://Gliffy.com">Gliffy</a></h3> <p class="roundup_text">Gliffy is a web app that helps us create & share quality flow charts, complex diagrams or technical drawings.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Microsoft Vizio </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10165" class="wp-caption alignleft"><img class="size-full wp-image-10165" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Instacalc.jpg" width="200" height="137" /> <p class="wp-caption-text">Instacalc</p> </div> <h3 class="roundup_text"><a href="http://Instacalc.com">Instacalc</a></h3> <p class="roundup_text">Instacalc is equipped with scientific functions & formulae and is a great replacement for the desktop app.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> The calculator app </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10166" class="wp-caption alignleft"><img class="size-full wp-image-10166" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/faxZERO.jpg" width="200" height="135" /> <p class="wp-caption-text">faxZERO</p> </div> <h3 class="roundup_text"><a href="http://faxZERO.com">faxZERO</a></h3> <p class="roundup_text">With faxZERO you can send free faxes to USA & Canada and paid faxes across the globe.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> A fax machine </li> <li><strong>Developer:</strong> Savetz Publishing </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10167" class="wp-caption alignleft"><img class="size-full wp-image-10167" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Netvibes.jpg" width="200" height="134" /> <p class="wp-caption-text">Netvibes</p> </div> <h3 class="roundup_text"><a href="http://Netvibes.com">Netvibes</a></h3> <p class="roundup_text">Netvibes is the fastest way to keep in touch with your RSS subscriptions and to track your real time web.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Feed demon, Net News Wire etc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10168" class="wp-caption alignleft"><img class="size-full wp-image-10168" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Meebo.jpg" width="200" height="100" /> <p class="wp-caption-text">Meebo</p> </div> <h3 class="roundup_text"><a href="http://Meebo.com">Meebo</a></h3> <p class="roundup_text">Meebo is a online multiple protocol chat app that does not need any introductions.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Almost all chat clients. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10169" class="wp-caption alignleft"><img class="size-full wp-image-10169" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Prezi.jpg" width="200" height="93" /> <p class="wp-caption-text">Prezi</p> </div> <h3 class="roundup_text"><a href="http://Prezi.com">Prezi</a></h3> <p class="roundup_text">Prezi is a great web app to create stunning & professional looking presentation material.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Microsoft PowerPoint </li> <li><strong>Requirements:</strong> Adobe Flash Player </li> <li><strong>Developer:</strong> Prezi Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10170" class="wp-caption alignleft"><img class="size-full wp-image-10170" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Wufoo.jpg" width="200" height="132" /> <p class="wp-caption-text">Wufoo</p> </div> <h3 class="roundup_text"><a href="http://Wufoo.com">Wufoo</a></h3> <p class="roundup_text">Wufoo makes building forms and survey applications to collect data from users extremely simple.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> A lot of shareware apps & to an extent IDE’s. </li> <li><strong>Developer:</strong> Infinity Box Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10171" class="wp-caption alignleft"><img class="size-full wp-image-10171" title="Evernote" alt="Evernote" src="http://web.appstorm.net/wp-content/uploads/2011/09/Evernote.jpg" width="200" height="149" /> <p class="wp-caption-text">Evernote</p> </div> <h3 class="roundup_text"><a href="http://Evernote.com">Evernote</a></h3> <p class="roundup_text">Evernote is the popular app of choice to jot down things on the fly.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Microsoft OneNote. </li> <li><strong>Requirements:</strong> The dedicated desktop & mobile apps for ease of use. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10172" class="wp-caption alignleft"><img class="size-full wp-image-10172" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/PDFescape.jpg" width="200" height="153" /> <p class="wp-caption-text">PDFescape</p> </div> <h3 class="roundup_text"><a href="http://PDFescape.com">PDFescape</a></h3> <p class="roundup_text">Read, edit, fill forms and create PDF files with this amazing web app.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Adobe Reader </li> <li><strong>Developer:</strong> CT Developing LLC. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10173" class="wp-caption alignleft"><img class="size-full wp-image-10173" title="Google Voice" alt="Google Voice" src="http://web.appstorm.net/wp-content/uploads/2011/09/Google-Voice.jpg" width="200" height="200" /> <p class="wp-caption-text">Google Voice</p> </div> <h3 class="roundup_text"><a href="http://google.com/voice">Google Voice</a></h3> <p class="roundup_text">After Google opened up international calling, the app has become the powerhouse of voice communication.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Skype </li> <li><strong>Requirements:</strong> Google Voice Account which is available only to US residents. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10174" class="wp-caption alignleft"><img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="size-full wp-image-10174" border="0" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/World-of-Soltaire.jpg" width="202" height="171" /> <p class="wp-caption-text">World of Soltaire</p> </div> <h3 class="roundup_text"><a href="http://worldofsolitaire.com/">World of Solitaire</a></h3> <p class="roundup_text">A windows user never ever gets tired of this good game!</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Solitaire </li> <li><strong>Developer:</strong> Cosmic Realms </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10175" class="wp-caption alignleft"><img class="size-full wp-image-10175" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/WebFTPer.jpg" width="200" height="127" /> <p class="wp-caption-text">WebFTPer</p> </div> <h3 class="roundup_text"><a href="http://webftper.com">WebFTPer</a></h3> <p class="roundup_text">Upload files, change permissions, manage data all without having to leave the browser.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> SmartFTP, Transmit etc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10399" class="wp-caption alignleft"><img class="size-full wp-image-10399" title="ScreenCastle" alt="ScreenCastle" src="http://web.appstorm.net/wp-content/uploads/2010/09/ScreenCastle.jpg" width="200" height="184" /> <p class="wp-caption-text">ScreenCastle</p> </div> <h3 class="roundup_text"><a href="http://screencastle.com">ScreenCastle</a></h3> <p class="roundup_text">Record, share & stream your screenshots without having to download and install anything. ScreenCastle offers 8 different links to watch, embed and share with different image sizes.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> TechSmith Camtasia Studio </li> <li><strong>Requirements:</strong> Java </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10177" class="wp-caption alignleft"><img class="size-full wp-image-10177" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Talon.jpg" width="200" height="154" /> <p class="wp-caption-text">Talon</p> </div> <h3 class="roundup_text"><a href="http://aviary.com/launch/talon">Talon</a></h3> <p class="roundup_text">From the stable of the popular web app supermarket Aviary, comes the online screenshot taking app.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> TechSmith SnagIT </li> <li><strong>Requirements:</strong> A Firefox or Chrome Plugin for enhanced functionality. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10178" class="wp-caption alignleft"><img class="size-full wp-image-10178" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/SmugMug.jpg" width="200" height="152" /> <p class="wp-caption-text">SmugMug</p> </div> <h3 class="roundup_text"><a href="http://SmugMug.com">SmugMug</a></h3> <p class="roundup_text">Our editor’s favorite photo management app is a great choice for hobbyists & professionals alike.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> ACD See, Picasa Desktop etc. </li> <li><strong>Requirements:</strong> An account at SmugMug </li> <li><strong>Developer:</strong> SmugMug Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10179" class="wp-caption alignleft"><img class="size-full wp-image-10179" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/PiratePad.jpg" width="200" height="193" /> <p class="wp-caption-text">PiratePad</p> </div> <h3 class="roundup_text"><a href="http://PiratePad.net">PiratePad</a></h3> <p class="roundup_text">PiratePad is a free online collaborative notepad for group discussion and code editing.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> WordPad, Tomboy etc </li> <li><strong>Developer:</strong> PiratPartiNet </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10180" class="wp-caption alignleft"><img class="size-full wp-image-10180" title="vixy" alt="vixy" src="http://web.appstorm.net/wp-content/uploads/2011/09/vixy.jpg" width="200" height="81" /> <p class="wp-caption-text">vixy.net</p> </div> <h3 class="roundup_text"><a href="http://vixy.net">vixy.net</a></h3> <p class="roundup_text">vixy.net converts your video into FLV format optimized to be played in your portable media player. Preset settings are available for popular portable players.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Handbrake </li> <li><strong>Developer:</strong> Farside Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10181" class="wp-caption alignleft"><img class="size-full wp-image-10181" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/movavi.jpg" width="200" height="172" /> <p class="wp-caption-text">movavi</p> </div> <h3 class="roundup_text"><a href="http://online.movavi.com/">movavi</a></h3> <p class="roundup_text">A great web app to convert multiple video files simultaneously into a variety of popular formats.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Videora, Xilisoft Video Converter etc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10182" class="wp-caption alignleft"><img class="size-full wp-image-10182" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Miro-Video-Converter.jpg" width="200" height="108" /> <p class="wp-caption-text">Miro Video Converter</p> </div> <h3 class="roundup_text"><a href="http://mirovideoconverter.com">Miro Video Converter</a></h3> <p class="roundup_text">In addition to converting videos into a lot of popular video formats, Miro Video Converter can also convert files into the latest WebM format too.</p> <div class="roundup_text"> <ul> <li><strong>Developer:</strong> Participatory Culture Foundation </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10186" class="wp-caption alignleft"><img class="size-full wp-image-10186" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/HootSuite.jpg" width="200" height="116" /> <p class="wp-caption-text">HootSuite</p> </div> <h3 class="roundup_text"><a href="http://HootSuite.com">HootSuite</a></h3> <p class="roundup_text">Right from following your friends to monitoring a social marketing campaign, there is nothing impossible with this web app powered by HTML5.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Tweetdeck </li> <li><strong>Requirements:</strong> A modern browser & social network accounts. </li> <li><strong>Developer:</strong> HootSuite Media Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10187" class="wp-caption alignleft"><img class="size-full wp-image-10187" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/mindmeister.jpg" width="200" height="157" /> <p class="wp-caption-text">mindmeister</p> </div> <h3 class="roundup_text"><a href="http://mindmeister.com">mindmeister</a></h3> <p class="roundup_text">mindmeister is an upgrade to the good old napkin system to capture ideas. It’s also possible to export mind maps, edit with another app (desktop or web) and import the same for further edits.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Mindomo, Simple Mind etc. </li> <li><strong>Developer:</strong> Meister Labs </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10188" class="wp-caption alignleft"><img class="size-full wp-image-10188" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Balsamiq.jpg" width="200" height="152" /> <p class="wp-caption-text">Balsamiq</p> </div> <h3 class="roundup_text"><a href="http://Balsamiq.com">Balsamiq</a></h3> <p class="roundup_text">Balsamiq is a simple & powerful web app to design UI prototypes & wireframes ideal for designers & developers.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Denim, OmniGraffle </li> <li><strong>Developer:</strong> Balsamiq Studios LLC. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10189" class="wp-caption alignleft"><img class="size-full wp-image-10189" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Kodingen.jpg" width="200" height="145" /> <p class="wp-caption-text">Kodingen</p> </div> <h3 class="roundup_text"><a href="http://Kodingen.com">Kodingen</a></h3> <p class="roundup_text">Kodingen is a web based Integrated Development Environment (IDE) that supports coding and version control of apps in a variety of top programming languages.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Dreamweaver, Visual Studio. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10190" class="wp-caption alignleft"><img class="size-full wp-image-10190" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Dabbleboard.jpg" width="200" height="227" /> <p class="wp-caption-text">Dabbleboard</p> </div> <h3 class="roundup_text"><a href="http://Dabbleboard.com">Dabbleboard</a></h3> <p class="roundup_text">A picture is worth a thousand words, and Dabbleboard lets you draw your ideas as pictures quickly. Others can also contribute to the idea on the board too.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> NotateIt </li> <li><strong>Developer:</strong> Dabbleboard Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10191" class="wp-caption alignleft"><img class="size-full wp-image-10191" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Piwik.jpg" width="200" height="180" /> <p class="wp-caption-text">Piwik</p> </div> <h3 class="roundup_text"><a href="http://Piwik.org">Piwik</a></h3> <p class="roundup_text">Piwik is a self hosted, open source (GPL licensed) real time web analytics software script which has the same set of features of Google Analytics.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Woopra </li> <li><strong>Requirements:</strong> A web server </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10192" class="wp-caption alignleft"><img class="size-full wp-image-10192" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Oprius.jpg" width="200" height="104" /> <p class="wp-caption-text">Oprius</p> </div> <h3 class="roundup_text"><a href="http://Oprius.com">Oprius</a></h3> <p class="roundup_text">Oprius is a sales and contact Management Software web app that lets you can access your contacts from anywhere.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Microsoft Outlook </li> <li><strong>Developer:</strong> Oprius Software Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10193" class="wp-caption alignleft"><img class="size-full wp-image-10193" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/SugarCRM.jpg" width="200" height="143" /> <p class="wp-caption-text">SugarCRM</p> </div> <h3 class="roundup_text"><a href="http://SugarCRM.com">SugarCRM</a></h3> <p class="roundup_text">Available in both commercial and open source flavors, SugarCRM is a competent Customer Relationship Management solution.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> vTiger, Microsoft Dynamics CRM and more. </li> <li><strong>Requirements:</strong> A web server for the open source version. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10194" class="wp-caption alignleft"><img class="size-full wp-image-10194" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/OpenBravo.jpg" width="200" height="94" /> <p class="wp-caption-text">OpenBravo</p> </div> <h3 class="roundup_text"><a href="http://OpenBravo.com">OpenBravo</a></h3> <p class="roundup_text">OpenBravo is a web-based integrated Enterprise Management system for managing your business right from the Point of Sales to Warehouse Management.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Microsoft Dynamics NAV, SAP </li> <li><strong>Requirements:</strong> A web server </li> <li><strong>Developer:</strong> Openbravo, S.L.U. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10195" class="wp-caption alignleft"><img class="size-full wp-image-10195" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Liquid-Planner.jpg" width="200" height="151" /> <p class="wp-caption-text">Liquid Planner</p> </div> <h3 class="roundup_text"><a href="http://www.liquidplanner.com/">Liquid Planner</a></h3> <p class="roundup_text">Liquid Planner is a project management web app known for its ability to make allowances for sliding estimates for tasks with inexact completion dates.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Microsoft Project </li> <li><strong>Developer:</strong> Liquid Planner Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10196" class="wp-caption alignleft"><img class="size-full wp-image-10196" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Less-Accounting.jpg" width="200" height="138" /> <p class="wp-caption-text">Less Accounting</p> </div> <h3 class="roundup_text"><a href="http://lessaccounting.com">Less Accounting</a></h3> <p class="roundup_text">Less Accounting is a great way to keep track of your expenses, income, invoicing and taxing needs. Less time spent on book keeping and more time to focus on your business.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Quick Books </li> <li><strong>Developer:</strong> Less Everything </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10197" class="wp-caption alignleft"><img class="size-full wp-image-10197" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Less-TimeSpent.jpg" width="200" height="118" /> <p class="wp-caption-text">Less TimeSpent</p> </div> <h3 class="roundup_text"><a href="http://lesstimespent.com">Less TimeSpent</a></h3> <p class="roundup_text">No more sticky notes and no more cluttered spreadsheets. LessTimeSpent tracks your work in real time, so no more over worked & underpaid hours.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> actiTime, Billings. </li> <li><strong>Developer:</strong> Less Everything </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10198" class="wp-caption alignleft"><img class="size-full wp-image-10198" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Magna-CRM.jpg" width="200" height="127" /> <p class="wp-caption-text">Magna CRM</p> </div> <h3 class="roundup_text"><a href="http://magnacrm.com">Magna CRM</a></h3> <p class="roundup_text">Magna CRM is a simple & intuitive on demand CRM solution to store business contacts, leads, opportunities in addition to scheduling & managing tasks.</p> <div class="roundup_text"> <ul> <li><strong>Developer:</strong> OnClick Solutions Ltd. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10199" class="wp-caption alignleft"><img class="size-full wp-image-10199" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Goplan.jpg" width="200" height="145" /> <p class="wp-caption-text">Goplan</p> </div> <h3 class="roundup_text"><a href="http://goplanapp.com">Goplan</a></h3> <p class="roundup_text">Goplan lets you keep track of your projects and collaborate with your colleagues securely through an intuitive user interface & is used by famous companies like Mozilla & Boxee among others.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Microsoft Project </li> <li><strong>Developer:</strong> Webreakstuff Lda. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10200" class="wp-caption alignleft"><img class="size-full wp-image-10200" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/TeuxDeux.jpg" width="200" height="160" /> <p class="wp-caption-text">TeuxDeux</p> </div> <h3 class="roundup_text"><a href="http://TeuxDeux.com">TeuxDeux</a></h3> <p class="roundup_text">TeuxDeux is a visually compelling and highly usable to-do app developed with the aim to reboot how contemporary Getting Things Done apps work.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Things </li> <li><strong>Developer:</strong> swissmiss & Fictive Kin </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10201" class="wp-caption alignleft"><img class="size-full wp-image-10201" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Springpad.jpg" width="200" height="182" /> <p class="wp-caption-text">Springpad</p> </div> <h3 class="roundup_text"><a href="http://Springpadit.com">Springpad</a></h3> <p class="roundup_text">Whether on your computer or smart phone, Springpad helps you remember stuff — places, websites, books, recipes, ideas, anything — all in one place so you can make better decisions.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Bento </li> <li><strong>Requirements:</strong> List </li> <li><strong>Developer:</strong> Spring Partners </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10202" class="wp-caption alignleft"><img class="size-full wp-image-10202" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/iClippy.jpg" width="200" height="177" /> <p class="wp-caption-text">iClippy</p> </div> <h3 class="roundup_text"><a href="http://iClippy.com">iClippy</a></h3> <p class="roundup_text">iClippy captures all your copy and cut operations & automatically copies them to the iClippy service. The web app can also capture from the screen and the scanner as well.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Ditto, Presto. </li> <li><strong>Developer:</strong> iClippy LLC. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10203" class="wp-caption alignleft"><img class="size-full wp-image-10203" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Photoshop.jpg" width="200" height="120" /> <p class="wp-caption-text">Photoshop.com</p> </div> <h3 class="roundup_text"><a href="http://Photoshop.com">Photoshop.com</a></h3> <p class="roundup_text">Edit, organize and share your photos with the Photoshop.com web app which with the familiar interface, is a close enough to be a light weight Photoshop. It’s free and comes with 1 GB free storage.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Adobe Photoshop </li> <li><strong>Requirements:</strong> An Adobe ID </li> <li><strong>Developer:</strong> Adobe </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10204" class="wp-caption alignleft"><img class="size-full wp-image-10204" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Toodledo.jpg" width="200" height="194" /> <p class="wp-caption-text">Toodledo</p> </div> <h3 class="roundup_text"><a href="http://Toodledo.com">Toodledo</a></h3> <p class="roundup_text">For those of us who are procrastinators, Toodledo is a special tool that analyzes dates, priorities, time estimates, and other characteristics to create a customized schedule of the best use of your time.</p> <div class="roundup_text"> <ul> <li><strong>Requirements:</strong> A Toodledo account </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10205" class="wp-caption alignleft"><img class="size-full wp-image-10205" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Zootool.jpg" width="200" height="157" /> <p class="wp-caption-text">Zootool</p> </div> <h3 class="roundup_text"><a href="http://Zootool.com">Zootool</a></h3> <p class="roundup_text">Zootool is a cool way to collect, organize and share your favourite images, videos, documents and links from all over the web.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Desktop & browser based bookmark apps </li> <li><strong>Developer:</strong> OpenWe GmbH </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10206" class="wp-caption alignleft"><img class="size-full wp-image-10206" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Livemocha.jpg" width="200" height="152" /> <p class="wp-caption-text">Livemocha</p> </div> <h3 class="roundup_text"><a href="http://Livemocha.com">Livemocha</a></h3> <p class="roundup_text">Livemocha is the world’s largest online language learning community and offers intelligently designed learning programs designed by native speakers of the language you are interested in.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Rosetta Stone </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10207" class="wp-caption alignleft"><img class="size-full wp-image-10207" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Cramberry.jpg" width="200" height="105" /> <p class="wp-caption-text">Cramberry</p> </div> <h3 class="roundup_text"><a href="http://Cramberry.net">Cramberry</a></h3> <p class="roundup_text">Cramberry helps you study with online flash cards. Cramberry analyzes your progress during the study and shows only the cards you need to study.</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> Popling </li> <li><strong>Developer:</strong> Lateral Communications Inc. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10208" class="wp-caption alignleft"><img class="size-full wp-image-10208" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/CliffsNotes.jpg" width="200" height="163" /> <p class="wp-caption-text">CliffsNotes</p> </div> <h3 class="roundup_text"><a href="http://CliffsNotes.com">CliffsNotes</a></h3> <p class="roundup_text">Literature can be pretty boring. CliffsNotes’ guides present and explain literary and other works in a condensed & simple form online.</p> <div class="roundup_text"> <ul> <li><strong>Developer:</strong> Wiley Publishing. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10209" class="wp-caption alignleft"><img class="size-full wp-image-10209" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Toggl.jpg" width="200" height="206" /> <p class="wp-caption-text">Toggl</p> </div> <h3 class="roundup_text"><a href="http://Toggl.com">Toggl</a></h3> <p class="roundup_text">With Toggl, you can track time with a single click and switch easily between different tasks and create reports at the same time.</p> <div class="roundup_text"> <ul> <li><strong>Developer:</strong> apprise </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10210" class="wp-caption alignleft"><img class="size-full wp-image-10210" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/Mibbit.jpg" width="200" height="101" /> <p class="wp-caption-text">Mibbit</p> </div> <h3 class="roundup_text"><a href="http://Mibbit.com">Mibbit</a></h3> <p class="roundup_text">For long mIRC has been the chosen client to access the grand daddy of IM, the IRC (Internet Relay Chat). With Mibbit, there is no need to know the complex login and channel commands and even newbies can start using IRC in no time..</p> <div class="roundup_text"> <ul> <li><strong>Replaces:</strong> mIRC </li> <li><strong>Developer:</strong> Mibbit Limited. </li> </ul> </div> <p> </p> </div> <div class="roundup clearfix"> <div style="width: 210px" id="attachment_10211" class="wp-caption alignleft"><img class="size-full wp-image-10211" alt="alt" src="http://web.appstorm.net/wp-content/uploads/2011/09/put.io_.jpg" width="200" height="178" /> <p class="wp-caption-text">put.io</p> </div> <div class="roundup_text"> <h3><a href="http://put.io">put.io</a></h3> <p>Put.io is a storage service that allows you to upload your medial files & and lets you stream them immediately as and when you please. You can use it to stream video, listen to your music and can also share your library with friends. </p> </div> </div> </div> </div> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com3tag:blogger.com,1999:blog-5073857838398398130.post-18618177714768208542010-09-08T04:20:00.001-07:002010-09-08T04:22:20.331-07:00Where to put named queries in JPA?<p>JPA provides multiple ways to obtain entities. There is a very simple programmatic API that allows us to get an entity by ID, there’s a more elaborate one called the Criteria API and then there’s a query language called JPQL (Java Persistence Query Language).</p> <p>JPQL is an object oriented query language that is based on the simplicity of SQL, but works directly on objects and their properties. The problem with such a language that’s used inside another language (Java) is where to store the query definition. Traditionally there have been 2 solutions:</p> <ol> <li>Store the definitions in annotations on some entity. </li> <li>Construct strings holding the definitions inline in your Java code. </li> </ol> <p>The first solution is called a Named Query in JPA, it looks like this:</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 96.31%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 192px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 94.83%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; height: 142px; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">@NamedQueries(value={<br /> @NamedQuery(<br /> name = <span style="color: #006080">"Website.getWebsiteByUserId"</span>,<br /> query=<span style="color: #006080">"select website from Website website where website.userId = :userId"</span>)<br /> @NamedQuery(...)<br />})<br />@Entity<br /><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> Website { ... }<br /></pre><br /><br /> <br /></div><br /><br /><p>The advantages of this method are twofold: JPA checks your query is valid at startup time (no runtime surprises) and the query definition is parsed only once and re-used afterwards. As an extra bonus, it also strongly encourages to used named parameters. The disadvantage however is that its location is just plain awkward. The entity is typically not the location where we wish to store this kind of logic. It gets even more awkward when the query is about multiple entities, yet you have to choose a single one to store the query definition on. Instead, a DAO, Service or whatever code is used to interact with the entity manager is a much more logical place to store a query definition. Unfortunately, @NamedQuery only works on entities. Neither Enterprise beans nor any other kind of managed bean in Java EE supports them.</p><br /><br /><p>This thus brings us to the second solution, which looks like this:</p><br /><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 96.36%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 160px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 90.81%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; height: 110px; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">public</span> foo() {<br /> <span style="color: #008000">// some code</span><br /> Website website = entityManager.createQuery(<br /> <span style="color: #006080">"select website from Website website where"</span> website.userId = :userId<span style="color: #006080">", Website.class)<br /> .setParameter("</span>userId", userId)<br /> getSingleResult();<br /></pre><br /><br /> <br /></div><br /><br /><p>This is arguably a much better location, though still not ideal. If the query is long, we have to concatenate strings which makes the query hard to read and hard to maintain. It has the major disadvantage that the query is only checked at runtime and has to be re-parsed over and over again. There are some limited opportunities for reusing a Query object obtained by createQuery(), but since this object is only valid as long as the persistence context in which it was created is still active, those opportunities are really rather limited. Additionally, this style of query definition can make it tempting for developers to build their queries dynamically, giving rise to some nasty potential injection holes.</p><br /><br /><p>So having the choice between those two, which one do we choose? Actually, it appears there is a third solution, which is for some reason quite often overlooked by many people:</p><br /><br /><blockquote><br /> <p>3. Store the query text in XML (mapping) files.</p><br /></blockquote><br /><br /><p>In addition to annotations, JPA (and pretty much every API in Java EE that uses annotations) allows you to define the same thing or occasionally a little more in XML. Of course we don’t want one huge XML file with all our queries, but as it turns out JPA simply allows us to use as many files as we need and organize them in whatever way we want. We could for example put all queries related to some entity in one file anyway, or put all financial queries in one file and all core queries in another file, etc. The mechanism is actually quite similar to using multiple faces-config.xml files in JSF. The XML based solution looks as follows.</p><br /><br /><p><b>persistence.xml:</b></p><br /><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 96.56%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 89.61%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; height: 206px; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><<span style="color: #008000">;?xml version="1.0" encoding="UTF-8"?></span><br /><<span style="color: #008000">;persistence xmlns="http://java.sun.com/xml/ns/persistence"</span><br /> xmlns:xsi=<span style="color: #006080">"http://www.w3.org/2001/XMLSchema-instance"</span><br /> xsi:schemaLocation=<span style="color: #006080">"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"</span><br /> version=<span style="color: #006080">"1.0"</span>><span style="color: #008000">;</span><br /><span style="color: #008000"></span><br /><span style="color: #008000"> <persistence-unit name="somePU"></span><br /> <<span style="color: #008000">;jta-data-source>java:/someDS</jta-data-source></span><br /><br /> <<span style="color: #008000">;!-- Named JPQL queries per entity, but any other organization is possible --></span><br /> <<span style="color: #008000">;mapping-file>META-INF/jpql/Website.xml</mapping-file></span><br /> <<span style="color: #008000">;mapping-file>META-INF/jpql/User.xml</mapping-file></span><br /> <<span style="color: #008000">;/persistence-unit></span><br /><<span style="color: #008000">;/persistence></span><br /></pre><br /><br /> <br /></div><br /><br /><p><b>Website.xml:</b></p><br /><br /><div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 96.8%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 210px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"><br /> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 110.34%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; height: 366px; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><<span style="color: #008000">;?xml version="1.0" encoding="UTF-8"?></span><br /><<span style="color: #008000">;entity-mappings version="1.0" xmlns="http://java.sun.com/xml/ns/persistence/orm"</span><br /> xmlns:xsi=<span style="color: #006080">"http://www.w3.org/2001/XMLSchema-instance"</span><br /> xsi:schemaLocation=<span style="color: #006080">"http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd "</span><br />><span style="color: #008000">;</span><br /><span style="color: #008000"> <named-query name="Website.getByUserId"></span><br /> <<span style="color: #008000">;query></span><br /> <span style="color: #0000ff">SELECT</span><br /> website<br /> FROM<br /> Website website<br /> WHERE<br /> website.userId = :userId<br /> <<span style="color: #008000">;/query></span><br /> <<span style="color: #008000">;/named-query></span><br /><br /> <<span style="color: #008000">;named-query name="Website.foobar"></span><br /> <<span style="color: #008000">;query></span><br /> ...<br /> <<span style="color: #008000">;/query></span><br /> <<span style="color: #008000">;/named-query></span><br /><br /><<span style="color: #008000">;/named-query></span><br /><<span style="color: #008000">;/entity-mappings></span><br /></pre><br /><br /> <br /></div><br /><br /><p>Finally, using such query definitions in code is exactly the same as if they would have been defined using annotations, i.e. by calling entityManager.createNamedQuery().</p><br /><br /><p>Each XML file can contain as few or as many queries as you like. It might make sense to put a really complicated and huge query in one file, but to group several smaller related queries in another file. Do note that query names are part of a global namespace and are not automatically put in any namespace based on the file they are defined in. In the example above queries are pre-fixed with “Website.”, which happens to be the name of the entity but you can choose anything you want here. In the example META-INF/jpql was used as the directory to store queries, but any location on the class path including storing queries in jars will do.</p><br /><br /><p>As mentioned, for some reason this XML method seem to be often overlooked by many people. I’ve personally met multiple persons who build themselves a management system for storing JPQL queries in files, loading them, substituting parameters, etc while such a mechanism is in fact readily available in JPA (and has been since JPA 1.0!). Of course, the home grown systems don’t have the startup-time validation of queries nor do they do any pre-parsing and pre-compilation of queries.</p> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0tag:blogger.com,1999:blog-5073857838398398130.post-5446395374655186402010-09-08T04:10:00.001-07:002010-09-08T04:12:07.971-07:00Introduction to UNIX assembly programming<h1>Hello, world!</h1> <p>Now we will write our program, the old classic "Hello, world" (<tt>hello.asm</tt>). You can download its source and binaries <a href="http://linuxassembly.org/intro/hello.tgz">here</a>. But before you do, let me explain several basics.</p> <h3>System calls</h3> <p>Unless a program is just implementing some math algorithms in assembly, it will deal with such things as getting input, producing output, and exiting. For this, it will need to call on OS services. In fact, programming in assembly language is quite the same in different OSes, unless OS services are touched.</p> <p>There are two common ways of performing a system call in UNIX OS: through the C library (libc) wrapper, or directly.</p> <p>Using or not using libc in assembly programming is more a question of taste/belief than something practical. Libc wrappers are made to protect programs from possible system call convention changes, and to provide POSIX compatible interface if the kernel lacks it for some call. However, the UNIX kernel is usually more-or-less POSIX compliant -- this means that the syntax of most libc "system calls" exactly matches the syntax of real kernel system calls (and vice versa). But the main drawback of throwing libc away is that one loses several functions that are not just syscall wrappers, like <tt>printf()</tt>, <tt>malloc()</tt> and similar.</p> <p>This tutorial will show how to use <i>direct</i> kernel calls, since this is the fastest way to call kernel service; our code is not linked to any library, does not use ELF interpreter, it communicates with kernel directly.</p> <p>Things that differ in different UNIX kernels are set of system calls and system call convention (however as they strive for POSIX compliance, there's a lot of common between them).</p> <blockquote> <p><b>Note: </b>(Former) DOS programmers might be wondering, "What is a system call?" If you ever wrote a DOS assembly program (and most IA-32 assembly programmers did), you may remember DOS services <tt>int 0x21</tt>, <tt>int 0x25</tt>, <tt>int 0x26</tt> etc.. These are analogous to the UNIX system call. However, the actual implementation is absolutely different, and system calls are not necessarily done via some interrupt. Also, quite often DOS programmers mix OS services with BIOS services like <tt>int 0x10</tt> or <tt>int 0x16</tt> and are very surprised when they fail to perform them in UNIX, since these are not OS services).</p> </blockquote> <h3>Program layout</h3> <p>As a rule, modern IA-32 UNIXes are 32bit (*grin*), run in protected mode, have a flat memory model, and use the ELF format for binaries.</p> <p>A program can be divided into sections: <tt>.text</tt> for your code (read-only), <tt>.data</tt> for your data (read-write), <tt>.bss</tt> for uninitialized data (read-write); there can actually be a few other standard sections, as well as some user-defined sections, but there's rare need to use them and they are out of our interest here. A program must have at least <tt>.text</tt> section.</p> <p>Ok, now we'll dive into OS specific details.</p> <h3>Linux</h3> <p>System calls in Linux are done through int 0x80. (actually there's a kernel patch allowing system calls to be done via the <tt>syscall</tt> (<tt>sysenter</tt>) instruction on newer CPUs, but this thing is still experimental).</p> <p>Linux differs from the usual UNIX calling convention, and features a "fastcall" convention for system calls (it resembles DOS). The system function number is passed in <tt>eax</tt>, and arguments are passed through registers, not the stack. There can be up to six arguments in <tt>ebx</tt>, <tt>ecx</tt>, <tt>edx</tt>, <tt>esi</tt>, <tt>edi</tt>, <tt>ebp</tt> consequently. If there are more arguments, they are simply passed though the structure as first argument. The result is returned in <tt>eax</tt>, and the stack is not touched at all.</p> <p>System call function numbers are in <tt>sys/syscall.h</tt>, but actually in <tt>asm/unistd.h</tt>. Documentation on the actual system calls is in section 2 of the manual pages some documentation is in the 2nd section of manual (for example to find info on <tt>write</tt> system call, issue the command <b>man 2 write</b>).</p> <p>There have been several attempts to write an up-to-date documentation of the Linux system calls, examine URLs in the <a href="http://asm.sourceforge.net/references.html">References</a> section below.</p> <p>So, our Linux program will look like:</p> <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 99.73%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; height: 252px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"> <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 81.01%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; height: 169px; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">section .text<br /> <span style="color: #0000ff">global</span> _start <span style="color: #008000">;must be declared for linker (ld)</span><br /><br />_start: <span style="color: #008000">;tell linker entry point</span><br /><br /> mov edx,len <span style="color: #008000">;message length</span><br /> mov ecx,msg <span style="color: #008000">;message to write</span><br /> mov ebx,1 <span style="color: #008000">;file descriptor (stdout)</span><br /> mov eax,4 <span style="color: #008000">;system call number (sys_write)</span><br /> int 0x80 <span style="color: #008000">;call kernel</span><br /><br /> mov eax,1 <span style="color: #008000">;system call number (sys_exit)</span><br /> int 0x80 <span style="color: #008000">;call kernel</span><br /><br />section .data<br /><br />msg db 'Hello, world!',0xa <span style="color: #008000">;our dear string</span><br />len equ $ - msg <span style="color: #008000">;length of our dear string</span><br /><br /></pre><br /><br /> <br /></div> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0tag:blogger.com,1999:blog-5073857838398398130.post-43014839417914527872010-08-14T21:02:00.000-07:002010-08-14T21:02:59.662-07:00Get Real<ul><li>People who are more interested in the buzz words and CS theory than actual experience and a history of practical application of skills are a perpetual thorn in the side of the programming industry.</li>
<li>Don’t look down on other programmers because they don’t fit your model definition of a programmer, they just might be better than you.</li>
<li>If 99 out of 100 candidates fail your interview then you are looking for something that doesn’t exist.</li>
<li>Without a varied group of developers in your team you will suffer from a lack of creativity.</li>
<li>Don’t test a CS curriculum, test the ability to create.</li>
<li>If you ever finish learning, then your career as a programmer is over. Go study law.</li>
</ul><br />
<div> </div><span style="font-size: large;">In short</span><br />
Look for someone who truly understand the concepts, who can offer creative and alternative ideas, and who shows the ability to grow as a programmer. Then you will finally find a real programmer.<br />
<br />
<div> </div>Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0tag:blogger.com,1999:blog-5073857838398398130.post-47415061351336496912010-05-16T20:17:00.001-07:002010-05-16T20:21:37.281-07:00Dynamic Class Loading<p></p> <h3><font color="#ff8000">Static : </font></h3> <ul> <li>Classes are statically loaded with Java's "new" operator.</li> </ul> <blockquote> <p><i>class MyClass { <br />        </i><i>public static void main(String args[]) { <br />              </i><i>Car c <b>= new </b>Car<b>(); <br />        </b></i><i>} <br /></i><i>}</i></p> </blockquote> <ul> <li>A <b><i>NoClassDefFoundException </i></b>is thrown if a class is referenced with Java's "<i>new" </i>operator (i.e. static loading) but the runtime system cannot find the referenced class. <br /></li> </ul> <h3><font color="#ff8000">Dynamic loading:</font></h3> <ul> <li>Dynamic loading is a technique for programmatically invoking the functions of a class loader at run time. Let us look at how to load classes dynamically.</li> </ul> <p><b>Class.forName </b>(String <i>className</i>);                    //static method which returns a Class</p> <p>The above static method returns the class object associated with the class name. The string <i>className </i>can be supplied dynamically at run time. Unlike the static loading, the dynamic loading will decide whether to load the class <i>Car </i>or the class <i>Jeep at </i>runtime based on a properties file and/or other runtime conditions. Once the class is dynamically loaded the following method returns an instance of the loaded class. It's just like creating a class object with no arguments.</p> <p><a name="more"></a></p> <ul> <li><b>class.newInstance ()</b>; //A non-static method, which creates an instance of a </li> </ul> <p>//class (i.e. creates an object). <br />Jeep myJeep = null ;</p> <p>//myClassName should be read from a .properties file or a Constants class. <br /><b>// stay away from hard coding values in your program. CO</b></p> <p>String myClassName = "au.com.Jeep" ; <br />Class vehicleClass = <b>Class.forName</b>(myClassName) ; <br />myJeep = (Jeep) vehicleClass.<b>newInstance</b>(); <br />myJeep.setFuelCapacity(50);</p> <ul> <li>A <b><i>ClassNotFoundException </i></b>is thrown when an application tries to load in a class through its string name using the following methods but no definition for the class with the specified name could be found:</li> </ul> <p>-The forName(..) method in class - <b><i>Class</i></b>. <br />-The findSystemClass(..) method in class - <b><i>ClassLoader</i></b>. <br />- The loadClass(..) method in class - <b><i>ClassLoader</i></b>.</p> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0tag:blogger.com,1999:blog-5073857838398398130.post-14563354653389826212010-04-20T00:56:00.001-07:002010-04-20T00:56:11.857-07:00SMS UDH Binary and Concatenated<p>As a standard SMS can only contain 160 7-bit GSM characters, Concatenated SMS are used to send long SMS which are bigger then 160 characters. Concatenation allows a sender to send more than one SMS which then get stuck together automatically by the phone to appear as one message.</p> <p>To indicate that the content contains a UDH, a flag on the SMS called the UDH Indicator (UDHI) must be turned on. This tells the phone that it must separate the UDH from the rest of the content.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaALSxYhcqC0ZZklSa8yEm9csiwR9H8N8fMD4iwPNIx6ayOfVaZcgIHpSzOebGZ4upJziJ50S5lR4EmcnlyfpTxfjsgSKwZ4PuZUEKHUF6MD4QWoRwk_EFtX-Jdq3e_1jrt9WbhVvM_Q6-/s1600-h/UDH%5B3%5D.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="UDH" border="0" alt="UDH" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhGLVVCcbpufFiAridibT9HEWkVNFXo0cyAmQjokazmu10atbvBWKY9yv2vfMLv0scVni3mZ25F8R9k-d7yJPQW9u110PvP1Tg-nWG8xdY7YhLnt_7weVUz7Qmv4u0zYql_ub0EpeqdqGtr/?imgmax=800" width="459" height="258" /></a> </p> <blockquote> <p align="center">Format of an SMS with a UDH</p> </blockquote> <p>The phone separates the UDH by reading the first byte of the content. The number in this byte is the length of the rest of UDH and is called the User Data Header Length (UDHL). The phone then knows how many bytes make up the UDH and can separate it from the rest of the message.</p> <p>There are two main kind of SMS systems one is Smart Messaging which is for NOKIA supported and sets (include almost all brand except older version of Sony and Ericsson), and other one is EMS (Enhanced messaging system), both have different type of content and UDH encoding , first with the common between them.</p> <ol> <li>both have same algo to build UDH .</li> <li>data and udh for both systems are only in hex i.e char having 0-9 or A-F. </li> <li>both have same Header for split messages i.e. concatenated messages, <br />for nokia it goes like for each binary messages there is data and UDH part now Nokia identifies coming binary message as ringtone, pic ,logo etc because of port number present in its header, lets consider full UDH of Nokia </li> </ol> <p> </p> <strong>06 05 04 1581 1581 </strong> <br /><strong>06  -</strong>  length of whole UDH i.e 6 octet now each octet has two char so 050415811581 counts to 6 octet, got it?, now <br /><strong>05  - </strong> it represents as keyword for 16-bit nokia port addressing(according to specs of smart messaging) <br /><strong>04  -</strong>  its again count of upcoming octets i.e. 4 , <br /><strong>1581  -  </strong>it is destination port mentioning port number in hex for ringtone, in other words this the thing which identifies upcoming message as ringtone. <br /><strong>1581  -  </strong>it is source port , when a ringtone is sent from handset to handset it automatically becomes 1581, but when you send it via GSM modem or SMPP connection it can be assigned to any valid hex string, preferably 0000. <br /> <p>so instead of ringtone if we are sending picture message, or logo or anything else then we just have to change destination port number for different binary messages it is as follows </p> <blockquote> <p><strong>Ringtone - 1581 <br />CGI /CLI - 1583 <br />Picture Msg- 158A <br />Operator Logo 1582 <br />vCard 23F4 <br />vCard Secure 23F6 <br />vCalendar 23F5 <br />vCalendar Secure 23F7 <br />eMail Notification 1588 <br />DMCP(obsolete) 1584 </strong></p> </blockquote> <p>now if our message is bigger than preferably 260 chars we need to break it into more than one part ,, that's called concatenation for that you need to append concat header in UDH which goes like <br /><strong></strong></p> <p><strong>00 03 XX 0N 0n  </strong></p> <p>it looks confusing but let me explain it , <br /><strong>00</strong> is offset to mention its new part of UDH </p> <p> <br /><strong>03</strong> is according to specs concat header </p> <p> <br /><strong>XX</strong> it can be from 00 to FF , it is called message reference header , its same in UDH of all splited message in order to make receiving body understand that incoming splitted message is part of earlier received message because it has same reference string, get it?? </p> <p> <br /><strong>0N</strong> represents total count of messages, like after splitting there are 3 parts then it is 03 , so here u can deduce that SMS support maximum 255 splits, becoz 25 if FF and it is largest 2 digit hex number. <br /><strong>0N</strong> represents sequence number of upcoming sms part like for first part it will be 01 for next it will be 02 and so on up to 0N, <br /></p> <p>now there is somthing u should take care of when we append concat header whole UDH becomes of 22 char i.e. 11 octets so UDH begins with 0B instead of 06 so for SMS of 3 splits of ringtone type UDHs will be </p> <p> <br /><strong>0B0504158115810003AF0301 <br />0B0504158115810003AF0302 <br />0B0504158115810003AF0303 </strong></p> <strong> <p> <br /></p> this is all about Smart messaging, now EMS is even more simpler,  there is no data part in EMS all is bundled together in UDH its like </strong> <p> <br /><strong>XX0CXX00<data hex string> <br /></strong>first <strong>XX</strong> = length of total data <br /><strong>0C</strong> is according to EMS specs octet for melody sound <br />second <strong>XX</strong> is length of rest part of data, <strong>00</strong> is offset to show start of data part data part it hex form of iMelody string, now even in EMS concat system is same , as mentioned earlier, so just append 0003XX0N0n before 00 offset of EMS, count the chars and make changes accordingly, </p> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com14tag:blogger.com,1999:blog-5073857838398398130.post-55908621840019361332010-04-20T00:34:00.001-07:002010-04-20T00:34:34.176-07:00Connect Nokia or Any other Phone to a Computer or a Laptop<p>Below is some information on how to configure your laptop for use with a GPRS-enabled mobile phone, for Internet access.</p> <p>On the PC, go to the Networking section of the Control Panel (Start > Settings > Control panel > Network)</p> <ol> <li>Select <strong>"Make new connection"</strong> (this should start a setup wizard) </li> <li>Choose <strong>"Dial up to Internet"</strong> </li> <li>Choose the <strong>"Connect via a Modem"</strong> option </li> <li>Select your mobile from the list of modems displayed </li> <li>Enter the telephone number to dial as <strong>*99#</strong> (No area code, and turn off dialing rules) </li> <li>Select the username and password for your Network Operator (GPRS settings here, first try leaving this blank) </li> <li>When complete, go to Control panel > networks, and double-click on the icon for your GPRS connection and click dial </li> </ol> <p><strong>NOTE :-</strong> If your phone is not listed as a modem install the proper drivers before continuing</p> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0tag:blogger.com,1999:blog-5073857838398398130.post-90878974114465272752010-04-01T07:31:00.001-07:002010-04-01T07:31:23.654-07:00How I Will Hack Your Password<p><em>Note: This isn't intended as a guide to hacking *other people's* weak passwords. Instead, the aim is to help you better understand the security of your own passwords and how to bolster that security.</em></p> <p>If you invited me to try and <a href="http://en.wikipedia.org/wiki/Password_cracking">crack your password</a>, you know the one that you use over and over for like every web page you visit, how many guesses would it take before I got it?</p> <p>Let's see… here is my top 10 list. I can obtain most of this information much easier than you think, then I might just be able to get into your e-mail, computer, or online banking. After all, if I get into one I'll probably get into all of them.</p> <ol> <li>Your partner, child, or pet's name, possibly followed by a 0 or 1 (because they're always making you use a number, aren't they?) </li> <li>The last 4 digits of your social security number. </li> <li>123 or 1234 or 123456. </li> <li>"password" </li> <li>Your city, or college, football team name. </li> <li>Date of birth – yours, your partner's or your child's. </li> <li>"god" </li> <li>"letmein" </li> <li>"money" </li> <li>"love"</li> </ol> <p>Statistically speaking that should probably cover about 20% of you. But don't worry. If I didn't get it yet it will probably only take a few more minutes before I do…</p> <p>Hackers, and I'm not talking about the ethical kind, have developed a whole range of tools to get at your personal data. And the main impediment standing between your information remaining safe, or leaking out, is the password you choose. (Ironically, the best protection people have is usually the one they take least seriously.)</p> <p>One of the simplest ways to gain access to your information is through the use of a Brute Force Attack. This is accomplished when a hacker uses a specially written piece of software to attempt to log into a site using your credentials. </p> <p>So, how would one use this process to actually breach your personal security? Simple. Follow my logic:</p> <ul> <li>You probably use the same password for lots of stuff right? </li> <li>Some sites you access such as your Bank or work VPN probably have pretty decent security, so I'm not going to attack them. </li> <li>However, other sites like the Hallmark e-mail greeting cards site, an <a href="http://forums.htmlhelp.com/">online forum</a> you frequent, or an e-commerce site you've shopped at might not be as well prepared. So those are the ones I'd work on. </li> <li>So, all we have to do now is unleash attack on their server with instructions to try say 10,000 (or 100,000 – whatever makes you happy) different usernames and passwords as fast as possible. </li> <li>Once we've got several login+password pairings we can then go back and test them on targeted sites. </li> <li>But wait… How do I know which bank you use and what your login ID is for the sites you frequent? All those cookies are simply stored, unencrypted and nicely named, in your Web browser's cache.</li> </ul> <p>And how fast could this be done? Well, that depends on three main things, the length and complexity of your password, the speed of the hacker's computer, and the speed of the hacker's Internet connection.</p> <p>Assuming the hacker has a reasonably fast connection and PC here is an estimate of the amount of time it would take to generate every possible combination of passwords for a given number of characters. After generating the list it's just a matter of time before the computer runs through all the possibilities – or gets shut down trying.</p> <p>Pay particular attention to the difference between using only lowercase characters and using all possible characters (uppercase, lowercase, and special characters – like @#$%^&*). Adding just one capital letter and one asterisk would change the processing time for an 8 character password from 2.4 days to 2.1 centuries.</p> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdI5JGUjuaCr2uco2hPkavC7sPp4YTHMRi57xC5iFQ0q-06KzIeum6wZkNHXAsbgx-F2zHRNRE8l9CstjLK9NUMnrSQxO_a7hKhAVB2s8KVi1hPxiWCF-i6LUPt1ergJLdAuvuy7WgvQ96/s1600-h/500x_password_hacking_times-1%5B4%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="500x_password_hacking_times-1" border="0" alt="500x_password_hacking_times-1" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDkWG7JTQ-9aDNQ0RCViG3k4hkf-xAQcVLKNQQ14SUq8RrYJ8v5VteElQWBvFFKha2rUsq6v6mIEFEA9LRmOSiPGtIgwInftfzlgqtcvxKUcamJUMTtb6VpnO_CAPtYIQBdSuTS6Vybs5D/?imgmax=800" width="391" height="213" /></a> </p> <p>Remember, these are just for an average computer, and these assume you aren't using <em>any word in the dictionary</em>. If Google put their computer to work on it they'd finish about 1,000 times faster.</p> <p>Now, I could go on for hours and hours more about all sorts of ways to compromise your security and generally make your life miserable – but 95% of those methods begin with <em>compromising your weak password</em>. So, why not just protect yourself from the start and sleep better at night?</p> <p>Believe me, I understand the need to choose passwords that are memorable. But if you're going to do that how about using something that no one is ever going to guess AND doesn't contain any common word or phrase in it.</p> <p>Here are some password tips:</p> <ol> <li>Randomly substitute numbers for letters that look similar. The letter ‘o' becomes the number ‘0′, or even better an ‘@' or ‘*'. (i.e. – m0d3ltf0rd… like modelTford) </li> <li>Randomly throw in capital letters (i.e. – Mod3lTF0rd) </li> <li>Think of something you were attached to when you were younger, but DON'T CHOOSE A PERSON'S NAME! Every name plus every word in the dictionary will fail under a simple brute force attack. </li> <li>Maybe a place you loved, or a specific car, an attraction from a vacation, or a favorite restaurant? </li> <li>You really need to have different username / password combinations for everything. Remember, the technique is to break into anything you access just to figure out your standard password, then compromise everything else. This doesn't work if you don't use the same password everywhere. </li> <li>Once you've thought of a password, try Microsoft's <a href="https://www.microsoft.com/athome/security/privacy/password_checker.mspx">password strength tester</a> to find out how secure it is.</li> </ol> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com1tag:blogger.com,1999:blog-5073857838398398130.post-46783250387757258182010-03-27T20:50:00.001-07:002010-03-27T20:58:15.168-07:00Rockers or Programmers<p>Recently I thought about this comparison… In the programming world there is this level of people who are a kind of “celebrities” within the developer community - they’re widely known, they have thousands of readers of their blogs, they have thousands of followers on Twitter, they speak on public events in front of thousands of people around the world… All of that just screams for a comparison with the equivalent in the show biz world - rock stars!</p> <p>So… I’m proud to present the first EVER comparison between rock stars and programming stars! afterwards judge for yourself what you wanna be. <table border="1" cellspacing="0" cellpadding="0"><tbody> <tr> <td valign="top" width="180"> <p><b>Comparison</b></p> </td> <td valign="top" width="313"> <p><b>Rock Star</b></p> </td> <td valign="top" width="314"> <p><b>Programming Star</b></p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Look</b></p> </td> <td valign="top" width="313"> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJ4J82hRB9v6mBNgK36Y2eamlrLh8WxZli-8Cxr5kYZVrCRbY5qTVDPW500FibChJJJwExlOmdOB_KEf-zNWfH31AvGHn2sMW0QzPiHwkJhpXNTkOrK7X07d-srpMr-Rc7YwEwGT-efF1W/s1600-h/0000263739_150%5B2%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="0000263739_150" border="0" alt="0000263739_150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8mUNsFeKMtluXYQinSRfZgsCLtc3xiij_J3JfqTberU-bB6sZORDqcjBzcDiuYdUCjM2XZR3Rue7Vl1J_L8ZuLCBFcI-ezVUrT0mNblxjKJ7bVytU6A7-4Tt2hRIZAmMpK9NReiepl9Dh/?imgmax=800" width="244" height="181" /></a> </p> </td> <td valign="top" width="314"> <p><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNbOtaQ3TDz-UR74Qrhlkjn6zJLsTyrs1UMVZjMmVhAaqUBCzTlMKzMGq1cOJG7ji5-VYtz_-xORnpO2EQ0NTmlVlJnFqgnbJCawJPvAU5KxROyeFrHa-56twlfLNgjTuPQ6lszPcOMF3E/s1600-h/microsofts-early-days%5B2%5D.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="microsofts-early-days" border="0" alt="microsofts-early-days" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjrXDvBoe0HhDrhL_ouJriP-Ej-lkMtLaBNCHS-_IvA5hzVnHTp5obJeKjHA8IWgLTeuDzKxDyB8tonmybdC97qEy8qF3Zlbqdr_esgneZUqdHIN_iS4E72s9JSOxUTLMIqbhw7nlzaITW/?imgmax=800" width="244" height="184" /></a> </p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Shown in public on</b></p> </td> <td valign="top" width="313"> <p>Concerts, TV, Radio, newspapers, magazines</p> </td> <td valign="top" width="314"> <p>Conferences, podcasts, programming magazines</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Known internationally</b></p> </td> <td valign="top" width="313"> <p>Yes</p> </td> <td valign="top" width="314"> <p>Yes</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Chances of being recognized in the grocery store</b></p> </td> <td valign="top" width="313"> <p>Almost with complete certainty</p> </td> <td valign="top" width="314"> <p>Rarely</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Charisma</b></p> </td> <td valign="top" width="313"> <p>Yes</p> </td> <td valign="top" width="314"> <p>Yes</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Tools</b></p> </td> <td valign="top" width="313"> <p>Microphone/Guitar/Drums/other instrument</p> </td> <td valign="top" width="314"> <p>Microphone + computer + projector</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Write</b></p> </td> <td valign="top" width="313"> <p>Lyrics</p> </td> <td valign="top" width="314"> <p>Code</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Average annual salary</b></p> </td> <td valign="top" width="313"> <p>Millions of dollars</p> </td> <td valign="top" width="314"> <p>Hundreds of thousands of dollars</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b># of Twitter followers</b></p> </td> <td valign="top" width="313"> <p>Millions</p> </td> <td valign="top" width="314"> <p>Tens of thousands</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b># of people attending a single show/talk</b></p> </td> <td valign="top" width="313"> <p>Tens of thousands</p> </td> <td valign="top" width="314"> <p>Thousands</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Way to the top</b></p> </td> <td valign="top" width="313"> <p>Hard work for years/American Idol</p> </td> <td valign="top" width="314"> <p>Hard work for years <br />(Simon Fuller, if you read this, what about a “Programming Idol” show?)</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Sex</b></p> </td> <td valign="top" width="313"> <p>So much that they’re sorry about that when they grow old.</p> </td> <td valign="top" width="314"> <p>I don’t know. Unlike rock stars, they don’t share this information.</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Drugs</b></p> </td> <td valign="top" width="313"> <p>Yes. A lot.</p> </td> <td valign="top" width="314"> <p>No. Geeks do not do drugs. Most of them at least.</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Alcohol</b></p> </td> <td valign="top" width="313"> <p>Yes</p> </td> <td valign="top" width="314"> <p>Drink beer from time to time</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Tour the world</b></p> </td> <td valign="top" width="313"> <p>A few months a year</p> </td> <td valign="top" width="314"> <p>A few days/weeks a year</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Own</b></p> </td> <td valign="top" width="313"> <p>A crib, a private jet, a collection of cool cars</p> </td> <td valign="top" width="314"> <p>A powerful laptop with SSD and two 24’ screens</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Can install Win7</b></p> </td> <td valign="top" width="313"> <p>No</p> </td> <td valign="top" width="314"> <p>Of course, they’ve done that multiple times already</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Eat bats during shows/talks</b></p> </td> <td valign="top" width="313"> <p>Yes</p> </td> <td valign="top" width="314"> <p>No</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Have tattoos</b></p> </td> <td valign="top" width="313"> <p>Yes</p> </td> <td valign="top" width="314"> <p>Mostly not, it hurts to get them done.</p> </td> </tr> <tr> <td valign="top" width="180"> <p><b>Have two eyes, two ears, one mouth and one nose</b></p> </td> <td valign="top" width="313"> <p>Yes</p> </td> <td valign="top" width="314"> <p>Yes</p> </td> </tr> </tbody></table> </p> <p>And the winner is………… I don't know, do you?</p> <p>Anyway in the end we’re all human and therefore have a chance to become stars.</p> <p>Go ahead and shine!</p> <p>by Shay.</p> Jason Jebanesanhttp://www.blogger.com/profile/13558192531067324517noreply@blogger.com0