Monday, December 24, 2007

Javascript Resources

Very interesting javascript libraries and reference

Dean Edwards
http://dean.edwards.name/

Javascript Fuscation
http://p2p.wrox.com/topic.asp?TOPIC_ID=32234

Enjoy!

:D

Saturday, November 10, 2007

Special Characters in QueryString : ASP.NET

If you need include special characters in your url, use HttpUtility.UrlEncode to do it in accurate way.

I read this before:
http://www.velocityreviews.com/forums/t102194-special-characters-in-query-string.html

Useful Learn English Links

Excelent learning resources

If you have grammar questions you may check it here:
Dr. Grammar : Frequenty Asked Quetions
English Grammar (fortunecity.com)

These were tips of my friend Luis G. and last one by Jose A., Thank you guys.
http://www.ego4u.com/
http://www.english108.com/
http://www.englisch-hilfen.de/
http://www.answers.com/
http://www.englishpage.com/
http://www.bbc.co.uk/worldservice/learningenglish/

Enjoy them.

Strange delay in compilation : VS2005

One day, when I working in Team Project and at least 8 projects in it, the compilation delay a lot of time. I did a lot of things, but problem was solved when I remove the references and add them again.

Maybe, Do somebody have another suggestion?

Monday, November 05, 2007

Working with XML Namespaces : NET 2.0

If your Xml document has a default namespace, you can assign prefix, using
XmlNamespaceManager object.
Look it:

Xml Snippet

<?xml version="1.0" encoding="UTF-8"?>
<data xmlns="http://tempuri.org/" xmlns:dc=http://tempuri.org/1.1/>
<items>
<dc:item>Hello</dc:item>
<dc:item>World</dc:item>
</items>
...

Code Snippet

XmlDocument xdoc = new XmlDocument();
xdoc.Load(@"C:\Bentz\data.xml");
...
XmlNamespaceManager nm = new XmlNamespaceManager(xdoc.NameTable);
nm.AddNamespace("ns", "http://tempuri.org/"); /* Default namespace*/
nm.AddNamespace("dc", "http://tempuri.org/1.1/");
...
//browsing a node
XmlNode xn = xdoc.SelectSingleNode("ns:data/ns:items/dc:item/text()", nm);
...

I read this article before:
http://support.microsoft.com/kb/318545


Good coding.

Language Translation Services

Some approach around Translation Web Service...

Simple and functional example:

http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:281335

Another links

http://www.eggheadcafe.com/articles/20050725.asp

http://www.codeproject.com/cs/webservices/translation.asp

http://www.restlessdelusions.com/projects/services/translate/translate.asmx


Enjoy.

Sunday, November 04, 2007

Tuesday, October 02, 2007

Thursday, September 27, 2007

Trusted WebService : ASP.NET

When you publish a WebService on IIS with Integrated Security. Maybe you got the following error: "The request failed with HTTP status 401: Access Denied". You need a twice of lines to include the credential of intranet client.

I read this article before:
http://geekswithblogs.net/ranganh/archive/2006/02/21/70212.aspx

That's it.

Tuesday, September 18, 2007

Detect Page Refresh : ASP.NET

In ASP.NET after page has done first postback, if the user makes a Refresh, the behavior is repeat the last postback. Let us imagine that we inserted data or we debit of a credit card, etc; one becomes a problem. Therefore one becomes important to handle this eventuality.

In Summary To handle a Session Flag and ViewState Flag, comparing them to know if one is about a Postback or a Refresh. For more details, see these articles.

http://www.codeproject.com/aspnet/Detecting_Refresh.asp
http://www.joel.net/code/refresh_capture.aspx
http://jarednevans.typepad.com/technoblog/2005/01/jareds_techno_b.html


Test it

Session.Abandon() : On browser is closed

Some times it is necessary to block the access of multiple users to same information. A route to do this is to register the entrance and the exit of the user to the application (DB, Application Object). It happens then that if the user closes browser without closing session in the application for some reason the Session_End does not happen. An alternative is to use the ScriptManager (MS AJAX) and a pair of lines of Javascript to notify the servant when it is closed in browser.

In summary

  1. Subscribe to the OnUnload event of the Body (<body OnUnload="Logout (); ">)
  2. Invoke the Static WebMethod (it will close session) from the function Javascript (PageMethods.AbandonSession ();)
  3. As when sailing to another page also it invokes the OnUnload event, it is necessary to make a last adjustment. All the pages of the application will be sailed from a IFRAME from a Content.aspx page. The trick is, the IFRAME makes navigation to other pages whereas Content.aspx this statics.

I read these articles before:
http://aspalliance.com/520
http://aspalliance.com/1294_CodeSnip_Handle_Browser_Close_Event_on_the_ServerSide
http://www.codeproject.com/csharp/Detect_closing_navigator.asp
http://geeks.ms/blogs/lruiz/archive/2007/02/27/controlar-cuando-el-usuario-nos-cierra-el-navegador-es-posible.aspx
http://www.programmersheaven.com/mb/ASPNET/303808/303808/readmessage.aspx

It works.

Team Explorer on Visual Studio Professional

It isn't necessary migrate to Visual Studio Team Suite for integrate with Team Server. You only install the Team Explorer in your Visual Studio Professional copy.


Look it...

Hidden Columns with values: asp:GridView

If you set Column Visible property to false, this column won't rendered. But if you want these values available, What will you do?

My trick was, set HeaderText to empty, convert the BoundField in TemplateField, and use a HiddenField control. The effect the column won't be visible. Also you can use the controls array to access to value property.

<Columns><asp:BoundField DataField="CompanyCode"
HeaderText="Company" SortExpression="CompanyCode" />
...
<Columns>
<asp:TemplateField><ItemTemplate><asp:HiddenField
id="hf1" Value='<%# Bind("CompanyCode") %>'
runat="server"></asp:HiddenField></ItemTemplate>
...
// accesing the value property
int tmpID =
Convert.ToInt32(((HiddenField)GridView1.SelectedRow.Cells[3].Controls[1]).Value);


And run it.

Cached Authentication Issue : Windows Authentication

My friend Jose Atencio, worked with Web Application managing Windows Roles and Users. After some testing, The changes are applied on client when they log off. While they are logged the changes are not reflected. It seems Windows Authentication information is cached on client at time when user log in.

Don't forget this issue in your testing.

Maybe, Do somebody have a solution?

IsNumeric Method : Regular Expression

Using int.Parse(expression) method throw an error if expression doesn't numeric; Instead of that, an alternative, is use custom method regular expression based. It returns a boolean value.

public static bool IsNumeric(string theValue){
Regex _isNumber = new
Regex(@"^\d+$");
Match m = _isNumber.Match(theValue);
return
m.Success;}

And run it.

Application_Error, Global.asax : Exception Handling

When I tried manage exceptions in Application_Error event, sometimes throw an error:

Cannot redirect after http headers have been sent

My trick for avoid this exception:

void Application_Error(object sender, EventArgs e)
{
// handle generic application errors
Exception ex = Server.GetLastError();
SiteHelper.HandleExceptionInLog(ex);
Server.ClearError();
Response.Clear();
Server.Execute("Error.aspx");
}

I read these articles before:
http://blogs.msdn.com/kaevans/archive/2003/07/07/9791.aspx
http://www.codeguru.com/csharp/.net/net_asp/miscellaneous/article.php/c12385/
http://forums.asp.net/t/44586.aspx

It works for me.

Thursday, September 13, 2007

Protected members are ignored : XmlSerialization

After some XmlSerialization testing, I saw, the child class, with protected members, the serialization result ignore those members. In sumary all serializable members most be public in the base class.

Does exist another lesson learned related?

Wednesday, September 12, 2007

Try...Finally Behavior

I needed to close a port after I finished to use it. The problem was if the communication fail, after the port was opened; I would like force it to close. The Try...Finally behavior is after Exception happened the immediately Finally code segment is executed and the parent Catch get the execution control.

In summary: It closes port always, but doesn't handle exceptions. It works for me.

Do have someone another alternative?

Sunday, July 15, 2007

IFN '97 - 10 Years Aniversary

I'm so happy... 10 years ago I were a "Archer" student. The time happens so fast!

There were a wonderful moments...

Grettings to all my people Instituto Fermin Naudeau 1997!

:)


Look us:
http://prom97ifn.blogspot.com/

Friday, April 27, 2007

Warning Animated Cursors On Vista

I would like get a animated cursor, but... there is a vulnerability with it.

Look the video...
Windows Vista Suicide

Enable or Disable Hibernation on Window Vista

When I cleaned the hard disk, I checked on option "Delete Hibernation Files", after that, the hibernation feature of system set to off.

For set your prefered state, perform a console commands:
How to disable and re-enable hibernation on a computer that is running Windows Vista

And that's it.

Saturday, March 24, 2007

Visual Studio 2005 and SQL Server 2005 on Vista

Recently I got a Laptop, it comes with Vista Business; Of course, I decide to install Visual Studio and SQL Server. You need to install some Service Pack and they work very good.

I read these articles before:
Visual Studio 2005 Service Pack 1 Update for Windows Vista
Microsoft SQL Server 2005 Service Pack 2

Don't surrender.

Saturday, March 17, 2007

Preferred Free Useful Tools

I'm using this tools for free:
  1. Foxit Reader: The fastest PDF Reader (Windows/Linux).
  2. CutePDF Writer: Virtual printer that allows any application with printing capability to generate PDF documents (Windows Only, Vista Compatible).
  3. Avira AntiVir PersonalEdition Classic: reliably protects your private computer against dangerous viruses, worms, Trojans and costly dialers (Linux/FreeBSD/Solaris/Windows, Vista Compatible on April 2007). Support offline Virus Definition Update (Incremental VDF)
  4. Zone Labs ZoneAlarm Basic PC Protection: Firewall blocks hackers and other unknown threats. (Windows 2000/XP)
  5. Free Download Manager: Full-featured download accelerator and manager, and It's free. (Microsoft Windows 9x/ME/2000/2003/XP/Vista)
  6. Eusing Free Register Cleaner: Eusing Free Registry Cleaner is a free registry repair software that allows you to safely clean and repair registry problems with a few simple mouse clicks. The Windows Registry is a crucial part of your PC's operation system. (Windows 9x/Me/NT/2000/XP/2003/Vista)
Enjoy them

Friday, February 16, 2007

Useful tools for .NET

Some useful tools for several scenarios:

ILMerge: For merging multiple .NET assemblies into a single .NET assembly (Merging v2.0 & v1.x assemblies).
Updater Application Block version 2.0: This tool is a .NET Framework component that you can use to detect, download, and apply client application updates deployed in a central location.

Enjoy them

:)

Sunday, February 04, 2007

Uninstall Visual Studio Community Content

For some days, I have been looking for way to uninstall Community Content. Power Toys are tools help you to build, uninstall community content. Look it in action...


They are available at:
Visual Studio Content Installer Power Toys

Enjoy.

Coding tools for Mono

Recently I made some ASPX pages for run on Linux, for now, using Mono 1.1.x. So one recommendation is use Visual Studio 2003 or ASP.Web Matrix (a legend), as IDE.

ASP.Web Matrix is a very useful and lite IDE
ASP.Web Matrix, Features and Download

In case you are coding for Mono 1.2.x, Visual Studio 2005 or Visual Web Developer Express, are some alternative.
Visual Web Develeper Express, Features and Download

I read these articles before:
Welcome to the Microsoft .NET Framework SDK QuickStart Tutorials
Presentación de los tutoriales del SDK de .Net Framework (Spanish)

Good Coding.

Wednesday, January 31, 2007

Validators In AJAX UpdatePanel

For perform the validation into UpdatePanel of Ajax, you need make some tricks...
I made it works, with ASP.NET AJAX Release 1.0.
Just add the following lines in the web.config file:
<pages>

<tagMapping>
<add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="Sample.Web.UI.Compatibility.CompareValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="Sample.Web.UI.Compatibility.CustomValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="Sample.Web.UI.Compatibility.RangeValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="Sample.Web.UI.Compatibility.RegularExpressionValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="Sample.Web.UI.Compatibility.RequiredFieldValidator, Validators, Version=1.0.0.0"/>
<add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="Sample.Web.UI.Compatibility.ValidationSummary, Validators, Version=1.0.0.0"/>
</tagMapping>
...
</pages>


I read these articles before:
Links to ASP.NET AJAX 1.0 resources, and answers to some common questions
ASP.NET AJAX Validators

Good Coding.

Thursday, January 18, 2007

Logic Studio Soccer Team

I didn't believe it!

Jajajaj... :)

Thank you Ivys...

Tuesday, January 09, 2007

Setup is unable to determine a valid ordering for the installation VS 2005

When I wanted recover a bit of free space on my HDD, I decided to uninstall some features of Visual Studio 2005. But it wasn't easy. I'm talking about release version.

The problem is the Visual Studio Installer doesn't know a self order for uninstall/install some components. But don't worry there is a manual way for do it.

I read this article. It works for VS 2005 too.
How to remove Visual Studio .NET 2003

For Beta versions look this article:
Uninstalling Previous Versions of Visual Studio 2005

You do not surrender.
Google