Sebastian

Sebastian P.R. Gingter develops ASP.NET applications at Smarthouse Media GmbH in Karlsruhe, Germany. His interests cover web- and software development in general, music, freemasonry and everything else that is interesting and fun to learn about.


Posts by Sebastian

Note to me: iPhone and hotspot flat

In the “note to me” posts I’m going to blog things that are not that obvious, which I had to figure out, that I want to remember and that, possibly, can be of some help for you if you have a similar issue.

This time I just wanted to access my T-Mobile hotspots flat that came with my iPhone contract from the train I’m sitting in. Login failed, though, because I couldn’t remember the login credentials.

Gladly I remembered that I stored the number I had to send a text message to in order to activate the hotspot flat in the phone. It is the 9526.

Just as I activated the account, I sent the text ‘open’ once again to this number. Shortly after that I got a text message with my credentials. By default, your user name is your mobile number. Important: to login to the hotspot, you have to take your username and add a @t-mobile.de to it. So by default a login name oils look like “491711234567890@t-mobile.de”

You can change both your username and your password by sending other text messages to the 9526. To change your user name, send ‘alias newusername’, where new username is the username you want to use in the future. In order to change your password send the text ‘passwort newpassword’ (yes, the first is the german word passwort). You will get a confirmation via text message shortly after sending. If the desired username is already taken you will be informed of that of course.

After changing my username I could login to the hotspot and use it to post this ;)

Curly braces in C# String.Format()

Ever wanted to use String.Format on, say, a javascript function? Those include curly braces ( { or } ), but those curly braces are reserved as placeholder marker in String.Format() (i.e. for {0}). Escaping the braces with a backslash (comes to mind first in C#) does not work, though.

The solution is pretty simple: You need to double those curly braces to escape them:

String.Format("function test() {{ return calcSomething({0}); }}", "123");

Pre-fill password fields in ASP.NET

At some stage I had to pre-fill a password field. Actually that is something you don’t want to do because the value can be seen in the plain html text. But perhaps you want to show some **** initially on a new user page or something.

ASP.NET won’t render the value of a TextBox with textmode set to password into the page, but you can force the required html to pre-fill password fields using the .AddAttribute(“value”, password); method on the control:

TextBox passwd = new TextBox() { TextMode = TextBoxMode.Password };
passwd.AddAttribute("value", "*****");

I already mentioned you can see the password in plain text in the html, so it is a bad idea to do that with real passwords. You should try to avoid this. But in some cases (i.e. display password strength / weakness during initial password entry on a “new user” page, with no real password but a dummy value) this totally makes sense.

Hello World. Again.

Hello World!

This is my third approach to a blog, but this time it’s serious ;-)

I’m going to blog about software development and some personal interests. More details will follow. This evening was spent setting up this blog, in the next view days I’m going to transfer some of my older blog posts to my new blog (especially some development related)

Have fun :)

Sebastian