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.
วันพุธที่ 28 เมษายน พ.ศ. 2553
วันอาทิตย์ที่ 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
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
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();
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();
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/
* 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
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
}
}
}
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
///
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.
//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.
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
วันพุธที่ 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.
"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/
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.
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.
สมัครสมาชิก:
บทความ (Atom)