Tag Archives: Microsoft

DNS SRV records (or: why Google Talk doesn't connect through this network)

[ There is some blabla here about SRV records, See last paragraph for the direct solution ]

Recently, the bus home was replaced with a shiny new one, which also provides Wi-Fi access. That's brilliant - as long as I have a seat, I don't mind how long the ride home takes. I just hope it doesn't radiate too much =)

Anyway, I've noticed that I fail to connect to Google talk through my favorite client, Pidgin, when connected to this Bus' wireless LAN. It's really fun to do some debugging with xterm and wireshark with passengers watching with curiosity.

And to the point - I'm not sure where this standard is defined (XMPP?), but Google recommends setting the Google Talk "domain" as gmail.com. But where is the XMPP server ip/name taken from? It's not gmail.com, as the telnet gmail.com 5222 fails.

Quick sniffing tells that my pidgin (and probably other clients) use DNS SRV records. SRV records (RFC2782) are a pretty neat idea: it lets you query your domain for services. Why remember (or worse: guess) what's the name of the SMTP server? Instead, SRV records suggest a way to ask a domain what's the IP of the domain's major SMTP service.

The DNS name is of the following structure: _<service name>._<protocol>.domain.

In our case: _xmpp-client._tcp.gmail.com. Let's run this nice command line:

# host -t SRV _xmpp-client._tcp.gmail.com

_xmpp-client._tcp.gmail.com has SRV record 20 0 5222 talk2.l.google.com.
_xmpp-client._tcp.gmail.com has SRV record 20 0 5222 talk3.l.google.com.
_xmpp-client._tcp.gmail.com has SRV record 20 0 5222 talk4.l.google.com.
_xmpp-client._tcp.gmail.com has SRV record 5 0 5222 talk.l.google.com.
_xmpp-client._tcp.gmail.com has SRV record 20 0 5222 talk1.l.google.com.

So briefly, each SRV record holds host name, port number, priority and weight. A single service may have several records, thus providing some kind of high availability and load balancing.

SRV records are intensively used in Microsoft Domains since Windows 2000, and it's even possible that they invented it (they're signed in the RFC after some non-microsoft guy). In that case, kudos to Microsoft for either inventing or pushing forward a good technological standard. Haven't seen this frequently.

So, it seems that the DNS in this bus disrespects my SRV queries, and thus my Pidgin can't figure out who is the Google Talk server. Setting another DNS server solved the problem.

Browser Wars: we win!

Due to Windows 7 release, many people indirectly upgrade from IE6 -> IE8 these days. You can see this here and here.

With IE7, IE8, FF, Chrome, Safari & Opera - the web would look much better. PPK's forecast -  that adding IE6 support would cost more money to the business - is becoming real.

This basically means that web is getting more standard than it used to, and "sites the work only in IE" should become rare even in the short term. Amen.

(Also, these days IE8 is starting to overcome IE7)

Few IronPython impressions and a quick guide

I've been messing with IronPython lately. It's a .NET, microsoft-supported [stop throwing tomatoes at me! Ms-PL is an OSI-recognized OSS license! Ouch, stop that!] implementation of Python, somewhat like Jython is a Java implementation. The same person is behind them both, by the way 🙂

What is it good for? Well, accessing the whole .NET framework with Python code is quite a strong feature. IronClad project aims to allow accessing CPython (the popular implementation) binary modules, not sure how mature it is.

First impressions? 2.0RC2 seems pretty mature. Most of the "random" .NET classes I've been trying out seemed to work flawlessly. Load time is a bit slow. But all in all, it seems pretty good.

And now to few specific notes, that a CPython user might need as of version 2.0RC2:

Loading .NET assemblies howto

note that mscorlib is needed for many common namespaces, such as Microsoft.Win32. In MSDN, the "assembly name" is specified for each namespace, so it's easy to find out.

Python logging module bug

The famous logging module currently throws an exception instead of printing lines. Here's a workaround till they fix it:

[see Michael's comment below]
_winreg module problem with REG_BINARY type

The CPython _winreg implementation works fine, however in IronPython there's currently a little problem: "high ascii" (>128) chars are getting screwed because of some converting/encoding problem (uses System.Text.Encoding.ASCII which is 7bit aware). My workaround was to use directly the Microsoft.Win32.Registry implementation, and manually convert the returned Microsoft Byte Array to native Python string of bytes. If you need the code, comment me and I'll add it.

Compiling to DLL/EXE

I was looking for some "py2exe" compiler, but found out that the compiler itself is available as an IronPython class, and anyone can call it from their own Python script to fit their needs. Still, I use the pyc code (command line compiler). Note: find the latest version of this script, cuz old versions (IronPython v1.x don't fit!). Current latest hides in "IronPython 2 Beta 4" release.

Note: sometimes EXEs don't behave exactly the same as in the interpreter:

  • sys.argv bug: would probably be fixed soon
  • "clr.AddReference()" lines are sometimes (always?) not needed when using the interpreter, but are always required in EXE.

I find a "make" system pretty needed for IronPython.

Writing GUI

Windows.Forms is an integral part on .NET, and as such, is native to IronPython. IronPython Studio aims to allow nice GUI drawing tool (ok ok, an IDE). Still a bit buggy (I've lost 1hr annoying-design-work cuz it wasn't saved well), but it surely helps designing.

-------

Debugging tools: haven't checked that area yet.

Sleep now.

How HP & Microsoft donate to world pollution (and Ink business)

Or: "how to set draft printing quality as default"

[warning: non Linux post]

I've had two pretty modern (year 2006+) HP InkJet printers. Their driver adds a new tab to the Windows "Printing Preferences" dialog (I really enjoy those vendor-specific dialogs!), through which  one can change the printing quality.

For 90% of my home needs, black-only draft quality is enough, so upon printing, from the "Printing Dialog", I click "Printing Preferences" and change the quality to black-only + fast/economical printing:

However, the GUI designer forgot (or the MS API doesn't allow) a "make this the default" button, which is a MUST in my opinion.

A quick digging revealed the forbidden truth, though.

So, how can we really set the default printing quality?

Control Panel -> Printers -> right click on your printer -> Properties -> "Advanced" Tab (Cuz it's only for really advanced users! are you sure you are one?) -> Printing Defaults button:

Microsoft (and Apple), as the biggest OS vendors, have the [almost] ultimate power: they set the rules for most of the world computers, and they set the defaults. By making power-saving options very straightforward, and even making the defaults environment-friendly, they can decrease the world power saving by very large numbers. Same should go with Ink saving.