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
A

AndieDu

@AndieDu
About
Posts
115
Topics
50
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Import a .reg file to a remote machine's registry
    A AndieDu

    thanks a lot, will try at that section.

    C# sysadmin csharp windows-admin algorithms tutorial

  • Import a .reg file to a remote machine's registry
    A AndieDu

    Hi All, I was searching on Internet with this topic but dont have much luck, so i am trying my luck in here now, lol My scenario is: i am havning a centralise release server that hosts the release applicaiton and backups, and now i would like to extend this application to allow the user to import the .reg file, sits on the release server, to a remote machine. just as an example, in windows, if we open registry edit, and we have an option "Connect Network Registry", so we can connec to remote machine, and once we connected, we can select the .reg file from local mahcine and import into the remote machine. Our release application would like to achieve the same goal. Hopefully i describe the scenario cleary, and since Windows is able to do it, then i am sure there is a way to do it in .Net, can someone in here point me to the right direction. Thanks heaps.

    C# sysadmin csharp windows-admin algorithms tutorial

  • Uninstall a none Microsoft program on a remote machine via WMI
    A AndieDu

    no one had any clue or i just posted in the wrong section of this forum?

    C# sysadmin windows-admin security

  • Uninstall a none Microsoft program on a remote machine via WMI
    A AndieDu

    Dear All, I am scratching my head about 4 hours to get this sorted, but without any luck. what i would like to do is on my windows form, it connects to a remote machine and then display all the programs that installed on a windows server 2003 box on a ListBox, then user can select one of the program, and click the Uninstall button to uninstall the selected program. I am able to load all the programs installed on the remote machines by this code:

    public static ArrayList GetAppLists(string p_machineName)
    {
    RegistryHive hive = RegistryHive.LocalMachine;
    RegistryKey subKey;
    string displayName, displayVersion, keyNameCurrentMachine32;
    ArrayList al = new ArrayList();
    //ArrayList uninstallStrings = new ArrayList();

            keyNameCurrentMachine32 = @"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
            using (RegistryKey regHive = RegistryKey.OpenRemoteBaseKey(hive, p\_machineName))
            {
                using (RegistryKey regKey = regHive.OpenSubKey(keyNameCurrentMachine32))
                {
                    if (regKey != null)
                    {
                        foreach (string k in regKey.GetSubKeyNames())
                        {
                            using (subKey = regKey.OpenSubKey(k))
                            {
                                displayName = subKey.GetValue("DisplayName") as string;
                                displayVersion = subKey.GetValue("DisplayVersion") as string;
                                if (!string.IsNullOrEmpty(displayName))
                                {
                                    al.Add(displayName + " " + displayVersion);
                                }
                            }
                        }
                    }
                }
            }
            return al;
        }
    

    but when i try to uninstall the particular progarm by this code:

    private void UninstallProgram()
    {
    ConnectionOptions connection = new ConnectionOptions();
    connection.Username = txtDomain.Text + "\\" + txtUserName.Text;
    connection.Password = txtPassword.Text;
    connection.Impersonation = ImpersonationLevel.Impersonate;
    connection.Authentication = AuthenticationLevel.Packet;
    connection.EnablePrivileges = true;

            ManagementScope scope = new ManagementScope(@"\\\\" + cbServerAddress
    
    C# sysadmin windows-admin security

  • Deserialise complicated Jason data
    A AndieDu

    right on the spot, Bob, and amazingly, i didnt spot out this subtle thing, thanks heaps anyway.

    C# csharp javascript design json help

  • Deserialise complicated Jason data
    A AndieDu

    Dear all, I have this jason data that ready to be serialised: (Indention added for readability)

    {"Error":"",
    "UserMeasurements":
    [{ "MeasurementName":"BloodPressure",
    "ClinicalDatas":
    [{"Name":"Systolic",
    "Unit":"mmHg ",
    "ClinicalDataPoints":[[1304197968110,149],[1304290213920,145],[1304369712717,159],[1304459900650,160],
    [1304542964530,176],[1304564292340,147],[1304649916767,141],[1304726125653,139],[1304826583873,156],
    [1304880946500,167],[1305069333890,152]]},
    {"Name":"Diastolic",
    "Unit":"mmHg ",
    "ClinicalDataPoints":[[1304197968220,129],[1304290215047,92],[1304369712763,91],[1304459900900,105],
    [1304542965530,83],[1304564292403,103],[1304649916797,81],[1304726125687,133],[1304826584000,85],
    [1304880946547,108],[1305069334890,89]]},
    {"Name":"Mean Blood Pressure",
    "Unit":"mmHg ",
    "ClinicalDataPoints":[]}
    ]
    }
    ]
    }";

    and I have these c# code to deserialised it:

    namespace Json
    {
    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    JavaScriptSerializer js = new JavaScriptSerializer();
    string test = "{\"Error\":\"\",\"UserMeasurements\":[{\"MeasurementName\":\"BloodPressure\",\"ClinicalDatas\":[{\"Name\":\"Systolic\",\"Unit\":\"mmHg \",\"ClinicalDataPoints\":[[1304197968110,149],[1304290213920,145],[1304369712717,159],[1304459900650,160],[1304542964530,176],[1304564292340,147],[1304649916767,141],[1304726125653,139],[1304826583873,156],[1304880946500,167],[1305069333890,152]]},{\"Name\":\"Diastolic\",\"Unit\":\"mmHg \",\"ClinicalDataPoints\":[[1304197968220,129],[1304290215047,92],[1304369712763,91],[1304459900900,105],[1304542965530,83],[1304564292403,103],[1304649916797,81],[1304726125687,133],[1304826584000,85],[1304880946547,108],[1305069334890,89]]},{\"Name\":\"Mean Blood Pressure\",\"Unit\":

    C# csharp javascript design json help

  • Ajax with VS 2005
    A AndieDu

    Hi All, I just come across a pretty weird behaviour on my VS 2005 and Ajax, basically i am having a master page and a content page. This is the front end html code for the master page:

    <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="MasterPage.master.cs" Inherits="WebApplication3.MasterPage" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc" %>
    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>Test Page</title>
    <link href="Stylesheet1.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <form id="form1" runat="server">

    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
    </asp:ContentPlaceHolder>
    <div>    
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
        <%--<cc:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc:ToolkitScriptManager> --%>
        <cc:Accordion ID="Accordion1" runat="server" FadeTransitions="true" SelectedIndex="0" 
                HeaderCssClass="accordionHeader" ContentCssClass="accordionContent">
                    <Panes>
                        <cc:AccordionPane ID="AccordionPane1" runat="server">
                            <Header>Test Pane 1</Header> 
                            <Content>Test pane 1</Content>
                        </cc:AccordionPane> 
                        <cc:AccordionPane ID="AccordionPane2" runat="server">
                            <Header>Test Pane 2</Header> 
                            <Content>Test pane 2</Content>
                        </cc:AccordionPane>
                        <cc:AccordionPane ID="AccordionPane3" runat="server">
                            <Header>Test Pane 3</Header> 
                            <Content>Test pane 3</Content>
                        </cc:AccordionPane>
                    </Panes>
        </cc:Accordion>
    </div>
    </form>
    

    </body>
    </htm

    ASP.NET csharp html css visual-studio design

  • Access the ConfigSection of specified config file
    A AndieDu

    Dear All ConfigurationManager.GetSection("Section1") only retrieve the default app.config's section information and it returns a object that can be casted. Now i have a specified configuration that used by my application. I have loaded the specified configuration file into the memory, please see the below code: this is the specified config file:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <configSections>
    <section name="Section1" type="CortexShell.DisplayModeSectionHandler,CortexShell" />
    </configSections>
    <Section1 DisplayMode="MonitorDisplay" Timeout="300" />
    </configuration>

    this is the c# code:

    Configuration config = ConfigurationManager.OpenExeConfiguration(@"c:\AppState.config");
    ExeConfigurationFileMap map = new ExeConfigurationFileMap();
    map.ExeConfigFilename = path;
    config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
    DisplayModeSection _displayMode = (DisplayModeSection)config.GetSection("Section1");

    Now the config.GetSection("Section1") only returns the specified configuration.ConfigurationSection object, hence when i compile it, this is the exception: Cannot convert type 'System.Configuration.ConfigurationSection' to 'CortexShell.DisplayModeSection', my question is how can i convert System.Configuration.ConfigurationSection to CortexShell.DisplayModeSection (this is my customised config section in the specified config file) Thanks very much

    C# question csharp xml performance announcement

  • .net 2.0 Custom Configuration Sections
    A AndieDu

    It is the issue with my bloody xml file, it should be like this:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <configSections>
    <sectionGroup name="packageVersionSection">
    <section name="packageVersion" type="ConsoleApplication2.Class1, ConsoleApplication2" />
    </sectionGroup>
    </configSections>
    <packageVersionSection>
    <packageVersion>
    <packages>
    <add name="Web Application" version="1.1.2.1" location="C:\Program Files\TeleMedCare\TMSWebApps" />
    <add name="RPU Applications" version="1.1.2.1" location="C:\Program Files\TeleMedCare\TMSWinApps" />
    <add name="Shared Applications" version="1.1.2.0" location="C:\Program Files\TeleMedCare\SharedApp" />
    </packages>
    </packageVersion>
    </packageVersionSection>
    </configuration>

    I just missed the 'packages' element in my previous posting and i should use 'add'. Thanks a lot for ur help anyway.

    C# csharp help visual-studio debugging workspace

  • .net 2.0 Custom Configuration Sections
    A AndieDu

    Dear All, I am trying to create a class to handle my custom config sections in my app.config file, but no matter what i tried, i always get this kind of error: Unrecognized attribute 'name'. Note that attribute names are case-sensitive. (D:\Users\xxx\Documents\Visual Studio 2005\Projects\ConsoleApplication2\ConsoleApplication2\bin\Debug\ConsoleApplication2.vshost.exe.config line 10) I had spent about half days to try to fix this annoy error but without any luck. can someone in here shed me a light will be greatly appreciated. This is my app.config file: and this is my source code: using System; using System.Collections.Generic; using System.Text; using System.Configuration; namespace ConsoleApplication2 { public class Class1: ConfigurationSection { [ConfigurationProperty("package")] public PackageVersionCollection PackageVersionItems { get { return ((PackageVersionCollection)(base["package"])); } } } [ConfigurationCollection(typeof(PackageVersionElement))] public class PackageVersionCollection : ConfigurationElementCollection { protected override ConfigurationElement CreateNewElement() { return new PackageVersionElement(); } protected override object GetElementKey(ConfigurationElement element) { return ((PackageVersionElement)(element)).Name; } public PackageVersionElement this[int idx] { get { return (PackageVersionElement)BaseGet(idx); } } } public class PackageVersionElement : ConfigurationElement { [ConfigurationProperty("name", DefaultValue = "", IsKey = true, IsRequired = true)] pu

    C# csharp help visual-studio debugging workspace

  • how do i know which web controls sent the request.
    A AndieDu

    Thanks very much for your reply, and you did point me in the right direction Here is the trick: Request.Params["__EVENTTARGET"].contains("xx"); xx is the control name (it's obficates, but still humna readable, such as: ctl00$AccordionMenu1$ctl15$clb0). the "AccordionMenu1" is the name of a user control, but u can but the other controls too, e.g. link button etc.

    ASP.NET database question

  • how do i know which web controls sent the request.
    A AndieDu

    Hi All, Is there a way to do this: if a request is from a manual item, then re-fetch the data from database, and if a request is from the other web controls, say link button, then do not re-fetch data from database. Thanks very much.

    ASP.NET database question

  • Asp.net Cross Page Post Back issue
    A AndieDu

    Thanks a lot mate, your post does help me and to help the others further, this is the code (in c#) that does the trick: if (Request.ServerVariables["HTTP_REFERER"].EndsWith("xxx.aspx"))

    ASP.NET help question csharp asp-net

  • Asp.net Cross Page Post Back issue
    A AndieDu

    Dear All, I have two web pages, say SourceWebPage and TargetWebPage, on the TargetWebpage I have a directive like: <%@ PreviousPageType VirtualPath = "~/SourceWebPage.aspx" %> These are the code behand on TargetWebPage Page_Load Event: if (!Page.IsPostBack) { if (Page.PreviousPage != null && Page.PreviousPage.IsCrossPagePostBack) { DateTime reportDate = PreviousPage.DTReportDate; string serialNo = PreviousPage.SerialNo; } else { LoadReportType(); odsSyncSummaryReport.FilterExpression = GetObjDSFillerExpression(); gvSyncSummaryReport.DataSourceID = "odsSyncSummaryReport"; gvSyncSummaryReport.DataBind(); } } else { odsSyncSummaryReport.FilterExpression = GetObjDSFillerExpression(); } there is a link button on SourceWebPage like this: OnClick = "lbSerialNo_Click" PostBackUrl = "~/TargetWebPage.aspx". Both pages are able to be accessed by click on the menu, when I go to SourceWebPage first and then click the link button, it posts back to the TargetWebPage and everything works fine. But the problem is when i go to the TargetWebPage first, it throws an exception. I think i know the problem because the PreviousPage property (SourceWebPage) hasn't been loaded yet, therefor there is no way that the TargetWebPage to get the value from SourceWebPage. What i want to know in here is how do I know whether the TargetWebPage is posted from SourceWebPage or it is posted from Menu. This piece of code doesn't help me at all: if (Page.PreviousPage != null && Page.PreviousPage.IsCrossPagePostBack) I was googling for hours but without any luck, can someone in here shed me a light? Thanks

    ASP.NET help question csharp asp-net

  • asp.net accross different domains.
    A AndieDu

    Hi All, i deployed my asp.net application into IIS, and if i run it in that server, say in Domain 1 , it works perfectly, but when i run that asp.net application from another machine, which is in the different domain, say in Domain 2, i got this error: Could not find a part of the path Domain 1\ITManagement\WarehouseData\Current. The senario in here is that a machine in Domain 1 browse into an asp.net application on a server in Domain 2, and then the asp.net application on domain 2 tries to access a shared network driver on Domain 1. i spent quite a few times to google it but without any luck, can someone in here help me plz

    ASP.NET sysadmin help csharp asp-net windows-admin

  • Select * from @TableName
    A AndieDu

    Thanks All for your help, and i will find an alternative way to do it then.

    Database database sql-server sysadmin help question

  • Select * from @TableName
    A AndieDu

    Mate, first of all, thanks for your reply, but if i can go the way that you mentioned, i wouldn't jump on internet, coz be realistic, a perfect database is a db that has no table. Hope you got my drift.

    Database database sql-server sysadmin help question

  • Select * from @TableName
    A AndieDu

    Thank very much, i knew the one that you mentioned, but this way is not what i want, coz it is not feasible for me since i have a very long select statement.

    Database database sql-server sysadmin help question

  • Select * from @TableName
    A AndieDu

    Declare @idOrder as nvarchar(10) set @idOrder = '144' Declare @sInvoice as nvarchar(50) set @sInvoice = 'UK_B_IN000051' Declare @DateRange as nvarchar(100) set @DateRange = '28Jul2010' Declare @Country as nvarchar(10) set @Country = substring(@sInvoice, 1, 2) Declare @TableName as nvarchar(500) set @TableName = 'splashdb..Comersus_' + @Country + '_Orders_' + @DateRange what i want is: select * from @TableName, but sql server returns me error. If someone in here can shed me a light would be really appreciated, or there is an alternative way to achieve the same goal?

    Database database sql-server sysadmin help question

  • Display message on asp label by using Javascript.
    A AndieDu

    Hi All, I am having an asp:label and an asp:Button at front end. what I would like to do is when user clicks the button on the web form, then the label displays some message, such as: "the file is loading, please wait". I know i need to use JavaScript to achieve this, but not quite sure how to do it. I would appreciate someone in here can help me. Thanks very much.

    ASP.NET javascript 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