<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-12103229</id><updated>2024-03-07T19:48:49.967+02:00</updated><title type='text'>Adi Drumea</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default?alt=atom'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default?alt=atom&amp;start-index=26&amp;max-results=25'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>28</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-12103229.post-8976674828743768864</id><published>2009-09-02T09:56:00.003+03:00</published><updated>2009-09-02T10:02:35.090+03:00</updated><title type='text'>[.NET] String.IndexOf</title><content type='html'>From MSDN: This method performs a word (case-sensitive and culture-sensitive) search using the current culture.&lt;br /&gt;&lt;br /&gt;I knew it was case-sensitive, but I had to solve a bug to discover it was also culture-sensitive. This lead to some annoying stuff like searching for string &quot;Țară&quot; (&quot;country&quot; in Romanian) in string &quot;Prima oară&quot; (&quot;first time&quot; in Romanian) would return index = 7. Because the default culture was en-US, IndexOf looked at &quot;Ț&quot; as empty string, so it would match just &quot;ară&quot;. Weird default behavior if you ask me.&lt;br /&gt;&lt;br /&gt;Anyway, they have decided to change it for .NET 4.0: &quot;Please note that on Silverlight, and starting in .NET Framework 4.0, this method performs an ordinal comparison instead of a culture-sensitive comparison using the current culture (CultureInfo.CurrentCulture). This will result in this method having a different behavior on these platforms. Instead, it is advised that the String.IndexOf(String, StringComparison) overload be used on all platforms to minimize the impact to your existing applications.&quot;</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/8976674828743768864/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/8976674828743768864' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/8976674828743768864'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/8976674828743768864'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2009/09/net-stringindexof.html' title='[.NET] String.IndexOf'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-6719254030365336623</id><published>2008-05-05T20:01:00.003+03:00</published><updated>2008-05-05T20:08:38.543+03:00</updated><title type='text'>[Apache] Error 300 Multiple Choices</title><content type='html'>I&#39;ve spent the last two hours trying to figure out the cause of this message. First I thought it had something to do with mod_rewrite, then I suspected mod_negotiate (didn&#39;t know what it does). To make things worse, searching the error message would hit error pages crawled by google, nothing helpful. Finally, I used some magic keywords (url closest match) and I found the guilty module: mod_speling. Once enabled, it matches the url to the closest valid name it can find.&lt;br /&gt;&lt;br /&gt;I can&#39;t help notice the humour of the open source programmers, spelling &#39;spelling&#39; as &#39;speling&#39;. Not enjoing it very much, they&#39;d better make a safer default apache config than try so hard to look smart. Typical &quot;rtfm!/i&#39;m so smart&quot; counterproductive behavior.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/6719254030365336623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/6719254030365336623' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/6719254030365336623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/6719254030365336623'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2008/05/apache-error-300-multiple-choices.html' title='[Apache] Error 300 Multiple Choices'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-9130214473606426880</id><published>2008-04-15T20:15:00.004+03:00</published><updated>2008-04-15T20:28:40.820+03:00</updated><title type='text'>[C++] Sending e-mail without SMTP</title><content type='html'>Today I needed to write some code in a .net application to allow the user to send e-mails with certain files attached to an arbitrary e-mail addresses. The application does not have to depend on Outlook or other e-mail clients being installed on the machine.&lt;br /&gt;&lt;br /&gt;I thought about the problem a bit and realized it can be done via DNS queries and sending the mail directly to the domain determined from the recipient&#39;s e-mail address (like any MTA does). Fortunately, someone beat me into writing a very simple solution based on ATL.&lt;br /&gt;&lt;br /&gt;Here&#39;s the link on codeproject:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.codeproject.com/KB/tips/CSMTPConnection2.aspx&quot;&gt;http://www.codeproject.com/KB/tips/CSMTPConnection2.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I downloaded the source code, basically a derived class overloading CSMTPConnection::Connect to enumerate SMTPs of the given domain, but it did not work. I have Visual Studio 2008 and ATL is no longer included in it. So I downloaded the ATL sources from Microsoft&#39;s codeplex:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.codeplex.com/AtlServer&quot;&gt;http://www.codeplex.com/AtlServer&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Next, I hit a bug in GetRecipientsString() from atlmime.h, which I have fixed. I then searched the issues on codeplex and found out it was there already:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.codeplex.com/AtlServer/WorkItem/View.aspx?WorkItemId=4683&quot;&gt;http://www.codeplex.com/AtlServer/WorkItem/View.aspx?WorkItemId=4683&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;All I was left to do was to assemble the code in a Managed C++ library and wrap the functionality in a friendly class and my task was done.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/9130214473606426880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/9130214473606426880' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/9130214473606426880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/9130214473606426880'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2008/04/c-sending-e-mail-without-smtp.html' title='[C++] Sending e-mail without SMTP'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-2141556206311693095</id><published>2008-03-12T14:06:00.005+02:00</published><updated>2008-03-12T14:22:00.386+02:00</updated><title type='text'>[Windows] How to obtain meaningful application dumps from your clients</title><content type='html'>Step 1. Have them download and install the userdump package from Microsoft:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyID=E089CA41-6A87-40C8-BF69-28AC08570B7E&amp;amp;displaylang=en&amp;amp;displaylang=en&quot;&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=E089CA41-6A87-40C8-BF69-28AC08570B7E&amp;amp;displaylang=en&amp;amp;displaylang=en&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Step 2. In the userdump configuration, have them add your &lt;strong&gt;application.exe&lt;/strong&gt; to the list of monitored processes&lt;br /&gt;&lt;br /&gt;Step 3. Have them run your application and when the error strikes a dump will be saved to the windows directory&lt;br /&gt;&lt;br /&gt;Step 4. Have them browse the windows directory, order by modified and send you the last .dmp file&lt;br /&gt;&lt;br /&gt;Step 5. Analyze the dump file with WinDBG from Microsoft:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx&quot;&gt;http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/2141556206311693095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/2141556206311693095' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/2141556206311693095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/2141556206311693095'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2008/03/windows-how-to-obtain-meaningful.html' title='[Windows] How to obtain meaningful application dumps from your clients'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-5112291487334566763</id><published>2008-03-10T22:20:00.005+02:00</published><updated>2008-03-10T22:30:56.454+02:00</updated><title type='text'>[HTML] Internet Explorer ignores TD width attribute when TD with colspan and large content is present</title><content type='html'>&lt;p&gt;Let&#39;s take a HTML table with fix width and two fixed width columns:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&amp;lt;table width=&quot;500&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td width=&quot;300&quot;&amp;gt;a&amp;lt;/td&amp;gt;&amp;lt;td width=&quot;200&quot;&amp;gt;b&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This will render in IE and Firefox as it is supposed to: one col 300 px and the other col 200 px.&lt;br /&gt;If you add another row with one cell with colspan = 2, and the content is wide, like:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&amp;lt;tr&amp;gt;&amp;lt;td colspan=&quot;2&quot;&amp;gt;&amp;lt;div style=&quot;&#39;width:490px;&#39;&quot;&amp;gt;aaaa&amp;lt;/div&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;..this works just fine in Firefox, but in IE it may break the widths of the other two cols, although it fits just fine in the table width. Very weird.&lt;/p&gt;&lt;p&gt;The fix is to use percentage width on the first column and to not specify a width for the second column. In this case, you would change the first row to:&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&amp;lt;tr&amp;gt;&amp;lt;td width=&quot;60%&quot;&amp;gt;a&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;b&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;This will behave the same in IE and Firefox.&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/5112291487334566763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/5112291487334566763' title='87 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/5112291487334566763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/5112291487334566763'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2008/03/html-internet-explorer-ignores-td-width.html' title='[HTML] Internet Explorer ignores TD width attribute when TD with colspan and large content is present'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>87</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-5052591828161168491</id><published>2008-03-10T15:34:00.005+02:00</published><updated>2008-08-13T12:56:20.020+03:00</updated><title type='text'>[MySQL, PHP] Using UTF-8 correctly -- updated</title><content type='html'>Here is a simple recipe for people who need to work with UTF-8 only in PHP and MySQL:&lt;br /&gt;&lt;br /&gt;In my.ini set the params below and restart the service:&lt;br /&gt;&lt;br /&gt;[mysql]&lt;br /&gt;default-character-set=utf8&lt;br /&gt;[mysqld]&lt;br /&gt;default-character-set=utf8&lt;br /&gt;&lt;br /&gt;In php.ini set the params below and restart the web server.&lt;br /&gt;&lt;br /&gt;default_charset = &quot;utf-8&quot;&lt;br /&gt;&lt;br /&gt;When using mysql/i to make a connection from PHP, execute the following after connecting:&lt;br /&gt;&lt;br /&gt;mysqli_set_charset($db, &#39;utf8&#39;);&lt;br /&gt;&lt;br /&gt;Use mb_xxx functions for string functions in PHP. See this page for reference:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.phpwact.org/php/i18n/charsets&quot;&gt;http://www.phpwact.org/php/i18n/charsets&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is a summary of the functions calls you need to replace in PHP (incomplete):&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.mail.php&quot;&gt;mail()&lt;/a&gt; --&gt; &lt;a href=&quot;http://www.php.net/manual/en/function.mb-send-mail.php&quot;&gt;mb_send_mail()&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.strlen.php&quot;&gt;strlen()&lt;/a&gt; --&gt; &lt;a href=&quot;http://www.php.net/manual/en/function.mb-strlen.php&quot;&gt;mb_strlen()&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.strpos.php&quot;&gt;strpos()&lt;/a&gt; --&gt; &lt;a href=&quot;http://www.php.net/manual/en/function.mb-strpos.php&quot;&gt;mb_strpos()&lt;/a&gt;&lt;br /&gt;stripos() --&gt; mb_stripos()&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.strrpos.php&quot;&gt;strrpos()&lt;/a&gt; --&gt; &lt;a href=&quot;http://www.php.net/manual/en/function.mb-strrpos.php&quot;&gt;mb_strrpos()&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.substr.php&quot;&gt;substr()&lt;/a&gt; --&gt; &lt;a href=&quot;http://www.php.net/manual/en/function.mb-substr.php&quot;&gt;mb_substr()&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.strtolower.php&quot;&gt;strtolower()&lt;/a&gt; --&gt; &lt;a href=&quot;http://www.php.net/manual/en/function.mb-strtolower.php&quot;&gt;mb_strtolower()&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.strtoupper.php&quot;&gt;strtoupper()&lt;/a&gt; --&gt; &lt;a href=&quot;http://www.php.net/manual/en/function.mb-strtoupper.php&quot;&gt;mb_strtoupper()&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.eregi.php&quot;&gt;ereg*()&lt;/a&gt; --&gt; preg*() (In general preg* is recommended)&lt;br /&gt;preg_* --&gt; preg_* /ui (make sure you add /u switch for safety)&lt;br /&gt;sprintf --&gt; ??? (uncertain, probably sprintf works out of the box)&lt;br /&gt;&lt;strong&gt;s[i] --&gt; mb_substr(s, i, 1) (indexing gets byte, not char, at index)&lt;br /&gt;&lt;/strong&gt;strstr() --&gt; mb_strstr()&lt;br /&gt;stristr() --&gt; mb_stristr()&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/function.split.php&quot;&gt;split()&lt;/a&gt; --&gt; &lt;a href=&quot;http://www.php.net/manual/en/function.mb-split.php&quot;&gt;mb_split()&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For preg_* functions make sure character classes like [a-z] becomes [\pLl] and [A-Z] becomes [\pLu]&lt;br /&gt;&lt;br /&gt;Also:&lt;br /&gt;&lt;br /&gt;html_special_chars seems to work just fine. Not sure about addslashes. In general you should audit the correct usage of every string function throughout your application.&lt;br /&gt;&lt;br /&gt;Bonus:&lt;br /&gt;&lt;br /&gt;1. In MySQL, to sort correctly by a utf8 column, specify collation after order by (or specify collation on that column when you create the table). For example to order by a utf8 column with romanian collation:&lt;br /&gt;&lt;br /&gt;select * from table order by column collate utf8_romanian_ci desc&lt;br /&gt;&lt;br /&gt;This is meant as a simple guide for the situation when you use only utf8 throughout your database and your application, which should be fine for most languages.&lt;br /&gt;&lt;br /&gt;2. I have not managed to make DBManager show UTF-8 characters in the results grid, so you will see garbage although the data is stored correctly. The same applies to the mysql command line client (on Windows).&lt;br /&gt;&lt;br /&gt;3. There may be some problems with inserting blobs if the default charset is utf8, I am currently looking at this and update this.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/5052591828161168491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/5052591828161168491' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/5052591828161168491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/5052591828161168491'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2008/03/mysql-php-using-utf-8-correctly.html' title='[MySQL, PHP] Using UTF-8 correctly -- updated'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-8285469780514911506</id><published>2008-02-04T17:53:00.000+02:00</published><updated>2008-02-04T17:58:55.403+02:00</updated><title type='text'>[SQL Server] Copy data between rows of the same table</title><content type='html'>How do you solve the problem of copying data from the same column between two &lt;strong&gt;existing&lt;/strong&gt; rows of the same table, in Microsoft SQL Server 2000?&lt;br /&gt;&lt;br /&gt;The answer is UPDATE ... FROM:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;UPDATE tbl SET val = b.val&lt;br /&gt;FROM tbl, tbl b&lt;br /&gt;WHERE tbl.primaryKey=pk1 AND b.primaryKey=pk2 &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The syntax may seem a bit weird... but it works.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/8285469780514911506/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/8285469780514911506' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/8285469780514911506'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/8285469780514911506'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2008/02/sqk-server-copy-data-between-rows-of.html' title='[SQL Server] Copy data between rows of the same table'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-63178596987976190</id><published>2007-11-27T22:59:00.000+02:00</published><updated>2007-11-27T23:04:06.216+02:00</updated><title type='text'>[Javascript] typeof</title><content type='html'>Today i needed a way to check the real type of an object in javascript. Since typeof always returns &#39;object&#39; for Date and Array objects, i needed a typeof routine that would return &#39;array&#39; or &#39;date&#39; (needed for json encoding).  Here is a simple method to detect if an object is an Array instance or a Date instance:&lt;br /&gt;&lt;br /&gt;function objectIsArray(o) {&lt;br /&gt;  if (o === null)&lt;br /&gt;    return false;&lt;br /&gt;  return o.constructor == (new Array).constructor;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The constructor function is always defined for arrays. Two functions return equal if and only if they&#39;re the same function.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/63178596987976190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/63178596987976190' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/63178596987976190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/63178596987976190'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2007/11/javascript-typeof.html' title='[Javascript] typeof'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-8644091545284377315</id><published>2007-11-23T18:34:00.000+02:00</published><updated>2007-11-23T18:50:14.087+02:00</updated><title type='text'>[MySQL] Query optimizer bug</title><content type='html'>Today I posted my first bug report to the MySQL project.&lt;br /&gt;&lt;br /&gt;Here is the link:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://bugs.mysql.com/bug.php?id=32665&quot;&gt;http://bugs.mysql.com/bug.php?id=32665&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It has to do with slow query when dependent subqueries and IN operator is used and the dependent subquery result can be cached (but it is not).&lt;br /&gt;&lt;br /&gt;Update: They said it will be fixed in MySQL 6. I&#39;m not too glad about the timeframe.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/8644091545284377315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/8644091545284377315' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/8644091545284377315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/8644091545284377315'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2007/11/mysql-query-optimizer-bug.html' title='[MySQL] Query optimizer bug'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-6407929027356855325</id><published>2007-11-05T22:57:00.000+02:00</published><updated>2007-11-05T23:22:40.452+02:00</updated><title type='text'>[Web] Content-Disposition: inline; filename=bla.pdf</title><content type='html'>For some reason, the adobe pdf reader plugin doesn&#39;t care about the filename argument of the Content-Disposition directive when you save the pdf file. The fix is to use friendly URLs, and to build your url with the pdf filename as the last part of the url. For example, consider the following url: view.php?op=pdf&amp;amp;id=100. Before the fix, the plugin would suggest the filename view.pdf, no matter what filename= would be given in the http headers. After the fix, using the url view.php/op/pdf/id/100/myname.pdf, the plugin would suggest myname.pdf, which is exactly what we wanted. Note that friendly urls typically exclude .php extension from the script name, but i didn&#39;t bother to make the proper apache config changes to support it. Also note that the script arguments should be separated by /, and no funny characters should appear in between unless properly encoded.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/6407929027356855325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/6407929027356855325' title='46 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/6407929027356855325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/6407929027356855325'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2007/11/web-content-disposition-inline.html' title='[Web] Content-Disposition: inline; filename=bla.pdf'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>46</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-1959564161211396999</id><published>2007-10-28T21:34:00.000+02:00</published><updated>2007-10-28T21:40:43.888+02:00</updated><title type='text'>Terminal Services Compatibility</title><content type='html'>I don&#39;t know whether there is a special label ISVs can put on a product box when their app is tested under Terminal Services for Windows... If there isn&#39;t, there definitely should be. Or, unless it is a media or other interactive application, Terminal Services compatibility should be a requirement for the Designed for Windows logo.&lt;br /&gt;&lt;br /&gt;I&#39;m working remotely on a windows machine and i&#39;m tired having to wait 10 seconds every time DBManager starts, just because of that nifty fading splash screen. Really, who gives a damn about that animation?</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/1959564161211396999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/1959564161211396999' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/1959564161211396999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/1959564161211396999'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2007/10/terminal-services-compatibility.html' title='Terminal Services Compatibility'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-5193520392408687946</id><published>2007-06-04T12:24:00.000+03:00</published><updated>2007-06-04T12:29:22.775+03:00</updated><title type='text'>[VS 2005] Quickly solving designer exceptions in Visual Studio 2005</title><content type='html'>From time to time (usually after code changes) some of your forms will not load in the VS 2005 designer showing instead the WSOD (white screen of darn) with an exception and stack trace. Unfortunately, from time to time, the stack trace is not useful and you may get stuck as I did today. The solution is to start another VS 2005 instance, to attach to the first instance and to make sure the debugger is set to catch all CLR exceptions (not only the unhandled ones). After that, re-oped the form and you&#39;ll break right into your source code. Usually (in my case) it&#39;s due to some setter not checking if it is in design mode and accessing unavailable resources.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/5193520392408687946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/5193520392408687946' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/5193520392408687946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/5193520392408687946'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2007/06/vs-2005-quickly-solving-designer.html' title='[VS 2005] Quickly solving designer exceptions in Visual Studio 2005'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-1628173883630291625</id><published>2007-04-13T22:20:00.000+03:00</published><updated>2007-04-13T22:22:45.460+03:00</updated><title type='text'>[Misc] svchost.exe cpu 100% after return from standby/hibernate</title><content type='html'>On my laptop, i sometimes see a cpu utilization of 100% for a long time (1-2 minutes). The process responsible for this is svchost. Othershave encountered this problem and a fix (at least partial) is found at:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://support.microsoft.com/kb/927891/&quot;&gt;http://support.microsoft.com/kb/927891/&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/1628173883630291625/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/1628173883630291625' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/1628173883630291625'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/1628173883630291625'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2007/04/misc-svchostexe-cpu-100-after-return.html' title='[Misc] svchost.exe cpu 100% after return from standby/hibernate'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-9184920853945387360</id><published>2007-03-16T15:22:00.000+02:00</published><updated>2007-03-16T16:11:02.231+02:00</updated><title type='text'>Floating point and the CLR</title><content type='html'>I recently had to use a math library (dll) from a managed c++ library used from c# code. All seemed well, the dll funcs appeared to work, but I got wrong results from time to time. When using the same code and compiling for unmanaged, the errors would dissapear. I did a _controlfp to get the floating point status word and it was different when running in managed from unmanaged context. It turned out that the precision was only 24 bits in managed and 53 bits in unmanaged. The solution was to save the control word prior to using the dll functions and to restore it just before returning from the managed c++ library (so other code in c# does not get messed up). They say the function is not supported nor reliable so I guess there will be some more issues when we compile in release mode, but for now I&#39;m content I have solved the problem.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/9184920853945387360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/9184920853945387360' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/9184920853945387360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/9184920853945387360'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2007/03/floating-point-and-clr.html' title='Floating point and the CLR'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-115187588717752961</id><published>2006-07-02T23:55:00.000+03:00</published><updated>2006-07-03T02:36:56.320+03:00</updated><title type='text'>[Really] Offtopic</title><content type='html'>Whenever I see a person who is talented or skilled I admire him. I also tend to admire people who forget about competing with others and transform any kind of competition (life included) into a competition with themselves. They are usually the true players of the game, but they are not always recognized as the best. This happens for many reasons and even if no rules ar broken I cannot feel anything but sad when it happens. But it&#39;s by the rules and that&#39;s all that matters.&lt;br /&gt;&lt;br /&gt;This is a fact of life and only a child would not accept it. Related to this is the joy of some people when they see the best of us fail. It&#39;s a result of envy and it&#39;s a very common feeling. This is because value is scarce and most people fight with mediocrity all their lives. Seeing others layed down by a fierce struggle, others that have been absolute winners so far, gives mediocre people the satisfaction that all people are alike. Mediocrity loves nothing but mediocrity. This is another fact of life.&lt;br /&gt;&lt;br /&gt;All of this is to better understand me when I say: god damn brasilians, with all their famous players, they deserved it!&lt;br /&gt;&lt;br /&gt;(Written in grief after being in the middle of 2-3000 french people, watching a WC 2006 quarter final in Metz, France)</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/115187588717752961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/115187588717752961' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/115187588717752961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/115187588717752961'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2006/07/really-offtopic.html' title='[Really] Offtopic'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-115085573326675278</id><published>2006-06-21T05:01:00.000+03:00</published><updated>2006-06-21T05:08:53.280+03:00</updated><title type='text'>Terahertz?</title><content type='html'>Recently, IBM has demonstrated a chip running at 500 Ghz in a very low temperature setting and at 350 Ghz at room temperature. They are confident that they could reach 1 Thz in the future. Let&#39;s imagine a 1 Thz computer... you would be able to play you extra fancy ultra realistic 3D action shooter on a giant high resolution screen while also doing some background transcoding of you DVD collection for your portable .5 Thz (lol) video player. I can&#39;t imagine any further... do we really need 1 Thz? :D&lt;br /&gt;&lt;br /&gt;Here&#39;s a link:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.macworld.com/news/2006/06/20/500ghz/index.php&quot;&gt;http://www.macworld.com/news/2006/06/20/500ghz/index.php&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/115085573326675278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/115085573326675278' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/115085573326675278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/115085573326675278'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2006/06/terahertz.html' title='Terahertz?'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-114873279109359003</id><published>2006-05-27T15:23:00.000+03:00</published><updated>2006-05-27T15:26:32.270+03:00</updated><title type='text'>Testing automatic posting from Word 2007</title><content type='html'>&lt;span xmlns=&quot;&quot;&gt;&lt;p&gt;I’ve installed Office 2007 beta and it’s quite cool. You can even post automatically to your blog! Very nice interface, lots of templates and save directly to PDF (finally). &lt;/p&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/114873279109359003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/114873279109359003' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/114873279109359003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/114873279109359003'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2006/05/testing-automatic-posting-from-word.html' title='Testing automatic posting from Word 2007'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-113865687540262126</id><published>2006-01-30T23:23:00.000+02:00</published><updated>2006-01-30T23:34:35.416+02:00</updated><title type='text'>[Offtopic] Dogs in Bucharest</title><content type='html'>I&#39;m watching a tv show called &quot;Nasul&quot; (romanian for Godfather) on B1TV and it&#39;s about the numerous dogs running freely in Bucharest. It seems that many people are being bitten by these dogs and recently an old man died, attacked by a pack of dogs. This situation is unnaceptable, and the obvious (an cheapest) solution is too dangerous, politically speaking, to be adopted. Euthanizing the dogs would probably raise a wave of protests from the so called animal lovers. So the dogs continue to exist in Bucharest because mayor Videanu doesn&#39;t have the guts to do what it takes.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/113865687540262126/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/113865687540262126' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113865687540262126'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113865687540262126'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2006/01/offtopic-dogs-in-bucharest.html' title='[Offtopic] Dogs in Bucharest'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-113831209691236621</id><published>2006-01-26T23:46:00.000+02:00</published><updated>2006-01-26T23:48:16.923+02:00</updated><title type='text'>[DB] Connection string templates</title><content type='html'>In case you have forgotten how to connect to a given DB, here&#39;s a useful link:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.connectionstrings.com/&quot;&gt;http://www.connectionstrings.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Useful.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/113831209691236621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/113831209691236621' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113831209691236621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113831209691236621'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2006/01/db-connection-string-templates.html' title='[DB] Connection string templates'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-113356671877800573</id><published>2005-12-03T01:36:00.000+02:00</published><updated>2005-12-03T03:46:51.573+02:00</updated><title type='text'>[C#] Unicode is everywhere</title><content type='html'>I&#39;ve just noticed that you may have unicode chars in identifiers in C#. Maybe not that useful, but definitely nice. Code like:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;string ţară=&quot;România&quot;; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;is now valid. :) There is a catch though. Change the encoding to unicode when saving. If you don&#39;t do that, even though in the editor the characters will appear ok, after you close and re-load the file, you will lose all the chars because of the default encoding on disk.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/113356671877800573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/113356671877800573' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113356671877800573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113356671877800573'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2005/12/c-unicode-is-everywhere.html' title='[C#] Unicode is everywhere'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-113279449373306397</id><published>2005-11-24T03:01:00.000+02:00</published><updated>2005-11-24T03:08:13.746+02:00</updated><title type='text'>[ASP.NET] Server side viewstate</title><content type='html'>During the development of an ASP.NET app, I noticed the increasing size of the viewstate as I added more controls to pages. Googled the net a bit and found a way to keep the viewstate on the serverside by overriding SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods of the Page class:&lt;br /&gt;- Create a unique key based on the session id, url and timestamp and use this to store the viewstate in the Cache.&lt;br /&gt;- Register a new hidden field to store this key client-side&lt;br /&gt;- When the viewstate needs to be restored, fetch the key from the page and load it from cache&lt;br /&gt;You may also use Session as it may be kept on SQL Server. Anyway, nice idea, dramatically reduced the size of my pages.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/113279449373306397/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/113279449373306397' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113279449373306397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113279449373306397'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2005/11/aspnet-server-side-viewstate.html' title='[ASP.NET] Server side viewstate'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-113166326666178990</id><published>2005-11-11T00:41:00.000+02:00</published><updated>2005-11-11T00:54:26.673+02:00</updated><title type='text'>[.NET] .NET components in IE, part 1</title><content type='html'>Same .NET app, trying to make it run as an ActiveX component. Throughout the app, I have made extensive use of the Forms Designer, because I like designing the interface in a visual way. I hate the programmatic ways. Anyway, this allowed me to attach images to my custom buttons (they should really put one generic image button control in the framework) while not being bothered with details about the bitmaps -- they just go into the resources and it knows to load them automagically. Nothing cooler, except that when you run the same component from IE, you hit into something named localization issues. For each ResourceManager instantiation, the framework looks for culture specific resource files in two dozen places (derived from the component&#39;s URI). This would not be an issue over the LAN, but over the Internet it is. Moreso, on my system, it sometimes just hangs while doing this. Debugging the app led me to a GetObject call from the ResourceManager. It just stops there. I didn&#39;t have the pacience to see if there was a timeout (and even if it is, who cares).&lt;br /&gt;&lt;br /&gt;Googled the net for answers, and finally found one great article for MSDN Mag:&lt;br /&gt;&lt;a href=&quot;http://msdn.microsoft.com/msdnmag/issues/02/07/NetSmartClients/&quot;&gt;http://msdn.microsoft.com/msdnmag/issues/02/07/NetSmartClients/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The solution appears to be removing the use of resource managers by loading the image files manually from external sources. This would reduce the number of HTTP requests to just 2 per component (the component and the .config file). It may or may not be a bug in the framework, but it certainly sends part of easy interface design to hell.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/113166326666178990/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/113166326666178990' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113166326666178990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113166326666178990'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2005/11/net-net-components-in-ie-part-1.html' title='[.NET] .NET components in IE, part 1'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-113132621329059917</id><published>2005-11-07T03:06:00.000+02:00</published><updated>2005-11-07T23:24:52.470+02:00</updated><title type='text'>[.NET] ToolTip resource leaks</title><content type='html'>Working on a .NET app. I&#39;ve added tooltips to some buttons in a complex user control. The user control was so complex, it contained about 70 controls in it. Creating/destroying this user control multiple times would exhaust the GDI resources on my machine. I first inspected the problem with Process Explorer from Sysinternals (&lt;a href=&quot;http://www.sysinternals.org&quot;&gt;www.sysinternals.org&lt;/a&gt;) and found out it was eating user handles like crazy. Then I used a memory profiler for .NET (.NET Memory Profiler 2.6 by Scitech - &lt;a href=&quot;http://www.scitech.se/memprofiler/&quot;&gt;http://www.scitech.se/memprofiler/&lt;/a&gt;), took some heap snapshots and manually inspected the leaking control instances. I finally found the problem to be a ToolTip control that is keeping references to objects. Then i googled the net and found the same problem being found about two years ago :)&lt;br /&gt;To put it simple: one should remove tool tips (at some point) in order to get the whole form disposed.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/113132621329059917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/113132621329059917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113132621329059917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113132621329059917'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2005/11/net-tooltip-resource-leaks.html' title='[.NET] ToolTip resource leaks'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-113079809576118060</id><published>2005-11-01T00:25:00.000+02:00</published><updated>2005-11-11T00:40:37.366+02:00</updated><title type='text'>[.NET] Out of Memory with Graphics.DrawImage and ImageAttributes</title><content type='html'>I am developing some user controls in .NET using Forms. I need to transparently draw a bitmap on a button, so I&#39;m using ImageAttributes to specify the transparent color. Still, a problem appeard: having many of these buttons shown on the screen would sometimes crash with OutOfMemoryException in the DrawImage method. Removing the ImageAttributes-based rendering would also prevent the creash. Dug the net, found nothing. I remembered a while ago that the best Bitmap format to use in terms of speed was 32bit PARGB. So I converted my Bitmaps to this format and the crash went away. My guess is that during the rendering with specified ImageAttributes, it performs some kind of expensive conversion (both time and resource wise) if not 32bit PARGB. Having the bitmaps in this format, prevents this expensive operation.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/113079809576118060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/113079809576118060' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113079809576118060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/113079809576118060'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2005/11/net-out-of-memory-with.html' title='[.NET] Out of Memory with Graphics.DrawImage and ImageAttributes'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12103229.post-111782105282089491</id><published>2005-06-03T20:25:00.000+03:00</published><updated>2005-06-03T20:50:52.826+03:00</updated><title type='text'>[C/C++] Arrays and pointers</title><content type='html'>Recently, during a Compilers test at school, I stumbled across a question like this: &quot;You are given two modules. In module A you have the definition &#39;int a[100];&#39;. In module B you have the external declaration &#39;extern int *a;&#39;. Does this link properly?&quot; Pointers and arrays are simiar in C/C++ but not identical. My answer was something like... well you are trying to map a pointer over an array, it should not even link. When I tried this in VC++/GCC, it linked without complaining. But, I have an example why this is not always correct:&lt;br /&gt;&lt;br /&gt;a.cpp:&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;#include &lt;stdio.h&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;int a[100] = {1, 2, 3};&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;void f() { printf(&quot;%d\n&quot;, a[0]); }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span &gt;b.cpp:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;#include &lt;stdio.h&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;extern int *a;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;void main() { int x = 10; a = &amp;x; printf(&quot;%d\n&quot;, a[0]); f(); }&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;font-family:Courier New;&quot;&gt;&lt;/span&gt;&lt;br /&gt;&lt;span &gt;In the above example, the problem is caused by the a = &amp;x statement. The linker maps the pointer to the array defined in a.cpp. This statement replaces the first element in the array a with the address of x (because sizeof(int) == sizeof(int *) on 32 bit). Running the example above, will print the number 10 and then the address of x. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Conclusion: avoid re-declaring arrays as pointers in external declarations, it can have unexpected behaviour as shown above.</content><link rel='replies' type='application/atom+xml' href='http://adidrumea.blogspot.com/feeds/111782105282089491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/12103229/111782105282089491' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/111782105282089491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12103229/posts/default/111782105282089491'/><link rel='alternate' type='text/html' href='http://adidrumea.blogspot.com/2005/06/cc-arrays-and-pointers.html' title='[C/C++] Arrays and pointers'/><author><name>Adrian Drumea</name><uri>http://www.blogger.com/profile/15350932311970122888</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>