<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: user code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 17 May 2008 04:44:16 GMT</pubDate>
    <description>DZone Snippets: user code</description>
    <item>
      <title>Get the username of the logged on user on remote machine</title>
      <link>http://snippets.dzone.com/posts/show/5465</link>
      <description>// description of your code here&lt;br /&gt;Cheats a little by getting the owner of explorer.exe to derive the logged in user. Add reference to System.Management and I think DirectoryServices&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Imports System.Management&lt;br /&gt;Imports System.DirectoryServices&lt;br /&gt;Imports Microsoft.Win32&lt;br /&gt;Imports System.Runtime.InteropServices&lt;br /&gt;Module Module1&lt;br /&gt;    Dim objManagementClass As ManagementClass&lt;br /&gt;    Dim objManagementScope As ManagementScope&lt;br /&gt;    Dim objManagementBaseObject As ManagementBaseObject&lt;br /&gt;    Sub Main()&lt;br /&gt;&lt;br /&gt;        Dim WMIScope As Management.ManagementScope&lt;br /&gt;        Dim WMIConnectionOptions As New Management.ConnectionOptions&lt;br /&gt;        Dim strRootDomain As String&lt;br /&gt;        Dim objRootLDAP As DirectoryEntry&lt;br /&gt;        Dim query As ManagementObjectSearcher&lt;br /&gt;        Dim queryCollection As ManagementObjectCollection&lt;br /&gt;        Dim oq As New System.Management.ObjectQuery&lt;br /&gt;        Dim mo As New ManagementObject&lt;br /&gt;        Dim UserDomain As String&lt;br /&gt;        Dim UserID As String&lt;br /&gt;        Dim StrLoggedUserSID() As Byte&lt;br /&gt;&lt;br /&gt;        Dim Strcomputer As String = My.Application.CommandLineArgs.Item(0)&lt;br /&gt;        'Console.WriteLine(Strcomputer)&lt;br /&gt;&lt;br /&gt;        With WMIConnectionOptions&lt;br /&gt;            .Impersonation = System.Management.ImpersonationLevel.Impersonate&lt;br /&gt;            .Authentication = System.Management.AuthenticationLevel.Packet&lt;br /&gt;&lt;br /&gt;        End With&lt;br /&gt;&lt;br /&gt;        WMIScope = New Management.ManagementScope("\\" &amp; _&lt;br /&gt;        strcomputer &amp; "\root\cimv2", WMIConnectionOptions)&lt;br /&gt;&lt;br /&gt;        objRootLDAP = New DirectoryEntry("LDAP://RootDSE")&lt;br /&gt;        strRootDomain = objRootLDAP.Properties.Item("rootDomainNamingContext").Value.ToString&lt;br /&gt;&lt;br /&gt;        oq = New System.Management.ObjectQuery("SELECT * from Win32_process Where Name='explorer.exe' and SessionID=0")&lt;br /&gt;        query = New ManagementObjectSearcher(WMIScope, oq)&lt;br /&gt;        queryCollection = query.Get()&lt;br /&gt;&lt;br /&gt;        If queryCollection.Count = 0 Then&lt;br /&gt;            Console.WriteLine("No user logged on")&lt;br /&gt;            Exit Sub&lt;br /&gt;        Else&lt;br /&gt;&lt;br /&gt;            Dim strKeyPath As String = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon"&lt;br /&gt;            objManagementScope = New ManagementScope&lt;br /&gt;            objManagementScope.Path.Server = strcomputer&lt;br /&gt;            objManagementScope.Path.NamespacePath = "root\default"&lt;br /&gt;            objManagementScope.Options.EnablePrivileges = True&lt;br /&gt;            objManagementScope.Options.Impersonation = ImpersonationLevel.Impersonate&lt;br /&gt;            objManagementScope.Connect()&lt;br /&gt;&lt;br /&gt;            objManagementClass = New ManagementClass("stdRegProv")&lt;br /&gt;            objManagementClass.Scope = objManagementScope&lt;br /&gt;            objManagementBaseObject = objManagementClass.GetMethodParameters("EnumValues")&lt;br /&gt;            objManagementBaseObject.SetPropertyValue("hDefKey", CType("&amp;H" &amp; Hex(RegistryHive.LocalMachine), Long))&lt;br /&gt;            objManagementBaseObject.SetPropertyValue("sSubKeyName", strKeyPath)&lt;br /&gt;&lt;br /&gt;            UserDomain = CStr(GetRegValues("DefaultDomainName", strKeyPath, "HKLM"))&lt;br /&gt;            UserID = CStr(GetRegValues("DefaultUserName", strKeyPath, "HKLM"))&lt;br /&gt;&lt;br /&gt;            Console.WriteLine(UserID)&lt;br /&gt;&lt;br /&gt;            'If the SID or the full name is needed sometime in the future the code is below&lt;br /&gt;&lt;br /&gt;            'If UCase(UserDomain) = UCase(strcomputer) Then&lt;br /&gt;            'Console.WriteLine("Logged on user = " &amp; UserDomain &amp; "\" &amp; UserID &amp; " (local user)")&lt;br /&gt;            'Exit Sub&lt;br /&gt;            'End If&lt;br /&gt;&lt;br /&gt;            'Dim LdapBind As String&lt;br /&gt;            'LdapBind = ("LDAP://" &amp; strRootDomain)&lt;br /&gt;&lt;br /&gt;            'Dim deEntry3 As New DirectoryEntry(LdapBind)&lt;br /&gt;            'Dim DSearch As New DirectorySearcher(deEntry3)&lt;br /&gt;&lt;br /&gt;            'With DSearch&lt;br /&gt;            '    .SearchScope = SearchScope.Subtree&lt;br /&gt;            '    .Filter = "(&amp;(objectclass=user)(sAMAccountName=" &amp; UserID &amp; "))"&lt;br /&gt;            '    .PropertiesToLoad.Add("name")&lt;br /&gt;            '    .PropertiesToLoad.Add("sAMAccountName")&lt;br /&gt;            '    .PropertiesToLoad.Add("distinguishedName")&lt;br /&gt;            'End With&lt;br /&gt;&lt;br /&gt;            'Dim sResultSet As SearchResult&lt;br /&gt;&lt;br /&gt;            'For Each sResultSet In DSearch.FindAll()&lt;br /&gt;&lt;br /&gt;            '    If UCase(GetProperty(sResultSet, "sAMAccountName")) = UCase(UserID) Then&lt;br /&gt;&lt;br /&gt;            '        Console.WriteLine("Logged on user = " &amp; GetProperty(sResultSet, "name") &amp; " (as " &amp; _&lt;br /&gt;            '        UserDomain &amp; "\" &amp; UserID &amp; ")")&lt;br /&gt;&lt;br /&gt;            '        Dim deEntry4 As New DirectoryEntry("LDAP://" &amp; GetProperty(sResultSet, "distinguishedName").ToString)&lt;br /&gt;            '        StrLoggedUserSID = CType(deEntry4.Properties("objectSid").Value, Byte())&lt;br /&gt;            '        Console.WriteLine("User's SID = " &amp; ConvertSid(StrLoggedUserSID))&lt;br /&gt;            '    End If&lt;br /&gt;            'Next&lt;br /&gt;&lt;br /&gt;        End If&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;    Public Function GetProperty(ByVal srSearchResult As SearchResult, ByVal strPropertyName As String) As String&lt;br /&gt;        If srSearchResult.Properties.Contains(strPropertyName) Then&lt;br /&gt;            Return srSearchResult.Properties(strPropertyName)(0).ToString()&lt;br /&gt;        Else&lt;br /&gt;            Return String.Empty&lt;br /&gt;        End If&lt;br /&gt;    End Function&lt;br /&gt;    Private Function GetRegValues(ByVal regkeyValue As String, ByVal regkey As String, ByVal Hive As String)&lt;br /&gt;&lt;br /&gt;        Select Case Hive&lt;br /&gt;            Case "HKLM"&lt;br /&gt;                Hive = CStr(RegistryHive.LocalMachine)&lt;br /&gt;            Case "HKU"&lt;br /&gt;                Hive = CStr(RegistryHive.Users)&lt;br /&gt;            Case "HKCU"&lt;br /&gt;                Hive = CStr(RegistryHive.CurrentUser)&lt;br /&gt;            Case "HKCR"&lt;br /&gt;                Hive = CStr(RegistryHive.ClassesRoot)&lt;br /&gt;        End Select&lt;br /&gt;&lt;br /&gt;        objManagementBaseObject = objManagementClass.GetMethodParameters("GetStringValue")&lt;br /&gt;        objManagementBaseObject.SetPropertyValue("hDefKey", CType("&amp;H" &amp; Hex(Hive), Long))&lt;br /&gt;        objManagementBaseObject.SetPropertyValue("sSubKeyName", regkey)&lt;br /&gt;        objManagementBaseObject.SetPropertyValue("sValueName", regkeyValue)&lt;br /&gt;        objManagementBaseObject = objManagementClass.InvokeMethod("GetStringValue", objManagementBaseObject, Nothing)&lt;br /&gt;        GetRegValues = objManagementBaseObject("sValue")&lt;br /&gt;&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;    Public Function ConvertSid(ByVal sid As Byte()) As String&lt;br /&gt;&lt;br /&gt;        Dim sidString As String&lt;br /&gt;        Dim sidPtr As IntPtr&lt;br /&gt;        Dim sidStringPtr As IntPtr&lt;br /&gt;        Dim res As Integer&lt;br /&gt;&lt;br /&gt;        sidPtr = Marshal.AllocHGlobal(sid.Length)&lt;br /&gt;        Marshal.Copy(sid, 0, sidPtr, sid.Length)&lt;br /&gt;        res = ConvertSidToStringSid(sidPtr, sidStringPtr)&lt;br /&gt;        If res = 0 Then&lt;br /&gt;            Throw New System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error())&lt;br /&gt;        End If&lt;br /&gt;        sidString = Marshal.PtrToStringAuto(sidStringPtr)&lt;br /&gt;        Marshal.FreeHGlobal(sidPtr)&lt;br /&gt;        Marshal.FreeHGlobal(sidStringPtr)&lt;br /&gt;&lt;br /&gt;        Return sidString&lt;br /&gt;&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;    &lt;DllImport("advapi32.dll", CharSet:=CharSet.Auto, SetLastError:=True)&gt; _&lt;br /&gt;    Private Function ConvertSidToStringSid(ByVal pSID As IntPtr, ByRef pSidString As IntPtr) As Integer&lt;br /&gt;    End Function&lt;br /&gt;&lt;br /&gt;End Module&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 05 May 2008 20:43:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5465</guid>
      <author>mellerbeck (Michael Ellerbeck)</author>
    </item>
    <item>
      <title>Getting Started With WWW::Mechanize</title>
      <link>http://snippets.dzone.com/posts/show/5134</link>
      <description>This Ruby code uses WWW:mechanize to act like a web browser.  &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; require 'rubygems'&lt;br /&gt; require 'mechanize'&lt;br /&gt;&lt;br /&gt; agent = WWW::Mechanize.new&lt;br /&gt; page = agent.get('http://google.com/')&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Refer to the documentation at http://mechanize.rubyforge.org/mechanize/. Then gem install mechanize, and try running the code in an irb session.&lt;br /&gt;&lt;br /&gt;output (extract):&lt;br /&gt;&lt;code&gt;&lt;br /&gt;=&gt; #&lt;WWW::Mechanize::Page&lt;br /&gt; {url #&lt;URI::HTTP:0xfdbbbb286 URL:http://www.google.com/&gt;}&lt;br /&gt; {meta}&lt;br /&gt; {title "Google"}&lt;br /&gt; {iframes}&lt;br /&gt; {frames}&lt;br /&gt; {links&lt;br /&gt;  #&lt;WWW::Mechanize::Page::Link&lt;br /&gt;   "Images"&lt;br /&gt;   "http://images.google.com/imghp?hl=en&amp;tab=wi"&gt;&lt;br /&gt;  #&lt;WWW::Mechanize::Page::Link&lt;br /&gt;   "Maps"&lt;br /&gt;   "http://maps.google.com/maps?hl=en&amp;tab=wl"&gt;&lt;br /&gt;  #&lt;WWW::Mechanize::Page::Link&lt;br /&gt;   "News"&lt;br /&gt;   "http://news.google.com/nwshp?hl=en&amp;tab=wn"&gt;&lt;br /&gt;  #&lt;WWW::Mechanize::Page::Link&lt;br /&gt;   "Shopping"&lt;br /&gt;   "http://www.google.com/prdhp?hl=en&amp;tab=wf"&gt;&lt;br /&gt;  #&lt;WWW::Mechanize::Page::Link&lt;br /&gt;   "Gmail"&lt;br /&gt;   "http://mail.google.com/mail/?hl=en&amp;tab=wm"&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 12 Feb 2008 17:53:54 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5134</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Simple user model with password crypting</title>
      <link>http://snippets.dzone.com/posts/show/4676</link>
      <description>A simple user model. It's using the virtual password attribute 'password' to store the clear-text password. This is what e.g. forms use for password input. It stores this password in the password_hash column. &lt;br /&gt;&lt;br /&gt;It allows for user editing, using the same form as user creation. The password won't be updated, and validations will pass, if the user doesn't touch the password field in the form.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;require "digesh/sha1"&lt;br /&gt;class User &lt; ActiveRecord::Base&lt;br /&gt;  validates_confirmation_of :password, :if =&gt; :perform_password_validation?&lt;br /&gt;  validates_presence_of :password, :if =&gt; :perform_password_validation?&lt;br /&gt;&lt;br /&gt;  before_save :hash_password&lt;br /&gt;  attr_accessor :password&lt;br /&gt;&lt;br /&gt;  # Returns true if the password passed matches the password in the DB&lt;br /&gt;  def valid_password?(password)&lt;br /&gt;    self.password_hash == self.class.hash_password(password)&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;  private&lt;br /&gt;&lt;br /&gt;  # Performs the actual password encryption. You want to change this salt to something else.&lt;br /&gt;  def self.hash_password(password, salt = "meeQue8Zucijoo7")&lt;br /&gt;    Dihest::SHA1.hexdigest(password, salt)&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;  # Sets the hashed version of self.password to password_hash, unless it's blank.&lt;br /&gt;  def hash_password&lt;br /&gt;    self.password_hash = self.class.hash_password(self.password) unless self.password.blank?&lt;br /&gt;  end&lt;br /&gt; &lt;br /&gt;  # Assert wether or not the password validations should be performed. Always on new records, only on existing&lt;br /&gt;  # records if the .password attribute isn't blank.&lt;br /&gt;  def perform_password_validation?&lt;br /&gt;    self.new_record? ? true : !self.password.blank?&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 19 Oct 2007 12:50:41 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4676</guid>
      <author>leethal (August Lilleaas)</author>
    </item>
    <item>
      <title>automate linking to Twitter users</title>
      <link>http://snippets.dzone.com/posts/show/4577</link>
      <description>this method searches for @some_user in a string (txt) and links found matches to the twitter-page of some_user&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;def link_twitter_user(txt)&lt;br /&gt;	if match = txt.match(/.*?(@)((?:[a-z][a-z]+))(:|\s)/i)&lt;br /&gt;		user = match[2]&lt;br /&gt;		txt.gsub!(user, '&lt;a href="http://twitter.com/' + user + '"&gt;' + user + '&lt;/a&gt;')&lt;br /&gt;	end&lt;br /&gt;	txt&lt;br /&gt;end&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:36:39 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4577</guid>
      <author>labuschin (Martin Labuschin)</author>
    </item>
    <item>
      <title>Email User Control VB .NET</title>
      <link>http://snippets.dzone.com/posts/show/3951</link>
      <description>Save as an .ascx file and insert into your project. &lt;br /&gt;Set properties via the properties window. &lt;br /&gt;Includes the form, code, validation, and css.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;%@ Control Language="VB" ClassName="Email" %&gt;&lt;br /&gt;&lt;%@ Import Namespace="System.Net.Mail" %&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script runat="server"&gt;&lt;br /&gt;    Public Property Email() As String&lt;br /&gt;        Get&lt;br /&gt;            Return recipientEmail&lt;br /&gt;        End Get&lt;br /&gt;        Set(ByVal value As String)&lt;br /&gt;            recipientEmail = value&lt;br /&gt;        End Set&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Public Property Host() As String&lt;br /&gt;        Get&lt;br /&gt;            Return mhost&lt;br /&gt;        End Get&lt;br /&gt;        Set(ByVal value As String)&lt;br /&gt;            mhost = value&lt;br /&gt;        End Set&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Public Property Port() As String&lt;br /&gt;        Get&lt;br /&gt;            Return mport&lt;br /&gt;        End Get&lt;br /&gt;        Set(ByVal value As String)&lt;br /&gt;            mport = value&lt;br /&gt;        End Set&lt;br /&gt;    End Property&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    Public Property Message() As String&lt;br /&gt;        Get&lt;br /&gt;            Return sentMessage&lt;br /&gt;        End Get&lt;br /&gt;        Set(ByVal value As String)&lt;br /&gt;            sentMessage = value&lt;br /&gt;        End Set&lt;br /&gt;    End Property&lt;br /&gt;    &lt;br /&gt;    Dim recipientEmail As String&lt;br /&gt;    Dim mhost As String&lt;br /&gt;    Dim mport As Integer&lt;br /&gt;    Dim sentMessage As String&lt;br /&gt;    Dim client As New Net.Mail.SmtpClient()&lt;br /&gt;&lt;br /&gt;    Protected Sub btnSendMail_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendMail.Click&lt;br /&gt;&lt;br /&gt;        client.Host = Host&lt;br /&gt;        client.Port = Port&lt;br /&gt;        client.Send(txtSenderEmail.Text, recipientEmail, txtSubject.Text, txtMessage.Text)&lt;br /&gt;        lblMessage.Text = sentMessage&lt;br /&gt;    End Sub&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;  label&lt;br /&gt;  {&lt;br /&gt;   	   float: left;&lt;br /&gt;   	   width:10em;&lt;br /&gt;   	   text-align:right;&lt;br /&gt;   	   clear:left;&lt;br /&gt;   	   margin-right: 7px;&lt;br /&gt;   	   font-family: Tahoma, Sans-Serif;&lt;br /&gt;   	   font-size:12px;&lt;br /&gt;   	   font-weight:bold;&lt;br /&gt;  	    padding:4px;&lt;br /&gt;   		background:#FFFFFF;&lt;br /&gt;   		color:#333333;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  .validate&lt;br /&gt;  {&lt;br /&gt;    font-family: Tahoma, Sans-Serif;&lt;br /&gt;   	font-size:12px;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  &lt;/style&gt;&lt;br /&gt;  &lt;br /&gt;&lt;label&gt;Email:&lt;/label&gt;&lt;asp:TextBox ID="txtSenderEmail" runat="server" Width="375px"&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;&lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtSenderEmail"&lt;br /&gt;    ErrorMessage="Required!" CssClass="validate"&gt;&lt;/asp:RequiredFieldValidator&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;label&gt;Subject:&lt;/label&gt;&lt;asp:TextBox ID="txtSubject" runat="server" Width="375px"&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;&lt;asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtSubject"&lt;br /&gt;    ErrorMessage="Required!" CssClass="validate"&gt;&lt;/asp:RequiredFieldValidator&gt;&lt;br /&gt;&lt;br /&gt;&lt;label&gt;Message:&lt;/label&gt;&lt;asp:TextBox ID="txtMessage" runat="server" TextMode="MultiLine"&lt;br /&gt;        Height="160px" Width="375px"&gt;&lt;/asp:TextBox&gt;&lt;br /&gt;&lt;asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtMessage"&lt;br /&gt;    ErrorMessage="Required!" CssClass="validate"&gt;&lt;/asp:RequiredFieldValidator&gt;&lt;br /&gt;&lt;br /&gt;&lt;label&gt;&lt;asp:Label ID="lblMessage" runat="server"&gt;&lt;/asp:Label&gt;&lt;/label&gt;&lt;asp:Button ID="btnSendMail"&lt;br /&gt;        runat="server" Text="Send" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 03 May 2007 00:43:47 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3951</guid>
      <author>D-ko (DS)</author>
    </item>
    <item>
      <title>Nokia - User Agent</title>
      <link>http://snippets.dzone.com/posts/show/3102</link>
      <description>// User Agent&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;Modello 3230&lt;br /&gt;"Nokia3230/2.0 (5.0614.0) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6260&lt;br /&gt;"Nokia6260/2.0 (3.0448.0) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6600&lt;br /&gt;"Nokia6600/1.0 (5.27.0) SymbianOS/7.0s Series60/2.0 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6620&lt;br /&gt;"Nokia6620/2.0 (4.22.1) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6630&lt;br /&gt;"Nokia6630/1.0 (5.03.08) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.1"&lt;br /&gt;&lt;br /&gt;Modello 6670&lt;br /&gt;"Nokia6670/2.0 (6.0540.0) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.0"&lt;br /&gt;&lt;br /&gt;Modello 6680&lt;br /&gt;"Nokia6680/1.0 (4.04.07) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.1"&lt;br /&gt;&lt;br /&gt;Modello 6681&lt;br /&gt;"Nokia6681/2.0 (5.37.01) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0&lt;br /&gt;Configuration/CLDC-1.1"&lt;br /&gt;&lt;br /&gt;Modello 9300&lt;br /&gt;"Mozilla/4.0 (compatible; MSIE 5.0; Series80/2.0 Nokia9300/05.22&lt;br /&gt;Profile/MIDP-2.0 Configuration/CLDC-1.1)"&lt;br /&gt;&lt;br /&gt;Modello 9500&lt;br /&gt;"Mozilla/4.0 (compatible; MSIE 5.0; Series80/2.0 Nokia9500/4.51&lt;br /&gt;Profile/MIDP-2.0 Configuration/CLDC-1.1)"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 07 Dec 2006 05:10:21 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3102</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>Python - Change user-agent</title>
      <link>http://snippets.dzone.com/posts/show/3015</link>
      <description>// Cambiare user-agent con urllib&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import urllib&lt;br /&gt;&lt;br /&gt;class AppURLopener(urllib.FancyURLopener):&lt;br /&gt;&lt;br /&gt;	version = 'Nokia6630/1.0 (2.3.129) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1'&lt;br /&gt;&lt;br /&gt;urllib._urlopener = AppURLopener()&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// Cambiare user-agent con urllib2&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import urllib2&lt;br /&gt;&lt;br /&gt;headers = { 'user-agent':'Nokia6630/1.0 (2.3.129) SymbianOS/8.0 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1',&lt;br /&gt;		    'keep-alive':'300',&lt;br /&gt;		    'content-type':'application/x-www-form-urlencoded'&lt;br /&gt;		  }&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 18 Nov 2006 15:14:46 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3015</guid>
      <author>whitetiger ()</author>
    </item>
    <item>
      <title>&#232;&#381;&#183;&#229;?&#8211;&#229;&#189;&#8220;&#229;&#8240;?&#231;&#8482;&#187;&#233;&#8482;&#8224;&#231;&#8221;&#168;&#230;&#710;&#183;&#231;&#353;&#8222;&#231;&#8482;&#187;&#233;&#8482;&#8224;&#229;??</title>
      <link>http://snippets.dzone.com/posts/show/2819</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;http://support.microsoft.com/default.aspx?scid=kb;zh-CN;832769&lt;br /&gt;//&#232;&#381;&#183;&#229;?&#8211;&#229;&#189;&#8220;&#229;&#8240;?&#231;&#8482;&#187;&#233;&#8482;&#8224;&#231;&#8221;&#168;&#230;&#710;&#183;&#231;&#353;&#8222;&#231;&#8482;&#187;&#233;&#8482;&#8224;&#229;?? &lt;br /&gt;WindowsPrincipal wp = (WindowsPrincipal)Thread.CurrentPrincipal; &lt;br /&gt;string wpname = wp.Identity.Name.ToString(); &lt;br /&gt;int j = wpname.LastIndexOf("\\"); &lt;br /&gt;string userName = wpname.Substring(j+1); &lt;br /&gt;string domainName = wpname.Substring(0,j); &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 15 Oct 2006 04:24:55 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2819</guid>
      <author>mornlee (mornlee)</author>
    </item>
    <item>
      <title>check user agent with javascript</title>
      <link>http://snippets.dzone.com/posts/show/2612</link>
      <description>// check user agent&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;a href="javascript:alert(navigator.userAgent)"&gt;User Agent&lt;/a&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 17 Sep 2006 17:00:15 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2612</guid>
      <author>ovhaag (Oliver Haag)</author>
    </item>
    <item>
      <title>Check whether current user is owner</title>
      <link>http://snippets.dzone.com/posts/show/1001</link>
      <description>&lt;code&gt;&lt;br /&gt;current_user=`id | sed 's/uid=[0-9][0-9]*(\([^)]*\)).*/\1/'`&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 22 Dec 2005 00:14:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/1001</guid>
      <author>levysoft (Antonio)</author>
    </item>
  </channel>
</rss>
