Click here to Skip to main content
       

C#

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralRe: Code does not appear to be called when program is runmemberbikerben12 Dec '12 - 1:23 
Thank you very much for this, I misunderstood how the code was processed. I was under the impression that static Methods would be processed in order one after another... I now know this is wrong.
 
Thank you for helping me out, I feel like I've taken another small step (probably a very smal baby step) in learning C#.
GeneralRe: Code does not appear to be called when program is runprotectorPete O'Hanlon12 Dec '12 - 2:25 
I'm glad I could help, and good luck with your C# journey.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

SuggestionRe: Code does not appear to be called when program is runmvpRichard MacCutchan12 Dec '12 - 3:07 
You may find .NET Book Zero, by Charles Petzold[^] well worth reading.
One of these days I'm going to think of a really clever signature.

GeneralRe: Code does not appear to be called when program is runmemberbikerben12 Dec '12 - 3:12 
Thank you Richard, I shall have a google for it. By the way I'm loving the creative signature Smile | :)
GeneralRe: Code does not appear to be called when program is runmemberAlan N12 Dec '12 - 3:07 
Pete O'Hanlon wrote:
Finally, Main should be public, not private.

You'd have thought that, but the entry point is special and will still be found even when hidden away inside a private nested class:
class Program {
  private class NestedClass {
    private static void Main() {
      Console.WriteLine("Hello");
      Console.ReadLine();
    }
  }
}
Alan.
QuestionTFS and WIXmemberPascal Ganaye11 Dec '12 - 22:33 
I have a nice set of C# solutions on my machine.
Solution A and B compiles a few exe and dll.
Solution C generates a couple of MSI with WIX (it gets it files from the output of the two other solutions).
 
It work well on my machine.
When I try to compile it with a TFS Build Server though things differ.
 
1 - all the exe and dll are going to a single folder
2 - as the files are not compiled in the same places wix cannot find the exe and libraries.
 
I can think of a few ways to fix this, but I can't help but wonder, what did I do wrong?
QuestionCanny edge detection in c#memberneha198711 Dec '12 - 22:11 
i want to know what is Gaussian blur of image how to do this.I am working on canny edge detection where i want to use Gaussian mask but i don't know mathematics behind it.
AnswerRe: Canny edge detection in c#memberSimon_Whale11 Dec '12 - 22:23 
There is a good amount of hits on Google for Gaussian Mask[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

AnswerRe: Canny edge detection in c#protectorPete O'Hanlon11 Dec '12 - 22:34 
Try this article[^].

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

QuestionWCF Services in a multi threaded application results in Oracle Connection request Timed out errormemberrajaron11 Dec '12 - 21:56 
I am using WCF services with Thread Pool concepts in the application using Oracle Database. The application has a Scheduling Workflow, where there will be multiple Jobs scheduled at the same time. The expected behavior is that, once the scheduler is triggered, all the jobs should be started parallel and at the background, various process are run.

All the jobs are not started in parallel. Say for example, if there are 20 jobs scheduled, only 15 are getting started and remaining are struck.

It results in Oracle Connection request timed out error.

Options Tried:

As the application uses PerSession and Concurrency mode as Multiple. The binding is netTCPBinding. Tried this could have been a WCF Throttling issues. So modified the Throttling parameters as well. But still results in Oracle error.

Any help would be appreciated.
AnswerRe: WCF Services in a multi threaded application results in Oracle Connection request Timed out errormemberEddy Vluggen12 Dec '12 - 3:05 
rajaron wrote:
Say for example, if there are 20 jobs scheduled, only 15 are getting started and remaining are struck.



It results in Oracle Connection request timed out error.

That means that 20 connections are reading from the same tables? Or are they also writing to those tables?
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
They hate us for our freedom![^]

GeneralRunning code as different usermemberMacUseless11 Dec '12 - 21:35 
Hello,
 
I'm working on a small project wich requires me to run some code as a different users , (not the windows users)
I.e. user starts the program and he/she is required to login first, then there allowed to run a piece of code.
 
My login code looks like this :
        //user authenticate
        private bool Authenticate(string userName, string password, string domain = null)
        {
            bool authentic = false;
            try
            {
                using (PrincipalContext context = new PrincipalContext(ContextType.Domain))
                {
                    authentic = context.ValidateCredentials(userName, password);
                }
            }
            catch (DirectoryServicesCOMException) { }
            return authentic;
        }
Wich works,
But i cannot execute the rest of my code.
I've tried to use Impersonation Class but it results in an "Catasthropic failure"
The code blow is how i use the impersonation,
it happends after a button_click event
                using (new Impersonator(txtGebruiker.Text, txtDomein.Text, txtPw.Text))
                {
                    string profile = GetProfilePath(txtProfiel.Text);
                    txtLog.Text = profile;
                }
 
I think im using the impersonation wrong ,
Any tips or suggestions are welcome Smile | :)
 
Thanks in advance
SuggestionRe: Running code as different usermemberRichard Deeming12 Dec '12 - 1:51 
If you have a problem using the code in an article, it's usually best to post the question to the message board at the end of the article[^], since the author of the article is the best person to help you.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


AnswerRe: Running code as different usermemberEddy Vluggen12 Dec '12 - 3:31 
From your code that's posted with the question on the article;
string profile = dirEntr.Properties["profilePath"][0].ToString(); //terug komende nullreference, 
                                                                  // lokaal geen probleem op server wel
dirEntr.Close();// this part returns catastrophic failure
If the first line throws an exception, it'd be logical for the second line to fail. The first line contains multiple statements, which I'd prefer to see split over several lines (to accommodate debugging), like this;
object profilePath = dirEntr.Properties["profilePath"];
string profile = Convert.ToString(profilePath[0]); // geen nullreference meer
                                                   // al kan de string nog steeds leeg zijn.
It might be that the property "ProfilePath" doesn't return a value; you'd put a breakpoint there and step through it. As a sidenote, you did see the warning in the article?
Please note: The user context that initiates the impersonation (i.e. not the user context to which it is switched to) needs to have the "Act as part of operating system" privilege set.

Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]
They hate us for our freedom![^]

QuestionHTML TO XML Convertion using C# [modified]memberchittu dinesh11 Dec '12 - 20:29 
Hi,
 
Please anybody knows how to convet the html file into XML file using C#. I need to convert whole html file into XML file.
 
Thanks...

modified 12 Dec '12 - 3:18.

AnswerRe: HTML TO XML Convertion using C#protectorPete O'Hanlon11 Dec '12 - 20:41 
chittu dinesh wrote:
Please anybody knows how to convet the html file into XML file using C#.

Yes I do.
 
chittu dinesh wrote:
Its urgent.

I couldn't care less. It's not urgent to me. Never use it's urgent in a forum posting - we don't work for you so your sense of urgency is completely irrelevant.
 
The solution you are looking for is to use the HTML Agility Pack[^]. Bear in mind, though, that an HTML page may be so badly formed that it cannot be represented as XML.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

GeneralRe: HTML TO XML Convertion using C#memberchittu dinesh11 Dec '12 - 22:41 
Hi,
 
Thanks. Laugh | :laugh:
AnswerRe: HTML TO XML Convertion using C#memberBobJanova12 Dec '12 - 4:25 
If it's valid XHTML, then it's already XML. If you mean translate it to a particular schema, you can do that with XSLT.
 
If it's typical Internet HTML, then it isn't valid XML, and you will have to construct some sort of state-based reader that makes reasonable guesses about what non-XML markup actually means (i.e. unclosed <li>s and <p>s, unmatched chevrons, tags with naked attributes, etc).
QuestionFor Developinf Login Application for windowsmemberMember 913168411 Dec '12 - 20:02 
Any one can help me,and tell that how i create a windows login application,and run this login application when computer start like windows logon screen,,and i want to replace this windows logon application with my own,,plz help Frown | :( Frown | :(
Vipul

AnswerRe: For Developinf Login Application for windowsprotectorPete O'Hanlon11 Dec '12 - 20:54 
Sure, join Microsoft and join the Windows team. Maybe then.
 
You can't replace the Windows Login screen - it would represent a huge security hole if you could replace it with a fake login. Just think about it for a moment and you'll see why it's not possible.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

AnswerRe: For Developinf Login Application for windowsmemberRichard Deeming12 Dec '12 - 1:48 
For Windows XP and earlier, you can use C++ to write a custom GINA module:
http://msdn.microsoft.com/en-gb/library/windows/desktop/aa380543%28v=vs.85%29.aspx[^]
 
For Windows Vista or later, this has been replaced with the credential provider model:
http://msdn.microsoft.com/en-us/magazine/cc163489.aspx[^]
 
You're unlikely to have much luck working with either of these from C#! Smile | :)



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


Questionstoring image in isolated storagemembersingh123456711 Dec '12 - 18:39 
I am working on windows mobile application in which i need to store a captured image from the camera in isolated storage without saving it in the camera roll.
I am able to store the captured image in the isolated storage but a copy of the captured image in also stored in the camera roll that i don't want ...please help
QuestionHow to print an SSRS Report in PDF Format from my asp.net pagememberVinay Meka11 Dec '12 - 18:04 
Hi guys.,
I had an grid view where i had placed an link button to print an report.In this button click event i need to call the SSRS report and need to get the output as pdf file.
I had used this below code,the code is running fine,but i'm unable to see the prompt to open/save pdf file.Plz reply ASAP.

 
protected void btnAuthenticateAndPrint_Click(object sender, EventArgs args)
    {
        try
        {
            
            //Getting Values from grid
            LinkButton lb = (LinkButton)sender;
            GridViewRow row = (GridViewRow)lb.NamingContainer;
            Label lbOrderID = row.FindControl("lbOrderID") as Label;
            int OrderId = Convert.ToInt32(lbOrderID.Text);
            da = new SqlDataAdapter("Get_PODetails", con);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.AddWithValue("@MPDI_ID", OrderId);
            ds = new DataSet();
            da.Fill(ds, "PO");
            if (ds.Tables["PO"].Rows.Count > 0)
            {
                lblPOId.Text=ds.Tables["PO"].Rows[0]["MPDI_ID"].ToString();
                lblVendid.Text = ds.Tables["PO"].Rows[0]["MVDI_ID"].ToString();
                lblBranch.Text = ds.Tables["PO"].Rows[0]["MBRI_ID"].ToString();
                lblDate.Text = Convert.ToDateTime(ds.Tables["PO"].Rows[0]["MPDI_Date"]).ToString("dd-MM-yyyy");
            }
 
            //SSRS Report Print
            rs = new RSWebService.ReportingService2005();
            rsExec = new REWebService.ReportExecutionService();
            rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
            rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;
            rs.Url = "http://localhost/ReportServer/ReportService2005.asmx";
            rsExec.Url = "http://localhost/ReportServer/ReportExecution2005.asmx";
            byte[] Sendresults = null;
            byte[] bytes = null;
            string historyID = null;
            string deviceInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
            string format = "PDF";
            string encoding = null;
            string mimeType = null;
            string extension = null;
            REWebService.Warning[] warnings = null;
            string[] streamIDs = null;
            string _reportName = @"/FIMO GOF Assets Reports/PURCHASE ORDER";
            REWebService.ExecutionInfo ei = rsExec.LoadReport(_reportName, historyID);
            REWebService.ParameterValue[] parameters = new REWebService.ParameterValue[4];
            parameters[0] = new REWebService.ParameterValue();
            parameters[0].Name = "MVDI_ID";
            parameters[0].Value = lblVendid.Text;
            parameters[1] = new REWebService.ParameterValue();
            parameters[1].Name = "MBRI_ID";
            parameters[1].Value = lblBranch.Text;
            parameters[2] = new REWebService.ParameterValue();
            parameters[2].Name = "MPDI_Date";
            parameters[2].Value = lblDate.Text;
            parameters[3] = new REWebService.ParameterValue();
            parameters[3].Name = "ReportParameter1";
            parameters[3].Value = lblPOId.Text;
            rsExec.SetExecutionParameters(parameters, "en-us");
            Sendresults = rsExec.Render(format, deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);
            MemoryStream ms = new MemoryStream(Sendresults);
 
 
            //To create a PDF
if (format == "PDF")
            {
                Response.ContentType = "application/pdf";
                Response.AddHeader("Content-disposition", "inline;filename=output.pdf");
                Response.AddHeader("Content-Length", Sendresults.Length.ToString());
            }
            Response.OutputStream.Write(Sendresults, 0, Sendresults.Length);
            Response.OutputStream.Flush();
            Response.OutputStream.Close();
 
        }
        catch(Exception Ex)
        {
            throw Ex;
        }
    }

AnswerRe: How to print an SSRS Report in PDF Format from my asp.net pagememberRichard Deeming12 Dec '12 - 1:42 
Vinay Meka wrote:
Response.AddHeader("Content-disposition", "inline;filename=output.pdf");

There's the problem - if you want the user to open or save the file, you need a Content-Disposition of attachment;filename=output.pdf instead.
 
http://en.wikipedia.org/wiki/MIME#Content-Disposition[^]
How To Raise a "File Download" Dialog Box for a Known MIME Type[^]
http://www.hanselman.com/blog/TheContentDispositionSagaControllingTheSuggestedFileNameInTheBrowsersSaveAsDialog.aspx[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


Questionadd labels to an image at different zoom levelsmembervr99999999911 Dec '12 - 18:03 
I want to add labels to an image at different zoom levels like the one on google maps please give me some ideas.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 25 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid