วันจันทร์ที่ 27 ธันวาคม พ.ศ. 2553

After Update Outlook 2007 doesn't support My Gmail Imap anymore.

Because New Option will available in Outlook 2007 is
"Require logon using Secure Password Authentication (SPA)"

just check out this option because if you create new one
default setting don't check this

now my gmail imap work again.

วันจันทร์ที่ 30 สิงหาคม พ.ศ. 2553

machine.config location

can find in C:\Windows\Microsoft.NET\Framework\(Version number)\Config

This useful when you need some config from default setting to deploy with your website.

วันจันทร์ที่ 9 สิงหาคม พ.ศ. 2553

Vista can't ping Windows XP

Yes I still need Windows XP because DB2 7.2 is can't install success in Vista
So what i need to do now.

I install newly Windows XP and I can't not ping to see it.
But XP can ping my Vista

Is simple if you don't have any firewall or something more than windows xp firewall
many mistake is come from Exceptions setting.

Windows XP Firewall in Tab "Exceptions"
Check box on "File and Printer Sharing"

This will enable any component to use for share file and printer. Yes it make them to see each other too.

วันพุธที่ 4 สิงหาคม พ.ศ. 2553

All about array Items on C#

/ Add an item to the end of an existing array
string[] ar1 = new string[] {"I", "Like", "To"}

// create a temporary array with an extra slot
// at the end
string[] ar2 = new string[ar1.Length + 1];

// add the contents of the ar1 to ar2
// at position 0
ar1.CopyTo(ar2, 0);

// add the desired value
ar2.SetValue("Code.", ar1.Length);

// overwrite ar1 with ar2 and voila!
// the contents of ar1 should now be {"I", "Like", "To", "Code."}
ar1 = ar2;

Or use List

List ls = new List();
ls.Add("Hello");

Or

Array.Resize(ref array, newsize);
array[newsize - 1] = "newvalue"

วันอังคารที่ 3 สิงหาคม พ.ศ. 2553

xsl on Tomcat 4 not download but display junk text.

This happen when server tomcat don't setting for some file extension to handles.
try to add mime-mapping in conf/web.xml

<mime-mapping>
<extension>xls</extension>
<mime-type>application/vnd.ms-excel</mime-type>
</mime-mapping>

and another mime-mapping is

.docm,application/vnd.ms-word.document.macroEnabled.12
.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotm,application/vnd.ms-word.template.macroEnabled.12
.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template
.potm,application/vnd.ms-powerpoint.template.macroEnabled.12
.potx,application/vnd.openxmlformats-officedocument.presentationml.template
.ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12
.ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12
.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow
.pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12
.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation
.xlam,application/vnd.ms-excel.addin.macroEnabled.12
.xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12
.xlsm,application/vnd.ms-excel.sheet.macroEnabled.12
.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltm,application/vnd.ms-excel.template.macroEnabled.12
.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template

Common mime-mapping is
http://www.w3schools.com/media/media_mimeref.asp

Other setting can be found here
http://wiki.metawerx.net/wiki/Web.xml.MimeMapping

วันจันทร์ที่ 2 สิงหาคม พ.ศ. 2553

Oracle Error : illegal variable name/number

This happen when i use some variable that can be not use in oracle

try to don't use any word like "@demo_table" but can use "@demotable"

Yes remove that line will help. but if variable name is can' use even if it only one word try to change that word.

วันอาทิตย์ที่ 1 สิงหาคม พ.ศ. 2553

feature not enabled: Bit-mapped indexes

About error from run sql statement when need to create database.

sql statement is export from Hora software DLL

to work around changed

CREATE BITMAP INDEX

to

CREATE INDEX

It will work fine.

(I used XE version in my Notebook but in server export script is Enterprise version)

วันจันทร์ที่ 26 กรกฎาคม พ.ศ. 2553

Can't restart service mysql in Windows server 2008

Delete instance
Uninstall MySQL
and delete all folder use
like

C:\ProgramData\MySql (This hidden folder)
C:\Program Files\MySql

and we will got new password and service to run again

วันอังคารที่ 29 มิถุนายน พ.ศ. 2553

ORA-00911: invalid character when try to query with .net app

Yes it because when use command like
SELECT TABLE_NAME FROM user_TABLES; in sqlplus in don't have any problem.

But when use in command string in .net APP
it will throw exception "ORA-00911: invalid character"

yes get rid of ";" in the end of line solve problem.

- -'

enjoy your coding.

Oracle 10g Express listener.ora and connection files default location

I try to find this information finally I found it.

C:/oraclxe/app/oracle/product/10.2.0/server/NETWORK/ADMIN/

listener.ora
sqlnet.ora
tnsnames.ora

วันพุธที่ 9 มิถุนายน พ.ศ. 2553

NUnit 2.5.5 and .NET 4 Testing

I have problem to load assembly .NET 4 to test
Yes compile to .NET 2 will don't have any problem but .NET 4 I can't open dll to test

To fix this we need to modified nunit.exe.config
In folder nunit.exe we used

by 2 step

1. Under <configuration> add:
<startup><requiredRuntime version="v4.0.30319" /></startup>
2. Under <runtime> add:
<loadFromRemoteSources enabled="true" />

Yes for me .NET is version 4.0.30319 (for now)

Thanks to this ref : http://beta.blogs.microsoft.co.il/blogs/dhelper/archive/2010/01/25/how-to-run-nunit-tests-created-with-vs2010-and-net-4.aspx

Change Facebook Group Name

For many mistake

Log in your Group as admin and to to tab "Info"
Click "Edit Information"
and change anything as you want.

Link between Area and not Area.

because if you are in some area you must change area before use other control in other area.

Html.ActionLink( "Home", "Index", "Home", new { area = "" }, null )

Html.ActionLink( "About", "About", "Home", new { area = "" }, null )

Html.ActionLink("Install", "Index", "Install", new { area = "Install" }, null)

How to set default route to Area

Is simple by open your {AreaName}AreaRegistration.cs

and use (Example I add Install Area and need it default page.)

public override void RegisterArea( AreaRegistrationContext context )
{
//context.MapRoute(
// "Install_default",
// "Install/{controller}/{action}/{id}",
// new { action = "Index", id = UrlParameter.Optional }
//);

context.MapRoute(
"Install_default",
"{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional, controller = "Install" },
new { controller = "Install" }
);
}

No need to change other.

ref url is http://stackoverflow.com/questions/2140208/how-to-set-a-default-route-to-an-area-in-mvc

web.config error Column 'InvariantName' when use MySql.Data.MySqlClient

An error occurred creating the configuration section handler for system.data: Column 'InvariantName' is constrained to be unique. Value 'MySql.Data.MySqlClient' is already present.

It' happened when i move my webapp to localhost today
Yes I comment out for now to work on

DbProviderFactories

May be check later.

วันอังคารที่ 8 มิถุนายน พ.ศ. 2553

ICQ search in Firefox address bar

In your Firefox address bar type (without quotes) "about:config". In the filter box type browser.search.defaultenginename . Check what the value is (probably ICQ). Double-click (or right-click & select "Modify") anywhere on that line and a box should come up with the current default engine name. Just change it to Google and see if that fixes the problem. another parameter 'browser.search.selectedEngine', which was also set to ICQ search, but only in one account. I couldn't actually find it in any other account.
I also deactivated a heap of 'icqtoolbar.xxx' parameters. But none of that helped. What finally did the trick was changing 'keyword.url' from
'http://search.icq.com/search/afe_results.php?ch_id=afex&q='
to
'http://www.google.de/search?q='
which I got from doing a google search, and deleting everything after the search term.

ref : from http://support.mozilla.com/tiki-view_forum_thread.php?comments_parentId=650923&forumId=1

วันอาทิตย์ที่ 6 มิถุนายน พ.ศ. 2553

Email port services.

For default email port service is

POP3: 110
IMAP: 143
SMTP : 25


Secure SMTP (SSMTP) - port 465

Secure IMAP (IMAP4-SSL) - port 585

IMAP4 over SSL (IMAPS) - port 993

Secure POP3 (SSL-POP) - port 99

Check this port when server not response.

วันพฤหัสบดีที่ 3 มิถุนายน พ.ศ. 2553

The transaction log is full sql fixed way.

With my current hosting i got this second time for this

Message: The transaction log for database 'horrorclub_net_DB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

this problem can resolve by runt two command.

DBCC SHRINKFILE ("HorrorClubStandUp_log", TRUNCATEONLY )
BACKUP LOG horrorclub_net_DB WITH TRUNCATE_ONLY

Yes Shrinkfile and backup it.

look like my database grow up everyday.


ref url : http://blog.nerdbank.net/2006/07/how-to-empty-sql-server-database.html

วันอังคารที่ 1 มิถุนายน พ.ศ. 2553

SmarterEmail permission check failed.

Will show this error

Failed /MailProcessing/ Folder Permissions Test
Notes: Cannot WRITE to the directory. Cannot DELETE from the directory. Please modify the permissions using NTFS.
Failed /App_Data/ Folder Permissions Test
Notes: Cannot WRITE to the directory. Cannot DELETE from the directory. Please modify the permissions using NTFS.

Just give permission Modify to user to pass permission test on both

วันเสาร์ที่ 29 พฤษภาคม พ.ศ. 2553

HC Controller 8 Install on Windows Server 2008

I try all night to install this but it have error and not work.
So i send support to request install for me

Now anything work fine.
I try to see what different from before and i found

IIS 6 Management Compatibility is Installed (I never think to install this)

This mean Hosting Controller require this feature

to add this feature try to add Roles in Server Manager.

วันพฤหัสบดีที่ 27 พฤษภาคม พ.ศ. 2553

ADSI on IIS

Today I try to install Mail Enable on my server and it need to pre install in IIS.

However you need to install IIS6 Management compatibility to used this function.

วันพุธที่ 26 พฤษภาคม พ.ศ. 2553

Javascript to close it self.

javascript:self.close()

or

window.close();

วันอังคารที่ 25 พฤษภาคม พ.ศ. 2553

block web unwanted

1. Used IE Options Sites > Manages Sites

2. Used Chrome go to option Restricted Sites

3. use Firefox try to find restrict sites add on (I try BlockSite)

4. Used Windows Host files

C:/Windows/System32/drivers/etc/hosts

to block type

127.0.0.1 google.com
127.0.0.1 www.google.com

Greasemonkey and JQuery

I try to @require http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.js
but it fail

so after search found if use full version (min version will get another error.)
we must change some in jquery code in line by used try catch to avoid error

isSupported = (eventName in el);
if ( !isSupported ) {
el.setAttribute(eventName, "return;");
isSupported = typeof el[eventName] === "function";
}
el = null;

to

try {
isSupported = (eventName in el);
if ( !isSupported ) {
el.setAttribute(eventName, "return;");
isSupported = typeof el[eventName] === "function";
}
el = null;
} catch(e) {}

now it work.

and another notice require will load only once when install user script to grease monkey so if you edit it it will need to uninstall and install again

to install new script is easy drag and drop your script to browser.

and you got lasted script by

http://www.asp.net/ajaxlibrary/cdn.ashx

Deserialize from TextReader and Stream

public CountryStorage CreateCountryListFromTextReader( TextReader xmlInput )
{
XmlSerializer xmlSerializer = new XmlSerializer(
typeof( CountryStorage ),
new Type[] { typeof( Country ), typeof( State ) } );

return (CountryStorage) xmlSerializer.Deserialize( xmlInput );
}

//public CountryStorage CreateCountryListFromStreamReader( StreamReader xmlInput )
//{
// XmlSerializer xmlSerializer = new XmlSerializer(
// typeof( CountryStorage ),
// new Type[] { typeof( Country ), typeof( State ) } );

// return (CountryStorage) xmlSerializer.Deserialize( xmlInput );
//}

Software that I used and like it but still don't get them.

Because I don't have money for it so i wait for that time.

Some program here is freeware so please check it with your self.


JetBrains dotTrace - for profile .net application

Comic Life - for Manga maker

Cheat engine - powerful cheat tool with good tutorial.

Adobe Acrobat Professional - How can i make pdf best to equal with this program ?
Adobe Photoshop - No one can do like this.

xp-Iso-Builder_3.0.7.exe - Make new Windows XP Iso with your pre driver.

Fiddler 2 - Debug your web application and other web.

parted magic (Partition utility)
http://partedmagic.com/download.html


hiren boot cd with utility
http://www.hirensbootcd.net/

All free partition utilities.

http://www.partition-tool.com
http://partedmagic.com/
http://partitionlogic.org.uk/
http://www.cutepm.com/
http://www.ranish.com/part/

Get value from string with StringReader or StreamReader

demoXML = "Stringja";

CountryStorageFactory csf = new CountryStorageFactory();
CountryStorage cs = new CountryStorage();
using (TextReader tr = new StringReader( demoXML ))
{
cs = csf.CreateCountryListFromTextReader( tr );
}



MemoryStream ms = new MemoryStream( System.Text.Encoding.UTF8.GetBytes( demoXML ) );

CountryStorageFactory csf = new CountryStorageFactory();
CountryStorage cs = new CountryStorage();
using (StreamReader sr = new StreamReader( ms ))
{
cs = csf.CreateCountryListFromTextReader( sr );
}

Serialize and Deserialize from string.

public static string XmlSerializeToString(this object objectInstance)
{
var serializer = new XmlSerializer(objectInstance.GetType());
var sb = new StringBuilder();

using (TextWriter writer = new StringWriter(sb))
{
serializer.Serialize(writer, objectInstance);
}

return sb.ToString();
}

public static T XmlDeserializeFromString(string objectData)
{
return (T)XmlDeserializeFromString(objectData, typeof(T));
}

public static object XmlDeserializeFromString(string objectData, Type type)
{
var serializer = new XmlSerializer(type);
object result;

using (TextReader reader = new StringReader(objectData))
{
result = serializer.Deserialize(reader);
}

return result;
}

Or use text to StringReader instead

var xml = @"";
var serializer = new XmlSerializer(typeof(Car));
using (var reader = new StringReader(xml))
{
var car = (Car)serializer.Deserialize(reader);
}

วันอาทิตย์ที่ 23 พฤษภาคม พ.ศ. 2553

Free email server

Can use on Vista for local test.

http://www.hmailserver.com
https://www.smartertools.com

If have more I will add later here

mercury
http://www.pmail.com/overviews/ovw_mercury.htm

xmailserver
http://www.xmailserver.org/

mail enable
http://www.mailenable.com/standard_edition.asp

วันศุกร์ที่ 21 พฤษภาคม พ.ศ. 2553

Reset window Position when post with JavaScript.

Easy way is with javascript

javascript:window.scrollTo(0,0);

but what if your element to reset is not whole window.

try this

gotoContentTop();

and in JavaScript function gotoContentTop() like this

function gotoContentTop()
{
document.getElementById('innerContentHolderArea').scrollTop = 0;
}

For use JQuery

$('#innerContentHolderArea').scrollTop(0);

Hope this help.

วันอังคารที่ 18 พฤษภาคม พ.ศ. 2553

Where can I find Microsoft.SqlServer.Smo dll

Please check in %ProgramFiles%\Microsoft SQL Server\100\SDK\Assemblies

But you must install "Microsoft SQL Server 2008 Management Objects" first.

For Database
Microsoft.SqlServer.Smo
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll

For ServerConnection
Microsoft.SqlServer.ConnectionInfo
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll

For Urn
Microsoft.SqlServer.Management.Sdk.Sfc;
C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Management.Sdk.Sfc.dll

วันศุกร์ที่ 7 พฤษภาคม พ.ศ. 2553

Protecting your software or make trial.

I need some information and this i collect on internet now on 07, 05, 2010

Make on your self
http://www.codeproject.com/KB/cs/Trial_Maker.aspx
http://social.msdn.microsoft.com/Forums/en/winforms/thread/e48d34d8-acab-4950-b10c-fee4f4adcc83
http://stackoverflow.com/questions/453030/how-can-i-create-a-product-key-for-my-c-app
http://www.developerfusion.com/code/3846/create-a-trial-period/

when need to encrypt
http://www.programmersheaven.com/user/DataDink/blog/1040-NET-Triple-DES-encryption-class/

Third Party
http://www.eziriz.com/
http://www.lomacons.com/LomaCons/Default.aspx
http://www.ssware.com/cryptolicensing/order_net.htm
http://ellipter.com/order/
http://olicense.de/en/en/index.html
http://www.softwarekey.com/protection-plus/compare-editions/
http://www.microsoft.com/slps/
http://www.infralution.com/licensing.html
http://www.logicprotect.com/index.asp

วันพุธที่ 28 เมษายน พ.ศ. 2553

Xml Serializer in memory.

My object name is request.
and I send TextReader parameter to ChargeRequestFactory Object
This explain simple 2 way to do about this.
But because StringWriter has alway create xml with utf 16 encoding
and I need UTF 8 instead so my choice is choose to use in second solution

Yes we can use StringWriter to create XML with UTF 8 but it must create new
Class and override Encoding so Second task look enough for me.

(1)
StringWriter stringWriter = new StringWriter();

xmlSerializer.Serialize( stringWriter, request );

StringReader stringReader = new StringReader( stringWriter.ToString() );

ChargeRequestFactory factory = new ChargeRequestFactory( stringReader );

(2)
Stream s = new MemoryStream();

XmlWriter xw = new XmlTextWriter( s, Encoding.UTF8 );

xmlSerializer.Serialize( xw, request );

TextReader tr = new StreamReader( s );

s.Seek( 0, SeekOrigin.Begin );

ChargeRequestFactory factory = new ChargeRequestFactory( tr );

In ChargeRequest function I have Deserialize to get XML Back to Object.

วันอาทิตย์ที่ 25 เมษายน พ.ศ. 2553

Problem when install Microsoft Expression Blend and they ask about .net 3.5 sp 1

My Little brother have problem to install Blend demo.
And he send me about this required to install .net framework 3.5 sp 1 and he said he already install but it don't work.

so i try to fix it out (I don't see his machine)
First to install .net framework 3.5 sp 1 complete we need most last version of Windows installer
http://www.microsoft.com/downloadS/details.aspx?familyid=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en
so i let him to download and install this.
Second not sure he download correct version so i let him download from
http://download.microsoft.com/download/2/0/e/20e90413-712f-438c-988e-fdaa79a8ac3d/dotnetfx35.exe

after few hour. yes few hour he said now he can install Microsoft Expression Blend now.

and for reference about this to make me clear how to help him is
http://social.msdn.microsoft.com/Forums/en/netfxsetup/thread/b9354cf4-5c51-416c-a048-c33b6c6a713c

anyone have problem with this hope this help

InfoBoard and warning error.

Warning: fopen(../data/xxxx/xxxxxx.xxx) [function.fopen]: failed to open stream: Permission denied in /home/www/virtual/clubmps.com/school/htdocs/news/_class/class.global.php on line xxx

Warning: fwrite(): supplied argument is not a valid stream resource in /home/www/virtual/clubmps.com/school/htdocs/news/_class/class.global.php on line xxx

Warning: fclose(): supplied argument is not a valid stream resource in /home/www/virtual/clubmps.com/school/htdocs/news/_class/class.global.php on line xxx


To fix this check in folder data to make sure anything have permission 777

วันศุกร์ที่ 23 เมษายน พ.ศ. 2553

Simple use on DbProviderFactory

using System.Data.Common;
using System.Collections;

DbProviderFactory factory = DbProviderFactories.GetFactory( "System.Data.OleDb" );

string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Vevo.mdb;";

connection = factory.CreateConnection();

connection.ConnectionString = connectionString;

connection.Open();

DbCommand cmd = connection.CreateCommand();

cmd.CommandText = "SELECT * FROM Page";

DbDataReader reader = cmd.ExecuteReader();

if (!reader.HasRows)
{
reader.Close();
return;
}

ArrayList array = new ArrayList();

while (reader.Read())
{
//result.Add( binder( reader ) );
array.Add( reader );
}

reader.Close();

connection.Close();

Comic tools

Comic life

http://plasq.com/comiclife-win

ASP.NET tools

ASP.NET ViewState Helper
* Page’s total size: This is the total size of the web page shown in the URL column
* ViewState size: This is the size of the ViewState field
* ViewState %: What percent of the total page size is being taken up by the ViewState?
* Markup size: The size of HTML markup (non-visible text) on the page
* Markup %: What percent of the page consists of non-visible HTML markup?

http://www.binaryfortress.com/aspnet-viewstate-helper/

CSS Friendly Control Adapters and aspnetcontroladapters

used for customize Style sheet easily for asp.net control

http://cssfriendly.codeplex.com/
http://code.google.com/p/aspnetcontroladapters/

Optimize Tortoise SVN Icon Cache.

It simple if we have only few folder to development because default setting Tortoise SVN cache will cache all drive and all sub folder (Take hard to read Hard disk)

To avoid this specified only folder need to cache by

1. Go to Tortoise SVN Settings
2. Go to Setting Tree Icon Overlays
3. Insert drive or folder in Exclude paths separate by new line.
like (Only Fixed drives)
C:\*
D:\*
4. Insert only folder want to cache files like
C:\WebDesign\*
D:\Project\*

Yes apply this setting now you will see icon only in specifies folder.
and reduce resource used by Tortoise SVN

Autobuild Nant in Console

Another Example to use Autobild Nant in console.

using System.Threading;

namespace AutobuildConsole
{
class Program
{
static void Main( string[] args )
{
//Console.Write( @"C:\WebBuild\nant-0.86-beta1\bin\NAnt.exe -help" );

//Console.ReadKey();

string commandLine = @"C:\WebBuild\nant-0.86-beta1\bin\NAnt.exe -help";

ExecuteCmd exe = new ExecuteCmd();
exe.ExecuteCommandSync( commandLine );
//exe.ExecuteCommandAsync( commandLine );

//Console.WriteLine( "\nDone !" );
Console.ReadLine();
}

public class ExecuteCmd
{

#region ExecuteCommand Sync and Async

///

/// Executes a shell command synchronously.

///


/// string command

/// string, as output of the command.

public void ExecuteCommandSync( object command )
{

try
{

// create the ProcessStartInfo using "cmd" as the program to be run, and "/c " as the parameters.

// Incidentally, /c tells cmd that we want it to execute the command that follows, and then exit.

System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo( "cmd", "/c " + command );

// The following commands are needed to redirect the standard output.

//This means that it will be redirected to the Process.StandardOutput StreamReader.

procStartInfo.RedirectStandardOutput = true;

procStartInfo.UseShellExecute = false;

// Do not create the black window.

procStartInfo.CreateNoWindow = true;

// Now we create a process, assign its ProcessStartInfo and start it

System.Diagnostics.Process proc = new System.Diagnostics.Process();

proc.StartInfo = procStartInfo;

proc.Start();



// Get the output into a string

string result = proc.StandardOutput.ReadToEnd();



// Display the command output.

Console.WriteLine( result );

}

catch (Exception objException)
{

// Log the exception

}

}



///

/// Execute the command Asynchronously.

///


/// string command.

public void ExecuteCommandAsync( string command )
{

try
{

//Asynchronously start the Thread to process the Execute command request.

Thread objThread = new Thread( new ParameterizedThreadStart( ExecuteCommandSync ) );

//Make the thread as background thread.

objThread.IsBackground = true;

//Set the Priority of the thread.

objThread.Priority = ThreadPriority.AboveNormal;

//Start the thread.

objThread.Start( command );

}

catch (ThreadStartException objException)
{

// Log the exception

}

catch (ThreadAbortException objException)
{

// Log the exception

}

catch (Exception objException)
{

// Log the exception

}

}

#endregion

}
}
}

Use ShellCommand in Web Form.

sing System.Diagnostics; // For Process


//string fileName = @"C:\WebBuild\nant-0.86-beta1\bin\NAnt.exe";
//string arguments = " -help";

//ProcessStartInfo startInfo = new ProcessStartInfo( fileName, arguments );
//startInfo.CreateNoWindow = false;
//startInfo.UseShellExecute = false;

////If this option is set the DOS window appear again
////startInfo.WindowStyle = ProcessWindowStyle.Hidden;
//startInfo.RedirectStandardOutput = true;
//string result = String.Empty;
//using (Process exeProcess = Process.Start( startInfo ))
//{
// result = exeProcess.StandardOutput.ToString(); ;
// exeProcess.WaitForExit();
//}

//string command = @"C:\WebBuild\nant-0.86-beta1\bin\NAnt.exe -help";
uxResult.Text = String.Empty;
string command = @"C:\WebBuild\nant-0.86-beta1\bin\NAnt.exe -buildfile:C:\WebBuild\vpaspSkin.build";

// create the ProcessStartInfo using "cmd" as the program to be run, and "/c " as the parameters.
// Incidentally, /c tells cmd that we want it to execute the command that follows, and then exit.

System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo( "cmd", "/c " + command );

// The following commands are needed to redirect the standard output.
//This means that it will be redirected to the Process.StandardOutput StreamReader.

//true
procStartInfo.RedirectStandardOutput = true;

// false
procStartInfo.UseShellExecute = false;

//If true Do not create the black window.
procStartInfo.CreateNoWindow = true;

// Now we create a process, assign its ProcessStartInfo and start it

System.Diagnostics.Process proc = new System.Diagnostics.Process();

proc.StartInfo = procStartInfo;

proc.Start();

// Get the output into a string

string result = proc.StandardOutput.ReadToEnd();

uxResult.Text = result;
// Display the command output.

//Console.WriteLine( result );
MessageBox.Show( "Success" );


From old code i have 2 solution to use shell command. this example is about build Nant by win form.

วันจันทร์ที่ 19 เมษายน พ.ศ. 2553

Microsoft File Transfer Manager with Vista and Runtime Error

Today I subscribe to Microsoft software project
and need to use Microsoft File Transfer Manager to download software from Microsoft

yes it cannot success with always run time error and close program itself.

This is bug from Microsoft File Transfer Manager itself.
to fixed this

1. Close Internet connection
2. Open Microsoft File Transfer Manager ( click link again or open directly from you local path)
3. Connected Internet.
4. If application have popup to not check version click yes ( and if it ask for update. Do it now )
5. Now you can choose where to place you software.

วันพฤหัสบดีที่ 8 เมษายน พ.ศ. 2553

c# to get url referer.

Use this

Request.UrlReferrer

to get url referrer.

วันพุธที่ 7 เมษายน พ.ศ. 2553

VevoCart 4 and Ajax Error in Admin page.

With this javascript error.

"Ajax client-side framework failed to load" and "Type is not defined"

However in Front page have no problem so I check on Admin page source and found this line in Default.aspx (rememver i cannot insert any tag here.)

asp:ScriptReference Name="MicrosoftAjax.js" Path="../ClientScripts/MicrosoftAjaxCustom/MicrosoftAjax.js"

but in source code they use this

script src="../ClientScripts/MicrosoftAjaxCustom/MicrosoftAjax.en-US.js" type="text/javascript"

Yes they have add Culture to path we reference so it can't find correct javascript

for setting in web.config compilation debug="true"

This will use ClientScripts\MicrosoftAjaxCustom\MicrosoftAjax.debug.js

and if compilation debug="false"

They will use ClientScripts\MicrosoftAjaxCustom\MicrosoftAjax.js

This happend in some server depend on server setting. not anyone found this
but finally I found solution for this

copy old script and place with culture in end of file name get rid of this error.
( Keep old file for compatible on any server that they don't add culture to script name )

Note * we use custome script to fix chrome loading issue but this only work with debug="true" if set false it will failed on load in Admin Some page.

วันอังคารที่ 6 เมษายน พ.ศ. 2553

Delete, Rename and File already in used problem.

totally answer here.

http://ccollomb.free.fr/unlocker/

วันศุกร์ที่ 2 เมษายน พ.ศ. 2553

Norton 360 Download Files location ?

I brought it today and it must download pass Norton download manager.
The point is where is really install files
(Because it let me download to install only 60 days)

For XP i not found yet.

For Vista location is
C:\Users\Public\Public Downloads\Norton\{N360S_prod_1.19_127}

Yes Maybe different if version change.

วันอังคารที่ 30 มีนาคม พ.ศ. 2553

Asp.net MVC make mistake about route name

Today I try to use route name in my MVC

string url = urlHelper.RouteUrl(routeName, routeValues);

Yes it don't work because it didn't find my route name

A route named 'Index' could not be found in the route collection.

Only route name "Default" i can use so what the point?

to use route name work you must map like

routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Vsaving", action = "Index", id = "" } // Parameter defaults

in Global.aspx ( I still don't test this )

another way use Action instead Route like this

RedirectToAction(string actionName, string controllerName);

compare with

RedirectToRoute(string routeName); If want to go "Index2" or something you must routes.MapRoute before

This is clear?

วันจันทร์ที่ 29 มีนาคม พ.ศ. 2553

Use Membership to get UserId

User.Identity have name but where userId

Here how to get that

MembershipUser CurrentUser = Membership.GetUser( User.Identity.Name ); // or use Membership.GetUser();
int userID = int.parce( CurrentUser.ProviderUserKey.ToString() );

by the way this mean when you want userID you must connect database so
check on this article for use other way to keep user

http://www.eggheadcafe.com/tutorials/aspnet/33d4018a-03cf-48aa-9b68-82ba27aa6af9/forms-auth-membership-r.aspx

and some customize provider will help this job done.

http://weblogs.asp.net/scottgu/archive/2006/04/13/442772.aspx

วันอาทิตย์ที่ 28 มีนาคม พ.ศ. 2553

jQuery and error "$ is not define"

To day I use Jquery in ASP.NET MVC and can't make it work.
It's always show java script error about "$ is not defined"

Yes after search and found a call wrong path for Include my jQuery script

and my problem now is confuse about relative path for jquery in my master page

and finally anything solve by

Url.Content ("~/Scripts/jquery-1.3.2.min.js")

Used this instead of

../../Scripts/jquery-1.3.2.min.js

Yes I don't include full code here because Google don't support code html for example with out encoding it myself.

I will find another block for do that.

Yes this will solve problem with css too.

วันพฤหัสบดีที่ 25 มีนาคม พ.ศ. 2553

Add Header link in C# Code Behind and Front

use HtmlHead and HtmlLink for this job

HtmlHead header = (HtmlHead) Page.Header;
HtmlLink link = new HtmlLink();
link.Attributes.Add( "href", Page.ResolveClientUrl( "~/App_Themes/Default/Default.css" ) );
link.Attributes.Add( "type", "text/css");
link.Attributes.Add( "rel", "stylesheet");
header.Controls.Add(link);

วันพุธที่ 24 มีนาคม พ.ศ. 2553

Kaspersky 2010 and MSN file transfer

"C:\Program Files\Kaspersky Lab\Kaspersky Internet Security 2010\avp.exe" scan

use this command in file transfer to receive or send file.

วันพฤหัสบดีที่ 11 กุมภาพันธ์ พ.ศ. 2553

New Windows XP with add customize driver.

I need to format my old PC K8V-X
But in didn't detect my hard disk when setup.

Yes it need F6 to install third party driver but
can use with only Floppy Disk 3.5 - -'

Who still used it but not me

So how can i do. Only one way seem to add driver directly to Windows XP ISO
but how

I try some article to show me to edit some file and manually add driver
But the last when setup it show me
TXTSETUP.SIF has error in line xxxxxxx

I go to check in line xxxxxx but it empty line ( - -* )

So may be i do some thing wrong but how

Finally I found
http://winfuture.de/XPIsoBuilder_en

and yes it gui to make iso step by step
and i complete it in few minute (last it will be .iso file so you need iso program to support this extension)

Now i can setup with my customize iso without to press F6 anymore
Cool!

วันพุธที่ 10 กุมภาพันธ์ พ.ศ. 2553

Logon Failure: The user has not been granted

Logon Failure: The user has not been granted the requested logon type
On Windows XP

Today I try to backup my old files in my old company PC but I cannot access shared folder
but old PC can access to my shared folder ( - -' )

yes they popup that message
and after on Google I found this

Download the following and install it

Windows Server 2003 Resource Kit Tools
http://go.microsoft.com/fwlink/?LinkId=4544

Then enter the following commands. (Attention: they are case sensitive.)

net user guest /active:yes
ntrights +r SeNetworkLogonRight -u Guest
ntrights -r SeDenyNetworkLogonRight -u Guest

The first command enables network access for Guest,
the two subsequent ones change two different policies to allow network access for Guest.

Yes after do this command it' work
So I post here for future use (I hope not found this issue again)

Ref : http://dotnetfree.blogspot.com/2009/08/logon-failure-user-has-not-been-granted.html

วันอังคารที่ 9 กุมภาพันธ์ พ.ศ. 2553

IE8 Javascript Can't Enable

I try anything to setup delete uninstall reinstall any add on and last is IE8 itself.
Nothing work - -'

So i find find and find finally found this

Start > Run...
In the Run box, type in (without quotes) "regsvr32 jscript.dll"
You should receive a popup says that it registration succeeded.

Work now. may be registry have some damage?
so don't make this mistake again.

When you need graph in WinForm (C#)

Try free graph

http://csharp-source.net/open-source/charting-and-reporting
http://www.nplot.com/
http://zedgraph.org/wiki/index.php?title=Main_Page

Or pay for it

http://www.gigasoft.com/netchart.html

Hope this help.

วันเสาร์ที่ 30 มกราคม พ.ศ. 2553

Mass Effect CPU 100%

Yes brought from steam and nice game to play.
But with RPG game why this suck my CPU to load 100% (With another game not).

Try this solution first. (I sill not try)

Browse to My Documents>Bioware>Mass Effect>Config and open up BIOEngine.ini

Search for

DisableHWShadowMaps=True

and set to False to stop cpu calculate shadows instead of gpu.

Use function show text in aspx page

This hard one when i found but write for don't forget this again.

Commonly we use <% =Function() %>

Or <% Response.Write( Function() ) %>

For this task

If this page you bind some data it will <%# Function() %>

PS. I hate to convert tag html in this blog for my self.

วันอังคารที่ 26 มกราคม พ.ศ. 2553

Free Private SVN Hosting Services

Need hosting personal svn project try on this site.

http://www.xp-dev.com
http://beanstalkapp.com
http://unfuddle.com
http://www.projectlocker.com

Don't know who best on services but i sign up at all
To review later.

วันเสาร์ที่ 23 มกราคม พ.ศ. 2553

Free Dotfuscator to use instead of Dotfuscator Community Edition 3.0

Today i still use Express Edition so found solution about free Dotfuscator here.

http://www.foss.kharkov.ua/g1/projects/eazfuscator/dotnet/Default.aspx

enjoy.

วันจันทร์ที่ 11 มกราคม พ.ศ. 2553

Automation Building tools

I'm newbie on automated build program to build my .Net webapp so i try some research and found powerful 2 tools
MsBuild and NANT

NANT stop update most 2 year.
and can't compile directly to 3.5 solution files but can use NANT to call MSBuild to use that task

so why i use NANT if i can use MSbuild to complete all my project.
NANT come with easy understand XML format and task but with some GUI tool is still expensive (And for not up to date because NANT not update)
* but why use gui tool if xml format is easy to understand right? so why gui tool is expensive to much i don't know.

With MSBuild we will face document Ms Style and with GUI Tools (MSBuild Sidekick) is a fair price to use if we want GUI tool (around $50 i think i can have it)

and With opensouce like MSBuild Extension Pack i most complete my package at once.

but no not because of tool but because i still newbie for this task still learn and yes
I think i will focus on msbuild because it came with any computer that install .NET 3.5 framework

If you have any suggestion or another solution for automation build please tell me.
I will try it out.

วันจันทร์ที่ 4 มกราคม พ.ศ. 2553

C# new empty project and can't build

With error does not contain a static 'Main' method suitable for an entry point

This simply fix by Check at properties of project that has

Output Type: on tab Application