tag:blogger.com,1999:blog-64220150731459339242024-02-20T14:34:59.276-08:00Kurniawan TroubleshootingThis is some of the issue that I know in virtual world.
I hope it will be very useful.Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-6422015073145933924.post-3205333430443503392007-10-25T15:16:00.000-07:002007-10-25T15:21:47.713-07:00BUG: Memory leak occurs when you query an open Excel worksheet by using ActiveX Data Objects (ADO) when Excel is opened<script type="text/javascript">loadTOCNode(1, 'symptoms');</script><div class="sbody"><span style="font-weight: bold;">For Excel Connection<br /></span><span> 'HDR=NO; = HEADER<br /> 'IMEX = 1; = type= text<br /> 'IMEX = 2; = type= Mixed<br /> 'change the registry...<br /> 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel\TypeGuessRows = 0 - it will check the data type for every field<br /> 'but at this momment we can not change using MAXSCANROWS=0 - it doesn't work<br /> Dim excelConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & fileFullName & ";Extended Properties='Excel 8.0;HDR=NO;IMEX=1;'"</span><br /><br />When you retrieve a Microsoft ActiveX Data Objects (ADO) Recordset from an Excel worksheet that is open in Excel, a memory leak occurs in the Excel process. Repeated queries may eventually cause Excel to run out of memory and raise an error, or cause Excel to stop responding.<br /><br />The memory used by the ADO queries cannot be reclaimed by closing and releasing the ADO objects. The only way to release the memory is to quit Excel.<br /><br />If possible, query the Excel worksheet only while the file is not open in Excel.<br /><br />If the worksheet must remain open (for example, to allow dynamic recalculation of worksheet values on an ongoing basis) use one of the following methods to work around the behavior: <h4 id="tocHeadRef">Method 1</h4><script type="text/javascript">loadTOCNode(3, 'resolution');</script><table class="list ul"><tbody><tr><td class="bullet">•</td><td class="text">Use the SELECT INTO syntax of the Jet OLE DB Provider to export the Excel data to a new worksheet. For additional information about using the SELECT INTO syntax to export data, click the following article number to view the article in the Microsoft Knowledge Base: <div class="indent"><a class="KBlink" href="http://support.microsoft.com/kb/295646/">295646</a><span class="pLink"> (http://support.microsoft.com/kb/295646/)</span> How To Transfer Data from ADO Data Source to Excel with ADO </div></td></tr></tbody></table><h4 id="tocHeadRef">Method 2</h4><script type="text/javascript">loadTOCNode(3, 'resolution');</script><table class="list ul"><tbody><tr><td class="bullet">•</td><td class="text">Use the <b>SaveCopyAs</b> method of the <b>Workbook</b> object in the Excel object model to programmatically save the open Excel file under a new name. You can then query the copy of the file that you previously saved under a new name from the ADO application.</td></tr></tbody></table><br /><span style="font-weight: bold;">Method 3<br /></span><br /> save as Excel using Excel.Application . SaveAs to Excel CSV file and Read that CSV file using OLEDB Connection<br /><span style="font-weight: bold;"><br />Provider=Microsoft.Jet.OLEDB.4.0;Data Source='FOLDER PATH';Extended Properties='text;HDR=Yes;IMEX=1;FMT=Delimited'<br /><br /></span><br />and using <span style="font-weight: bold;">select * from fileName.<br /><br /><br /></span><span></span><span style="font-weight: bold;"><br /><br /><br /></span></div>Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com0tag:blogger.com,1999:blog-6422015073145933924.post-10750624975364032642007-10-25T00:25:00.000-07:002007-10-25T00:26:31.793-07:00Adding Permission to Excel COM Object<p>If you run the service using Network Service Account then you need to add permission to Microsoft Excel COM Object because by default Microsoft Excel as a COM object can only activated by the following accounts:</p> <ul type="disc"><li class="MsoNormal" style="">Administrator </li><li class="MsoNormal" style="">System </li><li class="MsoNormal" style="">Interactive </li></ul> <p class="MsoNormal" style=""><o:p> </o:p></p> <h3>Configure DCOM</h3> <ul type="disc"><li class="MsoNormal" style="">Go to the Start-Run menu item. </li><li class="MsoNormal" style="">Type in "DCOMCNFG" and hit enter. </li><li class="MsoNormal" style="">This should load the "Component Services" MMC (you can also load from Administrative Tools - Component Services" </li><li class="MsoNormal" style="">Expand "Component Services" </li><li class="MsoNormal" style="">Expand "Computers" </li><li class="MsoNormal" style="">Expand "My Computer" </li><li class="MsoNormal" style="">Select the "DCOM Config" item </li><li class="MsoNormal" style="">Select the "Microsoft Excel Application" item. </li><li class="MsoNormal" style="">Right click and select Properties </li><li class="MsoNormal" style="">Add Permission to network service or ASP Net account<br /></li></ul> <span style="font-size: 12pt; font-family: "Times New Roman";"> <!--[if !supportLineBreakNewLine]--><br /> <!--[endif]--></span>Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com0tag:blogger.com,1999:blog-6422015073145933924.post-76023893529717441252007-10-25T00:21:00.000-07:002007-10-25T00:24:33.409-07:00EventLog.WriteEvent in Windows Service or ASPNETIf you get this error in writting EventLog.WriteEvent in Windows Service or ASP.Net.<br /><span xmlns="">"The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security."<br /><br />You need to create your source manually. because the process can not created for u.<br /><br />To add your source manually,<br />Open Regedit and add your source inside.<br /></span><span xmlns="">"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application".<br /><br />After that you will be able to Write event log freely.<br /><br /></span>Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com0tag:blogger.com,1999:blog-6422015073145933924.post-91087677001164438242007-09-06T16:58:00.000-07:002007-09-08T06:12:52.112-07:00How to debug your Javascript in .net 1.1 / 2.0To debug your javascript code...<br /><br />* Using Internet Explorer<br />Make sure that u untick <span style="font-weight: bold;">Disable Script Debuging </span>options.<br /><br />* for Firefox.. There is extension plugin<br /><br />*Configure your web config .. to enable debug...<br /><br />* Press F5 for build with debugging instead of Shift + F5.<br /><br /><br />* You may need to separate your javascript into other file... It can not be embedded into your .aspx file because at the runtime.. your *.aspx content will dynamically converted into html...<br /><br />However in VS 2005.. You can debug your embeded javascript...<br />But you can not directly put a break point into that line of code...<br />You need to Run first (F5) and go to DEBUG > WINDOWS > Script Explorer... You will see.. the merge javascript with your aspx which has been converted into html... and you can put the break point in there.<br /><br /><br />* USE ASP.NET AJax Extender...<br /><br />You can use <span style="font-weight: bold;"><br />Sys.Debug.trace("Whatever you want to trace - will appear in output window");<br /></span>and<br /><span style="font-weight: bold;">Sys.Debug.fail("It will stop in this point.. and you may start debugging");</span>Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com0tag:blogger.com,1999:blog-6422015073145933924.post-18208953014717462932007-08-23T20:26:00.000-07:002007-09-08T06:05:49.975-07:00Using AjaxPro2.dll from Michael Schwarz*Add web Config<br />inside <span style="font-weight: bold;">configuration/configSections</span><br /><span style="font-weight: bold;"><sectiongroup name="ajaxNet"></sectiongroup></span> <span style="font-weight: bold;"> <section name="ajaxSettings" type="AjaxPro.AjaxSettingsSectionHandler, AjaxPro.2"></section></span> <span style="font-weight: bold;"> <br /><br /></span>inside <span style="font-weight: bold;">configuration/system.web/httpHandlers<br /><add verb="*" path="ajaxpro/*.ashx" type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"><br /><br /><br /></add></span>*add reference AjaxPro2.dll into the bin folder<br /><span style="font-weight: bold;">using AjaxPro;</span><br /><br />* in page load (postback and not) - add <span style="font-weight: bold;">Utility.RegisterTypeForAjax(typeof(_Default));<br /><br />*</span>On client ajax method add attribute<br /><span style="font-weight: bold;"> [AjaxMethod(HttpSessionStateRequirement.ReadWrite)]</span> public string MyAjaxMethod(string username)<br /> {<br /> return "Halo" + UserName;<br /> }<br /><span style="font-weight: bold;"></span><br /><br />*call in client javascript<br /><span style="font-weight: bold;">_Default</span>.MyAjaxMethod("Kurniawan")<span style="font-weight: bold;">.value<br /><br /><br /></span>Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com0tag:blogger.com,1999:blog-6422015073145933924.post-76405151617352294682007-08-08T00:48:00.000-07:002007-08-08T01:03:38.050-07:00Thread and Delegate Issue<span style="font-weight: bold;">Run Thread with Parameters<br />----------------------------------------------<br />*** But it is only limited to 1 object...</span><br />Thread t = new Thread(<span style="font-weight: bold;">new ParameterizedThreadStart(Run)</span>);<br />t.Start("an Object");<br /><br />or using Thread Pool<br />-----<br /><span style="font-weight: bold;">ThreadPool.QueueUserWorkItem(new WaitCallback(Run), "an Object");</span><br />-----<br /><br /><pre><br /></pre><br />----------------------------------------------------------<br /><span style="font-weight: bold;">*** Use Class method...</span><span class="Modifier"><br />public</span> <span class="ReferenceType">class</span> UrlFetcher<br /><pre>{<br /> <span class="ReferenceType">string</span> url<br /><br /> <span class="Modifier">public</span> UrlFetcher (<span class="ReferenceType">string</span> url)<br /> {<br /> <span class="Keyword">this</span>.url = url;<br /> }<br /><br /> <span class="Modifier">public</span> <span class="ValueType">void</span> Fetch()<br /> {<br /> <span style="font-weight: bold;" class="InlineComment">// use Any Attribute here</span><br /> }<br />}<br /><br />UrlFetcher fetcher = <span style="font-weight: bold;" class="Keyword">new</span><span style="font-weight: bold;"> UrlFetcher (myUrl);// Set All the input</span><br /><span class="Keyword">new</span> Thread (<span class="Keyword">new</span> ThreadStart (fetcher.Fetch)).Start();</pre>-------------------------------<br /><span style="font-weight: bold;">or Call Delegate Asyn</span><br /><br /><pre><span class="ReferenceType">delegate void MyDel(object a, object b);<br /></span><br /> MyDel d = new MyDel(Fetch);<br /> d.BeginInvoke(a,b,new AsyncCallback(AfterRun),"this is state");<br /><br />====================================<br /></pre><br /><br />===================================================<br /><span style="font-weight: bold;">CALL DELEGATE Dynamically</span><br /><br />void Force(Delegate method, object[] args)<br />{<br /> method.<span style="font-weight: bold;">DynamicInvoke</span>(args)<br />}Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com0tag:blogger.com,1999:blog-6422015073145933924.post-10717673334994842652007-08-05T23:22:00.000-07:002007-08-07T22:22:30.530-07:00Coding Issue<span style="font-weight: bold;">Finalize VS Descructor<br /></span><br /><br />Finalize and (~) Desctructor is the same<br /><br />in VB - use Finalize<br />but<br />in C# - u can not use Finalize - must be desctructor (~)<br /><br />Protected Overrides Sub Finalize()<br />' Desctructor code to free unmanaged resources<br />MyBase.Finalize()<br />End Sub<br /><br />~ ClassName(){}<br /><br /><br />***Desctructor will be called by the garbage collector - if you call<br />GC.Collect();<br /><br /><br /><br /><br /><br />-------------------------------------<br /><span style="font-weight: bold;">GC.Collect VS GC.SuppressFinalize(Object)</span><br />Collect - will run Garbage Collector - which run your Desctructor / finalize<br />- However I realize It will run before you create another object.<br /><br />SuppressFinalize - will not run.. your desctructor on the object<br /><br /><br /><br />-------------------------------------<br /><span style="font-weight: bold;">Dispose() Vs Descructor<br /><br /></span>Desctructor - will guarantee run by Garbage Collector - But It may time Lag even you put GC.Collect(); - it Collect.. after you create another object<br /><br />Dispose - If you need to explicitly clean up without waiting GC...<br />- But It will not be run by GC - You need to call<br /><span style="font-weight: bold;">YourObject.Dispose(); </span><br /><br />or using <span style="font-weight: bold;">using</span> Keyword in CS <span style="font-weight: bold;"><br />Using(Object obj = new Object);</span><br /><br /><span>Note you call the </span><tt>Dispose</tt><span> method yourself and in Desctructor there is .Dispose as well... </span><br /><span>, you should suppress garbage collection on the object once it's gone, as we'll do here.<br /></span><span style="font-weight: bold;"><br />*** My preference is use Desctructor... to eliminate the risk - and called GC.Collect();<br /><br /></span><br />-------------------------------------<br /><span style="font-weight: bold;">ROUNDING Decimal 2 Digit<br /></span>Math.round(123.23123 * 100)<span style="font-weight: bold;"> / </span>100<span style="font-weight: bold;"><br /></span><span style="font-weight: bold;">ROUNDING Decimal 3 Digit<br /></span>Math.round(123.23123 * 1000)<span style="font-weight: bold;"> / </span>100<span>0</span><span style="font-weight: bold;"><br /></span><br />-------------------------------------<br /><span style="font-weight: bold;">REF and OUT in C#<br /></span>Ref to use in and out..<br /><span style="font-weight: bold;">out is for out only... you can not parse put input in it... you need to init inside the method...</span><br /><span style="font-weight: bold;">--------------------------------------<br /><br /><br /><br /><br /></span>Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com0tag:blogger.com,1999:blog-6422015073145933924.post-54244035933197218302007-07-21T05:40:00.000-07:002007-07-21T05:47:03.135-07:00Web Service ProblemsDeserialization<br />====================<br />* Namespace is very important when you want to convert your xml to the class that has been provided by web service (WSDL)<br /><br />* You need to add the namespace from the document<br />xlns:"www.tempuri.org"<br /><br />* add namespace in your serialization object<br />------C#-------<br />Serialization aSer = new Serialization(typeof(YOUR_OBJECT_NAME), _<br />doc.DocumentElement.NamespaceURI));<br /><br />------VB-------<br />dim aSer as new Serialization(GetType(YOUR_OBJECT_NAME), _ <br />doc.DocumentElement.NamespaceURI))<br /><br />=====================================Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com1tag:blogger.com,1999:blog-6422015073145933924.post-86079507405227462562007-07-06T17:01:00.000-07:002007-09-02T06:24:16.529-07:00.Net 1.1 migrating to .Net 2.0 issue<span style="font-weight: bold;">Problem:</span> Your directory will be included in the projects<br /><br /><span style="font-weight: bold;">Discussion: </span><span>Some times.. you need to backup 1 of your UI design in .NET 1.1<br />because you need to experiment a new design...<br /><br />in .NET 1.1, It will be fine because... unless you include that file, it won't included into your project...<br /><br />However.. in .NET 2.0... your project will automatically include them into your folder... and as a result when you compile,, it will raise an error... because there is duplicate.. aspx which refer to the same dll...<br /><br /></span><br /><span style="font-weight: bold;">Solution:<span style="font-weight: bold;"><span style="font-weight: bold;"></span></span> </span>Right click >Exclude from projects<br /><br />****************************************<br /><br /><br /><span style="font-weight: bold;">Problem:</span> You have several plugins in the previous version<br /><br /><span style="font-weight: bold;">Discussion:<br /></span><span>This is what happen to my previous projects...</span><br />We have several plugins that enhanced our systems.<br /><br />In .net 1.1 we just build several plugins in different project because we have several developers without a version controls... so we can shared the workload in our teams easily.<br /><br />and After the plugins finished we just copy the dll into the bin folder and copy the aspx file into the project...<br /><br />However, We can not do this anymore... because in .NET 2.0. all the dll.. will be compiled into dynamic name such as webApp_XXXXX.dll.<br /><br />So if there is update on 1 of our plugins, we need to copy the aspx as well...<br />How about if it builds with the same name?<br /><br />I tried to rename the .dll name and the aspx @page directive to refer to that dll... But It didn't work anymore..<br /><br />You can try to publish using static name... (default.aspx.dll)<br /><br />but it will make a dll for each aspx page...<br />And It will cause alot of problems...<br /><br /><br /><span style="font-weight: bold;">Solution: </span><span>One of the solutions is you need to combine all your plugins into 1 project except.. library which you and add the static reference.<br /><br />Because .Net 2.0 Now has support multi languange into the same projects.<br /></span><br /><br />****************************************Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com0tag:blogger.com,1999:blog-6422015073145933924.post-22723955336617397952007-07-05T18:45:00.000-07:002007-07-06T17:07:40.267-07:00Oracle Issues<span style="font-weight: bold;">Problems : Oracle DSN Connection with IIS </span><br />[IM004] [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle on SQL_HANDLE_ENV failed<br /><br />when trying to open DSN Connection from IIS<br /><br /><span style="font-weight: bold;">Possible Solution:</span><br /><span style="font-weight: bold;">* </span>Give permission to<br /><span class="MsgBodyText"><span style="font-weight: bold;">IUSR_mycomputername</span> and <span style="font-weight: bold;">IWAM</span></span><span class="MsgBodyText"><span style="font-weight: bold;">_mycomputername</span> to read <span style="font-weight: bold;">oracle/Bin</span> folder<br /><br /><hr /></span>**************<br /><span class="MsgBodyText"><hr /><br /><br /></span><span style="font-weight: bold;">Problems : Java Gone after install Oracle </span><br />Can not compile your Java Code anymore after Install Oracle<br />* It caused by oracle has been change the classpath which used by your java compiler<br /><br /><span style="font-weight: bold;">Possible Solution:</span><br /><span style="font-weight: bold;">* </span>Delete the oracle <span style="font-weight: bold;">Classpath </span>from <span style="font-weight: bold;">System Path </span>from <span style="font-weight: bold;">System/EnvironmentVariable<br /></span>Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com1tag:blogger.com,1999:blog-6422015073145933924.post-91024676564607387222007-07-05T18:31:00.000-07:002007-07-06T17:08:10.515-07:00TIFF 2 PDF Error<span style="font-weight: bold;">Problem: GDI+ Error </span><br />It usually happens when Tiff2PDF.dll trying to convert Tiff image to PDF<br /><br /><span style="font-weight: bold;">Solution:</span><br />Make sure directory has the write permission<br />* Documents Folder in filewiseWeb must have ASPNET and IIS_WP permission to write<br /><br /><hr/><br />**************<br /><br /><span style="font-weight: bold;"><br />Problem: Can not find dll<br /></span><br /><span style="font-weight: bold;">Solution:</span><br />*Register tiff2pdf.dll<br />*Put <span style="font-weight: bold;">t2pdf.h</span> into <span style="font-weight: bold;">system32<br />*</span>Install <span style="font-weight: bold;">TiffDll50</span><br /><span style="font-weight: bold;"><br /></span><hr />Anonymoushttp://www.blogger.com/profile/12056200584493392094noreply@blogger.com2