tag:blogger.com,1999:blog-28394117992504444862024-03-13T07:58:18.717+05:30Tech DisastersResults of my technical expeditions.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.comBlogger36125tag:blogger.com,1999:blog-2839411799250444486.post-63236204685568768942018-12-02T23:34:00.003+05:302018-12-03T21:27:54.776+05:30µ Query Builder As mentioned in <a href="https://tech-disasters.blogspot.com/2018/12/q-server.html" target="_blank">last post</a>, I created a simple querying mechanism from client side application. The query is structured as JSON object. If you played with it, you would soon realize that a bunch of complex and/or nested structure is difficult to written by hand.<br />
<br />
<a href="https://github.com/cnayan/mqb" target="_blank">µ Query Builder</a> is designed to generate the JSON query object. The syntax it supports is far easier and you need to spend only half-an-hour, or maybe less, to understand/learn it.<br />
<br />
Here is a sample:<br />
<pre style="background-color: #f6f8fa; border-radius: 3px; box-sizing: border-box; color: #24292e; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.6px; line-height: 1.45; overflow-wrap: normal; overflow: auto; padding: 16px; word-break: normal;"><span class="pl-c" style="box-sizing: border-box; color: #6a737d;"><span class="pl-c" style="box-sizing: border-box;">//</span> Returns 'employee_id' & 'employee_name' from 'employeeTable'; only first 5.</span>
<span class="pl-s" style="box-sizing: border-box; color: #032f62;">'5 * employeeTable [employee_id, employee_name]'</span></pre>
More examples are listed on GitHub page.<br />
<br />
Query building is pretty quick, and is not much overhead, considering the simplicity of writing query.<br />
<br />
Try it. Feedback are welcome.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-76853480466388721762018-12-02T23:25:00.000+05:302018-12-03T21:27:42.013+05:30q-ServerI've been working on an idea, similar to GraphQL concepts, but much simpler to implement and use. The idea came to me when I was studying GraphQL documentation, and was pleasantly surprised to see the ease of writing queries.<br />
<br />
The GraphQL query looks similar to a JSON object, but isn't. Why was JSON not used? I can't say, but I went in that direction and created my own version of writing queries to get (select / count) the data from data provider.<br />
<br />
<a href="https://github.com/cnayan/q-Server" target="_blank">q-Server</a> lets you connect to database or a data provider, and hosts an endpoint on which you can POST JSON object as queries. q-Server includes a connector to Microsoft SQL Server, and connects using Windows Authentication mode. This can be extended later to support user credentials. Well, there is lot of scope for improvement, but the current version, as already functional, is released with such limitation.<br />
<br />
The JSON query is not a replacement for SQL. It provides an abstraction over the inner specifics of connectivity to database or a provider. You data source need not be a database. It can be your own end-point, and not just a database.<br />
<br />
Take a look! Feedback are appreciated.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-82119738931908750482016-10-12T10:02:00.001+05:302016-10-12T10:03:25.918+05:30MVVM: DataGridComboBoxColumn binding doesn't pick dataThis is not a new problem, but I faced this recently. The WPF DataGrid control has <b>DataGridComboBoxColumn</b> which, when bound to a viewmodel collection, doesn't pick up the data.<br />
<br />
Here is the viewmodels I created for the demo app.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgChA-czwDhtLWfr0bi76nJIRz0yGG0TVhR6iQfE5zWH577v4J7cU3YuaTc7HH7RfjAKtegi2qnjP7PR73pEFSqkoaQ-9sCyltyq5IyzV67FJ8l9hPjBT1n1EFbvToHTlxGCC1wETJ8nTiZ/s1600/ViewModels.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgChA-czwDhtLWfr0bi76nJIRz0yGG0TVhR6iQfE5zWH577v4J7cU3YuaTc7HH7RfjAKtegi2qnjP7PR73pEFSqkoaQ-9sCyltyq5IyzV67FJ8l9hPjBT1n1EFbvToHTlxGCC1wETJ8nTiZ/s1600/ViewModels.PNG" /></a></div>
<br />
And the types of the properties are:<br />
<br />
<pre style="background: #fff; color: black;"> <span style="color: #ff7800;">public class</span> <span style="color: #3b5bb5;">MainViewModel</span> : <span style="color: #3b5bb5;">ViewModel</span>
{
<span style="color: #3b5bb5;">ObservableCollection<PersonViewModel></span> _Data;
...
</pre>
<br />
<pre style="background: #fff; color: black;"> <span style="color: #ff7800;">public class</span> <span style="color: #3b5bb5;">PersonViewModel</span> : <span style="color: #3b5bb5;">ViewModel</span>
{
<span style="color: #ff7800;">string</span> _Name;
<span style="color: #ff7800;">int</span> _Age;
<span style="color: #3b5bb5;">PersonViewModel</span> _SelectedSibling;
<span style="color: #3b5bb5;">ObservableCollection<PersonViewModel></span> _Siblings;
...
</pre>
<br />
The binding would seem innocuous, but it doesn't work.
<br />
<pre style="background: #fff; color: black;"> <DataGrid AutoGenerateColumns=<span style="color: #00a33f;">"False"</span>
ItemsSource=<span style="color: #00a33f;">"{Binding Data}"</span>>
<DataGrid.Columns>
...
<DataGridComboBoxColumn DisplayMemberPath=<span style="color: #00a33f;">"Name"</span>
Header=<span style="color: #00a33f;">"Siblings"</span>
ItemsSource=<span style="color: #00a33f;">"{Binding Siblings}"</span>
SelectedItemBinding=<span style="color: #00a33f;">"{Binding SelectedSibling}"</span>>
</DataGridComboBoxColumn>
...
</DataGrid.Columns>
</DataGrid>
</pre>
<br />
<div>
</div>
<div>
You would expect the combobox to be filled with the names of the siblings, but it doesn't.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGWW1_Wn2JKcmIJjwvB4OeiC6V_BzTLLkNlf5A7FUDNWXTr6NbC27WkozOrfESfNeF1pdZN9EG-nNjNjxRtJZURPRO5no2QFmMG28MoW7FU1fNOr6-ig0OwQ0Y9pjg1O-xJxBz3RUZo7VU/s1600/ProblematicView.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGWW1_Wn2JKcmIJjwvB4OeiC6V_BzTLLkNlf5A7FUDNWXTr6NbC27WkozOrfESfNeF1pdZN9EG-nNjNjxRtJZURPRO5no2QFmMG28MoW7FU1fNOr6-ig0OwQ0Y9pjg1O-xJxBz3RUZo7VU/s1600/ProblematicView.png" /></a></div>
<div>
<br /></div>
<div>
So, I looked up and found the answer on <a href="https://stackoverflow.com/questions/7050286/datagridcomboboxcolumn-data-binding" target="_blank">StackOverflow</a>:</div>
<div>
<blockquote class="tr_bq">
<i>DataGridColumn</i> doesn't derive from <i>FrameworkElement</i> or <i>FrameworkContentElement</i> so it isn't in the visual tree and doesn't have a <b>DataContext</b> and that's why your binding is failing.</blockquote>
</div>
<div>
That means the binding on the column's <b>ItemsSource</b> itself won't work. We need to access the combobox in the column and create the binding there.<br />
<br />
Here is the working XAML code:</div>
<div>
<br />
<pre style="background: #fff; color: black;"> <DataGrid AutoGenerateColumns=<span style="color: #00a33f;">"False"</span>
ItemsSource=<span style="color: #00a33f;">"{Binding Data}"</span>>
<DataGrid.Columns>
...
<DataGridComboBoxColumn DisplayMemberPath=<span style="color: #00a33f;">"Name"</span>
Header=<span style="color: #00a33f;">"Siblings"</span>
<span style="background-color: yellow;"><del>ItemsSource=<span style="color: #00a33f;">"{Binding Siblings}"</span></del></span>
SelectedItemBinding=<span style="color: #00a33f;">"{Binding SelectedSibling}"</span>>
<span style="background-color: yellow;"> <strong><DataGridComboBoxColumn.ElementStyle>
<Style TargetType=<span style="color: #00a33f;">"{x:Type ComboBox}"</span>>
<Setter Property=<span style="color: #00a33f;">"ItemsSource"</span> Value=<span style="color: #00a33f;">"{Binding Siblings}"</span> />
</Style>
</DataGridComboBoxColumn.ElementStyle>
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType=<span style="color: #00a33f;">"{x:Type ComboBox}"</span>>
<Setter Property=<span style="color: #00a33f;">"ItemsSource"</span> Value=<span style="color: #00a33f;">"{Binding Siblings}"</span> />
</Style>
</DataGridComboBoxColumn.EditingElementStyle></strong></span>
</DataGridComboBoxColumn>
...
</DataGrid.Columns>
</DataGrid>
</pre>
</div>
<div>
And now, we get the desired output:</div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXZjhBY1K9g9QlO1AIfEY7OvHWAgMo-dyTIgRUqovrJ3myWOcJx54m3uqKXPPKYIDSWVBwOPpdhbm5Hw-Fsmo1NBGGxTEkpfWf4m_MFDNwOUZhQJL-91T_GOmwF0kJ6bcogm1RInYQrMAX/s1600/WorkingView.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXZjhBY1K9g9QlO1AIfEY7OvHWAgMo-dyTIgRUqovrJ3myWOcJx54m3uqKXPPKYIDSWVBwOPpdhbm5Hw-Fsmo1NBGGxTEkpfWf4m_MFDNwOUZhQJL-91T_GOmwF0kJ6bcogm1RInYQrMAX/s1600/WorkingView.png" /></a></div>
<br /></div>
Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com6tag:blogger.com,1999:blog-2839411799250444486.post-49421549238576064032013-09-24T00:42:00.001+05:302018-02-08T11:31:01.434+05:30My Codeproject Article On WPF DataGrid Custom Header With Filter I'm happy to announce that my first article on Codeproject has been published. Here is the URL:<br />
<a href="http://www.codeproject.com/Articles/657657/WPF-DataGrid-With-Excel-Style-Column-Filter">http://www.codeproject.com/Articles/657657/WPF-DataGrid-With-Excel-Style-Column-Filter</a><br />
<br />
This article has been based on a journey to find simple UI designs. More about them in coming up articles.<br />
<br />
It took me 3 weeks to understand WPF DataGrid. It was faster near the end, when I started using WPF UI element debugger <a href="http://snoopwpf.codeplex.com/%E2%80%8E" rel="nofollow" target="_blank">Snoop</a>.<br />
<br />
Thanks for reading this post! And, yes, please, do vote on Codeproject article, if it makes sense to you.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-4080173190314212312012-09-15T03:01:00.001+05:302012-09-15T03:01:40.865+05:30Auto Save in Paint - ver 1.7.0.2 - Patch ReleaseThis is a small post to post a minor patch on top of release version 1.7<br />
<br />
<a href="http://www.blogger.com/profile/05659347484349509635">Tflamb</a> noticed that on Windows 7, the XP Paint application was not able to save the JPEG files, and thus shrink them. He suggested a delay to be introduced while saving the files.<br />
<br />
I made the delay configurable in the "Options".<br />
<br />
<u>Enhancement:</u><br />
1. In "Options" dialog box, there is a number selector (numeric up/down box) for the required delay while Paint application saves a file. The value that it can hold is in the range of 0 to 30. This number is the delay in seconds that AutoSavePaint (ASP) will wait for Paint application to save per file. If the delay is 0, then ASP will behave normally and no extra delay will be introduced.<br />
<br />
I'm only uploading the binary+source for the patch, instead of the whole package. Please download ver 1.7 first and then apply the patch.<br />
<br />
Download links for Auto Save in Paint v1.7.0.2 patch:<br />
<a href="http://dl.dropbox.com/u/6634742/AutoSavePaint_v1.7.0.2-Patch_Release.zip">Binary</a><br />
<a href="http://dl.dropbox.com/u/6634742/AutoSavePaint_v1.7.0.2_Patch_Source.zip">Source</a>Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com9tag:blogger.com,1999:blog-2839411799250444486.post-19766706480916837092011-11-03T14:23:00.002+05:302011-11-06T21:17:19.246+05:30Non intrusive shadow effect for translucent area<a class="comment-user owner" href="http://stackoverflow.com/users/183471/nexxeus" style="background-attachment: initial; background-clip: initial; background-color: #fafafa; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #0077cc; cursor: pointer; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 13px; line-height: 17px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 2px; padding-left: 5px; padding-right: 5px; padding-top: 2px; text-align: left; vertical-align: baseline; white-space: nowrap;" title="5185 reputation">NeXXeuS</a> asked a very interesting question. In WPF, you have DropShadowEffect which displays a shadow of a geometry/shape. But if the geometry/shape is translucent (0 < Opacity < 1), then you can see the shadow through.<br />
<span class="Apple-style-span" style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"><br /></span><br />
<span class="Apple-style-span" style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;">The question was posted on <a href="http://stackoverflow.com/questions/7986671/dropshadoweffect-on-rectangle-with-slight-transparency-how-to-make-shadow-not/" target="_blank">SO</a></span><span class="Apple-style-span" style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"> as:</span><br />
<span class="Apple-style-span" style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"><br /></span><br />
<span class="Apple-style-span" style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"><b>Ques:</b> <i>I have a DropShadowEffect on a Rectangle with a fill that's slightly transparent. The problem is, the drop shadow also shows up inside the fill, which is what I </i></span><i><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; vertical-align: baseline;">don't</span><span class="Apple-style-span" style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; text-align: left;"> want. Anyways to solve this? I tried </span><a href="http://stackoverflow.com/questions/2295589/how-to-draw-a-drop-shadow-on-a-transparent-rectangle" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #0077cc; cursor: pointer; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; vertical-align: baseline;">this</a><span class="Apple-style-span" style="background-color: white; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; text-align: left;">, but it doesn't work for me.</span></i><br />
<div style="text-align: left;">
<span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"><span class="Apple-style-span" style="font-size: 14px; line-height: 18px;"><br /></span></span></div>
<b><u>My answer:</u></b><br />
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; vertical-align: baseline; word-wrap: break-word;">
This is very tricky. You need to customize the shadow effect for this. This solution gives the desired effect.</div>
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; margin-bottom: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; vertical-align: baseline; word-wrap: break-word;">
This is a sample <code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 1px; padding-left: 5px; padding-right: 5px; padding-top: 1px; vertical-align: baseline;">Grid</code> with yellow background. I've drawn two intersecting rectangles of 100x100 dimension on it. You may need to customize the size according to your need. One rectangle is gray rectangle (to show shadow), and the other is a red rectangle (the actual semi-transparent rectangle that you want to display). The shadow depth has been hard coded as 5 pixels here. Please customize it at:</div>
<ul style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px; list-style-image: initial; list-style-position: initial; margin-bottom: 1em; margin-left: 30px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; vertical-align: baseline;">
<li style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"><div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; margin-bottom: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;">
RectangleGeometry Rect="5,5,100,100"</div>
</li>
<li style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;"><div style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; margin-bottom: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; word-wrap: break-word;">
RectangleGeometry Rect="0,0,95,95"</div>
</li>
</ul>
<div style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; clear: both; margin-bottom: 1em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; vertical-align: baseline; word-wrap: break-word;">
<div style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;">
So, the grid looks like:</div>
<div class="csharpcode">
<pre><span class="lnum"> 1: </span><Grid Background=<span class="str">"Yellow"</span>></pre><pre><span class="lnum"> 2: </span> <!-- A rectangle <span class="kwrd">for</span> shadow --></pre><pre><span class="lnum"> 3: </span> <Rectangle Fill=<span class="str">"Gray"</span> Width=<span class="str">"100"</span> Height=<span class="str">"100"</span> Opacity=<span class="str">".7"</span>></pre><pre><span class="lnum"> 4: </span> <Rectangle.Clip></pre><pre><span class="lnum"> 5: </span> <CombinedGeometry GeometryCombineMode=<span class="str">"Exclude"</span>></pre><pre><span class="lnum"> 6: </span> <CombinedGeometry.Geometry1></pre><pre><span class="lnum"> 7: </span> <RectangleGeometry Rect=<span class="str">"5,5,100,100"</span>/></pre><pre><span class="lnum"> 8: </span> </CombinedGeometry.Geometry1></pre><pre><span class="lnum"> 9: </span> <CombinedGeometry.Geometry2></pre><pre><span class="lnum"> 10: </span> <RectangleGeometry Rect=<span class="str">"0,0,95,95"</span>/></pre><pre><span class="lnum"> 11: </span> </CombinedGeometry.Geometry2></pre><pre><span class="lnum"> 12: </span> </CombinedGeometry></pre><pre><span class="lnum"> 13: </span> </Rectangle.Clip></pre><pre><span class="lnum"> 14: </span> <Rectangle.Effect></pre><pre><span class="lnum"> 15: </span> <!-- For nice soft shadow effect --></pre><pre><span class="lnum"> 16: </span> <BlurEffect Radius=<span class="str">"5"</span> /></pre><pre><span class="lnum"> 17: </span> </Rectangle.Effect></pre><pre><span class="lnum"> 18: </span> </Rectangle></pre><pre><span class="lnum"> 19: </span> </pre><pre><span class="lnum"> 20: </span> <!-- Actual rectangle which <span class="kwrd">is</span> translucent --></pre><pre><span class="lnum"> 21: </span> <Rectangle Fill=<span class="str">"Red"</span> Width=<span class="str">"100"</span> Height=<span class="str">"100"</span> Opacity=<span class="str">".6"</span> ></pre><pre><span class="lnum"> 22: </span> <Rectangle.Clip></pre><pre><span class="lnum"> 23: </span> <RectangleGeometry Rect=<span class="str">"0,0,95,95"</span>/></pre><pre><span class="lnum"> 24: </span> </Rectangle.Clip></pre><pre><span class="lnum"> 25: </span> </Rectangle></pre><pre><span class="lnum"> 26: </span></Grid></pre></div>
<pre class="lang-cs prettyprint" style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin-bottom: 10px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"></pre>
Hope this is interesting to you as much as I had fun creating it! :)</div>Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-79700046844668414942011-10-01T23:17:00.001+05:302011-10-02T10:57:34.818+05:30Visio 2010 64-bit bummerIts so weird and irritating to know something doesn't work and has been documented already. Just that I did not search for it. How would anyone know if things will work or not?<br />
<br />
You cannot use the ActiveX control of Visio 64 bit edition in your VS applications. I happen to run everything in 64 bit mode. x-(<br />
<br />
Here is the info: <a href="http://support.microsoft.com/kb/980533">http://support.microsoft.com/kb/980533</a><br />
<br />
<blockquote>
<b>You cannot add the Microsoft Visio 14.0 drawing control to a Windows Form application in Visual Studio if you have the 64-bit version of Visio 2010 installed</b><br />
<br />
<b>Cause:</b> These problems occur because the Visual Studio designer does not support 64-bit ActiveX controls and because the 64-bit version of Visio 2010 only works with the 64-bit version of the Microsoft Office Visio 14.0 drawing control. Therefore, the drawing control cannot be instantiated.
<br />
<br/>
<br>To work around this problem, follow these steps:</b>
<br />
<ol>
<li>Install the 32-bit version of Visio 2010 on a computer....</li>
</ol>
</blockquote>
<br />
Ridiculous. Now, I've to undo the installation and install 32 bit version. Great! :(
<br />
Why is VS Designer not modified to support 64 bit ActiveX controls?
<br/><br/>
Update:<br/>
Even when I uninstalled 64 bit Visio, the 32 bit Viso won't install because of 64 bit Office installed on my machine. That means I've to uninstall whole 64 bit MS Office for just one VS Designer to work. WTH?!Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-69747096084652033892011-01-03T11:42:00.001+05:302011-01-03T11:46:13.017+05:30Uno 1.3 at SoftpediaThis is great news! My game Uno (ver 1.3) has been featured at Softpedia! Yay! :)<br />
The link is here -> <a href="http://games.softpedia.com/get/Freeware-Games/Nayan-Choudhary-Uno.shtml" target=_blank>http://games.softpedia.com/get/Freeware-Games/Nayan-Choudhary-Uno.shtml</a><br />
<br />
It has been rated "Clean" for not containing any spyware/trojan/virus.<br />
<br />
I feel motivated when I see people using my creations. I plan to release a better/faster version soon.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com2tag:blogger.com,1999:blog-2839411799250444486.post-85352024285435655412010-10-24T01:50:00.004+05:302010-10-24T01:56:56.013+05:30Replace Files - v2.0I've never mentioned this project on my blog before. This is based on the requirement when you have to place a file somewhere in a directory (maybe many locations) and you do not know where. This is a search and replace tool which will do the job for you, only in smarter way.<br />
<br />
Short steps on how to use<br />
<ol><li>Select source folder where your new files are.</li>
<li>Select destination folder where you want your files to be replaced to.</li>
<li>If you don't know exact target folder, you may select "Recursive" option (it will search in sub-folders too).</li>
<li>If you are worried about taking a backup before replacement, you can select that option too. The original file will be renamed to <i><original-name>.old</i>. Just beware that if you replace the files again with backup feature on, the <i>original</I> old file will be overwritten.</li>
<li>Select the type of files that you are operating on. eg. - <i>*.exe</i>, <i>*I*don't*know*</i>, <i>H?ll*.txt</i>, <i>mspaint.exe</i> [;)] etc. These patterns are based on normal DOS search wildcards.</li>
<li>If there are some files that you want to avoid to be operated on, put them in Exclude list section. These do not use wildcards. eg. - if you want to avoid EXE files (search filter: *.exe) with name containing <b>obsolete</b>, then you add a filter by the same name. Hence, out of these files - abc.exe, aobsoletebc.exe, haha.obsolete.exe - only abc.exe will be searched and replaced.</li>
<li>Click Find button. Wait for it to finish.</li>
<li>Once done, the files which differ in target locations are highlighted in yellow color. You have option of deleting the list items, if you don't want them to be replaced.</li>
<li>Click "Set up" button, and it's done. If you will run Find again immediately, then you can see that there will empty lists (unless you manually intervened.) This is a sign that your files are already placed.</li>
</ol><br />
Features:<br />
<ol><li>CRC32 based accurate checks for file content.</li>
<li>Fast file search.</li>
<li>Option available to use GAC Util (for assemblies to be put in ASSEMBLY folder in Windows). For this, for now, you have to run this tool from <b>Visual Studio Command Prompt</b>. That way, it locates the gacutil.exe. Supports Visual Studio 2005, 2008 and 2010.</li>
<li>You can run external diff tools from inside the tool. It has been configured by default for Winmerge (still need some more testing on that), but if you use any other diff tool, provide the path in the Configure->Options menu.</li>
</ol><br />
Version 2.0 is the first public release. So don't worry, you have not missed earlier versions :)<br />
Please report bugs here.<br />
Download: <a href="http://db.tt/R89yvmJ">Zipped Binaries</a>Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-84871709323387299062010-10-19T00:19:00.000+05:302010-10-19T00:19:38.686+05:30Auto Save in Paint - ver 1.7.0.1 - Patch ReleaseThis is a small post to post a minor patch on top of release version 1.7<br />
<br />
Fixes:<br />
1. The "Options" dialog pops-up "The file [] doesn't exist! Please enter a valid file path." message even when the "Use custom application to save images" is unchecked. This message should only pop-up when the aforementioned checkbox is selected and the file path provided leads to invalid file path.<br />
<br />
I'm only uploading the binary+source for the patch, instead of the whole package. Please download ver 1.7 first and then apply the patch.<br />
<br />
Download links for Auto Save in Paint v1.7.0.1 patch:<br />
<a href="http://db.tt/e86v83p">Binary</a><br />
<a href="http://db.tt/pQeJWXQ">Source</a>Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com4tag:blogger.com,1999:blog-2839411799250444486.post-39522963341267659012010-10-16T21:00:00.000+05:302010-10-16T21:00:40.901+05:30Auto Save in Paint - ver 1.7Auto Save in Paint is back! :)<br />
<br />
In the <a href="http://tech-disasters.blogspot.com/2010/05/auto-save-in-paint-ver-16.html">last post</a>, I said that I was out of ideas on how to go further on with this project. Thanks to the users of this tool (special thanks to <a href="http://www.blogger.com/profile/05659347484349509635">tflamb</a>!) I got some nice inputs. Seems like I am not the only one who likes it :)<br />
<br />
So, what is new in this version? Here is the list:<br />
<ol><li><b>Options menu</b> - Tflamb and I discussed on the behavior of MS Paint in different OS version. The tool was originally created on Windows XP. MS Paint of XP has different save algorithm than that in Windows 7. In Windows 7, default MS Paint seems perform both ways - sometimes it will bloat up an image, other times, it will shrink it good. Now with option available to choose an application which can do the save part, you can use your own tool. For example: you have MS Paint from Windows XP copied on Windows 7 in some folder, and you want XP Paint to run with this tool rather than Win 7 Paint. Now, you can do it. Just browse to the file location where your tools is kept and you're done.</li>
<li><b>Don't ask again option</b> - If the constant pop-us bother you, you can disable them. This information goes into a <i>.config</i> file which is created in the folder where your application resides. It's XML file.</li>
<b><li>Some minor segregation of the projects (source code)</b> - I am providing source code of the "main" tool in this version. This is by demand too! :) But remember that I've not provided all the source files. There are some custom libraries that I have created (as DLLs) and they can be used for building up the code. You can set them in references, and I hope you'll be able to build the code. (I'll not go into details here on how to configure projects and all.)</li>
</ol>If there is any bug that you have found, or are unable to build the code, please let me know.<br />
<br />
Thanks again for using Auto Save in Paint! :)<br />
<br />
Download links for Auto Save in Paint v1.7:<br />
<a href="http://db.tt/r8IWBUc">Release Binaries</a><br />
<a href="http://db.tt/9xZRrZE">Source Code</a>Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com2tag:blogger.com,1999:blog-2839411799250444486.post-40118355766596666442010-10-03T15:17:00.002+05:302017-12-18T21:48:42.311+05:30Are we smart or whatI have been developing applications for about 7-8 years. Sometimes I wonder how many people out there are truly passionate about technology and have dedicate some part of their life for self-improvement.<br />
<br />
Most of the coders hired by big companies are freshers. Anybody can code, true. Then there are people who have to study each and everything in order to maintain that soggy piece of noodles.<br />
<br />
But this post is not about criticizing ways of the world. I'm highlighting how much a readable code means to a maintenance/sustenance team. One of the tip is this -<br />
<br />
<blockquote>
If you have see a function having a boolean argument, do not use it, if possible. Try to break that function down in two functions with <b>readable</b> names which depict their intentions clearly.</blockquote>
<br />
Why? Because boolean parameters are not made for readability. They are just a type to differentiate two ways of processing. For example:<br />
<br />
<span style="font-family: "courier new";"></span><br />
<div style="background-color: blue; color: white;">
<span style="font-family: "courier new";">void Greet(string message, bool world) {</span></div>
<div style="background-color: blue; color: white;">
<span style="font-family: "courier new";"> if (world) {</span></div>
<div style="background-color: blue; color: white;">
<span style="font-family: "courier new";"> Console.Writeln(message + " world!");</span></div>
<div style="background-color: blue; color: white;">
<span style="font-family: "courier new";"> } else {</span></div>
<div style="background-color: blue; color: white;">
<span style="font-family: "courier new";"> Console.Writeln(message + " me!");</span></div>
<div style="background-color: blue; color: white;">
<div style="background-color: blue; color: white;">
<span style="font-family: "courier new";"> }</span></div>
<div style="background-color: blue; color: white;">
</div>
<span style="font-family: "courier new";">}</span></div>
<br />
Now, using it seems strange:<br />
<br />
<span style="font-family: "courier new";"></span><br />
<div style="background-color: blue; color: white;">
<span style="font-family: "courier new";">Greet("Hello", false);</span></div>
<div style="background-color: blue; color: white;">
<span style="font-family: "courier new";">Greet("Hello", true);</span></div>
<br />
If we break it down to two functions, namely, GreetWorld and GreetMe, then it becomes more readable and understandable.<br />
<br />
<div style="background-color: blue; color: white;">
<span style="font-family: "courier new";">void GreetWorld(string message) {<br /> Console.Writeln(message + " world!");<br />}<br /><br />void GreetMe(string message) {<br /> Console.Writeln(message + " me!");<br />}<br /><br />//Usage<br />GreetWorld("Hello");<br />GreetMe("Hello");</span></div>
<br />
<br />
There are many standards set for coding. Think differently.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-7252479821887119682010-05-02T13:15:00.030+05:302010-05-03T01:56:18.439+05:30Dispose Complete Hierarchy<style type="text/css">.main_back {overflow:auto;overflow-y:hidden;-ms-overflow-y:hidden;}</style><br />While working with a family hierarchy of a class, I was trying to optimize the memory usage because there was a case reported in one of the tools that worked on that the data loaded in memory was using up all the RAM. I worked on the case and found that the custom classes that were written for the project were not disposable. This leaves memory freeing job to Garbage Collector, and its not best decision sometimes.<br /><br />I wrote two classes for making disposing of objects easy. <span class="style1">NayanTools.Dispose</span> method is the core of disposing engine.<br /><br />One thing that you need to keep in mind while using this function, it will dispose the member objects of the object you pass to it, as well as, it will go in recursion - provided all those classes are implemented from <span class="style1">AbstractDisposingClass</span>.<br /><br />So, the implementation of a disposable class using <span class="style1">AbstractDisposingClass</span> should look like -<br /><br /><pre style="color: rgb(255, 255, 255); background-color: rgb(0, 0, 64);font-family:'Courier New';font-size:10pt;"><span style="color: rgb(229, 210, 142);">01 </span><span style="color: rgb(226, 232, 37);">class</span> A <span style="color: rgb(186, 186, 186);">:</span> AbstractDisposingClass <span style="color: rgb(186, 186, 186);">{</span><br /><span style="color: rgb(229, 210, 142);">02 </span> ~<span style="color: rgb(232, 37, 226); font-weight: bold;">A</span><span style="color: rgb(186, 186, 186);">() {</span><br /><span style="color: rgb(229, 210, 142);">03 </span> <span style="color: rgb(232, 37, 226); font-weight: bold;">dispose</span><span style="color: rgb(186, 186, 186);">(</span><span style="color: rgb(226, 232, 37);">false</span><span style="color: rgb(186, 186, 186);">);</span><br /><span style="color: rgb(229, 210, 142);">04 </span> <span style="color: rgb(186, 186, 186);">}</span><br /><span style="color: rgb(229, 210, 142);">05 </span><span style="color: rgb(186, 186, 186);">};</span><br /></pre><br /><br />The usage is simple, as you dispose any other class-<br /><span class="style1">A n = new A();<br />n.Dispose();</span><br /><br />A bit more complex example will be -<br /><pre style="color:#ffffff; background-color:#000040; font-size:10pt; font-family:'Courier New';"><span style="color:#e5d28e">01 </span><span style="color:#e2e825">class</span> A <span style="color:#bababa">:</span> AbstractDisposingClass <span style="color:#bababa">{</span><br /><span style="color:#e5d28e">02 </span> List<span style="color:#bababa"><</span><span style="color:#60ff60">string</span><span style="color:#bababa">></span> jjj <span style="color:#bababa">=</span> <span style="color:#e2e825">new</span> List<span style="color:#bababa"><</span><span style="color:#60ff60">string</span><span style="color:#bababa">>();</span><br /><span style="color:#e5d28e">03 </span> ~<span style="color:#e825e2; font-weight:bold">A</span><span style="color:#bababa">() {</span><br /><span style="color:#e5d28e">04 </span> <span style="color:#e825e2; font-weight:bold">dispose</span><span style="color:#bababa">(</span><span style="color:#e2e825">false</span><span style="color:#bababa">);</span><br /><span style="color:#e5d28e">05 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">06 </span><span style="color:#bababa">};</span><br /><span style="color:#e5d28e">07 </span><br /><span style="color:#e5d28e">08 </span><span style="color:#e2e825">class</span> B <span style="color:#bababa">:</span> AbstractDisposingClass <span style="color:#bababa">{</span><br /><span style="color:#e5d28e">09 </span> <span style="color:#60ff60">string</span> test <span style="color:#bababa">=</span> <span style="color:#60ff60">string</span><span style="color:#bababa">.</span>Empty<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">10 </span> List<span style="color:#bababa"><</span><span style="color:#60ff60">string</span><span style="color:#bababa">></span> hello <span style="color:#bababa">=</span> <span style="color:#e2e825">new</span> List<span style="color:#bababa"><</span><span style="color:#60ff60">string</span><span style="color:#bababa">>();</span><br /><span style="color:#e5d28e">11 </span> List<span style="color:#bababa"><</span>A<span style="color:#bababa">></span> allo <span style="color:#bababa">=</span> <span style="color:#e2e825">new</span> List<span style="color:#bababa"><</span>A<span style="color:#bababa">>();</span><br /><span style="color:#e5d28e">12 </span> Dictionary<span style="color:#bababa"><</span><span style="color:#60ff60">int</span><span style="color:#bababa">,</span> <span style="color:#60ff60">int</span><span style="color:#bababa">></span> ddd <span style="color:#bababa">=</span> <span style="color:#e2e825">new</span> Dictionary<span style="color:#bababa"><</span><span style="color:#60ff60">int</span><span style="color:#bababa">,</span> <span style="color:#60ff60">int</span><span style="color:#bababa">>();</span><br /><span style="color:#e5d28e">13 </span> <span style="color:#e2e825">public</span> <span style="color:#e825e2; font-weight:bold">B</span><span style="color:#bababa">() {</span><br /><span style="color:#e5d28e">14 </span> allo<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">Add</span><span style="color:#bababa">(</span><span style="color:#e2e825">new</span> <span style="color:#e825e2; font-weight:bold">A</span><span style="color:#bababa">());</span><br /><span style="color:#e5d28e">15 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">16 </span> ~<span style="color:#e825e2; font-weight:bold">B</span><span style="color:#bababa">() {</span><br /><span style="color:#e5d28e">17 </span> <span style="color:#e825e2; font-weight:bold">dispose</span><span style="color:#bababa">(</span><span style="color:#e2e825">false</span><span style="color:#bababa">);</span><br /><span style="color:#e5d28e">18 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">19 </span><span style="color:#bababa">};</span><br /><span style="color:#e5d28e">20 </span><br /><span style="color:#e5d28e">21 </span><span style="color:#bababa">...</span><br /><span style="color:#e5d28e">22 </span><br /><span style="color:#e5d28e">23 </span><span style="color:#e2e825">private</span> <span style="color:#60ff60">void</span> <span style="color:#e825e2; font-weight:bold">destroyExample</span> <span style="color:#bababa">() {</span><br /><span style="color:#e5d28e">24 </span> B n <span style="color:#bababa">=</span> <span style="color:#e2e825">new</span> <span style="color:#e825e2; font-weight:bold">B</span><span style="color:#bababa">();</span><br /><span style="color:#e5d28e">25 </span> n<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">Dispose</span><span style="color:#bababa">();</span><br /><span style="color:#e5d28e">26 </span><span style="color:#bababa">}</span><br /></pre><br /><br />Here is the code for the classes and methods.<br /><br /><div class="main_back"></div><br /><pre style="color:#ffffff; background-color:#000040; font-size:10pt; font-family:'Courier New';overflow:auto;overflow-y:hidden;-ms-overflow-y:hidden;"><span style="color:#e5d28e">01 </span><span style="color:#e2e825">using</span> System<span style="color:#bababa">.</span>Collections<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">02 </span><span style="color:#e2e825">using</span> System<span style="color:#bababa">.</span>Reflection<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">03 </span><span style="color:#bababa">...</span><br /><span style="color:#e5d28e">04 </span><span style="color:#e2e825">public static class</span> NayanTools <span style="color:#bababa">{</span><br /><span style="color:#e5d28e">05 </span> <span style="color:#e2e825">public static</span> <span style="color:#60ff60">bool</span> <span style="color:#e825e2; font-weight:bold">IsList</span> <span style="color:#bababa">(</span><span style="color:#60ff60">object</span> obj<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">06 </span> IList list <span style="color:#bababa">=</span> obj as IList<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">07 </span> <span style="color:#e2e825">return</span> list <span style="color:#bababa">!=</span> <span style="color:#e2e825">null</span><span style="color:#bababa">;</span><br /><span style="color:#e5d28e">08 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">09 </span><br /><span style="color:#e5d28e">10 </span> <span style="color:#e2e825">public static</span> <span style="color:#60ff60">bool</span> <span style="color:#e825e2; font-weight:bold">IsCollection</span> <span style="color:#bababa">(</span><span style="color:#60ff60">object</span> obj<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">11 </span> ICollection coll <span style="color:#bababa">=</span> obj as ICollection<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">12 </span> <span style="color:#e2e825">return</span> coll <span style="color:#bababa">!=</span> <span style="color:#e2e825">null</span><span style="color:#bababa">;</span><br /><span style="color:#e5d28e">13 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">14 </span><br /><span style="color:#e5d28e">15 </span> <span style="color:#e2e825">public static</span> <span style="color:#60ff60">bool</span> <span style="color:#e825e2; font-weight:bold">IsDictionary</span> <span style="color:#bababa">(</span><span style="color:#60ff60">object</span> obj<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">16 </span> IDictionary dictionary <span style="color:#bababa">=</span> obj as IDictionary<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">17 </span> <span style="color:#e2e825">return</span> dictionary <span style="color:#bababa">!=</span> <span style="color:#e2e825">null</span><span style="color:#bababa">;</span><br /><span style="color:#e5d28e">18 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">19 </span><br /><span style="color:#e5d28e">20 </span> <span style="color:#e2e825">public static</span> <span style="color:#60ff60">void</span> <span style="color:#e825e2; font-weight:bold">Dispose</span> <span style="color:#bababa">(</span><span style="color:#60ff60">bool</span> bNotDisposed<span style="color:#bababa">,</span> <span style="color:#60ff60">object</span> _object<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">21 </span> <span style="color:#e2e825">if</span> <span style="color:#bababa">(</span>bNotDisposed <span style="color:#bababa">&&</span> _object <span style="color:#bababa">!=</span> <span style="color:#e2e825">null</span><span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">22 </span> Type type <span style="color:#bababa">=</span> _object<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">GetType</span> <span style="color:#bababa">();</span><br /><span style="color:#e5d28e">23 </span> FieldInfo<span style="color:#bababa">[]</span> arrayFI <span style="color:#bababa">=</span> type<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">GetFields</span> <span style="color:#bababa">(</span>BindingFlags<span style="color:#bababa">.</span>FlattenHierarchy<span style="color:#bababa">|</span>BindingFlags<span style="color:#bababa">.</span>GetField<span style="color:#bababa">|</span>BindingFlags<span style="color:#bababa">.</span>Instance<span style="color:#bababa">|</span>BindingFlags<span style="color:#bababa">.</span>NonPublic<span style="color:#bababa">|</span>BindingFlags<span style="color:#bababa">.</span>Public<span style="color:#bababa">);</span><br /><span style="color:#e5d28e">24 </span> <span style="color:#e2e825">foreach</span> <span style="color:#bababa">(</span>FieldInfo fieldInfo <span style="color:#e2e825">in</span> arrayFI<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">25 </span> <span style="color:#60ff60">object</span> fieldObject <span style="color:#bababa">=</span> fieldInfo<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">GetValue</span> <span style="color:#bababa">(</span>_object<span style="color:#bababa">);</span><br /><span style="color:#e5d28e">26 </span> <span style="color:#e2e825">if</span> <span style="color:#bababa">(</span>fieldObject <span style="color:#bababa">!=</span> <span style="color:#e2e825">null</span><span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">27 </span> <span style="color:#e2e825">if</span> <span style="color:#bababa">(</span>NayanTools<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">IsDictionary</span> <span style="color:#bababa">(</span>fieldObject<span style="color:#bababa">)) {</span> <span style="color:#ff7f9f">//key-value type collection?</span><br /><span style="color:#e5d28e">28 </span> IDictionary dictionary <span style="color:#bababa">=</span> fieldObject as IDictionary<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">29 </span> <span style="color:#e2e825">foreach</span> <span style="color:#bababa">(</span><span style="color:#60ff60">object</span> _ob <span style="color:#e2e825">in</span> dictionary<span style="color:#bababa">.</span>Values<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">30 </span> <span style="color:#e2e825">if</span> <span style="color:#bababa">(</span>_ob is IDisposable <span style="color:#bababa">&&</span> _ob <span style="color:#bababa">!=</span> <span style="color:#e2e825">null</span><span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">31 </span> IDisposable _disposeableObj_ <span style="color:#bababa">=</span> _ob as IDisposable<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">32 </span> _disposeableObj_<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">Dispose</span> <span style="color:#bababa">();</span><br /><span style="color:#e5d28e">33 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">34 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">35 </span> dictionary<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">Clear</span> <span style="color:#bababa">();</span><br /><span style="color:#e5d28e">36 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">37 </span> <span style="color:#e2e825">else</span> <span style="color:#bababa">{</span><span style="color:#ff7f9f">//normal collection</span><br /><span style="color:#e5d28e">38 </span> <span style="color:#e2e825">if</span> <span style="color:#bababa">(</span>NayanTools<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">IsCollection</span> <span style="color:#bababa">(</span>fieldObject<span style="color:#bababa">)) {</span><br /><span style="color:#e5d28e">39 </span> ICollectioncoll <span style="color:#bababa">=</span> fieldObject as ICollection<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">40 </span> <span style="color:#e2e825">foreach</span> <span style="color:#bababa">(</span><span style="color:#60ff60">object</span> _ob <span style="color:#e2e825">in</span> coll<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">41 </span> <span style="color:#e2e825">if</span> <span style="color:#bababa">(</span>_ob is IDisposable <span style="color:#bababa">&&</span> _ob <span style="color:#bababa">!=</span> <span style="color:#e2e825">null</span><span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">42 </span> IDisposable _disposeableObj_ <span style="color:#bababa">=</span> _ob as IDisposable<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">43 </span> _disposeableObj_<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">Dispose</span> <span style="color:#bababa">();</span><br /><span style="color:#e5d28e">44 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">45 </span> <span style="color:#e2e825">if</span> <span style="color:#bababa">(</span>NayanTools<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">IsList</span> <span style="color:#bababa">(</span>fieldObject<span style="color:#bababa">)) {</span><br /><span style="color:#e5d28e">46 </span> IList list <span style="color:#bababa">=</span> fieldObject as IList<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">47 </span> list<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">Clear</span> <span style="color:#bababa">();</span><br /><span style="color:#e5d28e">48 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">49 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">50 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">51 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">52 </span> <span style="color:#e2e825">if</span> <span style="color:#bababa">(</span>fieldObject is IDisposable<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">53 </span> IDisposable _disposeableObj <span style="color:#bababa">=</span> fieldObject as IDisposable<span style="color:#bababa">;</span><br /><span style="color:#e5d28e">54 </span> _disposeableObj<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">Dispose</span> <span style="color:#bababa">();</span><br /><span style="color:#e5d28e">55 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">56 </span> fieldInfo<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">SetValue</span> <span style="color:#bababa">(</span>_object<span style="color:#bababa">,</span> <span style="color:#e2e825">null</span><span style="color:#bababa">);</span><br /><span style="color:#e5d28e">57 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">58 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">59 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">60 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">61 </span><span style="color:#bababa">}</span><br /><span style="color:#e5d28e">62 </span><br /><span style="color:#e5d28e">63 </span><span style="color:#bababa">[</span>Serializable<span style="color:#bababa">]</span><br /><span style="color:#e5d28e">64 </span><span style="color:#e2e825">public abstract class</span> AbstractDisposingClass <span style="color:#bababa">:</span> IDisposable <span style="color:#bababa">{</span><br /><span style="color:#e5d28e">65 </span> <span style="color:#bababa">[</span>field<span style="color:#bababa">:</span>NonSerialized<span style="color:#bababa">]</span><br /><span style="color:#e5d28e">66 </span> <span style="color:#e2e825">protected</span> <span style="color:#60ff60">bool</span> m_IsDisposed <span style="color:#bababa">=</span> <span style="color:#e2e825">false</span><span style="color:#bababa">;</span><br /><span style="color:#e5d28e">67 </span><br /><span style="color:#e5d28e">68 </span> <span style="color:#e2e825">public virtual</span> <span style="color:#60ff60">void</span> <span style="color:#e825e2; font-weight:bold">Dispose</span> <span style="color:#bababa">() {</span><br /><span style="color:#e5d28e">69 </span> <span style="color:#e825e2; font-weight:bold">dispose</span> <span style="color:#bababa">(</span><span style="color:#e2e825">true</span><span style="color:#bababa">);</span><br /><span style="color:#e5d28e">70 </span> GC<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">SuppressFinalize</span> <span style="color:#bababa">(</span><span style="color:#e2e825">this</span><span style="color:#bababa">);</span><br /><span style="color:#e5d28e">71 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">72 </span><br /><span style="color:#e5d28e">73 </span> <span style="color:#e2e825">protected virtual</span> <span style="color:#60ff60">void</span> <span style="color:#e825e2; font-weight:bold">dispose</span> <span style="color:#bababa">(</span><span style="color:#60ff60">bool</span> bNotDisposed<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">74 </span> <span style="color:#e2e825">if</span> <span style="color:#bababa">(!</span>m_IsDisposed<span style="color:#bababa">) {</span><br /><span style="color:#e5d28e">75 </span> m_IsDisposed <span style="color:#bababa">=</span> <span style="color:#e2e825">true</span><span style="color:#bababa">;</span><br /><span style="color:#e5d28e">76 </span> NayanTools<span style="color:#bababa">.</span><span style="color:#e825e2; font-weight:bold">Dispose</span> <span style="color:#bababa">(</span>bNotDisposed<span style="color:#bababa">,</span> <span style="color:#e2e825">this</span><span style="color:#bababa">);</span><br /><span style="color:#e5d28e">77 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">78 </span> <span style="color:#bababa">}</span><br /><span style="color:#e5d28e">79 </span><span style="color:#bababa">}</span><br /></pre>Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-37525881580272027682010-05-02T11:26:00.004+05:302010-09-02T00:37:00.386+05:30Auto Save in Paint - ver 1.6This is latest version of AutoSavePaint application. Nothing major, but some fixes.<br /><br /><span style="font-size: large;"><b>Fixes</b></span><br /><ol><li>Busy icon was not properly showing. Fixed now.</li><li>The icons to show the job status (red, green, orange) were not properly showing sometimes. Fixed.</li></ol><br />The next version will take some time as there is nothing much to be fixed right now. And I have to think about new features (I don't have any idea!) =)<br /><br />If you would like to see some better changes, please provide feedback.<br /><br />Updated Download Link: <a href="http://dl.dropbox.com/u/6634742/AutoSavePaint_1.6.0.0.zip" target=_blank>Auto Save in Paint 1.6</a><br /><br />Update 1-Aug-2010:<br />I have tested and experimented this tool on Win XP, and it works great. But after trying it on Win 7, it seems that the Paint application of Win 7 works differently. The results can be opposite. I observed a 41 KB JPEG file turning to 62 KB after saving it.<br /><br />This tool works fine. Since it is dependent on external application (Paint here), the saving algorithm may vary, and so do the results.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com11tag:blogger.com,1999:blog-2839411799250444486.post-5330105064084995792010-02-22T23:23:00.005+05:302010-02-23T00:21:03.734+05:30Auto Save in Paint - ver 1.5Good news! The application just got simpler!! :)<br />
<br />
I feel that a small tool should not be complex. Even if its filled will complex algorithms, the user should not feel intimidated by it.<br />
<br />
In this version, 1.5, of AutoSavePaint, I have removed two lists to show the input and output. Rather, you just load file on one list and there it gets processed. Drag and drop and other features are still maintained.<br />
<br />
Read more details about the tool <a href="http://tech-disasters.blogspot.com/2010/02/auto-save-in-paint-version-10.html" target="_blank">here</a>.<br />
<br />
<u>Features Added</u>:<br />
1. <b>Recursion</b> - If you wish to select images from a folder and its sub-folders, you can do that now. No need to go into each and every directory and add images. How to use? When you select a folder, just make sure that the 'Recurse' check-box is selected. That's it!<br />
2. <b>Progress report</b> - Now you can see how much work has the tool done in a progress bar. Looks good too!<br />
3. <b>Toolbar</b> - I removed the buttons on side and moved the functionality in the toolbar buttons. Clearer and compact interface.<br />
4. <b>Reduced Size</b> - The file size of the application got smaller. This helps in loading it faster!<br />
5. <b>Icons</b> - :)<br />
<br />
For programmers, the news is - I wrote 3 custom controls and one generic animation class!! It was not easy, believe me. I'm glad they are bug free to max extent.<br />
<br />
I'll be putting up the controls' info on <a href="http://www.codeproject.com/" target="_blank">Codeproject</a> soon.<br />
<br />
Download the new version 1.5 of AutoSavePaint <a href="http://www.datafilehost.com/download-523d97bf.html" target="_blank">here</a>. Password is same, "Paint" (without quotes). It will remain same for all releases of this project.<br />
<br />
Feedbacks are welcome. :)Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com6tag:blogger.com,1999:blog-2839411799250444486.post-50355828192632331452010-02-19T03:24:00.012+05:302010-02-19T20:49:32.621+05:30Auto Save in Paint<span class="Apple-style-span" style="color:#38761d;">[Update Start - 19-Feb-10]</span><br /><ul><li><span class="Apple-style-span" style="color: rgb(56, 118, 29); ">It also supports drag and drop feature. Drop folders with images or just drop JPEG images on the list (named "Select") area, and they are queued for processing. Note - the list will be added with the data you are dropping subject to the option that you have selected (Folders or Files).</span></li><li><span class="Apple-style-span" style="color: rgb(56, 118, 29); ">Sorry, but I missed out this - if your images are huge, and by that I mean, like 30 MB+ (an estimated figure), then obviously Paint will take long time to load the image. The time taken by Paint to load an image also depends on how much RAM your PC has and what is the speed of your processor. More RAM and faster processor will probably help in loading the images quickly.</span></li><li><span class="Apple-style-span" style="color: rgb(56, 118, 29); ">The thing is, if it takes more than 30 secs to load an image in Paint, AutoSavePaint will ask you if wish to kill it. If you say yes, then it will move on to the next image in the list. Idea is that if an image takes that long, probably your PC is not fast enough or you have insufficient RAM. =D</span></li><li><span class="Apple-style-span" style="color: rgb(56, 118, 29); ">Updated to v1.1 - <a href="http://www.datafilehost.com/download-06fc0cd5.html" target="_blank">Download link</a></span></li></ul><div><span class="Apple-style-span" style="color:#38761d;">[Update End]</span><br /><br />I am very much into photography. But with digital images you have a problem - high resolution images take lot of space. Unless you want to ruin them, you do not modify them by reducing their size or content quality.<br /><br />These images, if JPEG format, are mostly uncompressed (or poorly compressed) by the cameras. This is the reason why each one of them can be so huge in file size. If you are professional photographer, you must be already having hard disks of many tera-bytes of space to keep these pictures.<br /><br />I accidently found out that 'Paint' application (on Windows platform, which supports JPEGs(!)) is the cheapest way to compress these images. Yes, I know that there are hundreds of applications which do so much better. But consider these facts -<br />1. MS Paint is light weight.<br />2. It doesn't lose the quality of JPEG fed to it (unless you are converting an image from another format).<br />3. The file size reduction is between 20% to 80% (as observed).<br /><br />I have already recovered gigabytes of space from my previously saved images using Paint.<br /><br />Now ask the question:<br />What is the problem then?<br /><br />Answer: You have to open each file in Paint and save them individually. Paint doesn't open multiple images. And, opening multiple Paint instances can take up lot of memory. This is a big pain!<br /><br />Till now. :)<br /><br />I created a tiny application, 'Auto Save in Paint' (AutoSavePaint) which automates the above procedure. So, you feed it a list of JPEG images or a folder in which you might have thousands of JPEG images. Then, ask it to process them. The application will open each image in MS Paint, save it, and then close that image. This will go on till all the images have been processed.<br /><br />You might say that you already have seen some tools which can process multiple files. To this I would say that they are mostly not free, shareware, ad-ware, eat up loads of memory themselves while loading, or are command line based. Even then, (so far) I have not seen any tool which compresses the JPEGs better than MS Paint - in simplest way. Sure, you can tweak the options in tools like GIMP and Photoshop to give you smallest file size output, but try doing that to 2000 pictures :)<br /><br />Yes, if you are geek enough, you would be running some scripts or command line programs which can take care of automating the tasks. But, unfortunately, not everyone can deploy such solution easily.<br /><br /><b><u>Benefits of AutoSavePaint -</u></b><br />1. Small memory footprint (in layman's terms, very small in size)<br />2. Loads up quickly<br />3. Uses third party tool to do the dirty work (MS Paint in this case). Hence, lesser chances of introducing its own bugs =D<br />4. Automatically detects errors if Paint could not open any image. It happens too :-/ (blame Microsoft)<br />6. Provides report of what has been done.<br /><br /><u>Steps to use -</u><br />1. Start it.<br />2. Provide it folder(s) where JPEG images are kept, or give it list of files individually.<br />3. Press start button and sit back. Use stop button if you want to interrupt the process.<br /><br /><u>Points to note -</u><br /><span class="Apple-style-span" style="font-size:x-large;"><b><span class="Apple-style-span" style="color:red;">Do not use your PC while AutoSavePaint is working</span></b></span> =D or you will see weird things happening.<br />Since MS Paint doesn't provide any convenient way to automate, I have used some programming tactics to achieve the result. Best time to use this utility will be when you are going to sleep or are stepping away from your PC for a while. Let it work on its own.<br /><br /><u>Cons or dependencies -</u><br />1. It needs .NET 2.0 framework. Most of the Windows OS these days already have it. If you do not have it (?!!) then you can download it from MS's website. <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en" target="_blank">Here is the link</a>.<br />2. It works only on Windows OS.<br />3. Uses MS Paint. If you have uninstalled MS Paint by any chance (?!!) then you can not use this tool.<br /><br />Please try it if you like, and do provide feedback :)<br />The link is <s>http://www.datafilehost.com/download-d1ad5e29.html</s> (look in the updates). The file name is <b>AutoSavePaint.zip</b> and its password is "Paint" (without quotes).<br /><br /><br />PS - Its in early phase, so please bear with me if you find any bug :) Send those bug details to me along with a little description of what happened exactly.</div>Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com4tag:blogger.com,1999:blog-2839411799250444486.post-73129640850396785132009-09-20T19:52:00.001+05:302009-09-20T19:52:47.850+05:30FreeWhat happens when you wake up from educated coma and understand that something is wrong around you? Your freedom is not what it is.<br />
<br />
Actually, freedom is also very subjective. But ever since our ancestors' brain started working, we have always consciously desired a recognition for our existence. Unfortunately, this desire tends to overtake our righteousness now and then in modern times. We tend to go overboard and set rules for others while making ourselves believe that it is in their best interests.<br />
<br />
We are still evolving in cyber world. How long has it been, hardly 10 years or so?! This generation is watching it live - setting up of rules for our virtual existence. Those who are setting it understand best what not everyone knows - information is the power - and it facilitates growth in other fields.<br />
<br />
While digital media is created by us, its debatable, or subjective whether its accessibility is really governed by the creator. The original idea of 'successful' trading, I believe, is creating and selling what others need, not what we want to sell. But mostly, we sell what we want to sell and not what others need. Freedom is virtual.<br />
<br />
Being an artist (somewhat) I also understand what it means to put hard work and time in creating amazing designs and results. But where is the fun? I feel, joy comes when its shared.<br />
<br />
This is bit late article to celebrate the day of FOSS (Free and open source software), perhaps I am not even aware of correct date, but my philosophy about sharing is not limited to it only. Audio, video, photographs, software etc. - it applies to all.<br />
<br />
Take what you need to survive, give away the rest. Peace.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com2tag:blogger.com,1999:blog-2839411799250444486.post-82894871207076940962008-12-23T18:24:00.004+05:302008-12-23T18:29:02.991+05:30Cisco code under troubleWHAM!!!<br /><br />What a bad luck! Read on.. :)<br /><br /><blockquote>A chip company had an Ethernet controller chip, and they engaged outsourcers in a Far East country to develop some software drivers for it. They sold the chip, together with the software drivers of course, to a company called Linksys, which incorporated it into the design of their four-port router. It was one of the most popular of the smaller routers. In the process of doing this, Linksys added their own code around these software drivers and then they marketed the unit. It just so happens that the outsourcer the chip company had employed at some point inserted a piece of code subject to a GNU General Public License, or GNU GPL.<br /><br />One of the properties of the GPL license is that you can use it and you don't have to pay anything, but any code that's written around this piece of code, and any modifications or derivations of the code, also become GPL. That means that you have to make the code publicly available. You basically must open up your code. Now Linksys probably wasn't aware that they had such code. Then, of course, Cisco acquired Linksys and inherited the technology and the router and the code. Cisco then began using the code in other sections of their own products. So, suddenly, a whole bunch of products at Cisco are now 'contaminated' with GPL code, which means that Cisco is in the unenviable position of having to 'open up' their valuable proprietary code to the public.</blockquote>Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com1tag:blogger.com,1999:blog-2839411799250444486.post-69109571065688026122008-12-20T18:30:00.002+05:302008-12-20T18:42:43.070+05:30Coming up: FRenI have always been in search of open source tools for file/folder renaming purpose. There was a time when I created one for my own, but that ran in console mode. I googled many time to find good tools but most of them are shareware/adware/paid. Those which I found good/useful were overly complex in user interface. Like <a href="http://myprogramspace.blogspot.com/2008/07/krename-multi-file-rename-tool-v0.html" target=_blank>this guy</a> - he has done good job and has wonderful ideas. But the tool is so buggy that after few uses I found my songs turned into documents and the videos turned into songs and so on. I find it very useful to lose my documents. Very risky!! Though its in beta, but I find it too cluttered and confusing to be released as beta.<br />
<br />
So, I decided to begin from scratch and spin the wheel again. I am following the ideas of Ken's Rename tool only, but highly robust.<br />
<br />
Please suggest ideas if you have faced challenges in using such tools and what would you like it to do. Hint: Check Ken's Rename tool.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-74281812374301974682008-11-12T15:15:00.007+05:302008-11-12T15:29:20.806+05:30How to configure applications without IP dependencyMany times we migrate machines/VMWare images from one place to another, affecting their domain and IPs. Sometimes we just fancy a different name for the machine. In both cases, the applications installed on that machine which are sensitive to the IP or machine name are required to be reconfigured. Siebel Ent. Applications is one of such products. However, the solution to such situations is very simple.<br /><br />The problem can be divided in to two situations -<br />1. IP changes.<br />2. Machine name changes.<br /><br />The following trick should be performed before the above changes to keep the matters simple.<br /><br />In the "host(s)" file (found in etc sub-folder on *nix and %windir%\system32\drivers\etc on Windows NTs), add a new machine name for the same machine IP address. Use this "new machine name" while configuring the applications, wherever required.<br /><br />1. In case of IP change-<br />Change the IP for all the machine names in the hosts file for the same network adapter. Replace all the instances of the old IP to new one.<br /><br />2. In case of machine name change -<br />Nothing needs to be done!Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com2tag:blogger.com,1999:blog-2839411799250444486.post-91304629800788710652008-10-01T15:13:00.002+05:302008-10-01T15:22:06.790+05:30OOO:)<br />I am traveling back to home for 2 weeks. Hope to see you here when I come back :)<br /><br />Take care fellas!Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com0tag:blogger.com,1999:blog-2839411799250444486.post-82683918423873056522008-09-23T18:24:00.003+05:302008-09-24T15:02:20.679+05:30Uno in C#Finally! Such a relief!<br /><br />I have been trying to create the project on Sourceforge for my game. Somehow, I couldn't upload the source code.. till now. The link to the game project is <a href="http://sourceforge.net/projects/unocsharp/" target="_blank">here</a>.<br /><br />Right now, I am trying to develop a web site for it =)Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com1tag:blogger.com,1999:blog-2839411799250444486.post-79725716409847682152008-09-06T11:19:00.004+05:302008-09-06T13:12:15.490+05:30Modifying templatesDonn is definitely confused with new blogger template :D<br /><br />His question is, "<span style="color: rgb(255, 102, 0);">How can I change text <span style="font-style: italic;">comments</span> to something else?</span>"<br /><br />Before I start, I must warn you that you will be tampering with your blogger's template. Any customization already done on it might be lost. <span style="font-style: italic;">Please take backup of your template before you modify it.</span><br /><br /><br />For old template users –<br />Open up your template in an editor. Search for text <span style="font-weight: bold; color: rgb(153, 51, 153);"><$I18NNumComments$></span><br />Replace it with <span style="font-weight: bold;"><span style="color: rgb(204, 0, 0);"><$BlogItemCommentCount$></span> <span style="color: rgb(51, 51, 255);">comments</span></span><br /><br /><br />For new template users –<br />You can replace <span style="font-weight: bold; color: rgb(153, 51, 153);"><data:top.commentlabel></span> with <span style="font-weight: bold; color: rgb(51, 51, 255);">comment</span><br />And <span style="font-weight: bold; color: rgb(153, 51, 153);"><data:top.commentlabelplural></span> with <span style="font-weight: bold; color: rgb(0, 0, 153);">comments</span><br /><br />Notice the plural nature of the latter.<br /><br /><br />Hope you find the above texts easily :)<br />Noobs can stop reading here now =P<br /><br /><br /><br /><u>Caution:</u><br />When you replace the texts, try to pad the code with angle brackets with at least one space to its left and right ends. The reason is something like this - HTML is messy.<br />These patterns in blogger code are not treated nicely all the time.<br /><span style="font-weight: bold; color: rgb(255, 0, 0);">>><br /><<<br />><</span><br />There is high probability of not seeing the results in expected manner.<br /><br />The correction can be done like this - by inserting a space in between the angle brackets.<br /><span style="font-weight: bold; color: rgb(51, 204, 0);">>&nbsp;><br /><&nbsp;<<br />>&nbsp;<</span><br /><br />Now, just in case you are wondering where the heck is space here, I should tell noobs :P that <span style="font-weight: bold;">&nbsp;</span> is equivalent of single space character. Its better to code this way than relying on normal coding because the blogger engine is designed to work this way. Its simple and robust.<br />If you are not sure what ever code you wrote is going to be interpreted correctly by blogger, then use <a href="http://vivociti.com/component/option,com_vivohtmlencoder/Itemid,66/" target="_blank">this site</a> for converting it to blogger friendly (and not so human friendly) code.<br /><br /><br /><br />You just need to read carefully the template. It would become very easy to modify the content once you take some time to understand the basic structure.<br /><a href="http://help.blogger.com/bin/topic.py?topic=12488" target="_blank">Read this</a> for more help.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com2tag:blogger.com,1999:blog-2839411799250444486.post-67061029742382911432008-09-05T11:45:00.006+05:302009-10-01T19:05:14.381+05:30Regex problemGeeeeezz!<br /><br />It took me so long to understand the difference between <b>\w</b> and <b>\b</b> in Regular Expressions!!!<br /><br />Although both mark the word boundary, \b is more effective (IMHO). Try search whole word text which is just at the end of a text file. Something like,<br /><br />....<br />blah blah blah<br />....<br />blah<i><eof></i><br /><br /><br />If you are searching for text 'blah' (notice the one at the end of file) then \w will skip it. So, better use \b!!<br /><br /><span style="font-family: courier new;"></span><blockquote><span style="font-family: courier new;">Regex re = new Regex(@"\bblah\b");</span></blockquote><br /><br />Happy coding! =)Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com8tag:blogger.com,1999:blog-2839411799250444486.post-11714831310407779282008-09-03T01:35:00.005+05:302008-09-03T01:48:45.026+05:30Google Chrome!You have to see this!<br /><br />Check <a href="http://tools.google.com/chrome/intl/en-US/welcome.html" target="_blank">Google Chrome</a> - the latest free browser. Its extremely fast and lightweight, probably because it lacks plugins and many other features (like it failed <a href="http://www.java.com/en/download/installed.jsp?detect=jre&try=1" target="_blank">Java tests</a>). Though it offers spelling correction, it doesn't offer the alternatives yet, leaving user to wonder what is wrong with what he typed.<br /><br />Mind that it is new and in early stages and that makes it not really worthy of being compared to FF or IE or any other standard browser for that matter. But the speed, light-weight, sleek design make it my instant favourite!<br /><br />But I am going to stick to FF for the love of extremely customizable interface and its robustness. I must say I missed <a href="https://addons.mozilla.org/firefox/addon/748" target="_blank">greasemonkey</a> the moment I started GC.<br /><br />I really hope Google keeps up the good work and give us more customizable version with the lightness and speed of it's current version.Nayanhttp://www.blogger.com/profile/10734131303940804145noreply@blogger.com6