URL Shortner DLL! (Over 25 sites)

Results 1 to 10 of 10
  1. #1
    Proficient Member MoBaTeY is offline
    MemberRank
    Jul 2008 Join Date
    169Posts

    URL Shortner DLL! (Over 25 sites)

    I created a dll which you can add to your .net project that allow you to shorten links for over 25 websites.








    Download:
    URLshorten.rar


  2. #2
    Software Person TimeBomb is offline
    ModeratorRank
    May 2008 Join Date
    United StatesLocation
    1,252Posts

    Re: URL Shortner DLL! (Over 25 sites)

    Do you really need to use Bitly's DLL to shorten the URL when you are shortening everything else through RuntimeHelpers.GetObjectValue(http.GetResponse....?

    It seems like a waste to require a second DLL and use it in your DLL just for one out of 25 url shorter sites.

    Other than that... why are you casting the shortened URLs, which are strings, to objects? I don't see this as necessary whatsoever; in fact, I just see it as an odd nuisance.


    Other than that, good job ;).

  3. #3
    RaGEZONER habib10 is offline
    MemberRank
    Nov 2009 Join Date
    AnywereLocation
    778Posts

    Re: URL Shortner DLL! (Over 25 sites)

    mmaybe a demo?

  4. #4
    Proficient Member MoBaTeY is offline
    MemberRank
    Jul 2008 Join Date
    169Posts

    Re: URL Shortner DLL! (Over 25 sites)

    Quote Originally Posted by timebomb View Post
    Do you really need to use Bitly's DLL to shorten the URL when you are shortening everything else through RuntimeHelpers.GetObjectValue(http.GetResponse....?

    It seems like a waste to require a second DLL and use it in your DLL just for one out of 25 url shorter sites.

    Other than that... why are you casting the shortened URLs, which are strings, to objects? I don't see this as necessary whatsoever; in fact, I just see it as an odd nuisance.


    Other than that, good job ;).
    I'm not using "RuntimeHelpers.GetObjectValue(http.GetResponse....".

  5. #5
    Software Person TimeBomb is offline
    ModeratorRank
    May 2008 Join Date
    United StatesLocation
    1,252Posts

    Re: URL Shortner DLL! (Over 25 sites)

    Quote Originally Posted by MoBaTeY View Post
    I'm not using "RuntimeHelpers.GetObjectValue(http.GetResponse....".
    Most of your shortening functions functions are very similar to
    Code:
        public object idgd(string url)
        {
          URLshorten.Utility.Http http = this.http;
          object objectValue = RuntimeHelpers.GetObjectValue(http.GetResponse("http://is.gd/create.php?format=simple&url=" + url, "", (List<DictionaryEntry>) null));
          return (object) http.ProcessResponse((HttpWebResponse) objectValue, false);
        }
    So my previous statements stand ;).

  6. #6
    Proficient Member MoBaTeY is offline
    MemberRank
    Jul 2008 Join Date
    169Posts

    Re: URL Shortner DLL! (Over 25 sites)

    Quote Originally Posted by timebomb View Post
    Most of your shortening functions functions are very similar to
    Code:
        public object idgd(string url)
        {
          URLshorten.Utility.Http http = this.http;
          object objectValue = RuntimeHelpers.GetObjectValue(http.GetResponse("http://is.gd/create.php?format=simple&url=" + url, "", (List<DictionaryEntry>) null));
          return (object) http.ProcessResponse((HttpWebResponse) objectValue, false);
        }
    So my previous statements stand ;).
    Nope. Completely off. Also there's more to it than that.

  7. #7
    Software Person TimeBomb is offline
    ModeratorRank
    May 2008 Join Date
    United StatesLocation
    1,252Posts

    Re: URL Shortner DLL! (Over 25 sites)

    Quote Originally Posted by MoBaTeY View Post
    Nope. Completely off. Also there's more to it than that.
    Ah, sorry about that, the reflector that I was using must have been doing a poor job.

    Nonetheless, it looked like you created a massive custom Http class? If not, than once again, I apologize for the shitty reflector.

    What you have done can be done a bit simpler, by grabbing the HTML data and then using a function to strip the HTML from the returned data, which will then only return the text(the shortened URL).

    The function to strip HTML tags [from the web data]:
    [C#] private string StripHTML(string source) { try - Pastebin.com

    With the above function, you can just use a few lines to get the shortened URL (if the website allows for data access similar to is.gd):
    Code:
            public string idgd(string url)
            {
                HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http://is.gd/create.php?format=simple&url=" + url);
                string html = (new StreamReader(wr.GetResponse().GetResponseStream())).ReadToEnd();
                return StripHTML(html);
            }
    Once again, because of the seemingly inaccuracy of the reflector I used, I don't know if much of anything that it was showing me was even remotely what is actually there, so I don't know if this method I am showing you now is simpler or not.

    Best of luck.

    P.S. The code in this post is C#
    P.S.S. The StripHTML function and the few lines to get HTML data were gotten through google.

  8. #8
    Fuck. SheenBR is offline
    ModeratorRank
    Feb 2008 Join Date
    Jaú, BrazilLocation
    2,433Posts

    Re: URL Shortner DLL! (Over 25 sites)

    why cant you just leave him alone? If you didnt like it, then just dont post anything.

  9. #9
    Banned Yamachi is offline
    BannedRank
    Oct 2006 Join Date
    Jolly EnglandLocation
    3,517Posts

    Re: URL Shortner DLL! (Over 25 sites)

    Quote Originally Posted by SheenBR View Post
    why cant you just leave him alone? If you didnt like it, then just dont post anything.
    Shut up, Sheen -.- He's trying to help him. Constructive criticism is good.

  10. #10
    Software Person TimeBomb is offline
    ModeratorRank
    May 2008 Join Date
    United StatesLocation
    1,252Posts

    Re: URL Shortner DLL! (Over 25 sites)

    Quote Originally Posted by SheenBR View Post
    why cant you just leave him alone? If you didnt like it, then just dont post anything.
    Hi Sheen; as Yamachi said, I do my very best to not post anything out of spite - especially in the coders' paradise section. Whether my replies be short or long, I do my best to make sure they have a clear and hopefully helpful point, so that the other user[s] can improve their current code.

    I may have a passion for programming, but I also have a huge passion for teaching others how to program, and how to improve their programming skills. I help because I hope that (at least some of the people that I help) someone will then perhaps help others, and teach others what they have learned.

    At the same time, I take any constructive criticism or suggestions people give me to heart, and I do my best to improve my current skills.

    I believe that constructive criticism heavily contributes towards bettering anything that you do, whether it be coding or painting or cooking or whatever it may be that someone does.



Advertisement