Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
X

Xiaoming Qian

@Xiaoming Qian
About
Posts
27
Topics
24
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to write c# version of Delphi's Abort procedure
    X Xiaoming Qian

    Delphi has a precedure named "Abort".The following is picked up from Delphi help: Use Abort to escape from an execution path without reporting an error.Abort raises a special "silent exception" (EAbort), which operates like any other exception, but does not display an error message to the end user. Abort redirects execution to the end of the last try .. finally block.

    EAbort = class(Exception);
    procedure Abort;
    function ReturnAddr: Pointer;
    asm
    MOV EAX,[EBP - 4]
    end;
    begin
    raise EAbort.Create(SOperationAborted) at ReturnAddr;
    end;

    I'm now going to .Net. I can not find any method Similar to the "Abort" procedure.Is it possible to to write c# version of Delphi's "Abort" procedure like this?

    try //application level try .. finally block
    {
    try
    {
    ...
    try //Current level try .. finally block
    {
    ...
    // Throw a SilentException that will only catched by application level try .. finally block
    // and redirects execution to the end of application level try .. finally block
    Abort; //How to??????????????????????????
    ...
    }
    catch
    {
    }
    }
    catch
    {
    }
    }
    catch ()
    {
    }
    finally
    {
    }
    ...

    Can anyone help me? Any suggestion wil be appropriate. Thanks a lot. .

    Forgive my poor English

    C# csharp help delphi tutorial question

  • The Client does not Download the Lastest Upload File
    X Xiaoming Qian

    My webform has a link to download a sverver file: "http://Server/App/UpLoad/File1.xls".But when I have upload a new file to replace the old file(File1.xls),this link still download the old file.The stanger thing is when I have deleted "File1.xls",it also download the old file(where the old file from ?!). All of our client machines have this problem,but when used in the Server's browser, it all works well. Can anyone help me? Thanks a lot.

    Forgive my poor English

    ASP.NET help sysadmin question

  • Type Incompatible When Calling ActiveXObejct's Method in Web Page
    X Xiaoming Qian

    Here is my code: <object id="ZKFPEngX1" classid="CLSID:CA69969C-2F27-41D3-954D-A48B941C3BA7"> </object> <script id="ZKFPEngX1_OnCapture" for=ZKFPEngX1 event=OnCapture(ActionResult,ATemplate) > LastCaptureTemplate = ATemplate; //Call a Web Server's method FingerPrint.GetCqryFingerData(GetCqryFingerDataCallback); </script> <script type="text/javascript" language="javascript"> var ZKFPEngX1 = document.getElementById("ZKFPEngX1"); var RegFeatureChanged = false; var LastCaptureTemplate; ZKFPEngX1.InitEngine() ZKFPEngX1.BeginCapture(); function GetCqryFingerDataCallback(response) //Web Server method call complete { var t = response.value.Tables[0]; var FoundPID = ""; for (i=0;i<t.Rows.length;i++) { var StoredTemplate = t.Rows[i].FINGERPRINT; //FINGERPRINT is byte arrays(JavascriptType) // VerFinger generate an error: Variant is not an array if (ZKFPEngX1.VerFinger(LastCaptureTemplate, StoredTemplate, false, RegFeatureChanged)) { FoundPID = t.Rows[0].PID; break; } } } </script> And here is our vender's SDK documentation: VB language expression is used here, and fingerprint template Variant variable show as one-dimension byte arrays. Function VerFinger(byval regTemplate, verTemplate, AdoLearning As Boolean, byval AregFeatureChanged As Boolean) As Boolean Events: OnCapture(ActionResult AS Boolean, ATemplate) When calling VerFinger(), it generate an error: Variant is not an array.I type 'typeof LastCaptureTemplate' in the debug window and it returns 'Unknown'. I think this is because VB array and Javascipt array are Incompatible. Can any one help me? Any idea will be appropriate. Thanks a lot. Also thanks CodeProject. I have got a lot of help here.

    Web Development help javascript sysadmin data-structures debugging

  • An ASP.Net Question
    X Xiaoming Qian

    Hi Everybody: I am a new comer to web development. I have a problem when developing my ASP.Net application.Here is my code: <table id="Header" cellpadding="0" cellspacing="0" border="0" width="100%" runat="server" EnableViewState="False" > <tr> <td valign="top"> <asp:Image EnableViewState="False" GenerateEmptyAlternateText="True" ID="Image1" runat="server" ImageUrl="~/Images/TopLeftCorner.png" Width="6px" Height="6px" /> </td> <td valign="middle" style="background-color: #F1F1F1;width: 100%;"> </td> <td valign="top"> <asp:Image EnableViewState="False" ID="Image2" runat="server" GenerateEmptyAlternateText="True" ImageUrl="~/Images/TopRightCorner.png" Width="6px" Height="6px" /> </td> </tr> </table> <table id="Content" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td valign="top" style="background-color: #F1F1F1; "> <asp:contentplaceholder id="ContentPlaceHolder1" runat="server"> </asp:contentplaceholder> </td> </tr> </table> <table runat="server" id="Footer" border="0" cellpadding="0" cellspacing="0" width="100%" EnableViewState="False"> <tr> <td valign="top"> <asp:Image EnableViewState="False" GenerateEmptyAlternateText="True" ID="Image14" Height="6px" Width="6px" runat="server" ImageUrl="~/Images/BottomLeftCorner.png" /> </td> <td style="width: 100%; background-color: #F1F1F1;"> </td> <td valign="top"> <asp:Image EnableViewState="False" GenerateEmptyAlternateText="True" ID="Image13" Height="6px" Width="6px" runat="server" ImageUrl="~/Images/BottomRightCorner.png"/> </td> </tr> </table> The display result of these code is: The cells that contain images have a greater height than 6px(that is my images height),and the images diplay in the middle of the cells(vertically). This causes the "Header","Content" and "Footer" be separated.That is what I not want to see. Is there any way? Any ideas will be appropriate.

    ASP.NET question csharp asp-net sysadmin help

  • A Session Question
    X Xiaoming Qian

    Hi everybody: In my web application,I store some information(UserName etc.) in Session. In a admin's web page,I want to list all the active Sessions and its data.Also, I wiil be able to stop any Session. Is there any way?

    ASP.NET question

  • Excel application does not quit after automation from Visual Studio .NET client
    X Xiaoming Qian

    Here is mycode: private void NullAndRelease(object runtimeObject) { try { System.Runtime.InteropServices.Marshal.FinalReleaseComObject(runtimeObject); } catch {} finally { runtimeObject = null; } } private void button1_Click(object sender, EventArgs e) { Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application(); object NullParam = System.Reflection.Missing.Value; Workbook Book = ExcelApp.Workbooks.Open(FileName, 0, true, NullParam, NullParam, NullParam, true, NullParam, NullParam, false, false, NullParam, false, true, NullParam); Worksheet Sheet = Book.Worksheets[1] as Worksheet; Range UsedRange = Sheet.UsedRange; Range Cell = null; int RowCount = UsedRange.Rows.Count; for (int i = 2; i <= RowCount; i++) { Cell = UsedRange.Cells[i, 1] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 2] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 3] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 4] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 5] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 6] as Microsoft.Office.Interop.Excel.Range; NullAndRelease(Cell); } NullAndRelease(Cell); NullAndRelease(UsedRange); NullAndRelease(Sheet); if (Book != null) Book.Close(false, NullParam, false); NullAndRelease(Book); ExcelApp.Quit(); NullAndRelease(ExcelApp); GC.Collect(); GC.WaitForPendingFinalizers(); } These code works well.But when I add the following code in the for loop: Cell = UsedRange.Cells[i, 7] as Microsoft.Office.Interop.Excel.Range; The server does not shut down. It seems that I can only read not more than 6 cells.That's why?

    C# csharp visual-studio com sysadmin testing

  • A COM Interop Question
    X Xiaoming Qian

    Thank you for your reply.But I stiil face a problem: private void NullAndRelease(object runtimeObject) { if (runtimeObject == null) return; try { System.Runtime.InteropServices.Marshal.FinalReleaseComObject(runtimeObject); } finally { runtimeObject = null; } } private void button1_Click(object sender, EventArgs e) { Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application(); object NullParam = System.Reflection.Missing.Value; Workbook Book = ExcelApp.Workbooks.Open(FileName, 0, true, NullParam, NullParam, NullParam, true, NullParam, NullParam, false, false, NullParam, false, true, NullParam); Worksheet Sheet = Book.Worksheets[1] as Worksheet; Range UsedRange = Sheet.UsedRange; Range Cell = null; int RowCount = UsedRange.Rows.Count; for (int i = 2; i <= RowCount; i++) { Cell = UsedRange.Cells[i, 1] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 2] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 3] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 4] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 5] as Microsoft.Office.Interop.Excel.Range; Cell = UsedRange.Cells[i, 6] as Microsoft.Office.Interop.Excel.Range; NullAndRelease(Cell); } NullAndRelease(Cell); NullAndRelease(UsedRange); NullAndRelease(Sheet); if (Book != null) Book.Close(false, NullParam, false); NullAndRelease(Book); ExcelApp.Quit(); NullAndRelease(ExcelApp); GC.Collect(); GC.WaitForPendingFinalizers(); } These code works well.But when I add the following code in the for loop: Cell = UsedRange.Cells[i, 7] as Microsoft.Office.Interop.Excel.Range; The server does not shut down. It seems that I can only read not more than 6 cells.That's why?

    C# com question csharp asp-net announcement

  • A COM Interop Question
    X Xiaoming Qian

    Look at the following code Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application(); ... ExcelApp.Quit(); The Excel object is not release after 'Quit()' method(Excel is still in the background process list).I think it is because there is still a reference of the object. I a windows application,this will be solved when I close the application. But I'm using these code in an asp.net application.Every time they execute,the background process list grows. Is there any way to relase the object or Is there any code to read excel files without using Microsoft Excel?

    C# com question csharp asp-net announcement

  • A COM Interop Question
    X Xiaoming Qian

    Look at the following code Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application(); ... ExcelApp.Quit(); The Excel object is not release after 'Quit()' method(Excel is still in the background process list).I think it is because there is still a reference of the object. I a windows application,this will be solved when I close the application. But I'm using these code in an asp.net application.Every time they execute,the background process list grows. Is there any way to relase the object or Is there any code to read excel files without using Microsoft Excel?

    COM com question csharp asp-net announcement

  • A Beginner's Question
    X Xiaoming Qian

    Hi I am a new commer to html.I have a question: <table style=" border-color:Black;border-width:1px;border-style:solid"> <tr > <td style="width:100px;height:100px"> 111111111111111111111111111111111111111111111111111111111111 </td> </tr> </table> I want the text in td be wraped when exceeds the width ,and the text be clipped when it exceeds the height. Can anyone help me? Any idea will be appropiate.

    Web Development question html architecture help learning

  • A beginer's qustion
    X Xiaoming Qian

    Hi everybody. I'm developing an IC card handset device application with standard C language.I'm a new comer to C language.I have a question Look at the funtion definition : unsigned short dt_recv(unsigned char *data, int *datalen) Input parameters: Data : to receive data buffer Output parameters: Datalen:receive data buffer size Return values: none. Communication Protocol : data[0]=command head; ... data[3]=high of length; data[4]=low of length; ... Data[3] and Data[4] store a Int16 value.I have problem when I try to get the value.Here is my code: short i; memcpy(&Data[3],&i,2); But it seems that I did not get the right value.I guess I'm in the wrong way.I'm not familiar with memory operation. Can any one give me the right way?Any idea will be appropriate.

    C / C++ / MFC question performance help

  • A qustion on Dll Call
    X Xiaoming Qian

    Thank you, it works. :-D

    C# help question

  • A qustion on Dll Call
    X Xiaoming Qian

    Hi everybody.I have problems when calling dll. Here is the Dll function definition(from the vander's document): __int16 __stdcall MW_GetDBRecord(HANDLE icdev, __int16 fsid, __int16 rec_size, char *buf, int *rlen) Input parameters: icdev: device handle fsid: selected table NO. rec_size: a record size space. Output parameters : Buf: return entire record data (you need give buf enough space ); Rlen: length of data . And here is my code: [DllImport("mwhandset")] public static extern Int16 MW_GetDBRecord(IntPtr icdev,Int16 fsid, Int16 rec_size,ref string buff,ref int rlen); ... private void button3_Click(object sender, System.EventArgs e) { ... int rlen = 0; string buff; buff = " ";//the length is enough MW_GetDBRecord(m_icdev,0,16,buff,ref rlen); } When calling MW_GetDBRecord it raise "System.NullReferenceException: Object not set to an instance".I'm sure the function has completed on the device, because rlen=16(the record size) when the exception raised.So I think it is caused by type incompatibility,most likely the buff parameter.What type should I use corresponding to "char *buf"? Or it is caused by any other reason? Can anyone help me? Any idea will be appropriate.

    C# help question

  • WebService Security
    X Xiaoming Qian

    I have developed a web service in our company.I want to only allow our customers' code to call our webservice,But I don't have much knowlogy on web sevice security.Can any one help me? Also are there basic security issues i should look into or does any one have any resources/links that will help me make a secure site.

    Web Development security help question

  • WebService Security
    X Xiaoming Qian

    I have developed a web service in our company.I want to only allow our customers' code to call our webservice,But I don't have much knowlogy on web sevice security.Can any one help me? Also are there basic security issues i should look into or does any one have any resources/links that will help me make a secure site.

    ASP.NET security help question

  • A Permission question
    X Xiaoming Qian

    I'm trying to operate with event logs in my asp.net application,here is my code: EventLog ev = new EventLog("MyAppLog",".","MyApp"); EventLogPermission ep = new EventLogPermission(PermissionState.Unrestricted); ep.Assert(); ev.Clear(); A Win32Exception raised when runing to ev.Clear(): System.ComponentModel.Win32Exception:Aceess denied. What's the problem in my code? Or any other advice to me? Note these code is running under the ASPNET windows account. Regards

    ASP.NET asp-net question csharp help

  • Web Control Designing Questions
    X Xiaoming Qian

    I had write a WebControl and its designer.The following is som of my code [Designer("SM.WebControls.PagingControlDesigner"), ParseChildren(false)] public class PagingControl : System.Web.UI.WebControls.WebControl,INamingContainer {   [Bindable(true),   EditorAttribute(typeof(UrlEditor), typeof(UITypeEditor))]   public string FirstButtonImg   {    get{return Convert.ToString(ViewState["FirstButtonImg"]);}    set{ViewState["FirstButtonImg"] = value;}   }   protected PlaceHolder ParsedSubObjectContainer = new PlaceHolder();   protected override void CreateChildControls()   {    Panel Panel1 = new Panel();    Create some Controls and add to Panel1    Controls.Add(Panel1);    Controls.Add(ParsedSubObjectContainer);   }   protected override void AddParsedSubObject(Object obj)   {    ParsedSubObjectContainer.Controls.Add((Control)obj);   }   internal string GetDesignTimeHtml()   {    EnsureChildControls();    StringWriter sw = new StringWriter();    HtmlTextWriter writer = new HtmlTextWriter(sw);    this.RenderControl(writer);    return sw.ToString();   }   ... } public class PagingControlDesigner : ControlDesigner {   public override bool DesignTimeHtmlRequiresLoadComplete   {    get{ return true;}   }   private PagingControl PagingControlInstance;   public override void Initialize(System.ComponentModel.IComponent component)   {    this.PagingControlInstance = (PagingControl) component;    base.Initialize (component);   }   public override string GetDesignTimeHtml()   {    return PagingControlInstance.GetDesignTimeHtml();   }   ... } I faced two problems when I writing this WebControl. The First is when I try to bind the FirstButtonImg property in a web form, the expression is not evaluated.It simple pass the '<%= Expression %>' string to the property <SM:PagingControl id="PagingControl1" runat="server" FirstButtonImg='<%= Expression %>' > I do call PagingControl1.DataBind() in my WebForm's code. The second, when I am designing a WebFrom: <SM:PagingControl id="PagingControl1" runat="server">  <asp:DataGrid id="DataGrid1" runat="server">  </asp:DataGrid> </SM:Pa

    ASP.NET design sysadmin

  • A .Net remoting question
    X Xiaoming Qian

    I am a newcomer to .Net Remoting. After I had read some articles at CodeProject,I did som work by my self. I created three project:Server.exe,Client.exe,RemotableObject.dll.Here is my Client code: using RemotableObject; ... private MyRemotableObject remoteObject; ... TcpChannel m_TcpChan = new TcpChannel(); ChannelServices.RegisterChannel(m_TcpChan); RemotingConfiguration.RegisterWellKnownClientType( typeof(MyRemotableObject),"tcp://localhost:8080/MyRemotableObject"); remoteObject = new MyRemotableObject(); remoteObject.Method1(); When I running the Client, it raise "System.IO.FileNotFoundException: File not found:RemotableObject".So I put RemotableObject.dll in the Client.exe's folder,and it's all well. My question is: Does the RemotableObject.dll must be deployed together with every client? If it must,then what role does the RemotableObject.dll acts on the client? If it doesn't ,what additional work should I do to let RemotableObject.dll apart from the client?

    C# question csharp sysadmin

  • How to assign roles to users
    X Xiaoming Qian

    The following is my Web.config file <location path="admin"> <system.web> <authorization> <allow roles="Admin" /> <deny users="*" /> </authorization> </system.web> </location> But in FormsAuthentications mechanism,I can't find how to and when to assign "Admin" role to Authenticate users. Can anyone help me? Any idea will be appropriate.

    ASP.NET security help tutorial question

  • How to make tablecell's width fixed
    X Xiaoming Qian

    I'm a beginer to ASP.net. I have a question. I want to let the width of a 'td' fixed, and the text in 'td' wrapped if it is too long. Can anyone help me? Thanks!

    ASP.NET question csharp asp-net help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups