<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-7849417896242181398</atom:id><lastBuildDate>Sun, 31 May 2026 14:22:18 +0000</lastBuildDate><category>Teq</category><category>PITA</category><category>Xeneral</category><category>java</category><category>Beyond Madness</category><category>MySQL</category><category>algo</category><category>Gaming</category><category>glassfish</category><category>programming</category><category>apache</category><category>data mining</category><category>lucene</category><category>ml</category><category>netbeans</category><category>nlp</category><category>php</category><category>ubuntu</category><category>9am</category><category>MongoDB</category><category>atom</category><category>nodejs</category><category>rss</category><category>self-reference</category><category>tf-idf</category><title>vikasing</title><description></description><link>http://www.vikasing.com/</link><managingEditor>noreply@blogger.com (Vik)</managingEditor><generator>Blogger</generator><openSearch:totalResults>42</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-3686400403436146396</guid><pubDate>Mon, 04 May 2015 23:36:00 +0000</pubDate><atom:updated>2017-06-20T21:23:20.627+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">algo</category><category domain="http://www.blogger.com/atom/ns#">ml</category><category domain="http://www.blogger.com/atom/ns#">nlp</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>Word vectors using LSA, Part - 2</title><description>&lt;b&gt;Latent Semantic Analysis&lt;/b&gt;&amp;nbsp;&lt;b&gt;(LSA)&lt;/b&gt;&amp;nbsp;is a theory and method for extracting and representing the contextual-usage meaning of words by statistical computations applied to a large corpus of text.&amp;nbsp;&lt;a href=&quot;http://lsa.colorado.edu/whatis.html&quot;&gt;[1]&lt;/a&gt; More about LSA can be found&amp;nbsp;&lt;a href=&quot;http://lsa.colorado.edu/papers/plato/plato.annote.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://videolectures.net/slsfs05_hofmann_lsvm/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. LSA uses Singular Value Decomposition (SVD), a matrix factorization method. For a given matrix &lt;b&gt;A&lt;/b&gt;,&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;SVD (A) = U*S*V&lt;sup&gt;T&lt;/sup&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
In the current scenario matrix &lt;b&gt;A&lt;/b&gt; is a term-document matrix (&lt;b&gt;m&lt;/b&gt; terms * &lt;b&gt;n&lt;/b&gt; documents). Visually SVD looks like this:&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA62bQ32L7VSvu-gYzicPP6hLOXgpKWhTKcVhQ_u75NXPYUtOZtS8b5xmxUYFijuZzC1gNaxrKcjK2K62SFExaxHG3ejw1up3FNaH7XZwWIYFLrBIB1s2QnZGrUaTnknkUuU2uUtYlHzI/s1600/svd.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;510&quot; data-original-width=&quot;582&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA62bQ32L7VSvu-gYzicPP6hLOXgpKWhTKcVhQ_u75NXPYUtOZtS8b5xmxUYFijuZzC1gNaxrKcjK2K62SFExaxHG3ejw1up3FNaH7XZwWIYFLrBIB1s2QnZGrUaTnknkUuU2uUtYlHzI/s1600/svd.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;Unlike word2vec, LSA does not require any training. But it suffers from curse of dimensionality because SVD calculations get slower and slower as we increase the number of documents, i.e. size of matrix &lt;/span&gt;&lt;b style=&quot;text-align: left;&quot;&gt;A&lt;/b&gt;&lt;span style=&quot;text-align: left;&quot;&gt;. On a single machine it can take hours. The overall cost of calculating SVD is O(mn&lt;/span&gt;&lt;sup style=&quot;text-align: left;&quot;&gt;2&lt;/sup&gt;&lt;span style=&quot;text-align: left;&quot;&gt;) Flops. This means if we had m =100,000 unique words with n = 80,000 documents, it would require 6.4 x 10&lt;/span&gt;&lt;sup style=&quot;text-align: left;&quot;&gt;14&amp;nbsp;&lt;/sup&gt;&lt;span style=&quot;text-align: left;&quot;&gt;Flops or 640,000 GFlops. At stock clock speed (4.0 GHz) my AMD FX-8350 gives around 40 GFlops. So it will take around 640,000/40 = 16,000 Seconds which is around 4 hours 30 minutes. &lt;/span&gt;&lt;a href=&quot;http://istc-bigdata.org/index.php/fast-data-analysis-with-svd/&quot; style=&quot;text-align: left;&quot; target=&quot;_blank&quot;&gt;[2]&lt;/a&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
In my previous post I had used 1.7 million sentences and 44 million words for training word2vec, i.e. if we run SVD on this large matrix, it might end up taking centuries on my machine. However SVD calculations on large matrices can be done using a large cluster of Spark. &lt;a href=&quot;https://databricks.com/blog/2014/07/21/distributing-the-singular-value-decomposition-with-spark.html&quot; target=&quot;_blank&quot;&gt;[3]&lt;/a&gt; &lt;a href=&quot;https://research.facebook.com/blog/294071574113354/fast-randomized-svd/&quot; target=&quot;_blank&quot;&gt;[4]&lt;/a&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;color: #009985; font-size: x-large;&quot;&gt;Results&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
I kept the document size constant at 2500 and let the term size vary. In order to rank the terms in relation to query term I used cosine distance. This time along with named entities I also added the noun phrases. The data is the news articles from yesterday (4th May, 2015). Here is the vector for the first query &quot;&lt;i&gt;delhi&lt;/i&gt;&quot;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;[law_minister=0.34, jitender_singh_tomar=0.23, chief_minister=0.22, fake=0.21, arvind_kejriwal=0.21, degree=0.18, protest=0.16, law_degree=0.16, win=0.15, congress=0.15, aam_aadmi_party=0.14, incident=0.14]&lt;/span&gt;&lt;/blockquote&gt;
Notice that the vector contains terms like &lt;i&gt;chief_minister&lt;/i&gt; and &lt;i&gt;law_degree&lt;/i&gt; which are not named entities.&lt;br /&gt;
Query for &quot;&lt;i&gt;chief_minister&lt;/i&gt;&quot;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;[arvind_kejriwal=0.34, parkash_singh_badal=0.29, today=0.28, delhi=0.28, mamata_banerjee=0.27, office=0.26, state=0.26, people=0.26, act=0.25, mufti_mohammad_sayeed=0.25, bjp=0.25, jammu_and_kashmir=0.25, governor=0.24]&lt;/span&gt;&lt;/blockquote&gt;
The vector gives the name of all the chief ministers which were in the news recently. Same goes for the query &quot;&lt;i&gt;prime_minster&lt;/i&gt;&quot;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;[shinzo_abe=0.37, japanese=0.33, sushil_koirala=0.27, david_cameron=0.27, tony_abbott=0.26, 2015=0.24, benjamin_netanyahu=0.24, president=0.23, country=0.23, government=0.22, washington=0.22]&lt;/span&gt;&lt;/blockquote&gt;
Lets look up for a person now, &quot;&lt;i&gt;rohit_sharma&lt;/i&gt;&quot;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;[mumbai_indians=0.45, skipper=0.4, ritika_sajdeh=0.37, captain=0.36, batsman=0.35, indian=0.34, lendl_simmons=0.34, kieron_pollard=0.33, parthiv_patel=0.31, ipl=0.29, runs=0.29, good=0.29, ambati_rayudu=0.29, mitchell_mcclenaghan=0.27, unmukt_chand=0.27]&lt;/span&gt;&lt;/blockquote&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;span style=&quot;color: #009985; font-size: x-large;&quot;&gt;Finding relations&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
What if I query for &lt;i&gt;chief_minister&lt;/i&gt; and &lt;i&gt;west_bengal&lt;/i&gt; and add both the vectors? &amp;nbsp;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot; style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;[&lt;b&gt;mamata_banerjee=0.69&lt;/b&gt;, bjp=0.67, state=0.6]&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
It gives the correct result, Mamata Banerjee is the current Chief Minister of West Bengal. Note that now numbers don&#39;t represent the cosine distance.&lt;br /&gt;
&lt;br /&gt;
What if we want to find out a relationship, instead of querying? Query for &lt;i&gt;india&lt;/i&gt; and &lt;i&gt;narendra_modi&lt;/i&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;[&lt;b&gt;prime_minister=0.5&lt;/b&gt;, make=0.42, government=0.4, country=0.4]&lt;/span&gt;&lt;/blockquote&gt;
Querying &lt;i&gt;mumbai_attack&lt;/i&gt; with &lt;i&gt;charged&lt;/i&gt; gives a list of a few names of those who were involved/charged:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;[people=1.14, left=1.08, november=1.05, dead=1.05, 166=1.05, executing=1.04, planning=1.04, 2008=1.02, &lt;b&gt;hamad_amin_sadiq&lt;/b&gt;=1.0, &lt;b&gt;shahid_jameel_riaz&lt;/b&gt;=1.0, &lt;b&gt;mazhar_iqbal&lt;/b&gt;=1.0, &lt;b&gt;jamil_ahmed&lt;/b&gt;=1.0, &lt;b&gt;younis_anjum&lt;/b&gt;=0.94, &lt;b&gt;abdul_wajid&lt;/b&gt;=0.94, &lt;b&gt;zaki-ur_rehman_lakhvi&lt;/b&gt;=0.62]&lt;/span&gt;&lt;/blockquote&gt;
Although above results look good, they are not always accurate, for example, query for &lt;i&gt;captain&lt;/i&gt; and &lt;i&gt;royal_challengers_bangalore&lt;/i&gt;&amp;nbsp;does not return virat_kohli as the first result:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: &amp;quot;georgia&amp;quot; , &amp;quot;times new roman&amp;quot; , serif;&quot;&gt;[ipl=0.67, rcb=0.66, match=0.64, kolkata_knight_riders=0.6, &lt;b&gt;virat_kohli=0.57&lt;/b&gt;]&lt;/span&gt;&lt;/blockquote&gt;
I guess more data from different time periods can help in establishing concrete relationships.&lt;br /&gt;
&lt;br /&gt;
Word vectors obtained from LSA can be useful in expanding the search queries, guessing the relationships (as shown above), generating similarity based recommendations and many other tasks related to text.&lt;br /&gt;
I wrote a one file implementation of LSA in Java (its buggy and design patterns free!), it uses jBLAS for SVD and other matrix operations, code can be found at &lt;a href=&quot;https://github.com/vikasing/jaLSA&quot; target=&quot;_blank&quot;&gt;github&lt;/a&gt;.&lt;br /&gt;
A couple of more links to understand LSA through examples:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://nlp.stanford.edu/IR-book/pdf/18lsi.pdf&quot;&gt;nlp.stanford.edu&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.engr.uvic.ca/~seng474/svd.pdf&quot;&gt;www.engr.uvic.ca&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://www.vikasing.com/2015/05/word-vectors-using-lsa-part-2.html</link><author>noreply@blogger.com (Vik)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiA62bQ32L7VSvu-gYzicPP6hLOXgpKWhTKcVhQ_u75NXPYUtOZtS8b5xmxUYFijuZzC1gNaxrKcjK2K62SFExaxHG3ejw1up3FNaH7XZwWIYFLrBIB1s2QnZGrUaTnknkUuU2uUtYlHzI/s72-c/svd.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-1967647931093711214</guid><pubDate>Tue, 24 Mar 2015 14:48:00 +0000</pubDate><atom:updated>2015-03-28T11:16:33.987+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">algo</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">ml</category><category domain="http://www.blogger.com/atom/ns#">nlp</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>Word vectors (word2vec) on named entities and phrases - I</title><description>word2vec is a C lib to compute the vector representation of a given word (or a phrase). It was released by a few Googlers and being maintained at&amp;nbsp;&lt;a href=&quot;https://code.google.com/p/word2vec/&quot; target=&quot;_blank&quot;&gt;word2vec&lt;/a&gt;. A couple of nice articles on what word2vec is capable of (roughly):&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://colah.github.io/posts/2014-07-NLP-RNNs-Representations/&quot; target=&quot;_blank&quot;&gt;Deep Learning, NLP, and Representations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://technology.stitchfix.com/blog/2015/03/11/word-is-worth-a-thousand-vectors/&quot; target=&quot;_blank&quot;&gt;A Word is Worth a Thousand Vectors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
Word vectors can boost performance of many ML and NLP applications, for example, sentiment analysis, recommendations, chat threading etc.&lt;br /&gt;
I used &lt;a href=&quot;http://deeplearning4j.org/word2vec.html&quot; target=&quot;_blank&quot;&gt;deeplearning4j&#39;s implementation of word2vec&lt;/a&gt;. The example given on that page does not work with the latest release of dl4j (at present 0.0.3.3) , working example can be found &lt;a href=&quot;https://github.com/deeplearning4j/dl4j-0.0.3.3-examples/blob/master/src/main/java/org/deeplearning4j/word2vec/Word2VecExample.java&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. I ended up using Stanford&#39;s CoreNLP for named entity recognition, OpenNLP works fine too.&lt;br /&gt;
&lt;br /&gt;
The training was done on the recent news data gathered from various sources, articles were split into sentences (using OpenNLP), duplicate and short sentences were removed. &amp;nbsp;The size of the corpus was around 300MB containing 1.7 million sentences and 44 million words. The training took almost 36 Hours with 3 iteration and a layer size of 200. Lets start with simple examples:&lt;br /&gt;
&lt;br /&gt;
For the word &lt;i&gt;&lt;b&gt;water&lt;/b&gt;&lt;/i&gt; I get the following word vector (limited to 21 words):&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Georgia, Times New Roman, serif;&quot;&gt;[groundwater, vapor, heater, pollutant, rainwater, dioxide, wastewater, sewage, potable, moisture, seawater, methane, nitrogen, vegetation, vapour, oxide, reservoir, hydrogen, plume, monoxide, sediment]&lt;/span&gt;&lt;/blockquote&gt;
We can see that almost all the words are used in the context of water, but this is limited to the trained corpus. With different corpus you&#39;ll get different set of results. Lets look at something which was there in the news recently, e.g., the term &lt;b&gt;&lt;i&gt;plane&lt;/i&gt;&lt;/b&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Georgia, Times New Roman, serif;&quot;&gt;[mh370, c17, crashland, skidd, 777, takeoff, qz8501, transasia, malaysia_airline, aircraft, globemaster, turboprop, cockpit, laguardia_airport, 1086, locator, singleengine, atr, solarpower, midair]&lt;/span&gt;&lt;/blockquote&gt;
Except &lt;b&gt;1086&lt;/b&gt; and &lt;b&gt;atr&lt;/b&gt;, every other word (or phrase) in the vector makes sense, but if you search for 1086 and atr, you&#39;ll find that 1086 was a&amp;nbsp;Delta Air Lines Flight which crashed recently and ATR is an aircraft manufacturer company. Lets look for an entity (specially phrase) vector, for example Leslee Udwin was in the news recently:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Georgia, Times New Roman, serif;&quot;&gt;[mukesh_singh, gangrape, nirbhaya, storyville, documentary, rapist, tihar, andrew_jarecki, citizenfour, telecast, bar_council_of_india, udwin, laura_poitra, filmmaker, jinx, bci, bbc, derogatory, chai_j, leslie_udwin, hansal_mehta, bbc_storyville]&lt;/span&gt;&lt;/blockquote&gt;
You can relate most of the words/phrases in the vector to Leslee Udwin or her documentary &lt;a href=&quot;http://en.wikipedia.org/wiki/India%27s_Daughter&quot; target=&quot;_blank&quot;&gt;India&#39;s Daughter&lt;/a&gt;. Other words in the vector are either the names of the documentaries or the documentary makers, for example, The Jinx is an HBO documentary mini-series directed by&amp;nbsp;Andrew Jarecki.&lt;br /&gt;
&lt;br /&gt;
dl4j library also provides the vector addition and subtraction mechanism, for subtraction code is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;List&amp;lt;String&amp;gt; &lt;string&gt; p = new ArrayList&amp;lt;&amp;gt;(), n = new ArrayList&amp;lt;&amp;gt;();
p.add(&quot;imitation&quot;);
n.add(&quot;oscar&quot;);
vec.wordsNearest(p, n, 20);
&lt;/string&gt;&lt;/pre&gt;
&lt;br /&gt;
Here is how the subtraction works, vector for &lt;i&gt;&lt;b&gt;imitation&lt;/b&gt;&lt;/i&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Georgia, Times New Roman, serif;&quot;&gt;[grand_budapest_hotel, michael_keaton, screenplay, birdman, boyhood, eddie_redmayne, whiplash, benedict_cumberbatch, felicity_jone, jk_simmon, richard_linklater, julianne_moore, j_k_simmon, wes_anderson, patricia_arquette, edward_norton, graham_moore, alejandro_gonzalez_inarritu, stephen_hawk, alejandro_g_inarritu, alexandre_desplat]&lt;/span&gt;&lt;/blockquote&gt;
It contains many Oscars entries and related terms, so subtracting the vector of term &lt;i&gt;&lt;b&gt;oscar&lt;/b&gt;&lt;/i&gt; should remove all those entries and give us something related to&lt;i&gt; The Imitation Game&lt;/i&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Georgia, Times New Roman, serif;&quot;&gt;[changer, throne, lllp, alan_tur, chris_kyle, oneindia, lilih620150308, sniper, rarerbeware, grand_budapest_hotel, benedict_cumberbatch, mockingjay, iseven, cable_news_network, extractable, theory, watchapple, enigma, codebreaker, washington_posttv, mathematician]&lt;/span&gt;&lt;/blockquote&gt;
This vector is not a very good representation of the movie &lt;i&gt;The Imitation Game, &lt;/i&gt;there is a lot of noise. This is because of the poor and small training data. But we see a few terms in the vector which are related to the movie, e.g.,&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #666666; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;alan_tur*,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;benedict_cumberbatch,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;enigma,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;theory,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #666666; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;mathematician&lt;/span&gt;&lt;/blockquote&gt;
&lt;span style=&quot;color: #666666; font-family: Georgia, &#39;Times New Roman&#39;, serif;&quot;&gt;*&amp;nbsp;&lt;i&gt;ing&lt;/i&gt; was removed by the tokenizer&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I have trained the data on entities for now (by replacing the space with underscore), I am planning to train it on general phrases as well, like &lt;b&gt;Member of Parliament&lt;/b&gt; should be combined into a single term &lt;b&gt;member_of_parliament. &lt;/b&gt;Will publish the results in the second part. Next I want to compare it with Brown Clustering, it is also used for the similar purpose.</description><link>http://www.vikasing.com/2015/03/word-vectors-word2vec-on-named-entities.html</link><author>noreply@blogger.com (Vik)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-7067061982149925829</guid><pubDate>Fri, 27 Feb 2015 22:59:00 +0000</pubDate><atom:updated>2015-03-06T21:53:54.696+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Beyond Madness</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><category domain="http://www.blogger.com/atom/ns#">Xeneral</category><title>Side Projects</title><description>I started my professional career in July 2008, fresh out of college I was really excited about working on real projects. After two months of training I was assigned to the Call Handling&lt;b&gt; (IVR)&lt;/b&gt; team, a .Net based project. Soon I realized that the project did not require much coding, whole day went into writing test cases and IVR workflows in XML. This motivated me to work on the following side projects:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #b45f06; font-size: large;&quot;&gt;Indews.in &lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;(2008)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Soon after &lt;a href=&quot;http://en.wikipedia.org/wiki/2008_Mumbai_attacks&quot; target=&quot;_blank&quot;&gt;2008 Mumbai attacks&lt;/a&gt;,&amp;nbsp;I decided to create my own news aggregation site for India, hence the name Indews (&lt;b&gt;Ind&lt;/b&gt;ian N&lt;b&gt;ews&lt;/b&gt;). I was not happy how Google News clubbed the news and sometimes ended up showing stale information as the main headline. I implemented some part of the site, wrote a very basic crawler in C#, hosted the site on a local IIS server at home. It had a really bad interface and did not survive more than 3 months. I had lost all my interest in a general news aggregator, now I was mainly interested in the tech/programming news.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #b45f06; font-size: large;&quot;&gt;9AM.in&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;(2009-2010)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
After shutting down indews.in, I started a project called &lt;b&gt;9am &lt;/b&gt;under&amp;nbsp;&lt;b&gt;http://www.natmac.org/9am/. &lt;/b&gt;I got bored with ASP.Net technologies, there was a lot of abstraction and many times I did not understand how things worked underneath, for example ajax implementation of ASP.Net. It was all magic and lots of dlls. And there were a very few open source projects in C#. So decided to move away from .Net and migrated all my code to Java. Having worked on Java and J2EE in college projects, it was easy.&lt;br /&gt;
9am was again an RSS/ATOM aggregator, but this time I was crawling the whole web for the tech related stuff and some news sites for general news (kept general news anyway from indews!). You can find an internet archive snapshot &lt;a href=&quot;http://web.archive.org/web/20100402074948/http://www.natmac.org/9am/home&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
9am had a many features, like: finding top keywords, grouping similar items, inbuilt search, categorizing a feed item into one of these categories:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;DBs, UI, .Net, S/W Engg, Languages, Mobile, Java, XML, OS&lt;/i&gt;&lt;/blockquote&gt;
Categorization was based on &lt;i&gt;bag of words&lt;/i&gt; and worked fairly well. It was also hosted at my home computer using a static IP and had a 384 Kbps network connection. Crawler used to crawl a few thousand URLs everyday based on a &lt;a href=&quot;http://www.vikasing.com/2009/07/feed-crawler-revisit-policy.html&quot; target=&quot;_blank&quot;&gt;Revisit Policy&lt;/a&gt;. The database had around 60,000 feed (RSS/ATOM) URLs and everyday it used to discover new ones. Some of the website owners got pissed with the crawling and asked me to &lt;a href=&quot;http://www.vikasing.com/2009/11/general-problems-encountered-when.html&quot; target=&quot;_blank&quot;&gt;remove&lt;/a&gt; the URLs. Since everything was automated, I had no control over URL discovery.&lt;br /&gt;
9am was really fun, it used to discover really good articles on the web everyday and I always had something amazing to read in my office. Following is an &lt;b&gt;internet archive&lt;/b&gt; screenshot of the Language category under TECH tab:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCcdhFEh-uhHmDSGC8cH5Fo4G7N6y4UBiqyKBbZXrr3KA9vsJ3PBE6j4_nWBihX1wUegPF-ZCiQPMDXIiia4cWZ3Kv7WDzshnfVeg-pK78IKAwfEiYucPDIUugPFwASguTvjBpoNX2FDU/s1600/Screenshot+from+2015-02-28+04:47:16.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCcdhFEh-uhHmDSGC8cH5Fo4G7N6y4UBiqyKBbZXrr3KA9vsJ3PBE6j4_nWBihX1wUegPF-ZCiQPMDXIiia4cWZ3Kv7WDzshnfVeg-pK78IKAwfEiYucPDIUugPFwASguTvjBpoNX2FDU/s1600/Screenshot+from+2015-02-28+04:47:16.png&quot; height=&quot;640&quot; width=&quot;538&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
The whole setup had many issues, day time power cuts, internet outage, slow internet, slow machine, poor MySQL full text search. Despite of all, it used to get ~5000 visits/day from Google.&lt;br /&gt;
When I was moving to another city, I had to shut it down. For unknown reasons it remained that way forever. The crawler code can be found at &lt;a href=&quot;https://code.google.com/p/crowl/&quot;&gt;https://code.google.com/p/crowl/&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href=&quot;https://github.com/vikasing/crowl&quot;&gt;https://github.com/vikasing/crowl&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #b45f06; font-size: large;&quot;&gt;Mozvo.com &lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;(2011-2013)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Mozvo analyzed the sentiments of tweets, reviews and blogs to create a Mozvo score for a movie. It had many other cool features like: movie recommendations, actor profiles, friends&#39; tweets about a movie, movie explorer based on many attributes etc. This was the most ambitious side project I ever did. It also involved two more guys from the same company I was working at. We worked after office, almost everyday, initially it felt like it might end up evolving in a startup. I mainly worked on the back-end part of it, which had MongoDB as its database and a data layer written in Java. It was fun building the core parts. I ended up learning lots of new stuff.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixfG2x6CWQxheiXoPc8RkuXjZ9Bi9xDOnWRmf5V2aRF_iGCdY6UAUv-4tvXDQ0QQaqUKBrZqRLBFpBjPZtzi_zZV2cyFdZIWkE_M5CInk_3wjf1m66irk_Fg0HYI3cgJqB0m04p-j6dLs/s1600/Screenshot+from+2015-02-28+02:52:45.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixfG2x6CWQxheiXoPc8RkuXjZ9Bi9xDOnWRmf5V2aRF_iGCdY6UAUv-4tvXDQ0QQaqUKBrZqRLBFpBjPZtzi_zZV2cyFdZIWkE_M5CInk_3wjf1m66irk_Fg0HYI3cgJqB0m04p-j6dLs/s1600/Screenshot+from+2015-02-28+02:52:45.png&quot; height=&quot;540&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
We kept on adding many features without asking our users whether they really wanted them or not. It was like a playground for us, whatever we (or any one of us) thought was cool, we ended up implementing that ignoring the outcome. We did not analyze whether any feature was helping us in retaining the users. Google brought all the traffic and that was not really enough, ~200 visits/day. Gradually we lost our interest and in April 2013 we altogether stopped working on it. It is still alive at &lt;a href=&quot;http://mozvo.com/&quot;&gt;mozvo.com&lt;/a&gt;&amp;nbsp;but in a dormant state.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #b45f06; font-size: large;&quot;&gt;GizmoAge&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #b45f06;&quot;&gt;(2012)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
This was an Android app built on top of PhoneGap, main aim was to collect latest gadget news and group it to remove ambiguity. &amp;nbsp;The first version of the app was ready to use and did look much better than many apps in the Play Store. I published the app in Play Store, but removed it after a couple of months, don&#39;t remember why :), I guess there were some server issues.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM3eeuRvJBodvrt7gPO1eazvzD41Haq01QTOmgB0JgHn6DcU0RfnNGmup7JP9mqMCvkhaRq1dIlOLjUODPxDF9XpWmR3px0R5jfsAQCZ-j0q82-m0gkHOXcMNkALvJtA00-2xGW98fRho/s1600/unnamed.webp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM3eeuRvJBodvrt7gPO1eazvzD41Haq01QTOmgB0JgHn6DcU0RfnNGmup7JP9mqMCvkhaRq1dIlOLjUODPxDF9XpWmR3px0R5jfsAQCZ-j0q82-m0gkHOXcMNkALvJtA00-2xGW98fRho/s1600/unnamed.webp&quot; height=&quot;640&quot; width=&quot;395&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #b45f06;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Cryptocurrency Mining&lt;/span&gt; (2014)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
This was my first hardware hacking project. I ended up investing around $1000 in this project, bought 2 top end graphics cards, a 850 watt SMPS and lots of hacky stuff like PCI risers, power buttons from Hong Kong etc.&lt;br /&gt;
The rig mined all the popular alt coin currencies at that time from Dogcoin to Coinocoin. I also did some trading at various exchanges. After three months of mining all the fun was gone so I stopped my rig and decided to sell the hardware. But before that following happened:&lt;br /&gt;
I had to RMA one of the graphics card and the motherboard short circuited (no RMA). Also lost around 0.1 bitcoin in trading. Sometime later I sold my 0.42 bitcoin and stopped the crypto currency madness all together.&lt;br /&gt;
Nevertheless it was fun, got to learn many things about crypto currencies eg. bitcoin, blockchain, ASIC, primecoin, mintcoin, CPU only coins, and there were these crazy ideas of coin drops, also country specific coins like Auroracoin for Iceland.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;twitter-tweet&quot; lang=&quot;en&quot;&gt;
The mining rig, mining &lt;a href=&quot;https://twitter.com/hashtag/Fluttercoin?src=hash&quot;&gt;#Fluttercoin&lt;/a&gt; &lt;a href=&quot;http://t.co/SgcwsNIYoa&quot;&gt;pic.twitter.com/SgcwsNIYoa&lt;/a&gt;&lt;br /&gt;
— Vikash Singh (@vikasing) &lt;a href=&quot;https://twitter.com/vikasing/status/455770374513242112&quot;&gt;April 14, 2014&lt;/a&gt;&lt;/blockquote&gt;
&lt;script async=&quot;&quot; charset=&quot;utf-8&quot; src=&quot;//platform.twitter.com/widgets.js&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyhRR_9C8bn3Ul0se7eIiXc_7P-zcNb_UKyguwHCPno-ya_35IKTkHRIj8zpHz9iyRZpcLUb8WamPDsDvcWNegQYNxFq1wBx62_WOLzH_hLHMVMVUHOohAvyw_KKxzSER3fq8XHFmWrDg/s1600/1397499094020.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyhRR_9C8bn3Ul0se7eIiXc_7P-zcNb_UKyguwHCPno-ya_35IKTkHRIj8zpHz9iyRZpcLUb8WamPDsDvcWNegQYNxFq1wBx62_WOLzH_hLHMVMVUHOohAvyw_KKxzSER3fq8XHFmWrDg/s1600/1397499094020.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #b45f06; font-size: large;&quot;&gt;Others
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
There were some other small projects here and there:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Crowl (2009- ):&amp;nbsp;&lt;/b&gt;The web crawler which powered 9am, still working on it, its much more powerful now.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;NiceText (2012-):&lt;/b&gt; This is a very small library I wrote to extract the text from a webpage. Other libs boilerpipe and readability port did not work that well on many pages. This is a part of crowl project. I wrote a&amp;nbsp;&lt;a href=&quot;http://www.vikasing.com/2013/09/keyword-extraction-in-java.html&quot; target=&quot;_blank&quot;&gt;post&lt;/a&gt;&amp;nbsp;about it and&amp;nbsp;&lt;a href=&quot;https://github.com/vikasing/NiceText&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;&amp;nbsp;is the github link.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;jaLSA (2014-)&lt;/b&gt;: A lib I wrote to do Latent Semantic Analysis. It was needed for a project I was working on&amp;nbsp;in&amp;nbsp;my previous company.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;velocityplus (2011)&lt;/b&gt;: An eclipse plugin for Apache velocity templating engine. Worked on it when I was working in my first company. It is unfinished, got really bored while developing it.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Fing.in (2012)&lt;/b&gt;: A Bollywood news portal, it was supposed to be a sub project of mozvo.com. Finished it locally but did not publish it anywhere.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Paltan.org (2008):&lt;/b&gt; I briefly worked on creating a social networking website for my college group, it was based on Wordpress based Buddypress. But the Buddypress itself was in beta development and lacked many obvious features. It was all PHP, lost my interest very soon, did not go anywhere, shut it down after sometime.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;letsj.com (2012)&lt;/b&gt;: An aggregator for Java related articles. Intention was to use Lucene as a database as well as indexing engine, got into many issues, abandoned.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
</description><link>http://www.vikasing.com/2015/02/side-projects.html</link><author>noreply@blogger.com (Vik)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCcdhFEh-uhHmDSGC8cH5Fo4G7N6y4UBiqyKBbZXrr3KA9vsJ3PBE6j4_nWBihX1wUegPF-ZCiQPMDXIiia4cWZ3Kv7WDzshnfVeg-pK78IKAwfEiYucPDIUugPFwASguTvjBpoNX2FDU/s72-c/Screenshot+from+2015-02-28+04:47:16.png" height="72" width="72"/><thr:total>15</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-830424031737018095</guid><pubDate>Wed, 26 Nov 2014 13:22:00 +0000</pubDate><atom:updated>2015-02-22T20:35:54.960+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">PITA</category><category domain="http://www.blogger.com/atom/ns#">Xeneral</category><title>HDMI monitor blinking (flickering) </title><description>I have a dual monitor setup at home, one is connected via HDMI and another one through DVI. A couple days back I noticed that the HDMI monitor was blinking very often, it used to go blank for a couple of seconds but the DVI one just worked fine. According to few forum posts the issue was related to graphics driver but in my case the problem was occurring on both Windows 7 as well as ArchLinux so I ruled out the driver issues, my Arch installation uses open source drivers.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQGVtT59Np6jJ5bgFCtctay2AVaSm8Po8hUH_DDO5-r8gLs4m0qKrAJE29NdwFvY6gCFaimIwpBT3mBMBcf1257Hpe-ajDgXMhn_ib1iqwGTcIB55u3BIYLnt0t0YcFb6XH9FlWcOExzM/s1600/IMG_20141126_173721.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQGVtT59Np6jJ5bgFCtctay2AVaSm8Po8hUH_DDO5-r8gLs4m0qKrAJE29NdwFvY6gCFaimIwpBT3mBMBcf1257Hpe-ajDgXMhn_ib1iqwGTcIB55u3BIYLnt0t0YcFb6XH9FlWcOExzM/s1600/IMG_20141126_173721.jpg&quot; height=&quot;480&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Somewhere it was also mentioned that it might have something to do with &quot;ground loop&quot;, you can read more about it on &lt;a href=&quot;http://en.wikipedia.org/wiki/Ground_loop_%28electricity%29&quot; target=&quot;_blank&quot;&gt;Wikipedia&lt;/a&gt;. Then I realized I had recently changed the power cords for the HDMI monitor, and the power cord which was in use did not have an earthing pin (3rd big pin in a plug), it looked like this:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj0ElbTOC1X1KO17SQFOsIJ2c2UpG1KDH5PjkVlcDzVHDbfTKEaiMlKEyQZEESCXZuP_SEGBGBrxJ_6i5_pfVk7mImwMfccXx5SkMJTZs2SSDSEahXJjxcZfvw72BiEXvhbF6Ti3Nz34k/s1600/Plug.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgj0ElbTOC1X1KO17SQFOsIJ2c2UpG1KDH5PjkVlcDzVHDbfTKEaiMlKEyQZEESCXZuP_SEGBGBrxJ_6i5_pfVk7mImwMfccXx5SkMJTZs2SSDSEahXJjxcZfvw72BiEXvhbF6Ti3Nz34k/s1600/Plug.jpg&quot; height=&quot;320&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
When I replaced the 2-pin plug power chord with a 3-pin plug one (the one with the earthing pin) the blinking problem disappeared. So I guess it was related to earthing but not necessarily to &lt;i&gt;ground loop&lt;/i&gt;.</description><link>http://www.vikasing.com/2014/11/hdmi-monitor-blinking-flickering.html</link><author>noreply@blogger.com (Vik)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQGVtT59Np6jJ5bgFCtctay2AVaSm8Po8hUH_DDO5-r8gLs4m0qKrAJE29NdwFvY6gCFaimIwpBT3mBMBcf1257Hpe-ajDgXMhn_ib1iqwGTcIB55u3BIYLnt0t0YcFb6XH9FlWcOExzM/s72-c/IMG_20141126_173721.jpg" height="72" width="72"/><thr:total>13</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-659096905714300169</guid><pubDate>Wed, 20 Aug 2014 16:34:00 +0000</pubDate><atom:updated>2018-07-30T13:34:16.566+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">self-reference</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>Install aura on ArchLinux without haskell dependencies</title><description>Here is how to install &lt;a href=&quot;https://wiki.archlinux.org/index.php/aura&quot; target=&quot;_blank&quot;&gt;Aura&lt;/a&gt; package manager on ArchLinux:&lt;br /&gt;
&lt;div&gt;
&lt;ol&gt;
&lt;li&gt;Download this &lt;a href=&quot;https://aur.archlinux.org/cgit/aur.git/snapshot/aura-bin.tar.gz&quot;&gt;https://aur.archlinux.org/cgit/aur.git/snapshot/aura-bin.tar.gz&lt;/a&gt; file and extract, go to the extracted directory, you&#39;ll find PKGBUILD file.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Install the missing dependencies using pacman e.g. &lt;b&gt;sudo pacman -S ghc fakeroot&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Run command&amp;nbsp;&lt;/span&gt;&lt;b style=&quot;font-weight: bold;&quot;&gt;makepkg&lt;/b&gt;, this will generate a bin file.&lt;/li&gt;
&lt;li&gt;Run command&amp;nbsp;&lt;b&gt;sudo pacman -U aura-bin-1.x.x.x-x-x86_64.pkg.tar.xz, &lt;/b&gt;in the same directory, replace&amp;nbsp;x.x.x-x with the actual version or just press tab after entering the partial command&amp;nbsp;&lt;b&gt;sudo pacman -U aura-bin, &lt;/b&gt;hit enter.&lt;/li&gt;
&lt;li&gt;If you did not get any errors, the installation was successful, validate by running command aura in the terminal.&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description><link>http://www.vikasing.com/2014/08/install-aura-on-archlinux-without.html</link><author>noreply@blogger.com (Vik)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-4915526423244368701</guid><pubDate>Sun, 17 Aug 2014 19:53:00 +0000</pubDate><atom:updated>2014-08-18T01:37:52.288+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Teq</category><category domain="http://www.blogger.com/atom/ns#">ubuntu</category><title>Few days with Arch Linux</title><description>Over a year ago I wrote a post called &lt;a href=&quot;http://www.vikasing.com/2013/06/ubuntu-fail.html&quot; target=&quot;_blank&quot;&gt;Ubuntu Fail&lt;/a&gt;. My opinion has changed a lot since then, I have totally stopped using Windows on any of my computers as my primary OS. My three desktops and one NUC run some form of Ubuntu 14.04 without any issues. I boot into Windows only when I want to play some game.&lt;br /&gt;
&lt;br /&gt;
My laptop, which is my primary machine, was running Ubuntu till last month (July 2014) then one kernel update broke the sound driver. I fixed it buy updating the kernel manually to the latest version, which was 3.15.*, but then I realized why not install a distro which always gets updated to the latest kernel, libs and drivers without all this manual effort. I started looking for such a distro, I read a few posts talking about Fedora and Arch Linux. I&#39;d installed Arch Linux on my Raspberry Pi long back and I was impressed with its performance then, it seemed faster than Raspbian, the official distro for RPi. I also liked Arch wiki.&lt;br /&gt;
&lt;br /&gt;
So I decided to replace my Ubuntu GNOME 14.04 with Arch. I backed up all my data and installed basic Arch, did the basic configuration, everything just worked fine. I went with my usual choice for DM i.e. GNOME 3, no issues there too. Although it took 2 days in setting up, but it was fun.&lt;br /&gt;
&lt;br /&gt;
It&#39;s been 3 weeks since the Arch installation and I haven&#39;t had any major issues. My system is more stable and faster than the previous Ubuntu installation, and that fuzzy touchpad issue which I described in my Ubuntu Fail post is not there in Arch.&lt;br /&gt;
&lt;br /&gt;
I don&#39;t think I&#39;m going back to Windows anytime soon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</description><link>http://www.vikasing.com/2014/08/few-days-with-arch-linux.html</link><author>noreply@blogger.com (Vik)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-588444830678593271</guid><pubDate>Fri, 20 Dec 2013 17:54:00 +0000</pubDate><atom:updated>2013-12-20T23:32:41.319+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">PITA</category><title>Ebay India Orders Fuck Up</title><description>I purchased a 24&#39;&#39; monitor to replace my 4 year old 19&#39;&#39; monitor from eBay on 13th of December. The estimated delivery date mentioned on the product page was 17th Dec. On 17th Dec I received this email from eBay:&lt;br /&gt;
&lt;br /&gt;
&lt;table bgcolor=&quot;#FFE680&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;color: #222222; font-family: arial, sans-serif; font-size: 13px; width: 100%px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;margin: 0px;&quot; valign=&quot;bottom&quot; width=&quot;100%&quot;&gt;&lt;h1&gt;
&lt;span style=&quot;font-family: Arial, Verdana; font-size: medium;&quot;&gt;MC011 XXXXXXX: Update- Error in payment mode details updated with the courier&lt;/span&gt;&lt;/h1&gt;
&lt;/td&gt;&lt;td align=&quot;right&quot; style=&quot;margin: 0px;&quot; valign=&quot;top&quot; width=&quot;8&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#FFCC00&quot; colspan=&quot;3&quot; height=&quot;4&quot; style=&quot;margin: 0px;&quot;&gt;&lt;u&gt;&lt;/u&gt;&lt;u&gt;&lt;/u&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;background-color: white; color: #222222; font-family: arial, sans-serif; font-size: 13px; width: 100%px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;margin: 0px;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;margin: 0px;&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;width: 100%px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;margin: 0px;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot; style=&quot;margin: 0px;&quot; valign=&quot;top&quot; width=&quot;100%&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;width: 100%px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;margin: 0px;&quot;&gt;&lt;/td&gt;&lt;td style=&quot;margin: 0px;&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;width: 100%px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot; colspan=&quot;1&quot; style=&quot;margin: 0px;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;1&quot; style=&quot;margin: 0px;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;left&quot; style=&quot;margin: 0px;&quot; valign=&quot;top&quot; width=&quot;100%&quot;&gt;&lt;span style=&quot;font-family: Arial, Verdana; font-size: x-small;&quot;&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for shopping with&amp;nbsp;&lt;span class=&quot;il&quot; style=&quot;background-color: #ffffcc; background-position: initial initial; background-repeat: initial initial; color: #222222;&quot;&gt;eBay&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We have noticed that due to a system bug there are few transactions where a wrong information about the payment mode has been updated in the system. You might receive SMS alert or an Emails asking you to keep the cod amount ready with you at the time of delivery. Request you to kindly ignore this SMS/Email and not to give any cod amount at the time of delivery if you have made payment of your transaction by using Debit/Credit card or via Net banking.&lt;br /&gt;&lt;br /&gt;Kindly be rest assured this issues has been addressed and resolved, the correct information of payment has been shared with the courier to avoid confusion at the time of delivery. If the courier executive is asking you to pay the cod amount you can refuse the payment and expect the product to be delivered in the next 2-3 working days without the cash being collected. If your transaction is getting returned due to this reason, you will get the refund of your transaction as per Paisa pay timelines.&lt;br /&gt;&lt;br /&gt;We sincerely regret for the inconvenience caused to you and also appreciate your cooperation and understanding at this time.&lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;&lt;span class=&quot;il&quot; style=&quot;background-color: #ffffcc; background-position: initial initial; background-repeat: initial initial; color: #222222;&quot;&gt;eBay&lt;/span&gt;&amp;nbsp;India&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
Next day I received this SMS from BlueDart courier company:&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;i&gt;Ebay order will reach thru BlueDart Awb xxxxxxxxx on or after 19-DEC-13.Kindly keep Cash Rs.xxxxx ready.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
Today (20th December) morning I received an email saying:&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
&lt;i&gt;A refund has automatically been initiated on item &quot;BenQ GL2450HM LED Monitor&quot; on 20-Dec-2013 since our shipping partner has not confirmed pickup of your shipment from the seller within the timelines.&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
I called up the seller and asked about this refund thing, the seller did not have any clue about it. He told me that the item was already shipped.

Around 3 PM the courier company guys appeared with the monitor at my doorstep and asked me to pay the whole amount again which I had already paid while placing the order. I tried to explain them that it was a prepaid item not a Cash On Delivery, it was of no use. Those guys took the monitor back and updated the status as: &lt;i&gt;&quot;Cnee Refused To Accept Shipment&quot;.&lt;/i&gt;&lt;br /&gt;
In the evening I got another email saying:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&quot;Your refund request has been put on hold by PaisaPay on 20-Dec-13 as the seller has appealed against this refund&quot;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;br /&gt;&lt;/i&gt;
I checked my account page and here is how it looked:&lt;br /&gt;
&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMr81ps3beorVo2dyYwO6SOVMIfmdRaus8kPxqoMDAXZYiI561l8n9SJoQEnRg-awhTN1DkP7MdxD_raQ3wcgqTZZx4NaPwJhPZiIzGMrGKp7zIHaKzFjLppvBTggHhVGxEllbG27R62k/s1600/eb.jpg&quot; /&gt;
&lt;br /&gt;
Notice the dates underlined by the orange line, they are all future dates.
How on earth a company like ebay can fuck up so much and at so many levels ??&lt;br /&gt;
First they fucked up the order payment mode then gave wrong information about the shipment and now all the dates celebrating Christmas already.&lt;br /&gt;
This was indeed an enlightening experience, will probably avoid going to ebay any more. Its already 8th day since I placed the order and customer care guy told me to wait till 25th Dec. WOW!!</description><link>http://www.vikasing.com/2013/12/ebay-india-orders-fuck-up.html</link><author>noreply@blogger.com (Vik)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMr81ps3beorVo2dyYwO6SOVMIfmdRaus8kPxqoMDAXZYiI561l8n9SJoQEnRg-awhTN1DkP7MdxD_raQ3wcgqTZZx4NaPwJhPZiIzGMrGKp7zIHaKzFjLppvBTggHhVGxEllbG27R62k/s72-c/eb.jpg" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-2422070895170043676</guid><pubDate>Sun, 08 Sep 2013 20:41:00 +0000</pubDate><atom:updated>2013-09-09T02:27:30.631+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">algo</category><category domain="http://www.blogger.com/atom/ns#">data mining</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">programming</category><category domain="http://www.blogger.com/atom/ns#">tf-idf</category><title>Keyword extraction in Java</title><description>Around two months back I started working on a Java library:&amp;nbsp;&lt;a href=&quot;https://github.com/vikasing/NiceText&quot; target=&quot;_blank&quot;&gt;NiceText&lt;/a&gt;, to isolate data mining stuff from &lt;a href=&quot;https://github.com/vikasing/crowl&quot; target=&quot;_blank&quot;&gt;Crowl&lt;/a&gt;&amp;nbsp;(another weekend project!) and make it an independent lib. I already implemented a &lt;a href=&quot;http://www.vikasing.com/2013/06/extracting-meaningful-text-from.html&quot; target=&quot;_blank&quot;&gt;text extractor&lt;/a&gt; for web pages (hence the name NiceText), which I observed sometimes performs faster and better than boilerpipe library.&lt;br /&gt;
&lt;br /&gt;
I also wanted to extract keywords (or keyphrases) from text. I considered widely used algo&amp;nbsp;&lt;b&gt;TF-IDF&lt;/b&gt; for this purpose. Since keyphrases can contain more than one word, I also considered n-grams (mono, bi and tri), e.g., consider the following text:&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;Astronomers have gotten the first-ever peek at our solar system&#39;s tail, called the heliotail, finding that it&#39;s shaped like a four-leaf clover, NASA scientists announced.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;The discovery was made using NASA&#39;s Interstellar Boundary Explorer (IBEX), a coffee-table-sized spacecraft that is studying the edge of the solar system.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&#39;We always drew pictures where the tail of the solar system just trailed off the page.&#39;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;- David McComas, IBEX principal investigator&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&quot;Many models have suggested the heliotail might look like this or like that, but we have had no observations,&quot; David McComas, IBEX principal investigator at Southwest Research Institute in San Antonio, Tex., said in a statement. &quot;We always drew pictures where the tail of the solar system just trailed off the page, since we couldn&#39;t even speculate about what it really looked like.&quot; [Images: NASA&#39;s IBEX Sees Our Solar System&#39;s Tail]&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;The heliotail is &quot;a much larger structure with a much more interesting configuration&quot; than scientists had previously predicted, McComas added during a news conference announcing the finding.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;The heliotail is inflated by the solar wind of particles streaming off the sun, and the four-leaf clover shape is the result of fast solar wind shooting out near the sun&#39;s poles and slower wind flowing from near the sun&#39;s equator, researchers say. The finding is based on the first three years of IBEX&#39;s measurements of energetic neutral atoms.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;In the interstellar boundary region, charged particles from the sun stream outward far beyond the planets toward the gas- and dust-filled space between stars. Collisions between these particles and interstellar material create fast-moving particles with no charge, known as energetic neutral atoms, or ENAs. Some of these particles speed inward toward the sun, where IBEX can detect them from its perch 200,000 miles above Earth.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;&quot;Scientists have always presumed that the heliosphere had a tail,&quot; Eric Christian, IBEX mission scientist at Goddard Space Flight Center in Greenbelt, Md., said during a Google+ Hangout announcing the finds. &amp;nbsp;&quot;But this is actually the first real data that we have to give us the shape of the tail.&quot;&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;Though IBEX data has given scientists an idea of the shape and structure of the heliotail, they say they have not been able to measure its length particularly well. They think it is probably evaporating over something like the 1000 times the distance between the Earth and the sun, McComas said.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;The $169 million IBEX spacecraft, launched in 2008, was built for an initial two-year mission, which has since been extended. &amp;nbsp;Early on in its mission, IBEX detected ENAs flowing toward the sun in an unexpected pattern: They were significantly enhanced in a mysterious ribbon on the edge of the solar system that scientists now think is a reflection of the solar wind, shot back toward the sun by a strong galactic magnetic field.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;color: #999999;&quot;&gt;IBEX has made several other important discoveries throughout its mission. In 2010, the spacecraft turned its gaze back toward Earth and got the first-ever peek at the solar wind crashing into the planet&#39;s magnetosphere. Last year, NASA announced that the spacecraft made its first detection of matter from outside the solar system, finding alien particles of hydrogen, oxygen and neon in the interstellar wind.&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
The extracted keywords are (arranged in decreasing order of tf-idf score):&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;ibex,&amp;nbsp;&lt;/i&gt;&lt;i&gt;solar system,&lt;/i&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;i&gt;h&lt;/i&gt;&lt;i&gt;eliotail, interstellar, mccomas, nasa,&amp;nbsp;&lt;/i&gt;&lt;i&gt;solar wind, spacecraft,&lt;/i&gt;&lt;i&gt;&amp;nbsp;particles, tail, toward sun,&amp;nbsp;&lt;/i&gt;&lt;i&gt;shape&lt;/i&gt;&lt;/blockquote&gt;
As you can observe keyphrases &quot;solar wind&quot; and &quot;solar system&quot; has a common word &quot;solar&quot; but it does not appear as a keyword, because the program takes care of this ambiguity by comparing monograms with bigrams and then bigrams with trigrams to check if certain words appear together at the same number of time. For example: if the word &quot;solar&quot; appeared 10 times with the word &quot;system&quot; and they individually occurred exactly 10 times each, then both words are merged to form a keyphrase &quot;solar system&quot;.&lt;br /&gt;
&lt;br /&gt;
The &lt;b&gt;tf &lt;/b&gt;can be calculated in many ways, but in the above case it is calculate by the below formula (it worked better than others!):&lt;br /&gt;
$$tf = log(TermFrequency+1)$$&lt;br /&gt;
Another way to calculate the &lt;b&gt;tf &lt;/b&gt;is (it is commented out, you can uncomment and comment the above one, if you decide to use the below one):&lt;br /&gt;
$$tf = {\alpha&amp;nbsp;+ (1-\alpha)*TermFrequency \over&amp;nbsp;\max\{f(w,d): w \in d\}} $$&lt;br /&gt;
Above method somewhat takes care of the bias created by document length. You can read more about it &lt;a href=&quot;http://nlp.stanford.edu/IR-book/html/htmledition/maximum-tf-normalization-1.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
As we know tf-idf depends on multiple documents, more number of documents leads to a better accuracy. Above results are based on only 40+ documents present&amp;nbsp;@&amp;nbsp;&lt;a href=&quot;https://github.com/vikasing/NiceText/tree/master/data&quot;&gt;https://github.com/vikasing/NiceText/tree/master/data&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;CODE:&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Code for extracting the keyphrases from the text is present in&amp;nbsp;&lt;a href=&quot;https://github.com/vikasing/NiceText/blob/master/src/com/vikasing/nicetext/TfIdf.java&quot;&gt;https://github.com/vikasing/NiceText/blob/master/src/com/vikasing/nicetext/TfIdf.java&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I would suggest to take (or fork it to play with it) the whole project to avoid any dependency issues. This is still a WIP, I&#39;ll release a lib (a jar) soon after adding more features and fixing some bugs.</description><link>http://www.vikasing.com/2013/09/keyword-extraction-in-java.html</link><author>noreply@blogger.com (Vik)</author><thr:total>12</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-1612494227534015602</guid><pubDate>Sun, 30 Jun 2013 18:29:00 +0000</pubDate><atom:updated>2013-07-21T00:00:42.815+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Beyond Madness</category><category domain="http://www.blogger.com/atom/ns#">ubuntu</category><title>Ubuntu Fail</title><description>Recently I tried to switch permanently to Ubuntu, the logic was that I mainly do 3 things on my laptop: internet browsing, coding and watching movies/videos on VLC and none of them require Windows, so switching to the Ubuntu made sense, also it has got some tools which I wanted to learn, e.g. octave. I didn&#39;t want to loose my Windows 8 installation and wanted to install Ubuntu 12.04 LTS parallel to W8. Earlier attempt of installing Ubuntu failed due to a lot of EFI related issues.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Ubuntu 12.04&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Installation was smooth and I was able to get the grub screen, which displayed a number of options to choose from. I logged into Ubuntu. The familiar Unity interface came up, which I did not like so I went ahead and installed GNOME. But it ran in fallback mode due to graphics driver issues. My laptop has hybrid graphics: ATI with +&amp;nbsp;Intel 4000 . I looked on the web for the drivers but found nothing, Intel stopped developing a graphics driver for 12.04 due to some dependency issues but there was a driver for 12.10.&lt;br /&gt;
&lt;br /&gt;
Another issue which I faced due to the lack of the graphics drivers was the pixelated video play in VLC. So I thought of upgrading from 12.04 to 12.10.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Ubuntu 12.10&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
After upgradation was done, I could not get the grub, it got screwed somehow. I got a blank screen, nothing else. I ran the live cd and did a boot repair. It restored the grub, but when I selected the linux option in the grub and hit Enter, a blank screen appeared and kept appearing until I switched of the system. I tried recovery mode, which logged me into the command line mode. There was a message which said I could upgrade to 13.04 from 12.10. Having known that Intel has provided a good support for 13.04 I decided to upgrade.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Ubuntu 13.04&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Again I had to run boot repair to fix the grub issues, even after that I was not able to log in, the blank screen didn&#39;t go away no matter what I did. This time I thought of installing 13.04 from scratch, a fresh installation. Everything went smooth and I was able to login. After using about half an hour I noticed a weird issue of my mouse pointer moving a little out of place, the motion was not precise. It seemed to be a driver issue for Synaptics touchpad. A latest driver for Synaptics was already installed. I tried tweaking Synaptics settings, but nothing noticeable happened. And this issue was affecting my whole experience, I was not able to open links I intended to open, I was not able to close windows etc. It was worse than that graphics issue I had in 12.04.&lt;br /&gt;
&lt;br /&gt;
So I went back to 12.04 and this time I installed Xubuntu desktop. It worked ok for some time until one day, I had to connect my laptop to a projector. Due to no graphics driver only one display was supported, I selected monitor option and my laptop screen went blank. When the job was done, I disconnected the projector hoping my laptop screen will lit up, it remained blank.&lt;br /&gt;
&lt;br /&gt;
Xubuntu-desktop had another issue, the fan would start spinning at full speed after waking the laptop from suspension. I tried a patch which I found on the net, it did not help.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Linux Mint 15&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Finally I thought of giving Mint a try, since it came with a lot of pre-installed software and drivers. Installed it after wiping the previous 12.04 installation. When I tried to boot I got a&amp;nbsp;&lt;b&gt;grub rescue&lt;/b&gt;&amp;nbsp;screen, I tried many things to restore grub but failed all the time. Now I was not able to boot into any of the systems, neither Windows 8 nor Mint 15. I gave up, removed grub and booted into W8 and formatted the Mint partition. Now I have decided to run linux on top Windows; in VrtualBox.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Final Thoughts&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Ubuntu 13.04 with GNOME has better looks than Windows 8 but when it comes to hardware support, many h/w companies don&#39;t care about this market segment (linux). GRUB is another rotten area in the Linux territory, if you are damn lucky then only it might work. Linux guys need to work together to create a better alternative to GRUB. Finally I still hope that one day I&#39;ll be able to make a permanent switch to Ubuntu or any other popular distribution.</description><link>http://www.vikasing.com/2013/06/ubuntu-fail.html</link><author>noreply@blogger.com (Vik)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-7522740087240485810</guid><pubDate>Thu, 27 Jun 2013 18:27:00 +0000</pubDate><atom:updated>2013-07-20T23:58:46.017+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Beyond Madness</category><title>Angelhack 2013 Bangalore Experience</title><description>Angelhack 2013 was held at Microsoft Research/Microsoft Accelerator for Azure Office at Lavelle Road, Bangalore. We were given 23 hours to code/hack, from 2PM June 22nd till 1PM next day. Me and my partner divided the work and started to code. Soon we realized that there were issues with wi-fi connectivity at the venue, there was no internet for a long time and we were expected to code/hack without internet. After a couple of hours when technician could not sort out the issue, we were given a generic wifi access, which was slow to the death, occasionally inaccessible. For important things I relied on my mobile data connection, many had USB modem, this situation did not improve at all.&lt;br /&gt;
&lt;br /&gt;
Organizers were happy to help/instruct.&lt;br /&gt;
Facilities were good, probably the best I&#39;ve seen in an IT office.&lt;br /&gt;
&lt;br /&gt;
I slept around 3AM after a 2nd git commit. Some did not sleep. I woke up around 6:30AM. We resumed our work around 7AM&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Demo Time&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Demo session started somewhere around 2:30PM, each team was given 2 Minutes for presentation + 1 Minute for QnA from judges. We&#39;d prepared a video of whatever we could finish, it was not even half backed, just featuring some HTML mockups and FB integration.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Judging&amp;nbsp;&lt;/b&gt;&lt;i&gt;(O&lt;/i&gt;&lt;i&gt;nly reason behind this post)&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Initially when the judges were ROFLing and making fun of the ideas and passing stupid comments, I was forced to think that these people really knew what they were talking about. But when a team presented an idea of querying the data by typing the human readable questions in a text field, one judge (the dominating one!) started to compare it with Wolfram Alpha, and went on saying that Wolfram Alpha was not present in&amp;nbsp;&lt;b&gt;Indian market&lt;/b&gt;, but when they come, your app wouldn&#39;t stand a chance.&lt;br /&gt;
&lt;br /&gt;
Another team presented an app based on some medical data, it could tell you what disease you might have based on your symptoms. One Judge suggested him to participate in a kaggle competition &quot;&lt;a href=&quot;http://www.heritagehealthprize.com/c/hhp&quot; style=&quot;color: #3b5998; cursor: pointer;&quot; target=&quot;_blank&quot;&gt;The Heritage Health Prize&lt;/a&gt;&quot; . BTW that event ended in April 2013, it may re-start this year sometime, but no announcement has been made yet about the dates.&lt;br /&gt;
&lt;br /&gt;
When we presented an idea about a generic platform for peer to peer learning, the judges responded with &quot;&lt;b&gt;many tried it and failed&lt;/b&gt;&quot;.&lt;br /&gt;
&lt;br /&gt;
One guy presented an app which created cinemagram of a video, he explained how it worked and claimed that it was faster than the apps present in the market. When judges asked why it was faster, he simply said that he didn&#39;t know. Guess what? he&amp;nbsp;&lt;b&gt;won&lt;/b&gt;&amp;nbsp;the hackathon.&lt;br /&gt;
&lt;br /&gt;
Finding out that something like cinemagram already exists was just a google search away, in fact there is a company named cinemagram which has got apps on both Android as well as iOS app stores. And when you search cinemagram on Play Store you get more that 60 apps.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Why am I pissed?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
My hackathon partner has a startup and he told me that he&#39;d met most of these judges at least once for pitching his product. They are well known in India&#39;s VC circle, kind of celebrities in startup world in Bangalore.&lt;br /&gt;
&lt;br /&gt;
This is what upsets me, at an event like hackathon we don&#39;t need celebrity judges, who can only focus on India when the event clearly wasn&#39;t about India. These people have a certain mindset, for example &quot;&lt;i&gt;this has failed before and would fail again&lt;/i&gt;&quot; or &quot;&lt;i&gt;this already exists&lt;/i&gt;&quot; or the ignorance about what has been happening around the world, like this cinemagram concept. Judges had great knowledge about Indian market and showed complete ignorance about outside world. Imagine about the people who seek funding from these ignorant people. Lots of great ideas may be dying everyday.&lt;br /&gt;
&lt;br /&gt;
Now I am a bit concerned, because I&#39;d be launching my startup in near future, and if the whole Indian industry is filled with such idiot VCs, I am going to face some really hard time.</description><link>http://www.vikasing.com/2013/06/angelhack-2013-bangalore-experience.html</link><author>noreply@blogger.com (Vik)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-435856474294488114</guid><pubDate>Mon, 24 Jun 2013 18:57:00 +0000</pubDate><atom:updated>2013-06-25T00:38:30.730+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">data mining</category><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">programming</category><title>Extracting (meaningful) text from webpages - II </title><description>&lt;div style=&quot;text-align: left;&quot;&gt;
I was looking at the Readability Java clone &lt;a href=&quot;https://github.com/vikasing/NiceText&quot; target=&quot;_blank&quot;&gt;snacktory&lt;/a&gt; to replace the very slow boilerpipe lib in my project, snacktory seemed faster but did not produce better results than boilerpipe. For example for the following url:&amp;nbsp;&lt;a href=&quot;http://alumniconnect.wordpress.com/2013/06/04/a-monk-who-didnt-care-for-ferrari-teaching-to-serve-society/&quot;&gt;http://alumniconnect.wordpress.com/2013/06/04/a-monk-who-didnt-care-for-ferrari-teaching-to-serve-society/&lt;/a&gt;&amp;nbsp;snacktory extracted just a small paragraph, about 25% of the whole text.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I forked the project and tried to fix it, but soon it turned out to be a challenging job. Snacktory&#39;s approach is totally based on the HTML markup, which makes it fail sometime, for example text inside &amp;lt;span&amp;gt;&amp;lt;/span&amp;gt; is ignored. That&#39;s exactly what is going on in the above case.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
I thought of modifying the snacktory in such a way so that it can ignore HTML tags and still give better results. But soon realized that I&#39;d have to change the whole logic behind the lib so I went ahead and created my own project &lt;a href=&quot;https://github.com/vikasing/NiceText&quot; target=&quot;_blank&quot;&gt;NiceText&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;How does NiceText work?&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Instead of looking for particular tags and block sizes, NiceText calculates the ratios of all the text blocks w.r.t. the largest text block. Then it excludes the blocks with a smaller ratio than a give limit (say a ratio of 0.15). After that it clusters the nearest blocks into multiple clusters by checking the distance between two blocks, each cluster contains several text blocks, the largest cluster is marked as the main text.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Here is the output of a TC article:&amp;nbsp;&lt;a href=&quot;http://techcrunch.com/2013/06/24/google-launches-cloud-playground-a-browser-based-environment-for-trying-its-cloud-platform/&quot;&gt;http://techcrunch.com/2013/06/24/google-launches-cloud-playground-a-browser-based-environment-for-trying-its-cloud-platform/&lt;/a&gt;&lt;/div&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;Google’s Cloud Platform is slowly becoming ay fully featured environment for running complex web apps, but it’s not easy to just give it a quick try. To get started with Cloud Platform, after all, you have to first install the right and other tools on your local machine. Today, however, Google is launching its browser-based Cloud Playground, which is meant to give developers a chance to try some sample code and see how actual production APIs will behave, or to just share some code with colleagues without them having to install your whole development environment.&lt;/i&gt;&lt;i&gt;Cloud Playground, Google says, is meant to be a place “for developers to experiment and play with some of the services offered by the Google Cloud Platform, such as Google App Engine, Google Cloud Storage and Google Cloud SQL.”&lt;/i&gt;&lt;i&gt;For now, Cloud Playground only supports Python 2.7 App Engine apps, and Google considers it to be an experimental service (so it could shut it down anytime).&lt;/i&gt;&lt;i&gt;To get started, you simply head for the Cloud Playground or, if you just want to see it at work, head for Google’s getting started documentation, which now features green Run/Modify buttons that allow you to run any of the sample code on these sites. The Cloud Playground itself features numerous sample apps and also gives you the option to clone other open source App Engine template projects written in Python 2.7 from GitHub.&lt;/i&gt;&lt;i&gt;The project itself is open source and consists of a basic browser-based code editor and , a Python App Engine app that serves as the development server.&lt;/i&gt;&lt;/blockquote&gt;
Which is what we need !!

I&#39;m also working on a summarizer, which will be integrated in NiceText. Some part of it is already there, but it needs a lot of improvements. Here is the summary of the above text; produced by SimilaritySummarizer.java (present in the repo):&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;i&gt;Today, however, Google is launching its browser-based Cloud Playground, which is meant to give developers a chance to try some sample code and see how actual production APIs will behave, or to just share some code with colleagues without them having to install your whole development environment. 

&lt;/i&gt;&lt;/blockquote&gt;
I have yet to create a jar, however you can download the files from &lt;a href=&quot;https://github.com/vikasing/NiceText&quot;&gt;github repository&lt;/a&gt;. NiceText has a dependency on &lt;a href=&quot;http://jsoup.org/&quot;&gt;Jsoup&lt;/a&gt;.</description><link>http://www.vikasing.com/2013/06/extracting-meaningful-text-from.html</link><author>noreply@blogger.com (Vik)</author><thr:total>15</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-6245248065475194651</guid><pubDate>Sat, 23 Feb 2013 12:53:00 +0000</pubDate><atom:updated>2013-02-24T00:57:35.582+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">apache</category><category domain="http://www.blogger.com/atom/ns#">php</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>Installing apache 2.4.x and php 5.3.x from source on Centos</title><description>&lt;i&gt;I used apache 2.4.3 and php 5.3.22 for this guide.
&lt;/i&gt;&lt;br /&gt;
Before installing anything from the source you need to remove old libs/packages from the Centos. You can remove PHP by typing:&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;yum remove php&lt;/pre&gt;
run following command to remove other php-libs:&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;yum remove php-cli php-gd php-mysql php-mbstring&lt;/pre&gt;
There is no need to uninstall the existing apache http server, however you need to stop the process for new installation of apache httpd to work.
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Prerequisites:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Create a directory where you will download the tars, e.g. &lt;b&gt;/usr/tmp/&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;cd to this directory&lt;/li&gt;
&lt;li&gt;Download the src of apache web server, apr, apr-util and php by using following commands:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;wget http://apache.techartifact.com/mirror//httpd/httpd-2.4.3.tar.gz
wget http://apache.techartifact.com/mirror//apr/apr-1.4.6.tar.gz
wget http://apache.techartifact.com/mirror//apr/apr-util-1.5.1.tar.gz
wget http://www.php.net/get/php-5.3.22.tar.gz/from/us1.php.net/mirror
&lt;/pre&gt;
You also need to install gcc and openssl-devel (for ssl support).
&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;yum install gcc
yum install openssl-devel&lt;/pre&gt;
&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Installing Apache HTTP Server:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
Extract all the 4 archives downloaded in the /usr/tmp/ dir using following command:

&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;tar xvfz httpd-2.4.3.tar.gz
tar xvfz apr-1.4.6.tar.gz
tar xvfz apr-util-1.5.1.tar.gz
tar xvfz php-5.3.22.tar.gz&lt;/pre&gt;
cd to the httpd-2.4.3 and run the following command (if you want to install Apache with ssl support add --enable-ssl option):
&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;./configure --enable-so --with-apr=/usr/tmp/apr-1.4.6 --with-apr-util=/usr/tmp/apr-util-1.5.1
&lt;/pre&gt;
Run following commands to install the Apache:
&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;make
make install
&lt;/pre&gt;
Start the Apache server using the command:
&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;/usr/local/apache2/bin/apachectl start
&lt;/pre&gt;
&lt;b&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;Installing PHP:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
cd to php-5.3.22 directory and run the following command to see the configuration options available with PHP installation:
&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;./configure --help
&lt;/pre&gt;
Select the php modules you want to install, also add the  --with-apxs2 option to configure the php with Apache server we installed, following command contains common php modules:
&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;./configure  --with-apxs2=/usr/local/apache2/bin/apxs --disable-debug --enable-inline-optimization --enable-mbregex --enable-gd-native-ttf --enable-mbstring --enable-zend-multibyte --enable-sockets --enable-sysvsem --enable-sysvshm --enable-zip --with-gettext --with-mcrypt --with-mhash --with-openssl --with-pcre-regex --with-pear --with-zlib --with-xsl 
&lt;/pre&gt;
Compile and install the PHP:
&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;make
make install
&lt;/pre&gt;
Restart the Apache server and you are done. I have tested this on Centos 5.x but it should work on Centos 6.x. Following are the important paths:
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Default web directory, where your all web stuff go: &lt;i&gt;/usr/local/apache2/htdocs&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;http.conf&lt;/b&gt; path:&lt;i&gt;/usr/local/apache2/conf/httpd.conf&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;&lt;b&gt;php.ini&lt;/b&gt; path:&lt;i&gt;/usr/local/lib/php.ini&lt;/i&gt;&lt;/li&gt;
&lt;/ul&gt;
</description><link>http://www.vikasing.com/2013/02/installing-apache-24x-and-php-53x-from.html</link><author>noreply@blogger.com (Vik)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-5726657890439864636</guid><pubDate>Sat, 23 Feb 2013 10:52:00 +0000</pubDate><atom:updated>2013-02-24T01:06:25.082+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">apache</category><category domain="http://www.blogger.com/atom/ns#">php</category><category domain="http://www.blogger.com/atom/ns#">PITA</category><title>PITA 6: PHP Warning:  Unknown: open(/var/lib/php/session/...., O_RDWR) failed: Permission denied (13) ...</title><description>Recently I compiled php 5.3 on my Centos 5.x machine, everything worked fine until I noticed that the HTTP session was not getting created.&lt;br /&gt;
I checked the apache error logs and found this php warning getting repeated:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
&lt;span style=&quot;color: #cc0000;&quot;&gt;&amp;nbsp;PHP Warning: &amp;nbsp;Unknown: open(/var/lib/php/session/...., O_RDWR) failed: Permission denied (13) in Unknown on line 0&lt;/span&gt;&lt;/blockquote&gt;
&lt;div&gt;
I tried to look for the solution on the net, couldn&#39;t find a proper solution except someone saying that apache sever should have write access to the session directory (&lt;b&gt;/var/lib/php/session&lt;/b&gt;&amp;nbsp;in my case). I did:&amp;nbsp;&lt;/div&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;
chmod 777&amp;nbsp;/var/lib/php/session
&lt;/pre&gt;
and restarted the http server, no warning this time in the error logs, everything started working as expected.&lt;br /&gt;
&lt;br /&gt;
My ls -l looks like following:&lt;br /&gt;
&lt;pre style=&quot;background-color: #333333; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; color: white; font-size: 13px; overflow-x: auto; padding: 20px;&quot;&gt;
drwxrwxrwx 2 root apache 270336 Feb 23 14:27 session
&lt;/pre&gt;</description><link>http://www.vikasing.com/2013/02/pita-6-php-warning-unknown.html</link><author>noreply@blogger.com (Vik)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-4559664180782716026</guid><pubDate>Sun, 10 Feb 2013 11:07:00 +0000</pubDate><atom:updated>2013-02-10T16:44:24.715+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">programming</category><title>A note on Matrix Multiplication in Java </title><description>I needed to calculate the &lt;b&gt;B &lt;/b&gt;=&amp;nbsp;&lt;b&gt;AxA&lt;sup&gt;T&lt;/sup&gt; &lt;/b&gt;for some task. Here A is a matrix of some size. Initially I considered a few open-source libs e.g. &lt;a href=&quot;http://acs.lbl.gov/software/colt/&quot; target=&quot;_blank&quot;&gt;Colt&lt;/a&gt;, &lt;a href=&quot;https://sites.google.com/site/piotrwendykier/software/parallelcolt&quot; target=&quot;_blank&quot;&gt;Parallel Colt&lt;/a&gt; and &lt;a href=&quot;http://math.nist.gov/javanumerics/jama/&quot; target=&quot;_blank&quot;&gt;JAMA&lt;/a&gt;, I found JAMA to be a bit easier to use and also it had better documentation than the other two. The size of my matrix &lt;b&gt;A &lt;/b&gt;was around &lt;b&gt;1700x2700&lt;/b&gt;. It used to take around 65 secs for getting &lt;b&gt;B&amp;nbsp;&lt;/b&gt;matrix with JAMA. It was fine with me util recently, my matrix size grew to &lt;b&gt;7000x14000&lt;/b&gt;. First let me make it clear that this matrix A is sparse and does contain values between [0,2].
I tried JAMA on this new matrix and tried to calculate the matrix &lt;b&gt;B&lt;/b&gt;, first it threw Out of Memory error, when I increased the heap memory to 4GB (max I could allocate!) it took some time in calculation and at the end again threw Out of Memory error.&lt;br /&gt;
&lt;br /&gt;
I tried to run the program on a higher memory machine and allocated 10GB to heap. Here is the code for JAMA for matrix multiplication:&lt;br /&gt;
&lt;pre class=&quot;brush: java;&quot;&gt;double[][] matrix // your pre-populated matrix
Matrix aMatrix = new Matrix(matrix);
Matrix bMatrix = aMatrix.transpose();
Matrix finalMatrix= aMatrix.times(bMatrix);
double[][] finalArray = finalMatrix.getArray(); // this step is not necessary
&lt;/pre&gt;
On this higher configuration machine the JAMA ran around 3 Hours before I killed it.
I started looking for other libs and other ways to calculated this matrix in as less as possible amount of time. For me a time between 15-30 minutes was acceptable. While googling I got this link: &lt;a href=&quot;http://stackoverflow.com/questions/529457/performance-of-java-matrix-math-libraries&quot;&gt;http://stackoverflow.com/questions/529457/performance-of-java-matrix-math-libraries&lt;/a&gt;, I found this benchmark page: &lt;a href=&quot;http://code.google.com/p/java-matrix-benchmark/&quot;&gt;http://code.google.com/p/java-matrix-benchmark/&lt;/a&gt; and decided to give &lt;a href=&quot;https://code.google.com/p/efficient-java-matrix-library/&quot; target=&quot;_blank&quot;&gt;EJML &lt;/a&gt;a try, basic code for multiplication is:&lt;br /&gt;
&lt;pre class=&quot;brush: java;&quot;&gt;double[][] matrix // your pre-populated matrix
SimpleMatrix aMatrix = new SimpleMatrix(matrix);
SimpleMatrix cMatrix = aMatrix.mult(aMatrix.transpose());
SimpleMatrix cMatrix =  aMatrix.mult(bMatrix)&lt;/pre&gt;
EJML calculated the smaller matrix multiplication (1700x2700) in 6-7 Secs, which was way faster compared to JAMA which took more than 60 Secs for the same calculation. So I went ahead and ran it on the bigger matrix and left it running on my home machine which has 12GB RAM and an Intel i7 Proc. When I returned from my work after 9 hours the program was still running. But after half an hour I saw the output. It took 9 hours and 30 minutes for EJML to finish this calculation and a total of 5.5 GB of RAM during this operation.
&lt;br /&gt;
&lt;br /&gt;
Meanwhile I was also looking at &lt;a href=&quot;http://jblas.org/&quot; target=&quot;_blank&quot;&gt;JBLAS&lt;/a&gt;, but due to its dependency on some native libs, I was not able to run it on production as well as on my home machine which runs Windows 8. I had to install cygwin to make it work on Win 8. I ran it against the small matrix and output appeared on the screen in no time. Total time taken for the 1700x2700 matrix was 0.6 Secs, it was exciting to see the output so quickly. Following is the code for matrix multiplication using JBLAS:&lt;br /&gt;
&lt;pre class=&quot;brush: java;&quot;&gt;double[][] matrix // your pre-populated matrix
DoubleMatrix aDoubleMatrix = new DoubleMatrix(matrix);
DoubleMatrix bDoubleMatrix = aDoubleMatrix.transpose();
DoubleMatrix fDoubleMatrix = aDoubleMatrix.mmul(bDoubleMatrix);
&lt;/pre&gt;
I ran the program on the big matrix, and got the results immediately, in 6 Secs. It uses the native libs BLAS and LAPACK, which make it so much faster than other purely java based libs. Also it uses all the cores available on your machine. Support from the author of the library is also great, he went some extra miles to resolve the issue I was facing, when I used the lib on a Centos 6 box (due to some older GLIB installation).
</description><link>http://www.vikasing.com/2013/02/a-note-on-matrix-multiplication-in-java.html</link><author>noreply@blogger.com (Vik)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-3063972752730522020</guid><pubDate>Thu, 10 Jan 2013 20:29:00 +0000</pubDate><atom:updated>2013-01-11T02:07:33.431+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Teq</category><category domain="http://www.blogger.com/atom/ns#">Xeneral</category><title>Gadgets I am looking forward to buy in 2013</title><description>Here are a few gadgets I am looking forward to buy in near future:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Leap Motion&lt;/b&gt;&amp;nbsp;&lt;b&gt;Controller &lt;/b&gt;&lt;i&gt;(&lt;a href=&quot;https://leapmotion.com/&quot;&gt;https://leapmotion.com/&lt;/a&gt;)&lt;/i&gt;: The reason why I want this device is because I am lazy, I don&#39;t want to get up from my bed to skip the current song or to play the next episode of a TV series. Plus it doesn&#39;t cost much. Right now its open for pre-orders just for $70. I wish Leap Motion will come up with a wireless version soon, may be a Bluetooth based. Check out this really cool video:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;object class=&quot;BLOGGER-youtube-video&quot; classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0&quot; data-thumbnail-src=&quot;http://0.gvt0.com/vi/_d6KuiuteIA/0.jpg&quot; height=&quot;320&quot; width=&quot;480&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/_d6KuiuteIA&amp;fs=1&amp;source=uds&quot; /&gt;&lt;param name=&quot;bgcolor&quot; value=&quot;#FFFFFF&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;embed width=&quot;320&quot; height=&quot;266&quot;  src=&quot;http://www.youtube.com/v/_d6KuiuteIA&amp;fs=1&amp;source=uds&quot; type=&quot;application/x-shockwave-flash&quot; allowfullscreen=&quot;true&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;Raspberry Pi&lt;/b&gt; &lt;i&gt;(&lt;a href=&quot;http://www.raspberrypi.org/&quot;&gt;http://www.raspberrypi.org/&lt;/a&gt;)&lt;/i&gt;: Raspberry Pi created a lot of buzz last year. People are doing lots of experiments with it e.g. creating a media server, for tiny http server, home automation, NAS and lots more. You can check out the site to watch some crazy stuff people have managed to do with this thing. It interests me because of its low power consumption and it can run Linux. My primary use of it is going to be as a bluetooth audio receiver. I am just waiting my order to arrive.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/300px-RaspberryPi.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/300px-RaspberryPi.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;Pebble Watch&lt;/b&gt;&lt;i&gt; (&lt;a href=&quot;http://getpebble.com/&quot;&gt;http://getpebble.com/&lt;/a&gt;)&lt;/i&gt;: I liked Casio watches and always wanted a Protrek model which comes with a thermometer, a barometer, an altimeter and a compass. But then realized none of these features were any use to me so never bought one. Since last couple of years a few companies have showed a lot of interest in making a smart watch. The main problem with these watches was their battery life, you need to recharge these watches as frequently as your phone, probably once in a day. Pebble is simple and has a black-white screen (E-Paper Screen) and that&#39;s probably the reason behind its 7 day battery life. Pebble also has an SDK for building new apps. The whole idea looks great, now lets see how things go from here. I pre-ordered mine today, now waiting for the shipment date. Check out the video from CES 2013:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/zseyQ8DvRM4?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;Belkin AirCast Connect&lt;/b&gt;&lt;i&gt; (&lt;a href=&quot;http://www.belkin.com/in/IWCatProductPage.process?Product_Id=546314&quot;&gt;http://www.belkin.com/in/IWCatProductPage.process?Product_Id=546314&lt;/a&gt;):&lt;/i&gt; This is not a new gadget, but its a must have one for the people who don&#39;t have a built in Bluetooth functionality in their cars. That&#39;s all I have to say, check out the video of this thing in action:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/ulaqZinAz9g?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;A Graphics Card:&lt;/b&gt; My last graphics card died just after the warranty period expiration. It was an ATI 4870. This is going to be a big investment because I&#39;ll also have to buy a new power supply. Nowadays higher end cards need around 600+ watts. I have yet to decide the manufacturer, but I am leaning towards nVidia because I can get a 5 Year warranty from Zotac. I am still not over with Skyrim and other games are queued up already e.g. far cry 3, COD, Walking Dead, Amnesia, NFS and many more. A still from Far Cry 3:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://cdn.pastemagazine.com/www/articles/far%20cry%203%20prowl.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;http://cdn.pastemagazine.com/www/articles/far%20cry%203%20prowl.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;b&gt;A Smartphone:&lt;/b&gt; I was desperately waiting for Nexus 4, but it kinda disappointed me. I have a Nexus One which runs the ages old version of Android (Cyanogenmod 7.2), I like its uni-body design which feels good. Galaxy Nexus it way too plasticy and its camera sucks!! Nexus 4 looks somewhat similar to Galaxy Nexus and also its always out of stock. I was hoping for a full HD screen from the next Nexus device plus some great design like the HTC phones have and the battery life of Motorola Droid HD Max. I already have a Nexus 7 tab for the latest Android experience, now I am just waiting for an amazing phone from Google + Motorola. If next Nexus phone takes a lot of time I may drift towards a Windows 8 Phone, Lumia 920 is so tempting right now, except a full HD screen&amp;nbsp;it has got almost everything I need in a smartphone.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</description><link>http://www.vikasing.com/2013/01/gadgets-i-am-looking-forward-to-buy-in.html</link><author>noreply@blogger.com (Vik)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-2469929360888510224</guid><pubDate>Fri, 02 Nov 2012 08:59:00 +0000</pubDate><atom:updated>2012-11-04T13:31:04.082+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">PITA</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>Resolving grub rescue issue after Windows 8 installation</title><description>The issue occurs when you try to upgrade your Windows 7 to Windows 8 and have installed a Linux version (e.g. Ubuntu) in the past, parallel to Windows 7. The &lt;b&gt;grub rescue&lt;/b&gt; screen appears just after first restart and it doesn&#39;t let you boot into the Windows. In my case the text looked like this:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: &#39;Ubuntu Beta&#39;, UbuntuBeta, Ubuntu, &#39;Bitstream Vera Sans&#39;, &#39;DejaVu Sans&#39;, Tahoma, sans-serif; font-size: 14px; line-height: 17px;&quot;&gt;error: unknown filesystem.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #f7f7f7; color: #333333; font-family: &#39;Ubuntu Beta&#39;, UbuntuBeta, Ubuntu, &#39;Bitstream Vera Sans&#39;, &#39;DejaVu Sans&#39;, Tahoma, sans-serif; font-size: 14px; line-height: 17px;&quot;&gt;grub rescue&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
This happens because grub can not find the Linux partition, which you may have deleted earlier (just by formatting the Linux disk partition). First you can try all these options:&lt;br /&gt;
&lt;br /&gt;
1. Repair Windows start-up using Windows 7 installation DVD.&lt;br /&gt;
2. Using command prompt option with W7 installation DVD to fix master boot record (MBR) [&lt;a href=&quot;http://www.sevenforums.com/tutorials/20864-mbr-restore-windows-7-master-boot-record.html&quot; target=&quot;_blank&quot;&gt;Link&lt;/a&gt;] &amp;amp; [&lt;a href=&quot;http://www.sevenforums.com/general-discussion/17521-how-fix-mbr-through-command-prompt.html&quot; target=&quot;_blank&quot;&gt;Link&lt;/a&gt;] &lt;br /&gt;
3. Try removing Grub using Ubuntu live CD/DVD [&lt;a href=&quot;http://www.youtube.com/watch?v=oB8NVzkgdEA&quot; target=&quot;_blank&quot;&gt;Link&lt;/a&gt;]&lt;br /&gt;
4. Use Ubuntu tool &quot;Boot-Repair&quot; [&lt;a href=&quot;http://www.ubuntugeek.com/boot-repair-simple-tool-to-repair-frequent-boot-problems.html&quot; target=&quot;_blank&quot;&gt;Link&lt;/a&gt;]&lt;br /&gt;
&lt;br /&gt;
If any of the above mentioned option did not work, then use the Ubuntu live CD/DVD to install Boot-Repair, after installation click on &quot;Create a BootInfo summary&quot;:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv2j_ULIn__6ku6ny-NwXDmp0O7EKVEq6J3MW38yvWdxc9-B5aGgV83-gHCH-Jnoq4WwqHK921-WZMl9B3CSffMgzr1OPktCanKjK3Jmy_KESgjvY0TOMit83scyVVDPjzwfEoedPfw5I/s1600/211.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;208&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv2j_ULIn__6ku6ny-NwXDmp0O7EKVEq6J3MW38yvWdxc9-B5aGgV83-gHCH-Jnoq4WwqHK921-WZMl9B3CSffMgzr1OPktCanKjK3Jmy_KESgjvY0TOMit83scyVVDPjzwfEoedPfw5I/s320/211.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
This will analyze all the partitions&#39; boot information and create a report, you&#39;ll have to access this report using the URL given by this program. The URL will look like:&amp;nbsp;&lt;a href=&quot;http://paste.ubuntu.com/1308107&quot;&gt;http://paste.ubuntu.com/&lt;/a&gt;(a_number)/&lt;br /&gt;
&lt;br /&gt;
The report is divided in many sections, what you should be looking at is the block where you can find an entry mentioning &lt;b&gt;grub.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
For example in my case the grub entry was located on the partition&amp;nbsp;&lt;b&gt;sda3:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #cccccc;&quot;&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;
sda3:__________________________________________________________________________
    File system:       vfat
    Boot sector &lt;span class=&quot;nb&quot; style=&quot;color: #aa22ff;&quot;&gt;type&lt;/span&gt;:  Unknown
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /EFI/Boot/bootx64.efi &lt;b&gt;&lt;span style=&quot;color: red;&quot;&gt;/EFI/ubuntu/grubx64.efi&lt;/span&gt;&lt;/b&gt; 
                       /EFI/Microsoft/Boot/bootmgfw.efi 
                       /EFI/Microsoft/Boot/bootmgr.efi 
                       /EFI/Microsoft/Boot/memtest.efi
&lt;/span&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
In you case grub boot file may be located on a different partition, mount that partition into &lt;b&gt;newd&lt;/b&gt; directory using command (in ubuntu live cd/dvd session):&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f3f3f3; border: 1px dashed rgb(193, 180, 150); color: #333333; font-family: UbuntuMono, courier, monospace; font-size: 13px; line-height: 16px; margin-bottom: 8px; padding: 4pt; vertical-align: baseline; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;sudo mount /dev/sda3 /newd&lt;/pre&gt;
go to the newd directory and then EFI by typing:
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f3f3f3; border: 1px dashed rgb(193, 180, 150); color: #333333; font-family: UbuntuMono, courier, monospace; font-size: 13px; line-height: 16px; margin-bottom: 8px; padding: 4pt; vertical-align: baseline; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;cd /newd/EFI/&lt;/pre&gt;
remove the whole ubuntu directory using command:
&lt;br /&gt;
&lt;pre style=&quot;background-color: #f3f3f3; border: 1px dashed rgb(193, 180, 150); color: #333333; font-family: UbuntuMono, courier, monospace; font-size: 13px; line-height: 16px; margin-bottom: 8px; padding: 4pt; vertical-align: baseline; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;sudo rm -r ubuntu&lt;/pre&gt;
End the live Ubuntu session and restart.
If you can boot into the Windows then it worked!! Otherwise look for other solutions on the Google (one of them was: re-installing the Ubuntu again, hence fixing the Grub).
&lt;/div&gt;
</description><link>http://www.vikasing.com/2012/11/resolving-grub-rescue-issue-after.html</link><author>noreply@blogger.com (Vik)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv2j_ULIn__6ku6ny-NwXDmp0O7EKVEq6J3MW38yvWdxc9-B5aGgV83-gHCH-Jnoq4WwqHK921-WZMl9B3CSffMgzr1OPktCanKjK3Jmy_KESgjvY0TOMit83scyVVDPjzwfEoedPfw5I/s72-c/211.png" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-5165191599625024336</guid><pubDate>Thu, 12 Apr 2012 19:02:00 +0000</pubDate><atom:updated>2012-09-23T01:44:39.441+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">nodejs</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>Introduction to node.js</title><description>Recently I had to give a presentation on a technology, I sorted out two: a graph db (neo4j) and node.js. I had heard a lot about node.js and was not very sure what it really was, so I choose it for the presentation. Here it is:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div id=&quot;__ss_11730771&quot; style=&quot;width: 595px;&quot;&gt;
&lt;strong style=&quot;display: block; margin: 12px 0 4px;&quot;&gt;&lt;a href=&quot;http://www.slideshare.net/vikasing/introduction-to-nodejs-11730771&quot; target=&quot;_blank&quot; title=&quot;Introduction to Node.js&quot;&gt;Introduction to Node.js&lt;/a&gt;&lt;/strong&gt; &lt;object height=&quot;497&quot; id=&quot;__sse11730771&quot; width=&quot;595&quot;&gt; &lt;param name=&quot;movie&quot; value=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=nodejs-120224031311-phpapp01&amp;rel=0&amp;stripped_title=introduction-to-nodejs-11730771&amp;userName=vikasing&quot; /&gt; &lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;/&gt; &lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;/&gt; &lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;/&gt; &lt;embed name=&quot;__sse11730771&quot; src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=nodejs-120224031311-phpapp01&amp;rel=0&amp;stripped_title=introduction-to-nodejs-11730771&amp;userName=vikasing&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; wmode=&quot;transparent&quot; width=&quot;595&quot; height=&quot;497&quot;&gt;&lt;/embed&gt; &lt;/object&gt; &lt;br /&gt;
&lt;div style=&quot;padding: 5px 0 12px;&quot;&gt;
View more &lt;a href=&quot;http://www.slideshare.net/&quot; target=&quot;_blank&quot;&gt;presentations&lt;/a&gt; from &lt;a href=&quot;http://www.slideshare.net/vikasing&quot; target=&quot;_blank&quot;&gt;Vikash Singh&lt;/a&gt; &lt;/div&gt;
&lt;/div&gt;
</description><link>http://www.vikasing.com/2012/04/introduction-to-nodejs.html</link><author>noreply@blogger.com (Vik)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-5317073097836036229</guid><pubDate>Mon, 26 Mar 2012 20:30:00 +0000</pubDate><atom:updated>2012-03-27T02:04:26.110+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>Extracting meaningful text from webpages</title><description>I was trying to extract the meaningful text from a webpage for a given URL for &lt;a href=&quot;http://code.google.com/p/crowl/&quot; target=&quot;_blank&quot;&gt;crowl&lt;/a&gt;. For example if I visit any news site for a particular article, I will find a lot of crap (clutter) with the news text, this includes: ads, related news stories, top news stories, comments on the article, other web site links and much more.&lt;br /&gt;
Lets take an example of this The Times of India article:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://timesofindia.indiatimes.com/tech/news/hardware/83-year-old-woman-sues-Apple-for-1m/articleshow/12415012.cms&quot; target=&quot;_blank&quot;&gt;&amp;nbsp;http://timesofindia.indiatimes.com/tech/news/hardware/83-year-old-woman-sues-Apple-for-1m/articleshow/12415012.cms&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The useful text in the The Times of India article has around 30% share of total content, the remaining 70% is the clutter. You may argue that you need those links related to most popular stories, related stories etc. But sill a lot of extra stuff is there which we really don&#39;t care about. &amp;nbsp;(Meaningful) Information extraction from such a page is a big nightmare. We can start with getting the HTML source and stripping the HTML tags from the text.&amp;nbsp;&amp;nbsp;Using regular expressions, lets remove all the links too. The resultant content will look like:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;white-space: pre-wrap; word-wrap: break-word;&quot;&gt;83-year-old woman sues Apple for $1m - The Times of India | The Times of India | | More More ADVERTISEMENT Hardware The Times of India The Times of India Indiatimes Web (by Google) Video Photos You are here: &amp;nbsp;» &amp;nbsp; » &amp;nbsp; » Hardware Breaking News: 83-year-old woman sues Apple for $1m The writer has posted comments on this articleANI | Mar 26, 2012, 04.42PM IST My Saved articles Read more:||||||| SHARE AND DISCUSS NEW YORK: An 83-year-old American woman has sued for 1 million dollars after she failed to see the glass door at the tech giant&#39;s office and smashed her face. Evelyn Paswall, a former Manhattan fur-company vice president, went to to return an on December 13. While approaching the store, Paswall didn&#39;t realize she was heading straight for a wall of glass. She smashed her face against it, breaking her nose, Paswall claims in her suit filed in the US Eastern District federal court. Now the Forest Hills, Queens, resident, Paswall claimed in her lawsuit that the company was negligent not elderly-proofing the store&#39;s see-through fa ade, The New York Post reports. She argues that Apple should have put marks on the glass that older people could spot before they come face-to-face with disaster. &quot;The defendant was negligent . . . in allowing a clear, see-through glass wall and/or door to exist without proper warning,&quot; Paswall suit said. Hi ! Do you like this story? My saved articles RELATED COVERAGE Articles Blogs LATEST NEWS » ......&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
As you can observe the above text has a lot of extra text which we don&#39;t want. Attempts have been made to get extract the main content, here is one such article:&amp;nbsp;&lt;a href=&quot;http://www.chrisspen.com/blog/how-to-extract-a-webpages-main-article-content.html&quot; target=&quot;_blank&quot;&gt;How to Extract a Webpage’s Main Article Content&lt;/a&gt;&lt;br /&gt;
The Java program to get&amp;nbsp;the&amp;nbsp;above text: (Jsoup can be downloaded from &lt;a href=&quot;http://jsoup.org/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;)&lt;/div&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java;&quot;&gt; public static void main(String[] args) throws Exception {
     String href=&quot;(&lt;a(.|\n)*?&gt;.*?&amp;lt;\\/a&amp;gt;)&quot;;
     Document doc = Jsoup.connect(&quot;http://timesofindia.indiatimes.com/tech/news/hardware/83-year-old-woman-sues-Apple-for-1m/articleshow/12415012.cms&quot;).get();
            String source = doc.html();
            source = source.replaceAll(href, &quot;&quot;);
     System.out.println(Jsoup.parse(source).text());
 }
&lt;/a(.|\n)*?&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
The best Java lib I could find to get the main text from a web page was &lt;a href=&quot;http://code.google.com/p/boilerpipe/&quot; target=&quot;_blank&quot;&gt;boilerpipe&lt;/a&gt;,&amp;nbsp;and the same&amp;nbsp;can be tested &lt;a href=&quot;http://boilerpipe-web.appspot.com/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;. It does a pretty good job of removing the clutter around the meaningful text. Running the The Times of India news article link through boilerpipe gives the following text:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;white-space: pre-wrap; word-wrap: break-word;&quot;&gt;Tweet
NEW YORK: An 83-year-old American woman has sued Apple for 1 million dollars after she failed to see the glass door at the tech giant&#39;s office and smashed her face.
Evelyn Paswall, a former Manhattan fur-company vice president, went to Apple&#39;s Manhasset store to return an iPhone on December 13.
While approaching the store, Paswall didn&#39;t realize she was heading straight for a wall of glass.
She smashed her face against it, breaking her nose, Paswall claims in her suit filed in the US Eastern District federal court.
Now the Forest Hills, Queens, resident, Paswall claimed in her lawsuit that the company was negligent not elderly-proofing the store&#39;s see-through fa ade, The New York Post reports.
She argues that Apple should have put marks on the glass that older people could spot before they come face-to-face with disaster.
&quot;The defendant was negligent . . . in allowing a clear, see-through glass wall and/or door to exist without proper warning,&quot; Paswall suit said.
Hi !&lt;/pre&gt;
&lt;br /&gt;
The above text is very close to what we want. Boilerpipe library is based on &lt;a href=&quot;http://www.l3s.de/~kohlschuetter/publications/wsdm187-kohlschuetter.pdf&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; paper. By&amp;nbsp;combining&amp;nbsp;Jsoup (to get the page title) with boilerpipe (to get the page content) we can get the meaningful content from a webpage.&lt;br /&gt;
&lt;br /&gt;</description><link>http://www.vikasing.com/2012/03/extracting-meaningful-text-from.html</link><author>noreply@blogger.com (Vik)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-5710108813871405372</guid><pubDate>Sat, 09 Jul 2011 20:02:00 +0000</pubDate><atom:updated>2011-07-10T01:41:50.417+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">MongoDB</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>A Note on YCSB</title><description>Recently we had to benchmark a number of In-Memory databases available, mainly open source ones. I didn&#39;t know about YCSB until my architect told me about it.&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;YCSB = &lt;a href=&quot;https://github.com/brianfrankcooper/YCSB&quot;&gt;Yahoo! Cloud Serving Benchmark &lt;/a&gt;&lt;/b&gt;&lt;/blockquote&gt;
It didn&#39;t impress me at first because it was from Yahoo! no offense but Yahoo! still expects us to pay for it&#39;s email POP3 access (Yahoo! Plus), they haven&#39;t learned anything from GMail, immaturity at its best. Nevertheless we started our benchmarking with Oracle and MongoDB. I know neither of them is an in-memory database but we liked the concept of memory mapped data of MongoDB. &lt;br /&gt;
&lt;br /&gt;
I wrote the Oracle client for YCSB and MongoDB client was included with the benchmark code (thanks to Yen Pai). Writing a client for YCSB is fairly simple and that&#39;s what impressed me. But my impressions were washed away by horrible glitches I found in the included drivers as well as in YCSB code itself. There are a number of forks (including mine, which is a dead one by the way) which provide a lot of patches to the original YCSB code and include many new clients as well but the owner of the project Brian Frank Cooper has a very small interest in reviewing them.&lt;br /&gt;
&lt;br /&gt;
I ran the first benchmark on 1,00,000 data sets for all the work loads provided with YCSB. Default workloads are not sufficient to test all the operation properly, which forced me to create my own workload configuration. It turned out that MongoDB was just 2-4 times faster than Oracle and that didn&#39;t impressed us much. So we considered Gemfire and Hazelcast as well, both &quot;real&quot; in-memory databases, one open source and other commercial (a 60 day trial in this case).&lt;br /&gt;
&lt;br /&gt;
Again I had to write the clients for both the new DBs and it turned out to be a piece of cake. I have to admit YCSB has a great pluggability, plugging a client for any db just requires the driver libs + some 20 lines of code and you are done . YCSB can also run on multiple machines. YCSB offers a great platform for benchmarking any kind of database out there and same should be realized by Yahoo! or Brian Cooper who can put some more effort in its development.&lt;br /&gt;
&lt;br /&gt;
Here are the results of MongoDB, Gemfire and Hazelcast benchmarks on 100000 data sets:&lt;br /&gt;
&lt;br /&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;min-height: 14.5pt;&quot;&gt;&lt;td style=&quot;border: solid black 1.0pt; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 103.1pt;&quot; valign=&quot;top&quot; width=&quot;137&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;Operation (100,000)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td colspan=&quot;3&quot; style=&quot;border-left: none; border: solid black 1.0pt; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 73.3pt;&quot; valign=&quot;top&quot; width=&quot;98&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;DBs Throughput (operations/sec)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;min-height: 14.5pt;&quot;&gt;
&lt;td style=&quot;border-top: none; border: solid black 1.0pt; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 103.1pt;&quot; valign=&quot;top&quot; width=&quot;137&quot;&gt;&lt;div align=&quot;right&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: right; text-autospace: none;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 73.3pt;&quot; valign=&quot;top&quot; width=&quot;98&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;Gemfire&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 71.75pt;&quot; valign=&quot;top&quot; width=&quot;96&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;MongoDB&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 72.5pt;&quot; valign=&quot;top&quot; width=&quot;97&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;Hazelcast&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;min-height: 14.5pt;&quot;&gt;
&lt;td style=&quot;border-top: none; border: solid black 1.0pt; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 103.1pt;&quot; valign=&quot;top&quot; width=&quot;137&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;Write (ops/sec)&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 73.3pt;&quot; valign=&quot;top&quot; width=&quot;98&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;3032.324&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 71.75pt;&quot; valign=&quot;top&quot; width=&quot;96&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;5123.475&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 72.5pt;&quot; valign=&quot;top&quot; width=&quot;97&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;3709.336&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr style=&quot;min-height: 14.5pt;&quot;&gt;
&lt;td style=&quot;border-top: none; border: solid black 1.0pt; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 103.1pt;&quot; valign=&quot;top&quot; width=&quot;137&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;Read (ops/sec)&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 73.3pt;&quot; valign=&quot;top&quot; width=&quot;98&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;7634.170&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 71.75pt;&quot; valign=&quot;top&quot; width=&quot;96&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;7825.338&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
&lt;td style=&quot;border-bottom: solid black 1.0pt; border-left: none; border-right: solid black 1.0pt; border-top: none; min-height: 14.5pt; padding: 0in 1.5pt 0in 1.5pt; width: 72.5pt;&quot; valign=&quot;top&quot; width=&quot;97&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center; text-autospace: none;&quot;&gt;
&lt;span style=&quot;color: black;&quot;&gt;4315.367&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
MongoDB turns out to be the winner, the reason which I can think of is that both Gemfire and Hazelcast use JVM but MongoDB leaves everything to OS by mapping the data into memory.&lt;br /&gt;
&lt;br /&gt;
More about YCSB can be found &lt;a href=&quot;http://research.yahoo.com/files/ycsb.pdf&quot;&gt;here&lt;/a&gt; and on the &lt;a href=&quot;https://github.com/brianfrankcooper/YCSB/wiki&quot;&gt;wiki &lt;/a&gt;</description><link>http://www.vikasing.com/2011/07/note-on-ycsb.html</link><author>noreply@blogger.com (Vik)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-1191900696247282631</guid><pubDate>Sun, 26 Jun 2011 09:42:00 +0000</pubDate><atom:updated>2011-06-26T21:46:50.780+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Xeneral</category><title>Find Me Lazy</title><description>I was supposed to write a New Year post six months back, I didn&#39;t. Someone last week asked me what are you best at, I didn&#39;t (or couldn&#39;t) answer, now I guess laziness is what I am best at. Last year&#39;s new year post can be found &lt;a href=&quot;http://www.vikasing.com/2010/01/bad-old-year-happy-new-year.html&quot;&gt;here&lt;/a&gt; which I posted just after 3 days of new year. This year I am late by just 6 months. So I&#39;ll summarize whats happened in last 18 months span:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Series I finished:&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0306414/&quot;&gt;The Wire &lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0118421/&quot;&gt;OZ  &lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0995832/&quot;&gt;Generation Kill &lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0248654/&quot;&gt;Six Feet Under&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0098936/&quot;&gt;Twin Peaks&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0950701/&quot;&gt;The Life and Times of Tim &lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0285331/&quot;&gt;24&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0830361/&quot;&gt;The Lost Room&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0374463/&quot;&gt;The Pacific&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0118298/&quot;&gt;Daria&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0403778/&quot;&gt;Long Way Round&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt1702042/&quot;&gt;An Idiot Abroad&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt1442449/&quot;&gt;Spartcus: Blood and Sand&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Series which I started following&lt;/b&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0903747/&quot;&gt;Breaking Bad&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0944947/&quot;&gt;Game of Thrones&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0835434/&quot;&gt;In Treatment&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0472954/&quot;&gt;Its Always Sunny In Philadelphia&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt1553644/&quot;&gt;The Ricky Gervais Show&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0417373/&quot;&gt;The Venture Bros.&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0487831/&quot;&gt;The IT Crowd&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt0979432/&quot;&gt;Boardwalk Empire&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.imdb.com/title/tt1119644/&quot;&gt;Fringe&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Apart from series, movies and games; few more insignificant things happened in my life:&lt;br /&gt;
Started a project &lt;a href=&quot;http://code.google.com/p/crowl/&quot;&gt;Crowl&lt;/a&gt; and released first revision (0.1)&lt;br /&gt;
Shifted to Noida from Bangalore.&lt;br /&gt;
Started gizmoage.com.&lt;br /&gt;
Finished a couple of novels.&lt;br /&gt;
Finished following games:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Crysis 2&lt;/li&gt;
&lt;li&gt;Blur&lt;/li&gt;
&lt;li&gt;Battlefield: Bad Company 2&lt;/li&gt;
&lt;li&gt;Need for Speed: Hot Pursuit&lt;/li&gt;
&lt;li&gt;Call of Duty Black Ops&lt;/li&gt;
&lt;li&gt;Call Of Duty Modern Warfare 2&lt;/li&gt;
&lt;li&gt;Just Cause 2&lt;/li&gt;
&lt;/ul&gt;To add to the list I bought a car and still learning how to drive with L sign on front as well as back. In Jack Sparrow way: the feeling which someone should have after getting a car, I don&#39;t have it.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Caution: A Blurry Pic Ahead!&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHhJ-qAff1gYk9kAcxcokvDmDvcZhHntlJaR8haA4msXVvlGWJF-Yb4EQecJvXNaXZM6O_KumFh6NfX69yf5-ffAu6h_W_ZdUFH1-NuI6ScsU_9PSODPJb07jtbH6sNTEBVQL_3ml7L10/s1600/IMG_20110620_170929.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHhJ-qAff1gYk9kAcxcokvDmDvcZhHntlJaR8haA4msXVvlGWJF-Yb4EQecJvXNaXZM6O_KumFh6NfX69yf5-ffAu6h_W_ZdUFH1-NuI6ScsU_9PSODPJb07jtbH6sNTEBVQL_3ml7L10/s640/IMG_20110620_170929.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</description><link>http://www.vikasing.com/2011/06/find-me-lazy.html</link><author>noreply@blogger.com (Vik)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHhJ-qAff1gYk9kAcxcokvDmDvcZhHntlJaR8haA4msXVvlGWJF-Yb4EQecJvXNaXZM6O_KumFh6NfX69yf5-ffAu6h_W_ZdUFH1-NuI6ScsU_9PSODPJb07jtbH6sNTEBVQL_3ml7L10/s72-c/IMG_20110620_170929.jpg" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-6823044875072562943</guid><pubDate>Sat, 20 Nov 2010 23:25:00 +0000</pubDate><atom:updated>2015-03-18T18:11:43.262+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">algo</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>A Simple URL Shortening Algorithm in JAVA</title><description>We have so many url shortening services available today, I am not sure what kind of algorithm they use to shorten a particular url. Given the limitations over the characters which can be used in a url it becomes pretty much obvious that we are limited to 62 alpha numeric chars i.e. [a-z 0-9 A-Z]. Though - (hyphen) and _ (underscore) are allowed in a url still we want to avoid them for many good reasons. Very obvious would be a bad looking url like http://xyz.com/&lt;b&gt;c0--rw_&lt;/b&gt; or http://xyz.com/&lt;b&gt;______-.&lt;/b&gt;&lt;br /&gt;
Following is the simple implementation of base10 to base62 converter, that&#39;s all we need to shorten a url. With 62 chars and a unique string 7 char long we can shorten:&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;62&lt;sup&gt;7&lt;/sup&gt; = 3,521,614,606,208&lt;/b&gt; urls&lt;/blockquote&gt;
that&#39;s a lots of urls. &lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;How shortening works in the present case:&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Suppose you have a table with following columns: &lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;1. unique auto increment id&lt;/b&gt; (long), &lt;br /&gt;
&lt;b&gt;2. url &lt;/b&gt;(string), &lt;br /&gt;
&lt;b&gt;3. base62 string &lt;/b&gt;(string)&lt;/blockquote&gt;
Now the trick is that we convert unique id to base62 string not the url, and then the url is mapped to the unique id. For example if we want to shorten the following url:&lt;br /&gt;
&lt;blockquote&gt;
&lt;i&gt;http://news.xinhuanet.com/english2010/world/2010-11/18/c_13612801.htm&lt;/i&gt;&lt;/blockquote&gt;
First we need to look for the last unique id in the table then add 1 to it and convert the resulting number to base62. Suppose last unique id was 678544325 now the next id 678544326 will be mapped to the above url and base62 of a 678544326 will be:&lt;br /&gt;
&lt;blockquote&gt;
&lt;b&gt;45*62&lt;sup&gt;4&lt;/sup&gt;&lt;/b&gt;&lt;b&gt;+57*62&lt;sup&gt;3&lt;/sup&gt;&lt;/b&gt;&lt;b&gt;+6*62&lt;sup&gt;2&lt;/sup&gt;&lt;/b&gt;&lt;b&gt;+23*62&lt;sup&gt;1&lt;/sup&gt;&lt;/b&gt;&lt;b&gt;+20*62&lt;sup&gt;0&lt;/sup&gt;&lt;/b&gt;&lt;/blockquote&gt;
means a five char url, having following array indexes {45}{57}{6}{23}{20} in&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;String[] elements = {
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;,&quot;e&quot;,&quot;f&quot;,&quot;g&quot;,&quot;h&quot;,&quot;i&quot;,&quot;j&quot;,&quot;k&quot;,&quot;l&quot;,&quot;m&quot;,&quot;n&quot;,&quot;o&quot;,
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;p&quot;,&quot;q&quot;,&quot;r&quot;,&quot;s&quot;,&quot;t&quot;,&quot;u&quot;,&quot;v&quot;,&quot;w&quot;,&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;8&quot;,&quot;9&quot;,&quot;0&quot;,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;,&quot;F&quot;,&quot;G&quot;,&quot;H&quot;,&quot;I&quot;,
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;J&quot;,&quot;K&quot;,&quot;L&quot;,&quot;M&quot;,&quot;N&quot;,&quot;O&quot;,&quot;P&quot;,&quot;Q&quot;,&quot;R&quot;,&quot;S&quot;,&quot;T&quot;,&quot;U&quot;,&quot;V&quot;,&quot;W&quot;,&quot;X&quot;,
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;Y&quot;,&quot;Z&quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; };
&lt;/pre&gt;
which will give a base62 string: &lt;b&gt;JVgxu&lt;/b&gt; and a shortened url can be &lt;b&gt;http://xyz.com/JVgxu&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Following is the java code to convert a number to base62 string&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/**
 * @author vikasing
 *
 */
public class Base62Converter {
    private final int LENGTH_OF_URL_CODE=6;
    public String convertTo62Base(long toBeConverted)
    {
        String[] elements = {
                &quot;a&quot;,&quot;b&quot;,&quot;c&quot;,&quot;d&quot;,&quot;e&quot;,&quot;f&quot;,&quot;g&quot;,&quot;h&quot;,&quot;i&quot;,&quot;j&quot;,&quot;k&quot;,&quot;l&quot;,&quot;m&quot;,&quot;n&quot;,&quot;o&quot;,
                &quot;p&quot;,&quot;q&quot;,&quot;r&quot;,&quot;s&quot;,&quot;t&quot;,&quot;u&quot;,&quot;v&quot;,&quot;w&quot;,&quot;x&quot;,&quot;y&quot;,&quot;z&quot;,&quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,
                &quot;5&quot;,&quot;6&quot;,&quot;7&quot;,&quot;8&quot;,&quot;9&quot;,&quot;0&quot;,&quot;A&quot;,&quot;B&quot;,&quot;C&quot;,&quot;D&quot;,&quot;E&quot;,&quot;F&quot;,&quot;G&quot;,&quot;H&quot;,&quot;I&quot;,
                &quot;J&quot;,&quot;K&quot;,&quot;L&quot;,&quot;M&quot;,&quot;N&quot;,&quot;O&quot;,&quot;P&quot;,&quot;Q&quot;,&quot;R&quot;,&quot;S&quot;,&quot;T&quot;,&quot;U&quot;,&quot;V&quot;,&quot;W&quot;,&quot;X&quot;,
                &quot;Y&quot;,&quot;Z&quot;
                };
        String convertedString=&quot;&quot;;
        int numOfDiffChars= elements.length;
        if(toBeConverted&amp;lt;numOfDiffChars+1 &amp;amp;&amp;amp; toBeConverted&amp;gt;0)
        {
            convertedString=elements[(int) (toBeConverted-1)];
        }
        else if(toBeConverted&amp;gt;numOfDiffChars)
        {
            long mod = 0;
            long multiplier = 0;
            boolean determinedTheLength=false;
            for(int j=LENGTH_OF_URL_CODE;j&amp;gt;=0;j--)
            {
                multiplier=(long) (toBeConverted/Math.pow(numOfDiffChars,j));
                if(multiplier&amp;gt;0 &amp;amp;&amp;amp; toBeConverted&amp;gt;=numOfDiffChars)
                {
                    convertedString+=elements[(int) multiplier];
                    determinedTheLength=true;
                }
                else if(determinedTheLength &amp;amp;&amp;amp; multiplier==0)
                {
                    convertedString+=elements[0];
                }
                else if(toBeConverted&amp;lt;numOfDiffChars)
                {
                    convertedString+=elements[(int) mod];
                }
                
                mod=(long) (toBeConverted%Math.pow(numOfDiffChars,j));
                toBeConverted=mod;                
            }
            
        }
        return convertedString;
    }

}
&lt;/pre&gt;
Above code is part of the project &lt;a href=&quot;http://code.google.com/p/crowl/&quot;&gt;Crowl&lt;/a&gt; on which I have been working for a while. File can be browsed under org.crow.utils package.&lt;br /&gt;
&lt;br /&gt;
Update: found this precise code for base62 conversion on the &lt;a href=&quot;http://javaconfessions.com/2008/09/convert-between-base-10-and-base-62-in_28.html&quot;&gt;web&lt;/a&gt;:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;public String converter ( int base, long decimalNumber)
 {
  
   String tempVal = decimalNumber == 0 ? &quot;0&quot; : &quot;&quot;;
         long mod = 0;

         while( decimalNumber != 0 ) {
             mod = decimalNumber % base;
             tempVal = baseDigits.substring( (int)mod, (int)mod + 1 ) + tempVal;
             decimalNumber = decimalNumber / base;
         }
         System.out.print(tempVal);
         return tempVal;
 }
&lt;/pre&gt;
&lt;br /&gt;
I didn&#39;t check the performance of the above code but it is smaller than the first one but both give the same output.</description><link>http://www.vikasing.com/2010/11/simple-url-shortening-algorithm-in-java.html</link><author>noreply@blogger.com (Vik)</author><thr:total>9</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-6522237971378761777</guid><pubDate>Sun, 24 Oct 2010 22:17:00 +0000</pubDate><atom:updated>2010-10-26T01:43:30.707+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Xeneral</category><title>10 TV series You Don&#39;t Want to Miss</title><description>I watched (or started following) &lt;a href=&quot;http://www.vikasing.com/2010/01/bad-old-year-happy-new-year.html&quot;&gt;15 TV series in 2009&lt;/a&gt; itself and in 2010 I was able to finish another 6. Here is a list of some of the great series you wouldn&#39;t wanna miss:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1.&lt;/b&gt;&lt;a href=&quot;http://draft.blogger.com/goog_1910856731&quot;&gt; &lt;/a&gt;&lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0141842/&quot;&gt;The Sopranos&lt;/a&gt;:&lt;/b&gt; You&#39;ll have to get through a couple of episodes first to get to know whats really going on. Its one of the best series HBO ever produced, depicting a New Jersey mafia family. Watch Tony Sopranos running a mafia family and struggling with his own.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtfhpdZizzTk4rvSVuAs-CcryhADde9jUkY3SOPeTMiYzondZ6DoCVR4t6d_dPu1LGqAykoifEAOrYj05Y_rmryfO1aoZdWbnuJ0zhjDMNIygiRAmCxRaDAdrIGjmQZ9F_sXvHhgEmRcQ/s1600/sopranos.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtfhpdZizzTk4rvSVuAs-CcryhADde9jUkY3SOPeTMiYzondZ6DoCVR4t6d_dPu1LGqAykoifEAOrYj05Y_rmryfO1aoZdWbnuJ0zhjDMNIygiRAmCxRaDAdrIGjmQZ9F_sXvHhgEmRcQ/s640/sopranos.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;2.&lt;/b&gt; &lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0118421/&quot;&gt;OZ&lt;/a&gt;&lt;/b&gt;: This is my favorite from HBO, it shows the daily life of prisoners in a maximum security penitentiary. It has got every possible face of crime. One of the many things I like about HBO is that it gives its characters a complete freedom and doesn&#39;t hesitate in showing anything, things which can&#39;t be seen on any other channel. The narration of character &lt;a href=&quot;http://www.imdb.com/character/ch0021487/&quot;&gt;Augustus Hill&lt;/a&gt; is one of the best part of the series.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLv2Cf7kP025uCEhL9fhubAvVNDo-rnOIyg3SMb_iox7_gMNdfwS4HWhwKux3Lx6rfI2HDOd5sRa0DipJKQV3fppDp0mBP42JTCFD9VWpseMUlYX7ACZWMVb4elgZgwJxccdk_nBhAq_0/s1600/oz.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLv2Cf7kP025uCEhL9fhubAvVNDo-rnOIyg3SMb_iox7_gMNdfwS4HWhwKux3Lx6rfI2HDOd5sRa0DipJKQV3fppDp0mBP42JTCFD9VWpseMUlYX7ACZWMVb4elgZgwJxccdk_nBhAq_0/s1600/oz.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;3.&lt;/b&gt; &lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0773262/&quot;&gt;Dexter&lt;/a&gt;&lt;/b&gt;: When it comes to the narration Dexter takes the cake,          &lt;a href=&quot;http://www.imdb.com/name/nm0355910/&quot;&gt;Michael C. Hall&lt;/a&gt; is a great actor and he fits perfectly in the role of a serial killer. Although many times a factor of luck plays an important role in the life of Dexter, the character of Dexter is very strong. A serial killer who can&#39;t feel any emotions: that&#39;s new and fresh.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOjwbXz-j8m-xvbWjRNItbmCiGUGLl5wYe7Wo_YuwlZUuUjEH21Vm5qC45fx-iY86JN5SCOTxJmBUsfUvjnD5G6pMiIoA7XR2BFFfp8oP3ofaN1_vNnJH23sS38kVLDCqy_wYZsoXz2lY/s1600/dexter-wallpaper-tv-show-9.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;360&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOjwbXz-j8m-xvbWjRNItbmCiGUGLl5wYe7Wo_YuwlZUuUjEH21Vm5qC45fx-iY86JN5SCOTxJmBUsfUvjnD5G6pMiIoA7XR2BFFfp8oP3ofaN1_vNnJH23sS38kVLDCqy_wYZsoXz2lY/s640/dexter-wallpaper-tv-show-9.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;4.&lt;/b&gt; &lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0264235/&quot;&gt;Curb Your Enthusiasm&lt;/a&gt;&lt;/b&gt;: Co-creator of &lt;a href=&quot;http://www.imdb.com/title/tt0098904/&quot;&gt;Seinfeld&lt;/a&gt;&lt;b&gt; &lt;/b&gt;&lt;a href=&quot;http://www.imdb.com/name/nm0202970/&quot;&gt;Larry David&lt;/a&gt; unites with HBO to produce this masterpiece. Believe me this series is better than Seinfeld, I have to admit I could not finish watching Seinfeld beyond 5th season because of its repetitive expressions/actions/dialogues. I liked Kramer but others became dull and boring after a certain number of episodes. Curb Your Enthusiasm shows David&#39;s daily life and his unusual way of handling the everyday matters.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlRVXKANAoXoBsvweUgYlM4bJEPUD0jkCKuvybQztqAL3tiuneaEW4gOlbE91zjd9skFU8L9obKwLZYpD5yJGMPmiDcyKp7oj-2MxCvKnMQPZlteaWUpOUQjh5OAjQ3L87AxVp52c8eWU/s1600/tv_curb_your_enthusiasm01.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;432&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlRVXKANAoXoBsvweUgYlM4bJEPUD0jkCKuvybQztqAL3tiuneaEW4gOlbE91zjd9skFU8L9obKwLZYpD5yJGMPmiDcyKp7oj-2MxCvKnMQPZlteaWUpOUQjh5OAjQ3L87AxVp52c8eWU/s640/tv_curb_your_enthusiasm01.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;5.&lt;/b&gt; &lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0185906/&quot;&gt;The Band of Brothers&lt;/a&gt;&lt;/b&gt; and &lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0374463/&quot;&gt;The Pacific&lt;/a&gt;&lt;/b&gt;: If you liked Saving Private Ryan, you don&#39;t wanna miss these two mini-series produced by HBO with the collaboration of Steven Spielberg and Tom Hanks. Aren&#39;t the names of these two masters enough? Both are based on World War-II.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil5lkjw1sF23V0fkUQc2GmrwgTSFU2Nqfyo1tUXf-PGLzqnc8hXB9QZyo73vz8jxIhii_9_yOEmxTrYQC524PXF7XdRfE1BX7iWWDE4YtbbmDvvtNBxDwuIiWXT__lN9mu9t0H9I9srbI/s1600/MV5BMTkxOTEzMTk5NV5BMl5BanBnXkFtZTYwNzkzNjc3._V1._SX485_SY389_.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil5lkjw1sF23V0fkUQc2GmrwgTSFU2Nqfyo1tUXf-PGLzqnc8hXB9QZyo73vz8jxIhii_9_yOEmxTrYQC524PXF7XdRfE1BX7iWWDE4YtbbmDvvtNBxDwuIiWXT__lN9mu9t0H9I9srbI/s1600/MV5BMTkxOTEzMTk5NV5BMl5BanBnXkFtZTYwNzkzNjc3._V1._SX485_SY389_.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;6.&lt;/b&gt; &lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0384766/&quot;&gt;Rome&lt;/a&gt;&lt;/b&gt;: BBC has produced a few documentary series&#39;s on Rome before. For this 2 season series BBC unites with HBO to produce a great series, which covers the most important time in history of Roman Empire, the lives of Julius Caesar and Augustus when the Rome expanded the most.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4nTz45CrjLkJ3Q3NkKHaWNlL74ArC2hKnq_v-NuW57mqrG_b1wc5mhtYCGmmboWIoNdWX4kmKAt7LLBBWilBUyefNguo951n-w0_96qb8L9P8YcmTLqIq90iO8aL4X1g5V6QQBXkvabg/s1600/rome.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;480&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4nTz45CrjLkJ3Q3NkKHaWNlL74ArC2hKnq_v-NuW57mqrG_b1wc5mhtYCGmmboWIoNdWX4kmKAt7LLBBWilBUyefNguo951n-w0_96qb8L9P8YcmTLqIq90iO8aL4X1g5V6QQBXkvabg/s640/rome.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0jda7flZluhMBXiwdZuMVLLF66D3yJhBDKZxp3y5U4WjuVv8vVR0k_uQslh5zx8okeuNWq9St6QVnolCjnSglckAE4u_yA9sYHszmJEC-FHFO2E9MDirOYXLc31ALikkjaDAw9b69wyw/s1600/arrested-development-02-1024x767.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;
&lt;/a&gt;&lt;/div&gt;&lt;b&gt;7. &lt;/b&gt;&lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0319969/&quot;&gt;Carnivàle&lt;/a&gt;&lt;/b&gt;: This is again from HBO, a  kind of serious and disturbing drama series set in 1934. Its a story of a Carnivàle which travels around and a fugitive Ben who joins the Carnivàle. It is great to watch the superb&amp;nbsp; acting from these nobodies. Its a  (sadly) 2 season series with some amazing background music.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMGbkyw1r6D_hEqi3Ua4pWsIZDLSK1Z-V0-_kNUq4JGVmLJx6bCpoC8hMLMHnt3aTSuFrb1K9qGXPvNg9CfIiLpHKHm-1zztvvQk9tcWAPFGxf5jpM3gktKxCh8Kk4pMgNIAEK0Bmmaoo/s1600/Carnivale.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMGbkyw1r6D_hEqi3Ua4pWsIZDLSK1Z-V0-_kNUq4JGVmLJx6bCpoC8hMLMHnt3aTSuFrb1K9qGXPvNg9CfIiLpHKHm-1zztvvQk9tcWAPFGxf5jpM3gktKxCh8Kk4pMgNIAEK0Bmmaoo/s1600/Carnivale.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;8.&lt;/b&gt;&lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0367279/&quot;&gt; Arrested Development&lt;/a&gt;&lt;/b&gt;: Its neither like FRIENDS nor like Seinfeld, its a different kind of comedy series from Fox. A story of a broken (or stupid) family. Jason Bateman tries to fix the problems of the family only to find himself in the funniest situations.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0jda7flZluhMBXiwdZuMVLLF66D3yJhBDKZxp3y5U4WjuVv8vVR0k_uQslh5zx8okeuNWq9St6QVnolCjnSglckAE4u_yA9sYHszmJEC-FHFO2E9MDirOYXLc31ALikkjaDAw9b69wyw/s1600/arrested-development-02-1024x767.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;476&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0jda7flZluhMBXiwdZuMVLLF66D3yJhBDKZxp3y5U4WjuVv8vVR0k_uQslh5zx8okeuNWq9St6QVnolCjnSglckAE4u_yA9sYHszmJEC-FHFO2E9MDirOYXLc31ALikkjaDAw9b69wyw/s640/arrested-development-02-1024x767.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;9.&lt;/b&gt;&lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0098936/&quot;&gt; Twin Peaks&lt;/a&gt;&lt;/b&gt;: Twin Peaks is a name of the town in which a murder takes place and an FBI agent visits the town to investigate the murder, this investigation covers the whole two seasons. The series is known for its bizarre characters e.g the main character Dale Cooper likes black coffee and cherry pie and it can be seen very often. Twin Peaks became a huge hit and almost gave birth to a cult.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyWjsOul48BO18j6b4IqZgvs_8LSRhSz1YftebPmClT5mcjJMeRReQIhxsI38wnYFPWBklDww2gn5Av0MUutwDVwmEHsGuGLHDbRkf0KKEYsNTrPlWb2SLpVSkZjtpVW27udtyC540-9c/s1600/twinpeaks_show_3.jpg&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyWjsOul48BO18j6b4IqZgvs_8LSRhSz1YftebPmClT5mcjJMeRReQIhxsI38wnYFPWBklDww2gn5Av0MUutwDVwmEHsGuGLHDbRkf0KKEYsNTrPlWb2SLpVSkZjtpVW27udtyC540-9c/s1600/twinpeaks_show_3.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;10.&lt;/b&gt; &lt;b&gt;&lt;a href=&quot;http://www.imdb.com/title/tt0904208/&quot;&gt;Californication&lt;/a&gt;&lt;/b&gt;:  I was surprised to see this kind of stuff coming from a non-HBO  channel. This is an amazing drama/comedy series from Showtime. The main  character Hank Moody is played by &lt;a href=&quot;http://www.imdb.com/name/nm0000141/&quot;&gt;David Duchovny&lt;/a&gt; who played Fox Mulder in The X-Files. Moody is an interesting character who tries to live his life in his own way and does many &#39;nasty&#39; things. Another interesting character is Charlie Runkle played by &lt;a href=&quot;http://www.imdb.com/name/nm0359577/&quot;&gt;Evan Handler.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn-P1lUnd0iFMkjfFou3DgxONUmhhLT1gSDMCqjdufpFXBvliPzyAxILkrF3XXH3KGQrNZ81j_3A8yzUsBKVq8lsLp_Dpfu-r5CHcNdWmWVJ3TyGFIouN2bTyXor4tEgPXuPrTX7NGls4/s1600/watch_californication_megavideo.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn-P1lUnd0iFMkjfFou3DgxONUmhhLT1gSDMCqjdufpFXBvliPzyAxILkrF3XXH3KGQrNZ81j_3A8yzUsBKVq8lsLp_Dpfu-r5CHcNdWmWVJ3TyGFIouN2bTyXor4tEgPXuPrTX7NGls4/s1600/watch_californication_megavideo.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;</description><link>http://www.vikasing.com/2010/10/10-tv-series-you-dont-want-to-miss.html</link><author>noreply@blogger.com (Vik)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtfhpdZizzTk4rvSVuAs-CcryhADde9jUkY3SOPeTMiYzondZ6DoCVR4t6d_dPu1LGqAykoifEAOrYj05Y_rmryfO1aoZdWbnuJ0zhjDMNIygiRAmCxRaDAdrIGjmQZ9F_sXvHhgEmRcQ/s72-c/sopranos.jpg" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-6611897783730740738</guid><pubDate>Fri, 08 Jan 2010 21:08:00 +0000</pubDate><atom:updated>2010-01-13T01:57:22.248+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Gaming</category><title>available memory less than 128mb!!! -1 half life 2</title><description>Half Life 2 has got some problem on Vista 64 bit, it keeps crashing with a pop up message:&lt;br /&gt;
&lt;blockquote&gt;&amp;nbsp;available memory less than 128mb!!! -1&lt;br /&gt;
&lt;/blockquote&gt;Solution for this is to run Half Life in Windows XP Compatibility Mode, right click on the short-cut of Half Life, click on the &lt;b&gt;Compatibility&lt;/b&gt; tab, select &lt;b&gt;Run this program in compatibility mode for:&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicKKRmU82TK539g5ZKfC26OctTktIB05LW-3I47aoGkghVOBi4aQgOkNuyvltcwJPvEk8BjnZI9ft4kkheJBa_rUa1sRavg6jr5bRuwk1_3V4ntRgcBYix1pOcCMFfPFaByG3CzWkubao/s1600-h/half-life.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicKKRmU82TK539g5ZKfC26OctTktIB05LW-3I47aoGkghVOBi4aQgOkNuyvltcwJPvEk8BjnZI9ft4kkheJBa_rUa1sRavg6jr5bRuwk1_3V4ntRgcBYix1pOcCMFfPFaByG3CzWkubao/s400/half-life.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><link>http://www.vikasing.com/2010/01/available-memory-less-than-128mb-1-half.html</link><author>noreply@blogger.com (Vik)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicKKRmU82TK539g5ZKfC26OctTktIB05LW-3I47aoGkghVOBi4aQgOkNuyvltcwJPvEk8BjnZI9ft4kkheJBa_rUa1sRavg6jr5bRuwk1_3V4ntRgcBYix1pOcCMFfPFaByG3CzWkubao/s72-c/half-life.png" height="72" width="72"/><thr:total>21</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-2420546898179559534</guid><pubDate>Tue, 05 Jan 2010 20:39:00 +0000</pubDate><atom:updated>2010-01-13T00:16:21.086+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">glassfish</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>Enable GZip Compression on Glassfish v3</title><description>Login to https://localhost:4848 (admin panel). Go to the Network Config &amp;gt; Network Listener and select the listener for which you want to enable gzip. Click on the HTTP tab, see below:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvTu_IDRSJA0aVCRjRST_ZnJTmJhhVWaAhVDjU4C0TY46T3c6qvMLATLEPAcOfO9jClg084yDdfFz639hRa_0E6QOPBaIUvXAN7bU4zjBr0EvCy6qgmJN02g1Op0WTxjGpqxpx5xRQXmE/s1600-h/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvTu_IDRSJA0aVCRjRST_ZnJTmJhhVWaAhVDjU4C0TY46T3c6qvMLATLEPAcOfO9jClg084yDdfFz639hRa_0E6QOPBaIUvXAN7bU4zjBr0EvCy6qgmJN02g1Op0WTxjGpqxpx5xRQXmE/s400/1.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
Scroll down until you get the following entries:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcZuFjPLLCvctVU8yvsrvk8Rhkczcq-yCBifKtQyIFC8GZeN0Xi0J6XhHYj37-Ih382T1haaDpu-NDWiS3_qe_nnGn2gp4ZuAtqwbo5I0LkQNTAtEZ3nDFh21mcfxR5kl5d31VujlU96c/s1600-h/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjcZuFjPLLCvctVU8yvsrvk8Rhkczcq-yCBifKtQyIFC8GZeN0Xi0J6XhHYj37-Ih382T1haaDpu-NDWiS3_qe_nnGn2gp4ZuAtqwbo5I0LkQNTAtEZ3nDFh21mcfxR5kl5d31VujlU96c/s400/2.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;Select Compression= &lt;b&gt;on, &lt;/b&gt;Put the mime types and click on Save button.&lt;br /&gt;
Its done!!</description><link>http://www.vikasing.com/2010/01/enable-gzip-compression-on-glassfish-v3.html</link><author>noreply@blogger.com (Vik)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvTu_IDRSJA0aVCRjRST_ZnJTmJhhVWaAhVDjU4C0TY46T3c6qvMLATLEPAcOfO9jClg084yDdfFz639hRa_0E6QOPBaIUvXAN7bU4zjBr0EvCy6qgmJN02g1Op0WTxjGpqxpx5xRQXmE/s72-c/1.png" height="72" width="72"/><thr:total>6</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-7849417896242181398.post-7334179220504392033</guid><pubDate>Sun, 03 Jan 2010 16:33:00 +0000</pubDate><atom:updated>2015-03-18T18:14:30.154+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">MySQL</category><category domain="http://www.blogger.com/atom/ns#">Teq</category><title>mysql and jtpl template engine tutorial</title><description>&lt;a href=&quot;http://jtpl.sourceforge.net/&quot;&gt;jtpl&lt;/a&gt; is a light-weight java template engine, which is good for small size application but becomes sludgy for data intensive apps. Following example shows how to use jtpl with mysql.&lt;br /&gt;
&lt;br /&gt;
jtpl replaces everything which is put inside &lt;b&gt;{} &lt;/b&gt;and it uses html comments as entry and exit points&lt;br /&gt;
&lt;blockquote&gt;
&amp;lt; ! -- BEGIN: main -- &amp;gt;&lt;br /&gt;
{&lt;i&gt;This will be replaced by jtpl&lt;/i&gt;}&lt;br /&gt;
&lt;i&gt;{ThisToo}&lt;/i&gt;&lt;br /&gt;
&amp;lt; ! -- END: main -- &amp;gt;&lt;/blockquote&gt;
this template file should be saved with the extension .jtpl&lt;br /&gt;
In your servlet you need to create a Template object which will take template file as input parameter.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;Template tpl = new Template(new File(&quot;FULL_PATH\\home.jtpl&quot;));
&lt;/pre&gt;
&amp;nbsp;next you need to assign the value to the template parameters like:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;tpl.assign(&quot;ThisToo&quot;, &quot;Assigned Value Here !&quot;);&amp;nbsp;&lt;/pre&gt;
in the end template is parsed using &lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;tpl.parse(&quot;main&quot;);&amp;nbsp;&lt;/pre&gt;
If you have nested template regions in a template like this:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
&amp;lt; ! -- BEGIN: main -- &amp;gt;&lt;br /&gt;
&amp;lt; ! -- BEGIN: header-- &amp;gt; &lt;br /&gt;
&lt;i&gt;{Links}&lt;/i&gt;&lt;br /&gt;
&amp;lt; ! -- BEGIN: header-- &amp;gt;&lt;br /&gt;
&amp;lt; ! -- END: main -- &amp;gt;&lt;/blockquote&gt;
Everything remains same except when you parse, you&#39;ll have to parse the inner region first, like: &lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;tpl.parse(&quot;main.header&quot;); &lt;/pre&gt;
then the outer (or main) region:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;tpl.parse(&quot;main&quot;);&amp;nbsp;&lt;/pre&gt;
You can put as many regions you want inside a main region.&lt;br /&gt;
Using jtpl with mysql(or any other db) is simple as explained above. Here is a sample template file &lt;i&gt;home.jtpl&lt;/i&gt;:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&amp;lt;!-- BEGIN: main1 --&amp;gt;
&amp;lt;html&amp;gt;
    &amp;lt;head&amp;gt;
        &amp;lt;title&amp;gt;{PTITLE}&amp;lt;/title&amp;gt;       
    &amp;lt;/head&amp;gt;
    &amp;lt;body&amp;gt;
            &amp;lt;div&amp;gt;               
                    &amp;lt;div&amp;gt;
                       &amp;lt;a class=&quot;a&quot; href=&quot;/anylink1&quot;&amp;gt;{LINK1}&amp;lt;/a&amp;gt;
                       &amp;lt;a class=&quot;a&quot; href=&quot;/anylink2&quot;&amp;gt;{LINK2}&amp;lt;/a&amp;gt;
                       &amp;lt;a class=&quot;a&quot; href=&quot;/anylink3&quot;&amp;gt;{LINK3}&amp;lt;/a&amp;gt;
                    &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
            &amp;lt;div&amp;gt;
                &amp;lt;div&amp;gt;
                    &amp;lt;div&amp;gt;
                        &amp;lt;!-- BEGIN: div --&amp;gt;
                            &amp;lt;div&amp;gt;
                                &amp;lt;a target=&quot;_blank&quot; href =&quot;{LINK}&quot;&amp;gt;{TITLE}&amp;lt;/a&amp;gt;
                                &amp;lt;br&amp;gt;&amp;lt;span&amp;gt;{CONTENT}&amp;lt;/span&amp;gt;
                            &amp;lt;/div&amp;gt;
                        &amp;lt;!-- END: div --&amp;gt;
                    &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&amp;lt;!-- END: main1 --&amp;gt;&amp;nbsp;&lt;/pre&gt;
and here is the Servlet:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;import net.sf.jtpl.Template;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.*;

/**
 *
 * @author viksin
 */
public class sample extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        PrintWriter out = response.getWriter();
        try {
            out.print(this.generatePage());
        } catch (Exception e) {
            e.printStackTrace(out);
        } finally {
            out.close();
        }
    }

    protected String generatePage() throws Exception {
        Template tpl = null;
        Connection conn = null;
        Statement st = null;
        ResultSet rs = null;
        String Content = &quot;&quot;;
        TimeCalc tc = new TimeCalc();
        tpl = new Template(new File(&quot;FULL_PATH\\home.jtpl&quot;));
        tpl.assign(&quot;PTITLE&quot;, &quot;MySite&quot;);
        tpl.assign(&quot;LINK1&quot;, &quot;Home&quot;);
        tpl.assign(&quot;LINK2&quot;, &quot;News&quot;);
        tpl.assign(&quot;LINK3&quot;, &quot;About&quot;);
        try {
            Class.forName(&quot;org.gjt.mm.mysql.Driver&quot;).newInstance();
            conn = DriverManager.getConnection(&quot;mysql_URL&quot;, &quot;USERNAME&quot;, &quot;PASSWORD&quot;);
            st = conn.createStatement();
            rs = st.executeQuery(&quot;select title,link,content from table&quot;);
            while (rs.next()) {
                tpl.assign(&quot;TITLE&quot;, rs.getString(&quot;title&quot;));
                tpl.assign(&quot;CONTENT&quot;, rs.getString(&quot;content&quot;));
                tpl.assign(&quot;LINK&quot;, rs.getString(&quot;link&quot;));
                tpl.parse(&quot;main1.div&quot;);
            }           
            tpl.parse(&quot;main1&quot;);
        } catch (Exception ex) {
            return ex.toString();
        } finally {
            if (rs != null) {
                rs.close();
            }
            if (st != null) {
                st.close();
            }
            if (conn != null) {
                conn.close();
            }
        }
        return (tpl.out());
    }
}
&lt;/pre&gt;
jtpl is meant for small and simple applications, it does not have many features which other template engines like velocity, stringtemplate etc. have.&lt;br /&gt;
jtpl also uses the SingleThreadModel which is not recommended also it gets slower with large data.&lt;br /&gt;
Presently I am using StringTemplate which is faster and better than jtpl.</description><link>http://www.vikasing.com/2010/01/mysql-and-jtpl-template-engine-tutorial.html</link><author>noreply@blogger.com (Vik)</author><thr:total>0</thr:total></item></channel></rss>