Announcing TypeScript 1.0RC

Its nearly at v1 level..

Some nice additions in v1.0rc, including:

  • use of ‘any’ in interfaces and subclassing
  • interface merging

Anway.. stroll along to…

http://blogs.msdn.com/b/typescript/archive/2014/02/25/announcing-typescript-1-0rc.aspx

Posted in Uncategorized | Comments Off on Announcing TypeScript 1.0RC

How to avoid using Unix touch command on Windows…

In my company we have a strange habit of using third party tools to do the most trivial things rather than using the native features.

A recent example of this is the use of the “Unix” touch command on Windows. It turns out it is quite simple to avoid having to install cygwin or an-other Unix command tools and just use a simple batch file or using the appropriate tasks in MsBuild or Ant.

The batch file solution, is not a perfect solution as I suspect if the file is very large the “copy to self” could take a while but for general developer use it works just fine.

So my touch.bat is simply…

Windows touch.bat

@echo off
for %%i in (%*) do (
  if exist %%i (
    echo Updating timestramp for file : %%i
    copy /b "%%i" +,,
  )

  if not exist %%i (
    echo Creating zero length file : %%i
    copy nul %%i
  )
)

If you are using msbuild, then it has a “Touch task” and similarly if you are using Ant it too has a Touch Task

Lastly if you are using powershell it can be done with a simple function:

function touch
{
  $file = $args[0]
  if($file -eq $null) {
    throw "No filename supplied"
  }

  if(Test-Path $file)
  {
    (Get-ChildItem $file).LastWriteTime = Get-Date
  }
  else
  {
    echo $null > $file
  }
}
Posted in fun, Microsoft Visual Studio, Tips, Windows Batch | Comments Off on How to avoid using Unix touch command on Windows…

Re-using COBOL rather than converting it to C#

While reading a article on-line about using “NACA transcoder” to translate COBOL into Java
it got me thinking about modernizing COBOL.

While I agree 100% about the actual code generated by the NACA transcoder is not
maintainable, I disagree that converting it to C# helps you modernize the code is
the only solution.

Using Visual COBOL the same code can be cut-pasted into a Class that exposes itself
in the same way as the C# he produces. Moving a legacy COBOL program into a Class
is just one way of reusing COBOL but in order to compare like with like, below is
the actual COBOL Class. This COBOL class can be compiled using Visual COBOL to
a .Net assembly or Java bytecode.

class-id Example public.

working-storage section.
01 COMPANY.
 05 COMPANY-NAME        PIC X(60) VALUE "Semantic Designs".
 05 COMPANY-ADDRESS.
  10 STREET PIC X(80)    VALUE "13171 Pond Springs Rd.".
  10 CITY.
   15 CITY-NAME           PIC X(40) VALUE "Austin".
   15 FILLER              PIC XX VALUE ", ".
   15 CITY-STATE          PIC XX VALUE "TX".
   15 ZIP.
    20 ZIP-5              PIC 9(5) VALUE 78729.
    20 FILLER             PIC X VALUE "-".
    20 ZIP-E4             PIC 9(4) VALUE 7102.
01 LINE-ITEM.
 05 ITEM                  PIC X(20) VALUE "Item Description".
 05 AMOUNT                PIC 999 VALUE 217.
 05 PRICE                 PIC 9999V99 VALUE 24.95.

77 TOTAL-AMOUNT           PIC 999999V99.
77 DISCOUNT-THRESHOLD     PIC 999999V99 VALUE 1111.11.
77 DISCOUNT-PERCENT       PIC 99 VALUE 20.
77 DISCOUNT-AMOUNT        PIC 99999999V99.

01 TOTAL-AMOUNT-FORMAT    PIC 999999.99.
01 TotalAmount            string public.

method-id ComputeTotal.
procedure division.
  MULTIPLY AMOUNT BY PRICE GIVING TOTAL-AMOUNT.
  IF TOTAL-AMOUNT > DISCOUNT-THRESHOLD
   MULTIPLY TOTAL-AMOUNT BY DISCOUNT-PERCENT
    GIVING DISCOUNT-AMOUNT
  DIVIDE 100 INTO DISCOUNT-AMOUNT
  SUBTRACT DISCOUNT-AMOUNT FROM TOTAL-AMOUNT.

  move TOTAL-AMOUNT to TOTAL-AMOUNT-FORMAT
  set TotalAmount to TOTAL-AMOUNT-FORMAT
 goback.
end method.

method-id. DisplayTotal.
procedure division.
 DISPLAY COMPANY-NAME.
 DISPLAY "Total: ", TOTAL-AMOUNT-FORMAT
end method.

method-id. PerformTask.
procedure division.
 invoke self::ComputeTotal()
 invoke self::DisplayTotal()
end method.

end class.

A C# program that uses the class above…. the same can also be done with Java…

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UseExample
{
    class Program
    {
        static void Main(string[] args)
        {
            new Example().PerformTask();
        }
    }
}

Another approach would be keep the legacy COBOL and create a wrapper class
that just uses the legacy COBOL.

       class-id Example2.

       working-storage section.

       method-id ComputeTotal.
       procedure division.
           call "COMPUTE-TOTAL".
       goback.
       end method.

       method-id. DisplayTotal.
       procedure division.
           call "DISPLAY-TOTAL".
       end method.
       
       method-id. PerformTask.
       procedure division.
           invoke self::ComputeTotal()
           invoke self::DisplayTotal()
       end method.

       end class.

Then to make the DISPLAY-TOTAL, COMPUTE-TOTAL accessible to the class add two entry-points so
they can be used with the CALL verb eg:

        EXTERNAL-EPS.
          
        ENTRY "DISPLAY-TOTAL".
           PERFORM DISPLAY-TOTAL.
           GOBACK.
           
        ENTRY "COMPUTE-TOTAL".
           PERFORM COMPUTE-TOTAL.
           GOBACK.

I personally think this it is quite a reasonable way to reuse COBOL…. plus the same code works under CLR
and JVM…. bonus….

Posted in CLR, COBOL | Tagged , , , , , , , | Comments Off on Re-using COBOL rather than converting it to C#

Visual Studio 2012 RC – Menus in CAPS

I like a lot of changes gone into Visual Studio 2012 but the one I had is the “Menus in CAPS”, luckly we have a registry workaround!

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General\SuppressUppercaseConversion
REG_DWORD value: 1

Or via PowerShell:

Set-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\11.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1

So lets say goodbye too…

If you want make your voice heard, go and vote for it being set back @ http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2837384-change-all-caps-menu-in-vs-rc-to-vs-beta-format-fi

Reference: https://connect.microsoft.com/VisualStudio/feedback/details/745767/menu-is-all-caps

Posted in Microsoft Visual Studio | Tagged | Comments Off on Visual Studio 2012 RC – Menus in CAPS

Building a better pogoplug.

A while ago I purchased a pogoplug as a means of sharing photos with my family but its use never really happened because the interface they provided is clunky for hi-res pictures/video.. and some of the family failed to consistently download things.. so it was not a success.

The pogoplug device should have allowed me to view my pictures on my dnla enabled samsung tv but it failed too…

So much for a personal cloud solution!

After this I started to use the device as a backup device/synchronisation store after enabling ssh and building a rsync executable.   This worked well… but seems liked a waste of a device that is always on.

I then formulated a plan:

  • the pogoplug software uses linux, so if I replace it with something more open I can make better use of it,  Arch Linux for arm is a good fit for me.
  • after installing Arch linux I need some software to make it useful:
    • mdns, so I can easily find the pogoplug
    • rsync for backup’s
    • git for private source repository
    • minidnla server for viewing the pictures
    • personal dropbox solution, the two that look hopeful are:

So far, I have installed Arch Linux, setup rsync, setup a small private git repository and the minidnla server and to my surprise it is working out much better than the pogoplug solution provided by them..  perhaps not for the inexperience but it works well and feels more future proof!

So what have I now got? Well I have a open source based solution that is always online, visible to the TV, used as a backup device and low-powered…   I’m happy..

Posted in pogoplug, rsync | Comments Off on Building a better pogoplug.

rsync & permission denied/operation not permitted & arch linux

I use rsync to sync directories between machines but one of my machines kept screwing up the permissions, I finally get time to track the “Operation not permitted” issue and it turned out to my vfat backup drive not being mounted under the right uid.

Coming from the old school Unix background, I thought updating /etc/fstab would be enough but due to this auto mount system it is done differently 😉 …

It turns out you need to change the rules for the auto mount via file /etc/udev/rules.d/11-media-by-label-auto-mount.rules

So what did I need to change? Well it turned out to be simple uid= to match the uid of my normal user (use id xxx, where xxx is your username)

Below are the changes:

ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", 
ENV{mount_options}="$env{mount_options},utf8,
uid=501,gid=100,umask=002"

[ad#Google Adsense-1]

Posted in pogoplug, rsync, Tips | Tagged , , , , , , | Comments Off on rsync & permission denied/operation not permitted & arch linux

Metro up Java

Microsoft’s Metro environment is a bit of a closed environment for the Open Source language vendor, so although you can code Metro applications in C/C++, C#, HTML/JavaScript/CSS on both Intel and ARM chipsets the choice of other languages are non-existent.

So where does this leave the JVM community, Perl or Ruby communities, well frankly unless they get started promptly then they will be stuck on the Desktop and not in Metro, though at first this does not seem such a bad thing. It does preclude apps being delivered to the user via the AppStore which are solely for the domain of the pure Metro applications

So it is possible to get Java, Perl or Ruby running in Metro given that we now have a reduced set of Windows APIs in WinRT framework plus the ability to execute dynamic code or even use LoadLibrary, Assembly.Load is now gone…

Well I think these languages might well have to look at embracing the CLR if they want to place nicely with Metro 🙂

Posted in Java, Metro, Windows8 | Tagged , , , , , , , | Comments Off on Metro up Java

Windows 8 Developer Preview on VirtualBox

Although I got a developer preview samsung Windows 8 tablet at the Microsoft Build event I do like to use Virtual machine whenever possible because they are very useful.

I have managed to get Windows 8 installed on VirtualBox on the Mac and PC. However the default size of the screen is rubish due to the lack of additions support, however you can get VirtualBox to include a custom video mode and this works. Todo this I used the command line:

VBoxManage setextradata "Windows 8" CustomVideoMode1 1366x768x32

Then start the VM and select the new resolution...

Next blog I will document some of the keyboard keystrokes I find useful for the Metro interface...

Posted in Windows8 | Tagged , , , , , , | Comments Off on Windows 8 Developer Preview on VirtualBox

Heroku add Java support but dumps containers!

Recently I have reviewing various cloud solutions and what impact this has on the way you create/architect applications and I have come to the conclusion they are often way too complicated for most existing applications to be effectively hosted in the cloud in a scalable way.

However I was very surprised to see Heroku have introduced support for Java but I was more surprised to see that they have chosen not to include JEE container support.

Which on first thoughts seems odd but given the complexity of implementing a multi-language solution within their environment a JEE container would be an unnecessary hinderance in the performance/scalability of the application.

So yeah… good choice, I wonder if anyone else will drop the JEE container too in their Java/Cloud solutions?

Posted in Heroku | Comments Off on Heroku add Java support but dumps containers!

Motorola XOOM 3.1 update for Europe

My beloved European XOOM finally is getting Android 3.1 support… Boy have I had to be patient…

Android™ 3.1 for Motorola XOOM™ will soon be available over the air to all Motorola XOOM users in Europe. We expect the over-the-air deployment to begin in early August, with the package being available for pull by August 9th.

Posted in Uncategorized | Comments Off on Motorola XOOM 3.1 update for Europe