nazham.com on Twitter

twitter9
I finally embrace Twitter. Yeah, I know. Sometimes I’m a little bit behind on the social networking trends. So, I finally giving it a go today, and I’m liking it so far.

Twitter

What is Twitter?
From Twitter.com:

Twitter is a service for friends, family, and co–workers to communicate and stay connected through the exchange of quick, frequent answers to one simple question: What are you doing?
Because even basic updates are meaningful to family members, friends, or colleagues—especially when they’re timely.
With Twitter, you can stay hyper–connected to your friends and always know what they’re doing. Or, you can stop following them any time. You can even set quiet times on Twitter so you’re not interrupted.
Twitter puts you in control and becomes a modern antidote to information overload.

From wiki:

Twitter is a free social networking and micro-blogging service that allows its users to send and read other users’ updates (otherwise known as tweets), which are text-based posts of up to 140 characters in length.
Updates are displayed on the user’s profile page and delivered to other users who have signed up to receive them. Senders can restrict delivery to those in their circle of friends (delivery to everyone being the default). Users can receive updates via the Twitter website, SMS, RSS, or email, or through an application.

Sometimes things are better explained in sight and sound media. So, here’s a video on Twitter in Plain English, from CommonCraft.

Twitter in Plain English

I’m very new in Twitter. It would be great if you guys could share your experience. Any tips? Any cool Twitter client apps (Windows, Mac, Linux, Firefox, etc)? Any good interesting tweets to follow? Please, do let us know. 😀

Creating an Author Page for your Blog (WordPress)

Nazham.com have multiple authors. Wouldn’t it be great if it can display a little info on the authors, along with their list of posts? I’ve created the page for a while for this site,  now just to share with the viewers. Here’s how I did it.

1. Create an author.php page. The page can simply be done by copying your existing archives.php page, and renamed it to author.php
2. Sample code below. Change the layout as you like to match with your blog’s theme.

<!--content-->
<div id="content">

	<!--left-col-->
	<div id="left-col">
	  <div class="post">

	  <!-- This sets the $curauth variable -->
	  <?php
	  if(isset($_GET['author_name'])) :
	  $curauth = get_userdatabylogin($author_name);
	  else :
	  $curauth = get_userdata(intval($author));
	  endif;
	  ?>

	  <h3>About: <?php echo $curauth->display_name; ?></h3>

	  <p><strong>Website:</strong>
          <a href="<?php echo $curauth->user_url; ?>">
	  <?php echo $curauth->user_url; ?></a></p>

	  <p><strong>Profile:</strong>
          <?php echo $curauth->user_description; ?></p>

	  <h3>Posts by <?php echo $curauth->display_name; ?>:</h3>
	  <ul>
	    <!– The Loop –>
	    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
		<li>
			<em><?php the_time('M jS, Y') ?></em>
                        <a href="<?php the_permalink() ?>" rel="bookmark"
                        title="Permanent Link: <?php the_title(); ?>">
			<?php the_title(); ?></a>
		</li>
	  <?php endwhile; else: ?>
		<p><?php _e('No posts by this author.'); ?></p>
	  <?php endif; ?>
	  <!– End Loop –>
	  </ul>
	  </div>
	</div>
</div>
<!--content-end-->

The code above will display the author’s name, website, profile and the author’s posts.

3. To create the author’s link (maybe somewhere at the post title of your index page), simply put the code below:
<?php the_author_posts_link(); ?>

Resource:
1. How To: Adding An Author Page To Your WordPress Blog
2. WordPress Author Templates

Python: Executing a Program on a Remote 64-bit Windows Machine

Executing a program, exe’s, services on a remote Windows machine can be accomplished very easily, with a very few lines of code in Python. The task is similar to Psexec. However, in Python, one of the ways is using Windows Management Instrumentation (WMI).

From Tim Golden’s Python Stuff:

Windows Management Instrumentation (WMI) is Microsoft’s implementation of Web-Based Enterprise Management (WBEM), an industry initiative to provide a Common Information Model (CIM) for pretty much any information about a computer system.

Executing remote program using WMI needs the win32 extensions from Mark Hammond. Below are one of the sample code that I’ve used on a 32-bit target machine:

c = wmi.WMI ('my_remote_windows_machine')
process_id, result = c.Win32_Process.Create (CommandLine="Notepad.exe")
    for process in c.Win32_Process (ProcessId=process_id):
        returnvalue = str(process.ProcessId) + " " + str(process.Name)

    if result == 0:
        returnvalue = "Process started successfully: %s" % returnvalue
    else:
        raise RuntimeError, "Problem creating process: %s" % str(result)
    print returnvalue

 

However, when it comes to 64-bit target machines, I’m getting errors below:

  File "C:\Python26\lib\wmi.py", line 1181, in connect
    return _wmi_namespace (obj, find_classes)
  File "C:\Python26\lib\wmi.py", line 821, in __init__
    self.classes.update (self.subclasses_of ())
  File "C:\Python26\lib\wmi.py", line 843, in subclasses_of
    for c in self._namespace.SubclassesOf (root):
  File "C:\Python26\Lib\site-packages\win32com\client\util.py", line 84, in next

    return _get_good_object_(self._iter_.next(), resultCLSID = self.resultCLSID)

 

The solution:

c = wmi.WMI ('my_remote_windows_machine', find_classes=False)
process_id, result = c.Win32_Process.Create (CommandLine="Notepad.exe")
    for process in c.Win32_Process (ProcessId=process_id):
        returnvalue = str(process.ProcessId) + " " + str(process.Name)

    if result == 0:
        returnvalue = "Process started successfully: %s" % returnvalue
    else:
        raise RuntimeError, "Problem creating process: %s" % str(result)
    print returnvalue

Notice the extra parameter find_classes=False when instantiating the WMI object.
Some of the good examples on WMI in Python:
Tim Golden’s Python Stuff
WMI Cookbook

WordPress 2.7 “Coltrane” Available Now

Following my previous post, WordPress 2.7 Coming Tomorrow, which meant to WordPress.com users, the self-hosted version is available NOW. WordPress 2.7 “Coltrane”, is available on WordPress.org site. When you logged in to your WordPress control panel, you will be prompt with a “WordPress 2.7 is available!” notification.

Wordpress 2.7
Wordpress 2.7

Enjoy your new WordPress release ! 🙂

Answering “So … what do you do?”

For most types of work, only two levels of description are ever needed. Accountants, for example, would describe themselves as accountants to laypeople, and “tax” or “GL” or “fixed assets” to other accountants.

For my line of work, however, I find it interesting that I need to give lots of different answers to different kinds of people:

  1. How do you explain “software developer” to someone who doesn’t even know what software is? Therefore, my dear grandmother thinks I’m selling computers …
  2. To normal laypeople, I just say I’m in IT.
  3. To people in SEO, I say I’m an SEO reseller.
  4. To people who are more IT savvy, I say that I’m in software.
  5. To people in software, I say that I develop web applications using .NET and C#.
  6. To people who are working in software development companies, I say that I’m doing both sustaining (defects) and product development.