Tuesday, December 27, 2011

Reboot Windows From macosx RDP session

There is a lot of confusing key combinations out there but essentially this is my recipe on my MacOSX 10.6.x with RDP "Remote Desktop Connection Client for Mac" by Microsoft v2.0.0.0
  1. perform a show desktop which is really minimize all running applications on the Windows side in the RDP session.
  2. click on the desktop of the Windows side in the RDP session and hit Fn-Option-Command-F4 and you will get presented with the Restart/Shutdown/Lock options on the windows machine

Wednesday, December 21, 2011

Windows Uptime

open a cmd session and type
751818@LC4QKTK1 ~
$ date
Wed Dec 21 16:21:28 EST 2011

751818@LC4QKTK1 ~
$ net statistics server
Server Statistics for \\LC4QKTK1


Statistics since 12/21/2011 12:41 PM


Sessions accepted                  1

Wednesday, November 16, 2011

Switch/case with regular expressions in Perl

Creating a switch/case in perl with regular expressions are the input, similar to bash' wildcarding.
sub adjusttype {
 my ($record) = @_;
SWITCH: {
  (
        $y[0] =~ /Local/
    or $y[0] =~ /Announc/
  ) && do { $record->{type} = 'Talk'; last SWITCH; };
  ( $y[0] =~ /and answers/ )
   && do { $record->{type} = 'Question and answers'; last SWITCH; };
  ( $y[0] )
   && do {    # strip the type from the title (if exists)
   $record->{title} =~ s/$y[0]//g;
   $record->{type} = $y[0];
   last SWITCH;
   };
 }

Tuesday, November 1, 2011

For Do Loop in Bash as one liner

Take note of the semi-colons ... that is the key

$ for i in {1..35}; do echo $i; done;

Friday, June 3, 2011

Maven XJC generation XMLSchemaType for date / dateTime missing

I've noticed a mishap with the xsd:date and xsd:dateTime conversions to Java objects. There are posts out there to avoid it or just modify the generated code but thats not what I want.

With the xsd defined as:

The 1.1 version of the com.sun.tools.xjc.maven2:maven-jaxb-plugin will not generate the XMLSchemaType "dateTime" however the 1.1.1 version does generate the correct XMLSchemaType.

By comparison if you choose to use the org.jvnet.jaxb2.maven2:maven-jaxb2-plugin it will generate the XMLSchemaType.

Here the comparison between 1.1 and 1.1.1 of the com.sun.tools.xjc.maven2:maven-jaxb-plugin.



<plugin>
                <groupId>com.sun.tools.xjc.maven2</groupId>
                <artifactId>maven-jaxb-plugin</artifactId>
                <version>1.1.1</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <removeOldOutput>true</removeOldOutput>
                    <schemaDirectory>src/main/schema/</schemaDirectory>
                    <includeSchemas>
                        <includeSchema>**/*.xsd</includeSchema>
                    </includeSchemas>
                    <strict>true</strict>
                    <verbose>false</verbose>
                    <extension>true</extension>
                    <readOnly>yes</readOnly>
                </configuration>
            </plugin>

Thursday, May 5, 2011

cygwin: killing inactive sessions from ps

Its probably not the shortest oneliner however it does the job in CYGWIN.
$ ps -a | grep '^I' | perl -pe '@x=split;print $x[1],"\n";$_=undef'| xargs -i{}
 -t kill -9 {}