<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Technology @ Kunal Cholera</title>
	<atom:link href="http://tech.kunalcholera.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.kunalcholera.com</link>
	<description>Computer Science Technology web experience of kunal cholera</description>
	<pubDate>Sat, 20 Mar 2010 03:34:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
	<language>en</language>
			<item>
		<title>Dynamic Regular expression generator</title>
		<link>http://tech.kunalcholera.com/dynamic-regular-expression-generator/</link>
		<comments>http://tech.kunalcholera.com/dynamic-regular-expression-generator/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 03:34:40 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=56</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/dynamic-regular-expression-generator/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Google Finance stock screen scrapping</title>
		<link>http://tech.kunalcholera.com/google-finance-stock-screen-scrapping/</link>
		<comments>http://tech.kunalcholera.com/google-finance-stock-screen-scrapping/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 03:33:26 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=54</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/google-finance-stock-screen-scrapping/feed/</wfw:commentRss>
		</item>
		<item>
		<title>InnerHTML vcs DOM -&gt; IE vcs Firefox -&gt; dynamic DOM manipulation</title>
		<link>http://tech.kunalcholera.com/innerhtml-vcs-dom-ie-vcs-firefox-dynamic-dom-manipulation/</link>
		<comments>http://tech.kunalcholera.com/innerhtml-vcs-dom-ie-vcs-firefox-dynamic-dom-manipulation/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 03:32:20 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=52</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/innerhtml-vcs-dom-ie-vcs-firefox-dynamic-dom-manipulation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>URL regular expression validation Javascript</title>
		<link>http://tech.kunalcholera.com/url-regular-expression-validation-javascript/</link>
		<comments>http://tech.kunalcholera.com/url-regular-expression-validation-javascript/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 03:31:32 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=50</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/url-regular-expression-validation-javascript/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Script to fill forms automatically.</title>
		<link>http://tech.kunalcholera.com/script-to-fill-forms-automatically/</link>
		<comments>http://tech.kunalcholera.com/script-to-fill-forms-automatically/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 08:51:00 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=42</guid>
		<description><![CDATA[
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Net;
using System.IO;
using System.Text.RegularExpressions;

namespace AutomationPost
{

	public class PersonInfo
	{
		public String name;
		public String email;
		public String contactNumber;
	}

	class Program
	{

		static List&#60;PersonInfo&#62; myVoters = new List&#60;PersonInfo&#62;();

		static void GenerateVoters()
		{
			//Scrap info from web site. or
			//http://hphappywheels.com/winners.php

			WebClient myDownloader = new WebClient();
			String webPageContents = myDownloader.DownloadString("http://hphappywheels.com/winners.php");
			webPageContents = webPageContents.Substring(webPageContents.IndexOf("919821232422")-30, webPageContents.Length - webPageContents.IndexOf("919821232422")-15);

			//Regex extractNameNumber = new Regex(@"&#60;tr&#62;&#60;td class=""listdata""&#62;(.*?)&#60;/td&#62;&#60;td class=""listdata""&#62;(.*?)&#60;/td&#62;&#60;td class=""listdata""&#62;(.*?)&#60;/td&#62;&#60;td class=""listdata""&#62;(.*?)&#60;/td&#62;&#60;td class=""listdata""&#62;(.*?)&#60;/td&#62;&#60;td class=""listdata""&#62;(.*?)&#60;/td&#62;&#60;td class=""listdata""&#62;(.*?)&#60;/td&#62;&#60;/tr&#62;");
			Regex extractNameNumber = [...]]]></description>
			<content:encoded><![CDATA[<pre class="brush: c-sharp;">
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Net;
using System.IO;
using System.Text.RegularExpressions;

namespace AutomationPost
{

	public class PersonInfo
	{
		public String name;
		public String email;
		public String contactNumber;
	}

	class Program
	{

		static List&lt;PersonInfo&gt; myVoters = new List&lt;PersonInfo&gt;();

		static void GenerateVoters()
		{
			//Scrap info from web site. or
			//http://hphappywheels.com/winners.php

			WebClient myDownloader = new WebClient();
			String webPageContents = myDownloader.DownloadString("http://hphappywheels.com/winners.php");
			webPageContents = webPageContents.Substring(webPageContents.IndexOf("919821232422")-30, webPageContents.Length - webPageContents.IndexOf("919821232422")-15);

			//Regex extractNameNumber = new Regex(@"&lt;tr&gt;&lt;td class=""listdata""&gt;(.*?)&lt;/td&gt;&lt;td class=""listdata""&gt;(.*?)&lt;/td&gt;&lt;td class=""listdata""&gt;(.*?)&lt;/td&gt;&lt;td class=""listdata""&gt;(.*?)&lt;/td&gt;&lt;td class=""listdata""&gt;(.*?)&lt;/td&gt;&lt;td class=""listdata""&gt;(.*?)&lt;/td&gt;&lt;td class=""listdata""&gt;(.*?)&lt;/td&gt;&lt;/tr&gt;");
			Regex extractNameNumber = new Regex(@"&lt;td class=""listdata""&gt;(.*?)&lt;/td&gt;");
			MatchCollection myDataMatches = extractNameNumber.Matches(webPageContents);

			int baseOffset = 0;
			int currentIncrement = 3;

			for (int i = 0; i &lt;= 1000; i ++)
			{ // 0 1 +4
			  // 4 5
				PersonInfo info = new PersonInfo();
				info.contactNumber = myDataMatches[baseOffset].Groups[1].Value;
				baseOffset++;
				info.name = myDataMatches[baseOffset].Groups[1].Value;
				baseOffset += currentIncrement;
				currentIncrement = (currentIncrement == 3)? 2 : 3;
				info.email = info.name.Replace(" ", "") + "@gmail.com";
				myVoters.Add(info);
			}
		}

		static void Main(string[] args)
		{
			int voteOffset = 66;
			GenerateVoters();			

			foreach (PersonInfo voter in myVoters)
			{
				String parameters = "name=" + voter.name + "&#038;email=" + voter.email + "&#038;contactno=" + voter.contactNumber + "&#038;profile_id=73&#038;votes=" + voteOffset + "&#038;flag=vote&#038;follo=0";

				StreamWriter myWriter = null;
				HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create("http://lavasawomensdrive.com/profile.php");
				objRequest.Method = "POST";
				objRequest.ContentType = "application/x-www-form-urlencoded";
				objRequest.ContentLength = parameters.Length;

				try
				{
					myWriter = new StreamWriter(objRequest.GetRequestStream());
					myWriter.Write(parameters);
				}
				catch (Exception e)
				{
					//Handle error
				}
				finally
				{

					myWriter.Flush();
					myWriter.Close();
					myWriter.Dispose();
					myWriter = null;
					objRequest = null;
				}

				voteOffset++;
				Console.WriteLine(voteOffset);
				System.Threading.Thread.Sleep(1000);
			}

			//myWriter.Close();
		}

	}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/script-to-fill-forms-automatically/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Regular expressions Interview Questions and Answers</title>
		<link>http://tech.kunalcholera.com/regular-expressions-interview-questions-and-answers/</link>
		<comments>http://tech.kunalcholera.com/regular-expressions-interview-questions-and-answers/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 04:30:15 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=40</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/regular-expressions-interview-questions-and-answers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Reading Writing and Editing XML files using C Sharp.</title>
		<link>http://tech.kunalcholera.com/reading-writing-and-editing-xml-files-using-c-sharp/</link>
		<comments>http://tech.kunalcholera.com/reading-writing-and-editing-xml-files-using-c-sharp/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 04:29:06 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=37</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/reading-writing-and-editing-xml-files-using-c-sharp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tag Cloud - Adobe Flex !</title>
		<link>http://tech.kunalcholera.com/tag-cloud-adobe-flex/</link>
		<comments>http://tech.kunalcholera.com/tag-cloud-adobe-flex/#comments</comments>
		<pubDate>Fri, 15 Jan 2010 05:18:54 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=32</guid>
		<description><![CDATA[<p>* I am learning Adobe Flex for this long weekend !</p>
<p>* My prototype will be to create Tag Cloud !</p>
<p>* I will provide detailed code and steps soon.</p>
]]></description>
			<content:encoded><![CDATA[<p>* I am learning Adobe Flex for this long weekend !</p>
<p>* My prototype will be to create Tag Cloud !</p>
<p>* I will provide detailed code and steps soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/tag-cloud-adobe-flex/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Stock portfolio application - Yahoo Finance and Yahoo pipes.</title>
		<link>http://tech.kunalcholera.com/stock-portfolio-application-yahoo-finance-and-yahoo-pipes/</link>
		<comments>http://tech.kunalcholera.com/stock-portfolio-application-yahoo-finance-and-yahoo-pipes/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 06:25:48 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=22</guid>
		<description><![CDATA[<p>* Building Query string of Stocks</p>
<p>* Using Yahoo pipes to generate portfolio related xml file.</p>
<p>* Building application that uses this xml file for portfolio management.</p>
<p>* I will show detailed steps soon.</p>
]]></description>
			<content:encoded><![CDATA[<p>* Building Query string of Stocks</p>
<p>* Using Yahoo pipes to generate portfolio related xml file.</p>
<p>* Building application that uses this xml file for portfolio management.</p>
<p>* I will show detailed steps soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/stock-portfolio-application-yahoo-finance-and-yahoo-pipes/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Facebook Programming Puzzles - User Bin Crash Solution !</title>
		<link>http://tech.kunalcholera.com/facebook-programming-puzzles-user-bin-crash-solution/</link>
		<comments>http://tech.kunalcholera.com/facebook-programming-puzzles-user-bin-crash-solution/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 10:21:58 +0000</pubDate>
		<dc:creator>Kunal Cholera</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<category><![CDATA[Facebook]]></category>

		<category><![CDATA[programming puzzles]]></category>

		<category><![CDATA[solution]]></category>

		<category><![CDATA[user bin crash]]></category>

		<guid isPermaLink="false">http://tech.kunalcholera.com/?p=21</guid>
		<description><![CDATA[<p>User Bin Crash
You are on a cargo plane full of commercial goods when the pilot announces that the plane is short on fuel. Unless cargo is ejected from the plane, you will run out of fuel and crash. The pilot provides you with the number of pounds of weight that must be ejected from the [...]]]></description>
			<content:encoded><![CDATA[<p>User Bin Crash<br />
You are on a cargo plane full of commercial goods when the pilot announces that the plane is short on fuel. Unless cargo is ejected from the plane, you will run out of fuel and crash. The pilot provides you with the number of pounds of weight that must be ejected from the plane. Fortunately, the manifest of the plane is both completely accurate, digitized, and you are a programmer of some repute. Unfortunately, your boss is going to be extremely unhappy, and wants you to exactly minimize the losses to the absolute minimum possible without crashing the plane. The manifest does not contain the exact quantities of every type of good, because you have so many on board. You may assume that you will not run out of any good in the course of saving the plane. You also realize this kind of program could be handy to others who find themselves in similar situations.</p>
<p>Write a program that takes a single argument on the command line. This argument must be a file name, which contains the input data. The program should output to standard out the minimum losses your boss will incur from your ejection of goods (see below). Your program will be tested against several manifests of several crashing planes; each with different data. Additionally, your program must be fast, and give the correct answer.</p>
<p>Input specifications<br />
The input file will start with an integer number indicating the minimum number of pounds of weight that must be ejected from the plane to prevent a crash, followed by a new line. Each additional line in the file represents a commercial SKU (stock keeping unit) along with its cost (in dollars) and weight (in pounds). The format of these lines is:</p>
<p>&lt;SKU label&gt;  &lt;weight in pounds&gt;  &lt;cost in dollars&gt;</p>
<p>SKUs are represented as a combination of letters (upper and lower case) and numbers. Both costs and weights are integers. Each piece of data in a line is separated by white space. Lines are separated by a single new line character. You are guaranteed your program will run against well formed input files.</p>
<p>Example input file:</p>
<p>1250<br />
LJS93K       1300       10500<br />
J38ZZ9       700        4750<br />
HJ394L         200        3250<br />
O1IE82         75         10250</p>
<p>Output specifications<br />
Your boss is not interested in exactly what you ejected to save the plane, he/she is currently only interested in how much it will cost the company. Your program must find the set of goods that will prevent the plane from crashing, and minimize company losses. It should print out the total value of goods lost as a plain integer, followed by a newline. Do not insert commas or dollar signs.</p>
<p>Example output (newline after integer):</p>
<p>9500</p>
<p>&#8212;&#8212;&#8212;</p>
<p>/*<br />
Author : Kunal Cholera<br />
email : kunalcholera@gmail.com<br />
web : http://tech.kunalcholera.com<br />
date : 31st Jan 2009<br />
time : 11:00 pm</p>
<p>Problem definition : http://tech.kunalcholera.com/facebook-programming-puzzlesfacebook-programming-puzzles/</p>
<p>Instructions to compile : g++ f1.cpp<br />
Instructions to execute : ./a.out</p>
<p>Expected output : Lowest Cost : 9500</p>
<p>*/</p>
<p>/* Input Array</p>
<p>1250<br />
LJS93K       1300       10500<br />
J38ZZ9       700        4750<br />
HJ394L       200        3250<br />
O1IE82       75         10250</p>
<p>*/</p>
<p>/* Array to be formed is as follows :<br />
item  cost   cost/item  Cost throwing only this item<br />
700   4750   6          9500<br />
1300  10500  8          10500<br />
200   3250   16         22750<br />
75    10250  136        174250</p>
<p>- Better improvement would be to check if there is other combinations of rows that lead to lower minimum<br />
- replace numberOfLines variable with the actual variable depending on the file size.</p>
<p>*/</p>
<pre class="brush: c-sharp;">

#include&lt;stdio.h&gt;
#include&lt;iostream&gt;

using namespace std;

int main(){

// Read and parse the input file based on tabbed data - \t

FILE *fileReader;
char *fileName = "input.txt";

fileReader = fopen( fileName, "r");

if( !fileReader ){
    cout&lt;&lt;"Could not open"&lt;&lt; fileName &lt;&lt;endl;
}

// Reading the weight to be thrown

int minimumWeight;
fscanf( fileReader, "%u", &amp;minimumWeight);

// forming the array of objects and their weights
// find out the storage size of the array..

int numberOfLines = 4;
int items[numberOfLines][4];

char tempString[50];

int i=0;
int remainingLines = 4;

while( remainingLines &gt; 0){
    fscanf( fileReader, "%s\t%u\t%u" , &amp;tempString, &amp;items[i][0], &amp;items[i][1] );
    items[i][2] = items[i][1]/items[i][0]; // This stores cost per unit of item
    i++;
    remainingLines--;
}

// cout&lt;&lt;i&lt;&lt;endl;
fclose(fileReader);

// sort the matrix in ascending order of 3rd colum for having low cost weights items first.
// bubble sort variation..

int temp;
for( i=0; i&lt; numberOfLines; i++){
    for( int j = i+1; j&lt; numberOfLines; j++ ){
        if( items[i][2] &gt; items[j][2] ){
        temp = items[i][0]; items[i][0] = items[j][0]; items[j][0] = temp;
        temp = items[i][1]; items[i][1] = items[j][1]; items[j][1] = temp;
        temp = items[i][2]; items[i][2] = items[j][2]; items[j][2] = temp;
       }
    }
}

// simply loop through and subtract lowest cost weight till you get minimumWeight &lt;0
int totalCost = 0;

// cout&lt;&lt;minimumWeight&lt;&lt;endl;

int weight = minimumWeight;
for( i = 0; i&lt; numberOfLines; i++){
    while( weight &gt; 0 ){
        weight -= items[i][0];
        totalCost += items[i][1];
    }
    items[i][3] = totalCost;
    // cout&lt;&lt;"Total Cost : "&lt;&lt;totalCost&lt;&lt;endl;
    totalCost = 0;
    weight = minimumWeight;
}

// print lowest cost
int lowestCost = items[0][3];
for( i=0; i&lt; numberOfLines; i++){
    if( items[i][3] &lt; lowestCost ){
        lowestCost = items[i][3];
    }
}

cout&lt;&lt;"Lowest Cost :"&lt;&lt;lowestCost&lt;&lt;endl;

return 0;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.kunalcholera.com/facebook-programming-puzzles-user-bin-crash-solution/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
