User Profile

Collapse

Profile Sidebar

Collapse
dschu012
dschu012
Last Activity: Sep 7 '11, 11:31 PM
Joined: Jul 10 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Thanks. I got what I needed by adding
    Code:
    (\s+\d{5})?
    to the end. Previously I had the ? inside the parenthesis with was causing the regex to come back with nothing if there were no spaces after the state.
    See more | Go to post

    Leave a comment:


  • How to match zipcode for simple address matching regex?

    I am trying to make a regex to match simple addresses like

    123 Main Street
    Simpleville, VA 12345

    I have little experience with regex's and through reading and lots of messing around I have come up with.

    Code:
    /(\d{1,5}).*\b(A[LKSZRAP]|C[AOT]|D[EC]|F[LM]|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEHINOPST]|N[CDEHJMVY]|O[HKR]|P[ARW]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])\b/gm
    While this can...
    See more | Go to post

  • dschu012
    replied to parse http header
    in C
    @Oralloy
    I was using a small http client sample code. In the sample they were just ignoring the header data and going straight to the \r\n\r\n to get the response data. I am only doing GETs and one of the URLs has a redirect which is why I needed the header data.

    @johny10151981
    It was only an example not real data and I am only doing GETs. Your suggestion doesn't help for multi line values.

    Thanks for referring...
    See more | Go to post

    Leave a comment:


  • dschu012
    started a topic parse http header
    in C

    parse http header

    I am having trouble figuring out how to parse a http header into a map<string,stri ng>
    Code:
    POST /blah HTTP/1.1
    Host: example.com
    Accept-Language: en-us,en;q=0.5
    Accept-Encoding: gzip,deflate
    Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Content-Type: application/x-www-form-urlencoded
    Content-Length: 25
    My idea was to find the first index of ':' on each line and use the text before...
    See more | Go to post

  • dschu012
    replied to Should I use an Enum or a List?
    I can't really say if something is the "best" way. I would use an xml file to store the data but since you don't want to have extra files, why not just do something like this.
    Code:
    string mapFromId(int id)
    {
    switch(id)
    {
    case 30:
    return "Last Resort";
    default:
    return "Invalid Map";
    }
    }
    If you want to do it in another class sure go ahead, but I...
    See more | Go to post

    Leave a comment:


  • Code:
    <xsl:value-of select="substring-before(substring-after(TAXNAME,'CST '),'%')"/>
    ...
    See more | Go to post

    Leave a comment:


  • dschu012
    replied to Should I use an Enum or a List?
    To me it sounds like a dictionary is what you want.
    Code:
    Dictionary<int, string> data = new Dictionary<int, string>();
    data.Add(30, "The string for 30");
    string value = data[30];   //gets the string associated with the key 30. in this case "The string for 30"
    See more | Go to post

    Leave a comment:


  • dschu012
    replied to Why does this hang? (zlib.net)
    Well I just decided to use DotNetZip's Zlib library and everything worked perfectly. Used all of the same code just changing the ZOutput stream to the DotNetZip's implementation. Thanks for trying to help.
    See more | Go to post

    Leave a comment:


  • dschu012
    replied to Why does this hang? (zlib.net)
    Can't edit the last post. But more investigation made me notice something. The output streams read only methods CanWrite, CanRead, and CanSeek are all false. When on the input stream they are all true. The streams are created like so
    Code:
    System.IO.FileStream outFileStream = new System.IO.FileStream(outFile, System.IO.FileMode.Create);
    zlib.ZOutputStream outZStream = new zlib.ZOutputStream(outFileStream);
    System.IO.FileStream
    ...
    See more | Go to post

    Leave a comment:


  • dschu012
    replied to Why does this hang? (zlib.net)
    How can I tell? I looked at the file with a hex editor and there were a bunch of null bytes (about 20 0x00 bytes) at the end.

    When compressing the files it doesn't hang at all and calls the same function.
    See more | Go to post

    Leave a comment:


  • dschu012
    started a topic Why does this hang? (zlib.net)

    Why does this hang? (zlib.net)

    I am using the ZLIB.NET library and trying to decompress a file. I am using the sample code that they provided.
    Code:
    public static void CopyStream(System.IO.Stream input, System.IO.Stream output)
    {
       byte[] buffer = new byte[2000];
       int len;
       while ((len = input.Read(buffer, 0, 2000)) > 0)
       {
            output.Write(buffer, 0, len);    //it hangs here on the last write
        }
    ...
    See more | Go to post

  • dschu012
    replied to Split string into a char array
    in C
    Nvm found the article. And when you say don't use any see functions does that mean use don't use anything like atoi() or strtol() like the first guy suggested. And ya Banfa I meant data on that one line.
    See more | Go to post

    Leave a comment:


  • dschu012
    started a topic Split string into a char array
    in C

    Split string into a char array

    Ignore the title it isn't exactly what I meant, and after reading it the title sounds kinda stupid.

    I have an list of numbers as an ascii string that I need to split by a token and store the result in an array of chars. However I want the value of the char to be the number the ascii text represents. i.e. if the text within the tokens is '240' I want the value of the char to be 0xf0. The main problem is I don't know how to split the strings...
    See more | Go to post

  • dschu012
    replied to Help with Webclient
    in .NET
    No. But I figured it out. The API tells me to use

    http://www.lyrdb.com/lookup.php?q=qu...ld&agent=agent

    which seems to redirect me to

    http://webservices.lyrdb.com/lookup....ld&agent=agent

    changing the WebClient to use the site I get redirected to fixed the problem....
    See more | Go to post

    Leave a comment:


  • dschu012
    started a topic Help with Webclient
    in .NET

    Help with Webclient

    I am trying to use someones web service to obtain lyrics for songs. I am able to use the web service via Firefox, however when I use a Webclient I do obtain the same results. An example URL of the service is

    http://webservices.lyr db.com/lookup.php?q=Ae rosmith|Love%20 In%20An%20Eleva tor&for=match&a gent=test/1.0


    However if I do

    Code:
                    using (WebClient wc = new WebClient())
    ...
    See more | Go to post

  • dschu012
    started a topic Set Textbox to string reference

    Set Textbox to string reference

    I want to be able to set a Textbox to a reference of a string so when the Textbox is changed so is the value of the string. I want to do this without using the TextChanged event. I have a class that contains many strings and want to be able to change the values of the strings in the class, for later use, using Textboxes.
    See more | Go to post

  • dschu012
    started a topic WebRequest using WebBrowser cookie C#
    in .NET

    WebRequest using WebBrowser cookie C#

    I am logging into a site using a WebBrowser. Once I log in I want to save an Image from within it without having to make the WebBrowser navigate to the URL where the Image is stored. Currently I am doing this
    Code:
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(myUri);
    request.Headers.Add(HttpRequestHeader.Cookie, webBrowser1.Document.Cookie);
    WebResponse response = request.GetResponse();
    Image captchaImage
    ...
    See more | Go to post

  • dschu012
    started a topic Multiple Webbrowsers and Cookies
    in .NET

    Multiple Webbrowsers and Cookies

    If I have multiple WebBrowser controls and want to log onto the same site on multiple accounts is this possible? Right now I create a WebBrowser control in one form and log onto a site. Then I create another WebBrowser control in another form and I am already logged on and have to sign off the other account in order to log onto a new one. How can I log onto multiple accounts at the same time?
    See more | Go to post

  • dschu012
    replied to C# Send Mouseclick to Window
    So apparently the coordinates that you supply in PostMessage() are with respect to the hWnd that you also supply. I just was supplying bad coordinates for the click because of a typo.
    See more | Go to post

    Leave a comment:


  • dschu012
    started a topic C# Send Mouseclick to Window

    C# Send Mouseclick to Window

    Is there a way to send mouseclick to an inactive window? My guess would be to use the Win32 API function PostMessge(). I tried to do this and it seems like that it may be sending the mouse click but I think the coordinates are with respect to the top left of the desktop and not the top left of the hWnd that I send as a parameter.
    See more | Go to post
No activity results to display
Show More
Working...