Label Cloud

Showing posts with label Windows. Show all posts
Showing posts with label Windows. Show all posts

Monday, April 06, 2009

99.9% pure .NET Coherence (100 % No Java Code Required)

Its not 100% .NET Coherence, since a developer is required to modify configuration files on the java service to specify the generic POF Serializer.

So to start: The .NET Class:

 

    [POFSerializableObject(StoreMetadata=true)]
    public class Person
    {
        [POFSerializableMember(Order=0,WriteAsType=POFWriteAsTypeEnum.Int16)]
        public int ID { get; set; }
        [POFSerializableMember(Order=1)]
        public string FirstName { get; set; }
        [POFSerializableMember(Order = 2)]
        public string LastName { get; set; }
        [POFSerializableMember(Order = 3)]
        public string Address { get; set; }
        [POFSerializableMember(Order = 4)]
        public string Title { get; set; }
        public Person()
        {
        }
        
    }

Note the StoreMetadata=true argument. When StoreMetadata is specified, Generic serializer will first first write a string array of property names. On server side, we must specify a Generic Java serializer. This is needed to be able to store objects for filtering. Here’s an interesting note. Unless filters are invoked, the object WILL NOT be deserialized on the java side. That means, Put, Get, GetAll calls without a filter, do not require Metadata to be written into the cache. Now. To specify Java Generic Serializer. Distributed Cache Configuration:

      <distributed-scheme>
      <scheme-name>dist-default</scheme-name>
      <serializer>
		<class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
		<init-params>
		  <init-param>
			<param-type>string</param-type>
			<param-value>custom-types-pof-config.xml</param-value>
		  </init-param>
		</init-params>
	  </serializer>
      <backing-map-scheme>
        <local-scheme/>
      </backing-map-scheme>
      <autostart>true</autostart>
    </distributed-scheme>

custom-types-pof-config.xml

<pof-config>
  <user-type-list>
    <!-- include all "standard" Coherence POF user types -->
    <include>coherence-pof-config.xml</include>
    <!-- include all application POF user types -->
    <user-type>
      <type-id>1001</type-id>
      <class-name>com.Coherence.Contrib.POF.POFGenericObject</class-name>
      <serializer>
        <class-name>com.Coherence.Contrib.POF.POFGenericSerializer</class-name>
        <init-params>
           <init-param>
             <param-type>int</param-type>
             <param-value>{type-id}</param-value>
           </init-param>
           <init-param>
            <param-type>boolean</param-type>
             <param-name>LoadMetadata</param-name>
             <param-value>true</param-value>
           </init-param>
         </init-params>        
	  </serializer>
    </user-type>
  </user-type-list>
</pof-config>

For now, you must specify a user-type for each .Net object. On the java side, the server will be using the POFGeneicSerializer, and all values in the object array indexed by the property names. A generic getProperty method is implemented to allow filtering on any property that was used in the serialization. Property evaluation is happening on the server, so only filtered data is returned.

Here’s a simple loop to add an object into the cache

INamedCache cache = CacheFactory.GetCache("dist-Person");
for (int i = 0; i < 1000; i++)
{
    cache.Add(i, new Person()
    {
       ID = i,
       FirstName = string.Format("First Name {0}", i),
       LastName = string.Format("LastName {0}", i),

       Address = string.Format("Address {0}" , Guid.NewGuid()) ,
       Title = i % 2  == 1 ? "Mr" : "Mrs"
    });
}

A cool side effect, data can be accessed from .Net and from Java code in the same fashion.


Share/Save/Bookmark

Thursday, March 26, 2009

Windows Server 2008 R2 is 64bit only

Learned something new from Mark’s blog: Windows Server 2008 R2 is 64bit ONLY( The news is not new, but I only learned it tonight.) It will still support 32 bit applications, but only via OPTIONAL WoW64 functionality that is not added by default. I’ve heard about Microsoft stopping 32bit OS development a while back, but seeing this actually done…. This is BIG.

Technorati Tags: ,,


Share/Save/Bookmark

Monday, December 22, 2008

Rebuilding my PC – And thank you Mozy for the backup

I’ve finally rebuilt my PC. The installation Vista install was relatively painless, except for one minor snag. When I booted from the DVD Drive, and deleted my old partition, Vista refused to install with a message: “Windows is unable to find a system volume that meets it's criteria for installation.” Ohh Sh*t… Well a quick search on Google (using a laptop), provided a solution. Removing USB from the boot-up sequence in BIOS settings resolved this problem.

Before rebuilding the machine, I’ve spent a few hours backing up data from my desktop to DVDs. However, after reinstallation, I found out that I missed to backup my music collect. I don’t have that much, only 8 gigs or so, but it is still not something that I would want to miss. So here’s were Mozy comes in. I subscribe to Mozy’s online backup solution (http://www.mozy.com) For 4.95 a month, it provides a complete “Set it and Forget it” backup solution. After my machine was back up and running. I logged into the Mozy website. Selected “Restore using Web”, and chose my music folder. In about an hour, Mozy sent me an email notifying my that my restore files was ready. The email contained 3 links to file downloads: 3, 3, and 2GB files. About 1 hour for download, simple extract to the c:\ and I am back having my full music collection restored.

Mozy provides a pretty neat interface, very simple, yet pretty powerful. Ability to create multiple backup sets, bandwidth throttling, explorer integration (for Backup and Restore functions). Professional version provides even more functionality. And if all that didn’t get you excited, guess this: All that functionality is available FREE for up to 2GB of space. Yep. Completely Free. So check it it out: http://www.mozy.com

Technorati Tags: ,,,


Share/Save/Bookmark

Saturday, February 16, 2008

Windows Server 2008 will have an SP1 label

I came cross an interesting blog entry that said that Windows Server 2008 will have SP1 label already applied to it. Take a look at http://blogs.msdn.com/iainmcdonald/archive/2008/02/15/windows-server-2008-is-called-sp1-adventures-in-doing-things-right.aspx

Now, how will this effect people's rule not to install a Microsoft server, until SP1 is released (or did the rule implement this version scheme due to that rule :)

Technorati Tags: , ,


Share/Save/Bookmark

Wednesday, December 05, 2007

Subversion pre-revprop-change hook

Another small batch file hook for those running subversion on windows. This hook will allow users to update a log message on the old check-in.

Note: Property changes are not versioned, so you will permanently loose the old message.

Place this in a pre-revprop-change.cmd
-------------
IF %5 EQU M GOTO CONT1
GOTO FAIL
:CONT1
IF %4 EQU svn:log GOTO OK
:FAIL
echo "Changing revision properties other than svn:log is prohibited" >&2
exit 1
:OK
exit 0
------------

 

Technorati Tags: , ,


Share/Save/Bookmark

Friday, August 24, 2007

Update to the Scott Hanselman's 2007 Ultimate Developer and Power Users Tool List for Windows

Scott Hanselman updated his excellent tool list. For those who never saw it, I highly recommend to go through the list to see what they have been missing. For those who know about it, see what's new.


Share/Save/Bookmark

Friday, June 08, 2007

.CHM help files are not working

Sometimes I download help files from the Internet, and on some machines, they would not display. I'd receive an IE error "The page cannot be displayed".

I finally decided to look into it. The solution is explained in the KB902225

The specific thing that worked for me was:

  1. Right-click the CHM file, and then click Properties.
  2. Click Unblock.
  3. Double-click the .chm file to open the file.


Share/Save/Bookmark

Tuesday, May 29, 2007

LogParser

I just added an essential tool to my toolset. Microsoft LogParser. This great tool allows running of SQL queries against a variety of log files and other data sources. Here's an example query

 

SELECT date, REVERSEDNS(c-ip) AS Client, COUNT(*) FROM IISLOG.log WHERE sc-status<>200 GROUP BY date, Client

The same can be ran against event logs, registry, csv, xml files, and much much more.

The link to Microsoft download site is: http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en

There is also a great helper site: www.logparser.com with a large collection of scripts to help with the more complicated admin tasks.


Share/Save/Bookmark

Monday, March 26, 2007

New Sansa e260 + USB connectivity through a keyboard = almost system rebuild...

I just got myself a Sansa E260 MP3 player. A pretty good deal for $95 at Buy.Com after Google Checkout

Its a pretty nice device. Plays everything I need it to play - WMA, MP3, Video (after conversion - pretty annoying), Images (After conversion - again pretty annoying), Radio. The UI is OK. Reminds me of a mix between Windows Media Center and IPod. I think IPod is easier to navigate, but Sansa is still not bad at all. For $95, its a great little toy.

I connected it at home to me Vista laptop with no issues at all. Everything worked like charm. So I brought it to work and decided to copy the latest hanselminutes podcast to it. That's when the trouble started.

I have a media USB keyboard from Dell. Nothing special, a default keyboard that came with the system. It can (or rather should) act as a USB hub providing 2 extra USB plugs. I should mentioned, that I never used it as a hub before, and just assumed that it worked. I plugged the Sansa in, and ..... Nothing happened. Media player did not show the device. Running "Add hardware" wizard showed a nice little dialog: "you can install only one device at a time". Rebooting didn't help. Google search found a few articles about the error with almost all of them pointing to a specific registry - "Remove the key and reboot". Well.... Being adventurous - I do exactly what the posts suggest. After the reboot - I see a "Windows XP Setup" screen as the first window, Before any network logons, startup scripts, etc... After rebooting in safe mode, windows brings up an error message: "Setup can not run in safe mode" and reboots. The "Windows XP Setup screen" starts up again and system looks hung up, with only occasional HardDrive light. After 30 minutes or so, I decide that I might have to rebuild it - or at least repair from the DVD.

In another 30 minutes or so, the system finally starts up, and seems normal. However, the original problem is still not fixed. The Sansa still does not connect, the "Add new hardware" wizard still does not start up. So I decide to go back to basics. Crawl under my desk, and plug it into the back of the machine. Hooray, it works like a charm. The system recognized it within 10 seconds, brought up WMP, and showed it as the device.

So... Lessons learned:

  1. Minimize experiments unless you have spare machines or multiple harddrives. (I have both so I was able to work while my main system is down, and rebuild OS still keeps all my important files intact)
  2. KISS - Keep it simple. When you need to plug in the new device - don't use the USB keyboard as a hub if you never did it before. Go straight for the USB port you trust.
  3. DO NOT SCREW AROUND WITH REGISTRY. Especially based on forum posts unless you completely trust people who trust them


Share/Save/Bookmark

Wednesday, March 14, 2007

Synchronize to Internet Time on Windows Vista

Here's an easy tip to keep your computer's time up to date.

Windows Vista will synchronize to Internet time clocks on regular intervals. To force the synchronization,

  • Right Click on the clock in your task bar and select "Adjust Date/Time"
  • Select "Internet Time" tab
  • Click on "Change settings...." button
  • Click "Update now" button

That's all.


Share/Save/Bookmark
Directory of Computers/Tech Blogs