ingig.net

Ideas, problems and development of Fronturs websites

Google search results

clock April 22, 2008 21:18 by author ingig
Does anyone else feel like the google search results aren't the same quality as it used to be. Just a feeling, it's been really difficult to find stuff lately.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


List of usefull asp.net stuff

clock April 18, 2008 12:04 by author ingig

I have to say that aspdotnetfaq.com is pretty cool page, reminds of javascript.faqts.com which is also a great page

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Remove item from Response Header

clock April 17, 2008 12:16 by author ingig

Every time somebody requests a item from our webserver it inserts a litle info about itself into the response header

Server:Microsoft-IIS/6.0

I've been wondering how to remove this since I think it pretty pointless

You need to create a httpmodule, 

public class WebsiteDomainModule : IHttpModule {
    // IHttpModule members
    public void Init(HttpApplication httpApp) {
        httpApp.PreSendRequestHeaders += new EventHandler(this.OnPreSendRequestHeaders); 
    }

    public void Dispose() {
        // Usually, nothing has to happen here...
    }
    public void OnPreSendRequestHeaders(object sender, EventArgs e) {
        HttpContext.Current.Response.Headers.Remove("Server");
    }
}

Just add a reference into you web.config file and that line is gone.

By removing that line we save about 25 MB of traffic data every day, about 3GB a month. Not bad.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


IHttpModule bara fyrir .net kóða

clock April 16, 2008 12:31 by author ingig

Ég var að vinna í HttpModule sem við erum með og var að logga niður hvaða síður voru að keyra hann. Þegar ég skoðaði listann þá sá ég þetta venjulega

  • /default.aspx
  • /js/default.js.aspx
  • /images/logo.jpg
  • /css/design.css
  • .... fleiri static skrár

Það sem er verra við þetta er að þarna er static skrár að keyra í gegnum module-inn og þar þarf ekki í þessum module. Í IIS 7 er hægt að segja að það eigi bara managed síður að keyra module-inn. Það er ósköp einfallt, bætir einfaldlega  preCondition="managedHandler" við þar sem þú setur module-inn inní web.config hjá þér.

<system.webServer>
    <modules>       
        <add name="WebsiteDomainModule" type="Frontur.WebsiteDomainModule,  frontur" preCondition="managedHandler" />
    </modules>
</system.webServer>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Eve Online clientin orðin open source

clock April 14, 2008 23:26 by author ingig

Slashdot var að segja frá þessu. Clientinn er ekki alveg orðin open source en honum var lekið inná thepiratebay.org. Nokkuð magnað. Væri ekki bara tilvalið að gera clientinn þá bara að open source, hann er hvortið er þarna úti núna og það kannski auðveldar vinnuna. Bara hugdetta.

Ef þú ert Eve-Online notandi, þá er best að halda sig frá torrentinum. CCP menn eru víst að monitora allar iptölur sem tengjast honum og loka á þá accounta sem iptalan tengist. Kannski komin tími að heimsækja foreldrana :)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Næsta skref í vefþjónustukerfinu hjá okkur

clock April 14, 2008 18:14 by author ingig

Ég hef verið að skoða WCF undanfarið þar sem það er víst það sem tók við af WSE. Þetta er nokkuð sniðugt og mjög sveigjanlegt en það tekur slatta tíma að komast inní þetta. Það eru mörg vandamál sem koma upp sem ég fer í seinna en núna er ég að vinna í því að endursmíða API kerfið hjá okkur. Það verður í SOAP, REST og JSON formi. 

Á næstu dögum ætlum við (hjá Fronti) að setju upp smá samkeppni þar sem viljum fá eins marga til að búa til forrit sem notar vefþjónusturnar okkar, hvort sem er með vefsíðu, síma eða gluggaforrit. Við munum bjóða uppá flotta vinninga fyrir bestu forritin og væntanlega auglýsa þetta í einhverjum skólanum, jafnvel í mínum gamla skóla HR.

Ég skelli svo inn slóðinni hérna inn þar sem verður hægt að fá upplýsingar hvernig hægt er að taka þátt og skrá sig.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Augnaleikur og Binary klukkua

clock April 11, 2008 13:17 by author ingig

Undarlegt hvernig augun á manni virkar þegar maður horfir á punktinn í þessari mynd í 30 sekúndur og færir svo músina yfir hana

Svo er eitthvað fyrir nördinn í manni, Binary klukka

http://www.scottklarr.com/topic/30/binary-clock---free-javascript/

Það er hægt að fá svona armbandsúr á gadgets.dk. Þetta er búð í Århus, svona 40 fm2 en einhvernvegin náði ég að eyða rúmri klukkustund af ævi minni þar og hvert skipti sem ég fór hring um hana fann ég eitthvað nýtt.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Upper the first letter - Util

clock April 10, 2008 16:36 by author ingig

Another simple one. This makes sure that the first letter in a text is uppercase

public static string UpperFirstLetter(string str) {
    return str.Substring(0, 1).ToUpper() + str.Substring(1, str.Length-1);
}

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Mario in Javascript

clock April 9, 2008 12:53 by author ingig

It's amazing what they can do with javascript today. Check out Mario written in javascript. In one 14kb file

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


When session expires - Util

clock April 8, 2008 16:02 by author ingig

I use this code to insert into form when there is the possibility that a session will expires, e.g. when users are writing a weblog. When the session expires the user is logged out and there is the possiblity that he'll lose all the text he has written.

So in the form where the user is writing his text I add this this the form

<%= Util.GetIdentityInput(pid) %>

This will give me a hidden input box, with his identity encrypted(pid == person Id), so if the session has expired I can retrieve what user id he was using and log him back in.

The code is pretty simple, after the encryption I need to replace any " with &quote; since this is an input box and " are not allowed. The UrlEncode is simply for browser compatability.

public static string GetIdentityInput(int pid) {
    return "<input name=\"EventAccess\" value=\"" + HttpContext.Current.Server.UrlEncode(Encrypt.EncryptPassword(pid.ToString())).Replace("\"", "&quote;") + "\" type=\"hidden\" />";
}
 
By doing this users never loses their text because of logout.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Just in case someone is using type for locking

clock April 7, 2008 18:38 by author ingig
Check out this article about locking, http://jeffbarnes.net/portal/blogs/jeff_barnes/archive/2008/02/07/don-t-use-types-for-locking.aspx

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Change text to html - from Util class

clock April 4, 2008 22:47 by author ingig

This code is a pretty old one, but I've been using it on our site and it works. It simply changes url and email into links and \n into <br />. If I don't allow the user to insert html then I send false into the allowHTML variable.

public static String ConvertToHTML(String text, bool allowHTML) {
    StringBuilder sb = new StringBuilder(text);
   
    if(!allowHTML) {
        //Convert the brackets into HTML equivalents
        sb.Replace("<","&lt;") ;
        sb.Replace(">","&gt;") ;
        //Convert the double quote
        sb.Replace("\"","&quot;");
    }            

    string strInput = sb.Replace("\n", "<br />").ToString();
    string strResult;
   
    string strPattern = @"((([a-z0-9]+@))([a-z0-9]+(\-+[a-z0-9]+)*\.)+[a-z]{2,7}(/?\?([a-z0-9+_.%-]+)=[a-z0-9+_.%/-]*)?(&([a-z0-9+_.%-]+)=[a-z0-9+_.%/-]*)*/?)";
   
    string strReplace = "<a href=\"mailto:$0\">$0</a>";
    strResult = Regex.Replace(strInput, strPattern, strReplace, RegexOptions.IgnoreCase);
    strPattern    = @"((.){0,1}(http|ftp|https):\/\/|www\.)[\w]+(.[\w]+)([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?";
    strReplace    = "<a href=\"$0\" target=\"_blank\">$0</a>";
    strResult    = Regex.Replace(strInput, strPattern, new MatchEvaluator(Util.CapText), RegexOptions.IgnoreCase);
    return strResult;
}

public static string CapText(Match m) {
    if (m.Value.ToLower().IndexOf("http://") > -1) {
        if (m.Value.Substring(0, 1) != "\"" && m.Value.Substring(0, 1) != "=") {
            if (m.Value.Substring(0, 1) == "h") {
                return " <a href=\"" + m.Value + "\" target=\"_blank\">" + m.Value + "</a>";
            } else {
                return m.Value.Substring(0, 1) + " <a href=\"" + m.Value.Remove(0, 1) + "\" target=\"_blank\">" + m.Value.Remove(0, 1) + "</a>";
            }
        } else {
            return m.Value;
        }
    } else {
        return "<a href=\"http://" + m.Value + "\" target=\"_blank\">" + m.Value + "</a>";
    }
}

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Clear html - from Util class

clock April 3, 2008 13:44 by author ingig

To continue with my util class, this is how you clear all html from a text.

public static String ClearHTML(String text) {
    Regex reg = new Regex("<[^>]*>");
    return reg.Replace(text, " ");           
}

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


The Util class

clock April 2, 2008 15:40 by author ingig

I was looking at the Util class that we use in our website and decided to put the code here on the blog. I'll create a post for each method, but be aware, the code isn't always the most optimized and some of it was written over 6 years ago. 

Let's start with something simple

public static bool LegalEmail(string email) {
    if (email == null) return false;
    if (email.Length < 6) return false;
    if (email.IndexOf("@") == -1) return false;

    return (Regex.Match(email, @"^[a-z0-9\._-]+@[a-z0-9\._-]+\.+[a-z0-9]{2,4}$", RegexOptions.IgnoreCase).Length != 0);
}

This method simply checks if the string is a legal email address. Now that .Net support extension in v3.5 I guess it's time to change this into an extension, so instead of writing

string email = "example@example.com";
if (Util.LegalEmail(email)) {
    //do stuff
}

you can write

string email = "example@example.com";
if (email.LegalEmail()) {
    //do stuff
}

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Rss færslur

clock April 1, 2008 23:40 by author ingig
Ef einhver er áskriftandi af rss hjá mér þá væri frábært ef þú gætir breytt rss slóðinni í http://feeds.feedburner.com/Ingignet. Þannig get ég fylgst með hvort einhver sé áskrifandi og það kannski hvetur mig til að skrifa meira og oftar.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


1, apríl

clock April 1, 2008 20:21 by author ingig

Aprílgabbið gekk vel. Þeir sem vissu að það var fyrsti apríl áttuðu sig fljótt á þessu en aðrir voru fljótir að senda póst, skilaboð eða hringja í okkur. Við fengum 25 símtöl og held að við höfum fengið í kringum 100 skilaboð og pósta senda á okkur. Ég veit ekki hvað margir komu í BT, en kannski fæ c.a. tölu á því seinna.

Kerfið keyrði nokkuð vel, það voru nokkrir böggar, eins og að komast inná heimasíðu barnsins frá ákveðnum stað en annars gekk allt vel.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Barnaland.is og er.is á dönsku

clock April 1, 2008 01:38 by author ingig

Nú höfum við breytt barnaland.is og er.is yfir á dönsku. Hér er tilkynningin frá okkur.

Kæru notendur,

Frá og með 1. apríl 2008 verða stýri- og umsjónarkerfi barnalands og er.is
eingöngu á dönsku.

Þetta er gert í hagræðingarskyni þar sem Frontur rekur
sambærileg vefsetur á Norðurlöndunum. Því hefur verið ákveðið að nota eitt
og sama tungumálið fyrir alla vefina, þ.e. dönsku.

Þeir notendur sem vilja nota íslenskt stýrikerfi áfram geta keypt
það í verslunum BT, frá og með 1.apríl.

Stýrikerfið mun kosta kr. 2190,- en þriðjudaginn 1. apríl verður
það selt á sérstöku tilboðsverði, eða kr. 990,- Athugið að tilboðið stendur
eingöngu þennan eina dag.

Virðingarfyllst,
starfsfólk barnalands og er.is

Frontur ApS
Nørregade 2
Nyborg centrum
5800 Danmark
Tel: +45 6591 5525

 

 

Ég held að þetta verði breyting til hins betra, allt viðhald verður auðveldara fyrir okkur og íslendingar læra meiri dönsku.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Search

Twitter Updates

    Myndir

    Er.is

    Calendar

    <<  November 2008  >>
    SuMoTuWeThFrSa
    2627282930311
    2345678
    9101112131415
    16171819202122
    23242526272829
    30123456

    Archive

    Tags

    Categories


    Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in