• Custom Search

Delete control characters in VIM

image

Recently I had to review some very large registry files (.reg).

Trouble was when the file was large, VIM somehow displays also the control characters.

This made the file difficult to read.

The solution is to delete all the control characters with

:%s/[[:cntrl:]]//g

and voila:

image

Technorati tags:

Read more work articles

Posted in work | Leave a comment

Microsoft’s support disappoints !! My experience of fixing “Class not registered” for mscomct2.ocx control after Microsoft support staff abandoned the case

I had a very disappointing experience of dealing with Microsoft Dynamics support.

Last month, my client started deploying Meeting Room Manager. I first noticed that the customization on my PC stopped working and soon the problem spread to the citrix server.

The symptoms of the problem was that when I fired up a customized form in GP, it would complain of missing components. The components were Microsoft Listview control and Microsoft Date and Time Picker control.

We tried to fix the problem by reimporting the package but the import also failed.

clip_image002

I (not Microsoft) identified that the problem was due to Meeting Room Manager installing its mscomct2.ocx. Microsoft only allows 1 version of the ocx. So when Meeting Room Manager installed its version, it dumped the version that GP was using.

Microsoft Dynamics support then asked us to unregister and re-register the version that is found in c:\windows\system32. It registered successfully but the problem still persisted.

Microsoft Dynamics support said they were stumped and then they went into 7 days of ‘I am following up with my colleague in US’ , ‘I am in discussion with my colleague in US’ mode without any progress. They hinted that we should just rebuild the server and not waste time fixing the cause.

At this point, the users and I were very frustrated.

I updated the case with this:

GP is a Microsoft product, Meeting Room Manager is a Microsoft Gold Certified partner product. We purchased 1 and then the other and now we cannot get both to work together. Where did we misplace our confidence.

To which, this undynamic Dynamics support chap replied to the effect of:

‘GP was working fine. After Meeting Room Manager, GP does not work, so go after the Meeting Room Manager vendor, it’s not our problem. So there. Go rebuild your server and update us on outcome’

That was SHOCKING !! Both are Microsoft or Microsoft certifed products and they cannot work together and this chap said it was not their (Microsoft) problem !!

That chap could only see that it was not a Microsoft Dynamics GP problem and so it was not his problem.

 

Utterly fed up with his attitude, I did my own research on the issue.

The issue is actually not very complex.

clip_image002[5]mscomct2.ocx though registered successfully, was actually not registering the classes within correctly.

That was the issue.

So I focused on investigating how mscomct2.ocx was distributed.

I got a recently reformatted laptop and tried to add a Microsoft Date and Time Picker control on a VB form in Excel. It worked. I thought that the Meeting Room Manager messed up some operating system files.

I then did a Windows repair. But the problem still persisted.

Then I found out that mscomct2.ocx was previously distributed with Office XP Developer. So I downloaded the mcsomct2.cab file and unzipped its contents (mscomct2.inf, mscomct2.ocx).

I unregistered mscomct2.ocx.

I installed mscomct2.inf. That copied mscomct2.ocx to the system32 directory.

Then I registererd mscomct2.ocx and Voila !! Everything was working again !

There was no secret juice, just about 1 day’s research and trial and error. That’s much better than Microsoft Dynamic’s month long of ‘discussing with my colleague’, ‘following up with my colleague’ without any results !!

Technorati tags: , ,

Read more boo, work articles

Posted in boo, work | 1 Comment

My Dell 640m

SKO_2380 SKO_2381 SKO_2382 SKO_2383 SKO_2384 SKO_2385 SKO_2386 SKO_2387 SKO_2388 SKO_2389

On sale now at Lelong.com.my.

Read more Uncategorized articles

Posted in Uncategorized | Leave a comment

Dell’s reliability

image

Dell has only marginally higher malfunction rate than Apple according to the report that can be downloaded at ComputerWorld.

Given that Apple is significantly more expensive than Dell, I would say Dell gives greater value for money.

I am a long time Dell customer (my last 4 laptops were Dell) and I am super happy with the convenient on-site service.

 

Technorati tags: ,

Read more guide to buying a dell articles

Posted in guide to buying a dell | Leave a comment

Clip Path for Windows 64

imageOne of the things I missed when I moved to Windows 64 bit was ClipPath.

I looked for a ClipPath utility for Windows 64 and found something hopeful but the file was missing.

Then I came across Tim Sneath’s Windows Vista Secret: Copy as Path. I promptly tried shift right click and found that I got my ClipPath functionality back !!

 

Technorati tags: ,

Read more work articles

Posted in work | Leave a comment

Coupon codes for RM 500 discount on Dell Studio systems – limited time offer

image

Dell is giving RM 500 off for Studio 14 laptop and Studio One 19 desktop.

Laptop coupon code: T79KXQ8$6P9G4W

Desktop coupon code: T79KXQ8$6P9G4W

This offer is valid from October 20-23, 2009 only.

I just bought the laptop that was configured like my dream laptop for RM 4,822. My dream previously cost RM 6,067 in July 2009.

Granted that Studio is not the Studio XPS, but my Studio has a faster T9600 CPU.

The catch is that Studio 14 is soon to be replaced by Studio 14z.

I love to get this end of season deals.

Read more guide to buying a dell, work articles

Posted in guide to buying a dell, work | Leave a comment

string.Template with default substitution value

I wanted a string.Template class that will substitute placeholders with a default value if the mapping is not provided.

For example, say I create a template

A template with $value1, $value2

When I substitute this template with values, say I provide only $value1, I want other $variables to be substituted with a default value. If my default value is HAHA. and I provide this map {'value1': 'first_value'}, the result is

A template with first_value, HAHA

Creating the class was very simple (in retrospect).

I just subclassed string.Template and provided my own version of safe_substitute.

 

Here's the class, complete with doctest code.

 

import string
 
class Template(string.Template):
    """
        Template with modified functions
 
    -- doctests ----
    >>> t = 'this is a $test with $result'
    >>> st = Template(t, 'haha')
    >>> d = {'test': 'a big test'}
    >>> result = st.safe_substitute(d)
    >>> expected_result = 'this is a a big test with haha'
    >>> test_result = True if expected_result == result else 'expected %s >>> but got <<< %s' % (expected_result,  result)
    >>> test_result
    True
    >>> st = Template(t)
    >>> d = {'test': 'a big test'}
    >>> result = st.safe_substitute(d)
    >>> expected_result = 'this is a a big test with $result'
    >>> test_result = True if expected_result == result else 'expected %s >>> but got <<< %s' % (expected_result,  result)
    >>> test_result
    True
 
 
    """
 
 
    def __init__(self, template, default_substitution_value = None):
        string.Template(template)
        self.default_substitution_value = default_substitution_value
        self.template = template
 
 
    def safe_substitute(self, *args, **kws):
        '''
            Returns template with placeholders substituted
              if no substitution value is specified, the
                  default_substitution_value
                  is used
        '''
        if len(args) > 1:
            raise TypeError('Too many positional arguments')
        if not args:
            mapping = kws
        elif kws:
            mapping = _multimap(kws, args[0])
        else:
            mapping = args[0]
        # Helper function for .sub()
        def convert(mo):
            named = mo.group('named')
            if named is not None:
                try:
                    # We use this idiom instead of str() because the latter
                    # will fail if val is a Unicode containing non-ASCII
                    return '%s' % (mapping[named],)
                except KeyError:
                    if self.default_substitution_value:
                        return self.default_substitution_value
                    return self.delimiter + named
 
            braced = mo.group('braced')
            if braced is not None:
                try:
                    return '%s' % (mapping[braced],)
                except KeyError:
                    return self.delimiter + '{' + braced + '}'
            if mo.group('escaped') is not None:
                return self.delimiter
            if mo.group('invalid') is not None:
                return self.delimiter
            raise ValueError('Unrecognized named group in pattern',
                             self.pattern)
        return self.pattern.sub(convert, self.template)

 

I built the above because I was building an interface to populate P2 Energy's Field Operations equipment readings. The application sends data via xml files and there are many attributes in the file that I did not care to populate. Rather than hand code a default value for each of them, I built the above python class.

Read more python articles

Posted in python | Leave a comment

Windows 7 upgrade

According to this piece of news, Windows 7 upgrade from Vista can take a almost a day !

Whoa ! I was tempted to get a Vista system with upgrade option but now I would not.
Slashdot Technology Story | Windows 7 Upgrade Can Take Nearly a Day
A clean 32-bit install on what Microsoft calls 'high-end hardware' should take only 30 minutes. In the worst case scenario, the process will take about 1220 minutes. That second extreme is not a typo: Microsoft really did time an upgrade that took 20 hours and 20 minutes.


Read more work articles

Posted in work | Tagged | Leave a comment

Windows 32 bit’s 4 GB RAM limit

A very bright Geoff Chappel looked into Microsoft's claim and said this:

That 32-bit editions of Windows Vista are limited to 4GB is not because of any physical or technical constraint on 32-bit operating systems. The 32-bit editions of Windows Vista all contain code for using physical memory above 4GB. Microsoft just doesn’t license you to use that code.

I say that Geoff Chappel is very bright because he gave a very long and detailed explanation for his conclusion. In fact, there are many very good articles about the Windows Shell in his website.

How does this revelation (that 32 bit Windows can access 4GB RAM and more) affect me ?

I have my reasons to stay 32-bit and I hope that Microsoft will remove the license limit.

Technorati tags:

Read more work articles

Posted in work | Leave a comment

How to view the query the SQL for an Excel worksheet with data source

 

Save the following code in a module.

Sub print_query_table_sql()
    Dim s As Worksheet
    Dim qt As QueryTable
    Dim r As Range
    Dim sql As String
    Set s = ActiveSheet
    Set qt = s.QueryTables(1)
    sql = qt.sql
    Set r = s.Cells(1).SpecialCells(xlLastCell).Offset(1, 1)
    r = sql
End Sub

 

Select your worksheet that contains data from a database source, then run the above macro.

It will print out the SQL in the last cell. (Ctrl-End).

Technorati tags: ,

Read more work articles

Posted in work | Leave a comment