<?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: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-7719194818142703652</id><updated>2011-04-21T14:15:20.289-07:00</updated><category term='Transaction Log'/><category term='ASP'/><category term='SQL'/><category term='ASPX Page events'/><title type='text'>Gerald Juan's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://geraldjuan.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://geraldjuan.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gerald Juan</name><uri>http://www.blogger.com/profile/16751216341949110948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7719194818142703652.post-2393901859505946467</id><published>2008-06-19T03:59:00.000-07:00</published><updated>2008-06-19T04:35:11.350-07:00</updated><title type='text'>execScript does not work in Firefox</title><content type='html'>I came across this issue recently when I was testing our admin web pages in Firefox. &lt;br /&gt;What the page was trying to do was to run some custom javascript function from a parent window using the window execScript() function.&lt;br /&gt;&lt;br /&gt;The problem is that the window.execScript() does not work in Firefox. Apparently, window.execScript() is only available in IE (http://ajaxian.com/archives/evaling-with-ies-windowexecscript). &lt;br /&gt;&lt;br /&gt;The work around to this is as follows:&lt;br /&gt;&lt;br /&gt;//assume parentWnd variable has reference to the parent window.&lt;br /&gt;if (parentWnd.execScript) {&lt;br /&gt; parentWnd.execScript(sScript); //for IE&lt;br /&gt;} else {&lt;br /&gt; eval('self.opener.' + sScript); //for Firefox&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7719194818142703652-2393901859505946467?l=geraldjuan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geraldjuan.blogspot.com/feeds/2393901859505946467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7719194818142703652&amp;postID=2393901859505946467' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/2393901859505946467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/2393901859505946467'/><link rel='alternate' type='text/html' href='http://geraldjuan.blogspot.com/2008/06/execscript-does-not-work-in-firefox.html' title='execScript does not work in Firefox'/><author><name>Gerald Juan</name><uri>http://www.blogger.com/profile/16751216341949110948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7719194818142703652.post-2875015392159865459</id><published>2008-05-22T05:21:00.000-07:00</published><updated>2008-06-19T05:59:48.129-07:00</updated><title type='text'>Unable To Cast Object of Type 'x' To Type 'x'</title><content type='html'>I got this really weird runtime error:&lt;br /&gt;&lt;br /&gt;Unable To Cast Object of Type 'x' To Type 'x'&lt;br /&gt;&lt;br /&gt;The weird thing was, the 'x' above was the same type.&lt;br /&gt;&lt;br /&gt;The best explanation I found to this issue is:&lt;br /&gt;http://www.hanselman.com/blog/FusionLoaderContextsUnableToCastObjectOfTypeWhateverToTypeWhatever.aspx&lt;br /&gt;&lt;br /&gt;Basically, I had 2 identical dll files that contain the type 'x' in different paths on the server. One of the dlls was referenced in my project, while the other was loaded using the LoadFrom() function from the System.Reflection.Assembly namespace. &lt;br /&gt;When it was time to cast an object to type 'x', I got the error "Unable To Cast Object of Type 'x' to Type 'x' ".&lt;br /&gt;&lt;br /&gt;To resolve this problem, I simply deleted the extra dll reference. This will ensure the same assembly will be used in the project reference and when LoadFrom() is used.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7719194818142703652-2875015392159865459?l=geraldjuan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geraldjuan.blogspot.com/feeds/2875015392159865459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7719194818142703652&amp;postID=2875015392159865459' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/2875015392159865459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/2875015392159865459'/><link rel='alternate' type='text/html' href='http://geraldjuan.blogspot.com/2008/05/unable-to-cast-object-of-type-x-to-type.html' title='Unable To Cast Object of Type &apos;x&apos; To Type &apos;x&apos;'/><author><name>Gerald Juan</name><uri>http://www.blogger.com/profile/16751216341949110948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7719194818142703652.post-3836617614896995578</id><published>2008-05-20T14:34:00.000-07:00</published><updated>2008-06-19T05:08:35.598-07:00</updated><title type='text'>readOnly textboxes</title><content type='html'>Sometimes you want to set a textbox to read only because you don't want the user to change the value inside. This is the case when the value in the textbox is, for example, the date the user has selected from a calendar control, or the result of some calculation.&lt;br /&gt;&lt;br /&gt;To make the textbox read only, you would normally set the ReadOnly attribute to True or enabled = false in the .aspx page.&lt;br /&gt;&lt;br /&gt;However, if you want to process this value on the server (e.g. save it to a database), the value is not recognised. This is because the server does not process read only values.&lt;br /&gt;&lt;br /&gt;To fix this, set the following in the code behind, for example:&lt;br /&gt;&lt;br /&gt;txt.Attributes.Add("readOnly", "true")&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7719194818142703652-3836617614896995578?l=geraldjuan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geraldjuan.blogspot.com/feeds/3836617614896995578/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7719194818142703652&amp;postID=3836617614896995578' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/3836617614896995578'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/3836617614896995578'/><link rel='alternate' type='text/html' href='http://geraldjuan.blogspot.com/2008/05/readonly-textboxes.html' title='readOnly textboxes'/><author><name>Gerald Juan</name><uri>http://www.blogger.com/profile/16751216341949110948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7719194818142703652.post-3935010413680760123</id><published>2008-05-14T05:44:00.000-07:00</published><updated>2008-05-14T07:00:33.642-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Transaction Log'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>SQL Transaction Logs</title><content type='html'>Today I was getting the following error while deleting records from a very large table (over 7.6 million rows):&lt;br /&gt;&lt;br /&gt;The log file for database 'xxxxx' is full. Back up the transaction log for the database to free up some log space. [SQLSTATE 42000] (Error 9002).  The step failed.&lt;br /&gt;&lt;br /&gt;Deleting large amounts of data will cause this type of error to occur since deleted rows are entered into the transaction log. Truncating the table would overcome this problem, however truncating would delete all the records which I didn't want as I had to keep the last 2 years worth of data.&lt;br /&gt;&lt;br /&gt;So I tried to do what the error message said, and that was to backup the transaction log:&lt;br /&gt;&lt;br /&gt;BACKUP LOG XXXXX with truncate_only&lt;br /&gt;&lt;br /&gt;and I also shrunk the log file for good measure:&lt;br /&gt;&lt;br /&gt;dbcc shrinkfile ('XXXXX_Log', 'truncateonly')&lt;br /&gt;&lt;br /&gt;After running these 2 lines and confirming that the size of the transaction log was reduced (20MB down to less than 1MB), I tried a second time to delete the table, and again it gave me the same error!&lt;br /&gt;&lt;br /&gt;After some time of investigating and searching the net for more answers, I realised that the problem was a lack of hard drive space. The available space was only less than 100MB which wasn't enough to carry out the delete command on my large table.&lt;br /&gt;&lt;br /&gt;The solution was to move the database to another hard drive with plenty of free space on it. This was easily done using the Detach and Attach commands in SQL Enterprise manager. This can only be done after hours when there are no connections to the database.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7719194818142703652-3935010413680760123?l=geraldjuan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geraldjuan.blogspot.com/feeds/3935010413680760123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7719194818142703652&amp;postID=3935010413680760123' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/3935010413680760123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/3935010413680760123'/><link rel='alternate' type='text/html' href='http://geraldjuan.blogspot.com/2008/05/sql-transaction-logs.html' title='SQL Transaction Logs'/><author><name>Gerald Juan</name><uri>http://www.blogger.com/profile/16751216341949110948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7719194818142703652.post-5034088604890573850</id><published>2008-05-08T14:30:00.000-07:00</published><updated>2008-05-08T14:59:55.891-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP'/><title type='text'>The CreateObject of '(null)' caused exception C0000005.</title><content type='html'>I had to upgrade an old-school ASP website the other day. I uploaded the new version of the .asp pages, unregistered the website .dll file, made a backup copy of it, copied the new .dll over, and then registered it. Everything when to plan (so I thought) until it was time to test the site. I then received the following error:&lt;br /&gt;&lt;br /&gt;The CreateObject of '(null)' caused exception C0000005. &lt;br /&gt;&lt;br /&gt;I thought to myself - how could this happen? I've tested the .dll file on a test site and had no problem with it. So I immediately when to the source code and had a look at the line where it was giving the error. Funny that, the line giving the error was not modified by me! In fact the page was not modified at all.&lt;br /&gt;&lt;br /&gt;So I decided to restore the original version of the .dll (good thing I did make a backup), and it too gave me the same error. Very strange.&lt;br /&gt;&lt;br /&gt;The only thing left to do was an IIS restart. And that fixed the problem.&lt;br /&gt;&lt;br /&gt;So the problem was probably due to IIS still having a reference to the old version of the .dll, and restarting IIS was a way of flushing it out.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7719194818142703652-5034088604890573850?l=geraldjuan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geraldjuan.blogspot.com/feeds/5034088604890573850/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7719194818142703652&amp;postID=5034088604890573850' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/5034088604890573850'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/5034088604890573850'/><link rel='alternate' type='text/html' href='http://geraldjuan.blogspot.com/2008/05/createobject-of-null-caused-exception.html' title='The CreateObject of &apos;(null)&apos; caused exception C0000005.'/><author><name>Gerald Juan</name><uri>http://www.blogger.com/profile/16751216341949110948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7719194818142703652.post-5004357123904177286</id><published>2008-05-04T05:51:00.000-07:00</published><updated>2008-05-04T15:10:30.686-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASPX Page events'/><title type='text'>ASPX Page Events</title><content type='html'>I thought I would investigate the firing order of .aspx page events as my first post (well, second post actually as the first one was just a quick intro).&lt;br /&gt;&lt;br /&gt;For this test, I created a new web project inVS2008 and simply added a server button on the aspx form, with a bunch of Response.writes in each event I found in the code behind, except inside the unload events, as a Response.write in the unload event will cause a runtime error to occur.&lt;br /&gt;&lt;br /&gt;The result of this quick test is as follows:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;New&lt;/li&gt;&lt;li style="COLOR: rgb(0,0,0)"&gt;Page PreInit&lt;/li&gt;&lt;li style="COLOR: rgb(0,0,0)"&gt;button Init&lt;/li&gt;&lt;li style="COLOR: rgb(0,0,0)"&gt;form Init&lt;/li&gt;&lt;li style="COLOR: rgb(0,0,0)"&gt;page Init&lt;/li&gt;&lt;li style="COLOR: rgb(0,0,0)"&gt;Page InitComplete&lt;/li&gt;&lt;li&gt;Load Viewstate *&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Page Preload&lt;/li&gt;&lt;li&gt;Page Load&lt;/li&gt;&lt;li&gt;form Load&lt;/li&gt;&lt;li&gt;button Load&lt;/li&gt;&lt;li&gt;Button Click ^&lt;/li&gt;&lt;li&gt;Button Command ^&lt;/li&gt;&lt;li&gt;Page LoadComplete&lt;/li&gt;&lt;li&gt;Page PreRender&lt;/li&gt;&lt;li&gt;form PreRender&lt;/li&gt;&lt;li&gt;button PreRender&lt;/li&gt;&lt;li&gt;page PreRenderComplete&lt;/li&gt;&lt;li&gt;page SaveStateComplete&lt;/li&gt;&lt;li&gt;button Unload&lt;/li&gt;&lt;li&gt;form Unload&lt;/li&gt;&lt;li&gt;page Unload&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;* To determine when viewstate is loaded, I placed the following code inside the form load event:&lt;br /&gt;If Not Page.IsPostBack Then&lt;br /&gt;Me.ViewState("x") = "x"&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;I then monitored when the variable x in the view state changed from nothing to x using Watch after clicking on the button.&lt;br /&gt;&lt;br /&gt;^ these events were fired after a page postback.&lt;br /&gt;&lt;br /&gt;As you can see, the viewstate is loaded after the page init event, but before the page load event. This is very important to remember if you are planning to work with viewstates in aspx.&lt;br /&gt;&lt;br /&gt;Also, note that postback events (eg. button Click), occur after page Load, but before the page LoadComplete events.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7719194818142703652-5004357123904177286?l=geraldjuan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geraldjuan.blogspot.com/feeds/5004357123904177286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7719194818142703652&amp;postID=5004357123904177286' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/5004357123904177286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/5004357123904177286'/><link rel='alternate' type='text/html' href='http://geraldjuan.blogspot.com/2008/05/aspx-page-events.html' title='ASPX Page Events'/><author><name>Gerald Juan</name><uri>http://www.blogger.com/profile/16751216341949110948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7719194818142703652.post-3523673514914115140</id><published>2008-05-04T00:45:00.000-07:00</published><updated>2008-05-04T01:09:12.339-07:00</updated><title type='text'>Welcome to my blog!</title><content type='html'>Hi, I would like to invite you to my blog. Here I will try and share my experiences as a Microsoft .Net developer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7719194818142703652-3523673514914115140?l=geraldjuan.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://geraldjuan.blogspot.com/feeds/3523673514914115140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7719194818142703652&amp;postID=3523673514914115140' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/3523673514914115140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7719194818142703652/posts/default/3523673514914115140'/><link rel='alternate' type='text/html' href='http://geraldjuan.blogspot.com/2008/05/welcome-to-my-blog.html' title='Welcome to my blog!'/><author><name>Gerald Juan</name><uri>http://www.blogger.com/profile/16751216341949110948</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
