Thursday, February 23, 2012

SSO

The following write up covers the results of some research I did for work regard SSO. The purpose was to give a brief high level report of what I had been investigating. It was not meant to cover all technologies investigated or implementation strategies in depth. I thought it might be of some use. This study was done in January of 2008.

SAML SSO Solution

SAML (Security Assertion Markup Language) is an XML-based standard for exchanging authentication and authorization data between security domains. SAML is used to try to solve the Web Browser Single Sign-On (SSO) problem, which is finding a way to allow a user to use several different services without needing to log in several different times with different usernames and passwords. The main componenents of a SAML solution are a service provider, which provides SAML assertions, and an identity provider, which consumes SAML assertions. The Service Provider and Identity Provider are configured to know that they can trust each other.

A SAML Assertion contains:
  •  A packet of security information consisting of header information. The header contains the name of the identity provider and other information such as issue and expiration dates. 
  • The name of the subject.
  • One or more statements.  The two most important statement types are authentication statements and attribute statements.
A principal (often the user) must be enrolled with an identity provider. The identity provider is expected to provide local authentication services to the principal. The identity provider can use any method it wants for authentication, such as LDAP or Active Directory. The principal always communicates with the Service Provider to determine authentication. If the principal is not authenticated, the Service Provider will redirect the principal to the Identity Provider. The Identity Provider will log the principal in, commonly by displaying a log in page shared by all services. Once the Identity Provider has authenticated the principal, it will create an assertion that is provided to the Service Provider. The Service Provider will provide an artifact, which may be used to obtain the assertion, to the the principal. Of course, failure to authenticate the user will provide in failure to obtain access to the server. This allows Single Sign On Functionality, as any principal from any domain can authenticate themselves through Service Provider calls. A domain can check the status of a user by providing the SAML artifact and examining the resulting SAML assertion. More commonly, the Service Provider will redirect the principal to the service they requested after the Service Provider determines the principal is authenticated.

In addition to SAML, the Liberty ID-FF standard was investigated in addition to SAML. Liberty ID-FF is an extension to SAML version 1.0. Its primary difference is that it provides what Liberty called a circle of trust, which allowed policies to be defined to let domains know they can trust each other. SAML version 2.0 represents the convergence of Liberty ID-FF and other proprietary extensions, as well as early versions of SAML itself.

Sun Access Manager

Sun Access Manager was the first application I evaluated as a SAML Service Provider and Identity Provider. Tutorials proved to be difficult to follow and many supporting technologies were required to use Sun Access Manager for SAML purposes. Ultimately, I switched to the newest version of Sun Access Manager, which was OpenSSO. OpenSSO was not only being actively developed, but it already contained the supporting technologies Sun Access Manager had required for SAML.

OpenSSO

OpenSSO is Sun's open source access management and federation server platform. It is configured via an admin web interface and contains a rich Java API. The Java API defines communication between clients and OpenSSO. The Java API also contains interfaces so that developers can design plugins, or modules, to OpenSSO. The downside to OpenSSO is its complexity and flexibility. OpenSSO is so huge and does so much that it takes a lot of time to learn about it, despite only needing to do one small thing. OpenSSO is a combination of several different Sun Technologies and so has a very large amount of documentation. OpenSSO is also fairly new, although its underlying technologies are not, which make it difficult to find independent tutorials. Sun's OpenSSO documentation can be found at http://docs.sun.com/app/docs/coll/1767.1.

Authentication Service

The Identity Provider provides authentication. The identity provider to be used was OpenSSO, which provides authentication services through plugins. Three built-in plugins included LDAP, Active Directory, and OpenSSO's internal data store. There were many other plugins along with an interface to create custom authentication plugins. This provided confidence that OpenSSO could interact with any client's authentication service. LDAP, Active Directory, and OpenSSO's internal store were all investigated so that they could be used for flexibility demonstration purposes. Tutorials were found for all three services and all authentication services were set up successfully.

An SSO Solution

The identity provider will be OpenSSO. This will require an authentication service to be configured and populated. OpenSSO will also need to be configured as an identity provider. No plugins will need to be written unless the authentication service chosen to be used is not supported, which is an unlikely case.

The Service Provider can be either OpenSSO or a custom server. Creating a custom server would give a project more control, but would require writing code to parse SAML artifacts and assertions, as well as code to communicate with the Identity Provider. The SAML specification is not trivial, so this would be a lot of work to do correctly. It would probably be easier to use OpenSSO as the service provider. This would likely require writing OpenSSO plugins to circumvent certain redirections. This will also require a lot of OpenSSO configuration.

Code will also need to be written to retain artifacts, transport artifacts, and communicate with Service Provider to obtain assertions. Code will also need to be written to parse assertions, but this will most likely be accomplished through the OpenSSO API.

Weblinks

The following is a brief collection of web urls with information to help someone to implement the strategy described in the SSO Solution section.

A Good Overview of SAML: http://en.wikipedia.org/wiki/SAML
Directions to using OpenSSO as an IdP with Google as an SP, which will allows you to set up a working demonstration:
http://blogs.sun.com/wahmed/entry/how_to_federate_with_google
Directions to configuring OpenSSO as an SP: https://www.enterpriselab.ch/wiki/doku.php?id=public:opensso_sp_shib20_idp
OpenSSO SAML API: http://docs.sun.com/source/820-3739/index.html

Open SSO Token

Although the SAML approach is viable, it would take too much time to implement at this point in time. The introduction of a Service Provider and an Identity Provider would have added a significant amount of work, time spent debugging, and time spent spent documenting, especially in conjuncion with OpenSSO. A much less time consuming approach would use OpenSSO Tokens through the OpenSSO API. In this approach, only one OpenSSO instance is required. The OpenSSO instance will consume authentication requests and provide OpenSSO Tokens. It will also consume OpenSSO Tokens to provide OpenSSO assertions, which are collections of information about the principal whose authentication produces the OpenSSO token. Using the OpenSSO Token is a much simpler Single Sign On solution.

The downside is that SAML is a standard where the OpenSSO Token is not. However, using the OpenSSO Token still allows interaction with whichever authentication service a client is using. Furthermore, SAML functionality could be added given more time.

Sunday, February 19, 2012

Learning Programming

My advice to a friend who wanted to learn about programming:

Honestly, for beginning programming, the best thing to do is to think of something you want to make and then try to make it.  I started with websites.  Books can sometime take the fun away from learning and learning because of passion is really the best way to go.

But if you want a guide, I think eloquentjavascript is a pretty good, easy to get into, thorough, interactive beginners book.  It uses Javascript, which is generally used to make web pages interactive, but is a full language on its own.  There's a bar at the bottom of the page you can click to open up a console, in which you can type and execute code.  The book is pretty easy to understand, yet covers the basics pretty well.  I would probably recommend this book the most: http://eloquentjavascript.net/contents.html

I read through this book on Ruby (which is recently popular for building the back end of websites) before and I liked it a lot.  Ruby is a very fun language to use and this is one of the more straightforward beginner's guides out there for any language: http://www.ruby-doc.org/docs/ProgrammingRuby/html/index.html

The book I mentioned when you came up is K&R's C Programming Language.  It covers C, which is an important language mostly used today for applications that require excellent performance.  The book is very, very good, but it's a lot more difficult to work through because of the nature of C and also the difficulty of getting C programs to run on your machine.  Because it's C, you get into the nitty-gritty of things kind of too early. This is a great book and more important than the ones above, but it's probably best to work through at least one of the two books I listed above first: http://www.iu.hio.no/~mark/CTutorial/CTutorial.html

The language you start out with doesn't matter much.  You can think of Programming Languages like web browsers... they all really do the same thing, but in slightly different ways.  You can also think of languages like tools, you use different ones depending on the job you want to do.  Sure you can use a hammer to get a screw in, but it's not the best way of doing it.  Which language you start out with doesn't matter, but you might make your choice depending on what type of thing you want to program.  Javascript/HTML/CSS/Flash for front end websites, Ruby/Perl/Python/Php for back end websites, C/C++ for high performance applications, Java for business applications, Scala/Haskell/Lisp/Schema for algorithmically complex languages.

Good luck learning.  Maybe read two chapters from each book and decide which path you want to take.


P.S:  As for my favorite beginner's guide... probably this one: http://mislav.uniqpath.com/poignant-guide/.  It's probably way too absurd and time consuming to be an actual good programming guide, but it's certainly fun.

Monday, January 23, 2012

Extended Cron

I wrote a Reminder/Notification program for Windows called Reminder 19 (you can check it out at http://reminder.relic19.net.)  I wanted to be able to cleanly define many different kinds of alert schedules and decided to use cron as my starting point.  I ended up extending the format because I wanted to have things like time delayed alerts and a year field.  This is the format I came up with... I think it's pretty expressive.  The only way I think it would be more expressive is if I added conditional alerts (for example, an alert should be shown on the 31st if the month has 31 days, otherwise it should be shown on the 28th).

Format 1: Advanced Schedule By Dates and Times
  +------------------ minute (0 - 59)
  |  +--------------- hour (0 - 23)
  |  |  +------------ day of month (0 - 31)
  |  |  |  +--------- month (1 - 12)
  |  |  |  |  +------ year (number between 1700 and 9999)
  |  |  |  |  |  +--- dayOfWeek (0 - 7, 10-17, 20-27, 30-37, 40-47)
  |  |  |  |  |  |  + optional command and parameters
  *  *  *  *  *  *  *

Each of the patterns from the first six fields may be either a single in range number, * (the asterisk character, which means the field matches all legal values), or a list of in range numbers separated by commas (such as 2,3). There may be no spaces following commas and fields may not end with a comma.  There is also an optional special seventh field.

The hour field (field 1) is specified using the 24-hour format.  0 is 12 AM, 4 is 4 AM, and 15 is 3 PM.

The month field (field 4) is defined as a number, where 1 is January and 11 is November.  Alerts will not be shown for non existent days, such as September 31.  Please note that an alert will not show on September 30 instead.

For the day of the week field (field 6), both 0 and 7 are considered Sunday.  The dayOfWeek field can be two digits, where the first digit represents its position in the month and the second digit is the day of the week.  For example, 31 would mean the third Monday of every month.  A position of 0 means every postion, so 03 means every Wednesday.  In deciding the next wake up time between, for example, the 1st and 31st, the soonest wake up date is chosen.

An alert is shown when the time/date specification fields all match the current time and date. There is one exception: if both "day of month" and "day of week" are restricted (not "*"), then either the "day of month" field (field 3) or the "day of week" field (field 6) must match the current day (even though the other of the two fields need not match the current day).

The command field (field 7) is completely optional.  If it is present, then an attempt will be made to execute the command.

Example 1:
00 16 1,2,31 2,3 2008 1,45
This alert specifies the following date and times:
February 1, 2008 at 4:00 PM
February 2, 2008 at 4:00 PM
February 4, 2008 at 4:00 PM (A Monday)
February 11, 2008 at 4:00 PM (A Monday)
February 18, 2008 at 4:00 PM (A Monday)
February 22, 2008 at 4:00 PM (The fourth Friday)
February 25, 2008 at 4:00 PM (A Monday)
March 1, 2008 at 4:00 PM
March 2, 2008 at 4:00 PM
March 3, 2008 at 4:00 PM (A Monday)
March 10, 2008 at 4:00 PM (A Monday)
March 17, 2008 at 4:00 PM (A Monday)
March 24, 2008 at 4:00 PM (A Monday)
March 28, 2008 at 4:00 PM (The fourth Friday)
March 31, 2008 at 4:00 PM (The 31st and a Monday)

Example 2:
00 4,16 * * * * "C:\Program Files\Internet Explorer\IEXPLORE.EXE" ? http://www.google.com
Every day at 4 AM and 4 PM, an instance of Internet Explorer will be launched that navigates to http://www.google.com.


Format 2: Advanced Schedules by Time Delays
  +------------------ the start minute (0 - 59)
  |  +--------------- the start hour (0 - 23)
  |  |  +------------ the start day of month (0 - 31)
  |  |  |  +--------- the start month (1 - 12)
  |  |  |  |  +------ the start year (number between 1700 and 9999)
  |  |  |  |  |  +--- increment in minutes (+[number of minutes to delay])
  |  |  |  |  |  |  + optional command and parameters
  * * * * *  *  *

No field in this format may be * (an asterisk character.)  Field 7 (the command field) is optional, but all other fields must be defined.

Each of the first 5 fields must be a single number in the specified ranges.  They will be used to define the start date.

The hour field is specified using the 24-hour format.  0 is 12 AM, 4 is 4 AM, and 15 is 3 PM.

The months are defined as number, where 1 is January and 11 is November.

For "increment in minutes" field (field 6), a non-negative number must be specified, prefixed by a '+' character.  The number represents the number of minutes to wait between alerts.  For example, +59 means that the alert will be triggered every 59 minutes after the start date.

The command field (field 7) is completely optional.  If it is present, then an attempt will be made to execute the command.

Example 1:
00 00 31 3 2008 +30
This alert will be shown every 30 minutes after March 31, 2008 at 12:00 AM.  So the first alert will go off at March 31, 2008 at 12:30 AM, the next alert will go off at March 31, 2008 at 1:00 AM, and so on.

Example 2:
00 00 31 3 2008 +60 "C:\Program Files\Internet Explorer\IEXPLORE.EXE" ? http://www.google.com
This alert will be shown every 60 minutes (one hour) after March 31, 2008 at 12:00 AM.  So the first alert will go off at March 31, 2008 at 1:00 AM, the next alert will go off at March 31, 2008 at 2:00 AM, and so on.  Whenever an alert goes off, http://www.google.com will be launched in Internet Explorer.

Wednesday, January 18, 2012

Decoding Text Formats

Occasionally, you're get text documents in different formats.  I'm a plain text kinda guy.  I like that it's really flexible.  Anyway, here's a list of decoders I used.  These have been virus and functionally tested.

CHM Decoder (CHM to HTML) - It's useful to me because sometimes the text is too small to read on a CHM and there's no nice way I know of to increase the font size.  You can download it at: http://www.shareup.com/CHM_Encoder-download-26404.html

CLIT (LIT to HTML) - I found a similar program to convert LIT files to HTML.  Although it has a slightly unfortunate name, it works really well.  You can download it at: http://www.convertlit.com/download.php

Sunday, September 11, 2011

ReNamer


I wanted to replace a lot of text in filenames without any hassle, so I quickly looked for a program to do it for me.  The first program I tried worked perfectly, had no installation process, and had a "no install" version (the archive version.)  So, if you need to rename files easily, I suggest giving this a program a try.

Try out ReNamer

Monday, May 16, 2011

C# Notes

I made a stupid C# mistake today. In the constructor of my form, I had an OpenFileDialog.Show() call (to get the name of a file to operate on.) When I ran the program, the OpenFileDialog would show as expected. But after I pressed okay, the main application would not be the focused window.

It took me too long to figure out that since I was calling OpenFileDialog in the constructor, the Application wasn't initialized yet and so the OpenFileDialog.ShowDialog() was using another window as its parent. Using the call OpenFileDialog.ShowDialog(this), where this is the current form, made everything work as expected.

Another problem I had was not being able to exit the program by calling Application.Exit() in the constructor. Apparently, the Application isn't initialized before the constructor returns. So I'd either have to throw an exception for whoever is calling Application.Run() or else use the Environment.Exit(). I went with Environment.Exit()... not sure if there's any reason not to.

I spent a long time trying to figure out why I couldn't set an item as selected for a ListView by setting the Select property to true. Apparently, you're supposed to call ListView's Select method. I should look into this more.

More:

Use the Shown Callback in forms if you want to do stuff to controls outside of the contstructor but before things really start running. In the constructor, there are no event handlers and you can't exit the application without using Environment.Exit.

If you want to use a checkbox in a list view, that is built in. If you're listening for items checked, make sure you don't add the ListViewItem to the list until the checked value is correctly set.

When I first started .Net development, I couldn't get the KeyDownEvent listener to work for my form. It turns out I forgot to change the form's KeyPreviewProperty to true.

Monday, May 09, 2011

iPhone Pains

Man, at this point I wish I had gone with an Android phone instead of an iPhone. But I have too much time and money burned (NOT INVESTED) on the iPhone to make it worthwhile. My laptop died last month (I think Taiwan's summer destroyed its ability to stay cool.) I used that laptop to sync with my iPhone and because of the way the iPhone is designed, I needed to resync with iTunes on a new computer, which would delete all my music and playlists. Luckily, the hard drive from my busted laptop was still good so I could get my music. Otherwise, I would need to spend A LOT of time looking for safe, trustworthy programs to get my music off my iPhone. I've heard they exist, I just don't want to spend the time figuring out what they are and how to use them safely.

So I needed to copy all the music from the laptop onto a new computer. I ended up using an old Mac Mini I had lying around, (might as well find a use for that expensive lesson on how I do not enjoy developing iPhone software in my freetime.) I needed to figure out how to copy all my playlists (hint: figure out where your iTune's library.xml file is and import it. Use some text editing software and do a "replace all" on your music directories from your old computer to where they live on the new computer.)

I spent an entire evening doing all of this, which was really annoying. I really, really wish I didn't have to jump through all these hoops to add new music or to sync other items with my iPhone. While the iPhone is pretty, using it requires so much awkward hoop jumping that one day, I know I'm just going to give up on it.

Advice to a man for a successful marriage

Okay, today I'm going to share one of the secrets to a successful marriage (for the husband.) This secret was passed down to me by a wise former boss of mine. Here's what he told me:

"At some point, especially in the beginning of marriage before she learns better, she will inevitably ask you to make a choice. This should be your most frequent response:

1. Slowly look over each choice. You don't have to really care, but it needs to appear like your thinking about them.
2. Pause until the count of 3.
3. Ask her what she thinks. She will have an opinion. You must make her voice it.
4. Reply: Y'know, that's what I was leaning for too. Let's go with that one."

This works very well, just don't be too obvious. And remember, in an argument, it's not a question about who is right or who is wrong. It's just about who cares more. I read that from Scott Adam's blog, and although I don't always agree with him, I agree with him in that.

(Yes, in case you're worried, there's loads of sarcasm in this entire post, Maybe. Ha ha.)

Wednesday, May 04, 2011

Subversion

Notes I wrote up in 2006 regarding subversion. It functions as an intro guide to subversion, both as a client and as an administrator.

I've been using subversion (nope, not a git guy yet) for most of my own work, I even got our projects at my current job onto subversion. It's much better than source safe/offsite (which I used at a previous job) and I even prefer it to CVS. Subversion is designed specifically to be a modern replacement for CVS and shares a number of the same key developers. It uses a copy-modify-merge for file sharing. To read more about subversion, you can read their very good documentation at http://svnbook.red-bean.com/. The following is a link to an appendix from the svnbook that introduces subversion for cvs users. I think that it will be a very helpful and painless way to quickly understand subversion with a cvs background. You can read it starting at http://svnbook.red-bean.com/en/1.2/svn.forcvs.html.

Monday, May 02, 2011

Executing Java from VBScript

This post is simple, it's just some Visual Basic Script for executing a jar and keeping the text output in a variable:

  1. Set objShell = WScript.CreateObject("WScript.Shell")  
  2. Set objExecObject = objShell.Exec("java -classpath JavaCode.jar JavaClassName")  
  3.   
  4. Do Until objExecObject.StdOut.AtEndOfStream  
  5.  Results = Results + " " + objExecObject.StdOut.ReadLine()   
  6. Loop  

Wednesday, April 27, 2011

Copy Your Hard Drive with Windows 7

I got a new SATA hard drive and decided to make it my primary drive. My current hard disk was IDE and was pretty old, so the decision made sense. But I really didn't want to reinstall everything, so I looked into copying the old hard disk into the new one. This is called Disk Cloning and there are lots of programs that do this. I just wanted the easiest way.

I first looked into Hiren's Boot CD because I had used Hiren's Recovery Tools before. You burn a CD, boot from it, and one of its tools clones the hard drive. I was too lazy to create a boot CD, so I read on. I read about Clonezilla, Aconis (not free), and Paradigm (maybe free?), which all required you to make a system image (a file that's a snapshot of a hard disk), but ultimately decided I didn't want to look into third party software if possible. (It takes me a while to read enough to convince myself that third-party software isn't going to mess up my computer and is going to be user friendly enough to use.) I'm using Windows 7 and read that the built in Backup and Restore program worked well. I didn't have to download anything or burn anything, so I decided to try that first.

To use it, you need:

  • The Windows 7 Installation CD (or you'll need to create a system repair CD)
  • Your original hard drive
  • Your new hard drive
  • And some other storage system (DVDs/External Hard Drive/Internal Hard Drive) to store the image of your original hard drive.

WARNING: The new hard drive and other storage system must be at least the size of your original hard drive. The other storage system CAN NOT be the new hard drive.

To use Windows 7's backup and restore tool:

  1. Go to Start Bar -> Control Panel -> Backup and Restore -> Create a System Image
  2. Choose where you want to store the image and press next
  3. Choose the drive (the other storage system) you want to back up and press "Start Backup"

It took about an hour and a half to create a backup image for a 200GB system. When the backup is done, shut down your machine.

THIS IS IMPORTANT: You now need to unplug the power to your original hard drive (or otherwise remove it from your system.) Your new hard drive and other storage system must remain accessible.

Then boot from your Windows 7 Installation CD (or a system repair disk.) You'll get the Windows 7 Installation Menu. Choose your language, then choose "Restore from System Image."

The system image you just made should already be selected. Choose it and press next.

By default, the system restore program will take every hard disk on your system (except for the one holding the system image), delete it, format it, and restore the system image on it. So make sure to exclude any hard disks you don't want to be replaced on the next screen, then continue.

When I first tried this, I got an error that said no suitable disks were found. I wasted half an hour trying to figure out what was wrong. I ended up needing to cancel, select "Command Prompt" from the tools menu, and then doing the following:

  1. Type "diskpart"
  2. Type "select disk=disk0"
  3. Type "detail disk"
  4. (Read the output and make sure this disk is the new hard drive)
  5. Type "clean"
  6. Type "exit"

Select "Restore system from System Image" and this time there hopefully won't be an error.

Your system should restore and you should boot up into windows (you may need to go into your system BIOS to make sure your new drive is set as a boot device.) You can shut down the computer and plug your old hard disk back in if you'd like to continue using it for storage. Make sure it's not your primary boot device in BIOS! If windows doesn't show the old drive, you may need to right click "My Computer", select "Manage", select "Disk Management", and then right click your old drive and select "Online."

When I finished switching my primary drive, I brought up my Windows System Rating. Up to a 5.9 ... ... ... ... it makes me want to upgrade my machine more. Microsoft and your achievement points.... *sigh*

English Challenge

While I was in Taiwan, I would meet with Taiwanese students to exchange language. I'd help them with their English for an hour, then they would help me with their Chinese for an hour. It was a lot of fun.

Before doing it, I didn't fully realize how difficult a language English was. The grammar has so many special cases and confusing rules. Just being able to read a word doesn't necessarily help you with its pronunciation, there is a lot of memorization. Case in point, try reading this poem named Chaos: http://www.hep.wisc.edu/~jnb/charivarius.html

I still think English is easier to communicate in than Chinese. Even if you mangle the sounds up or use very messy grammar, you're still understandable... you just sound like a foreign speaker. If you mangle Chinese sounds or grammar, there's a good chance you won't be understood.

Tuesday, April 26, 2011

Taiwan Visa and Visa Extension

So, I went to Taiwan over the summer to study Chinese. I'm American and I was there for a little more than three months, which means I needed a Vistor Visa and that I needed to extend my Visa while I was there.

I live in California, San Diego. The nearest Taiwan embassy was in Los Angeles (which is about a 2 hour drive away) and I didn't have enough time to do my Visa through mail. The embassy is only open on weekdays, so I chose a day and drove through traffic to get up there. The office was not too easy to find. It's on the 4th floor of some huge building with a bank of the first floor. The visa application process itself was a lot smoother than I expected and the line moved pretty quickly. As long as you have your passport and proof of a reason to need a Visitor Visa, you're good to go. You do need Passport Photos, but you can take them once you're there. You can make free copies of documents there as well.

I expected them to have to mail the visa back to me, but it actually only takes a few hours to process. So I went out to lunch and picked up my Vistor Visa before I left LA. You have the option between a single visit and multiple visit visa. A multiple visit visa allows you to leave the country during your stay without voiding your visa. I got the single visit visa because it was faster to process and slightly cheaper. In the end, I wish I got a multiple visit visa so I could have taken weekend trips out.

The Visitor Visa is only valid for about two months, so if you're going to be there for longer than two months, it needs to be renewed from Taiwan. (Multiple Visit Visa will be renewed automatically if you leave the country and come back.) Renewal is free and I believe you can keep renewing it for about two years as long as you can prove a need for it. I think you can renew your Visa as early as a month after arriving in Taiwan, although I waited until the week before expiration. Renewing your Visa is free, the process is immediate and only takes 10 minutes or so once you make it to the front of the line. The attendants all speak enough English to get by if your Mandarin is really bad. The only problem I had was trying to renew my Visa at Taipei City's Office instead of Taipei County's Office; I didn't realize I was living in Taipei County. The Taipei City office is really easy to find. The Taipei County office is a bit more difficult to find, so leave yourself a lot of time if you have to go there.

If you have a multiple visit visa, renewal is much easier. Just leave the country and when you come back, it will be extended for you. One of my classmates extended his visa this way.

Monday, April 25, 2011

CLD Program Impressions

I attended the CLD Program at NTU (台大) over summer 2010 and I thought it would be useful for people considering the program if I wrote my impressions about it. I'll just write about my experiences and you can make of it what you will.

First, my background. I'm currently 27 and am studying Mandarin for purely personal reasons. I basically want basic conversational skills and good listening comprehension. Although I've previously studied French and Japanese, I'm only fluent in English. Before going to Taiwan, I self-studied Mandarin college textbooks, listened to audio tapes, and practiced conversational skills with my wife. I decided to go to Taiwan in order to strengthen my foundational skills so I could study more effectively with my wife at home. After reading about several programs from forums and other people's reviews, I decided to attend NTU (台大) over NTNU (師大), and then the CLD Program over the ICLP Program. I'm very happy with my choices.

The application process was simple. My application probably didn't get to them until the day before their "deadline", but I got in anyway. It only left me with a month to prepare for the trip, the main hassle being getting my visa. CLD doesn't offer any housing, but that wasn't a problem for me because I already had a place to stay. I had classmates that didn't take care of housing until after they arrived with very little hassle, although their rent tended to be more expensive than those that planned earlier.

The CLD is located on the NTU campus on the second floor of the language center (語言中心.) It was very easy to find, even though I'd never been to the campus before, as there are plenty of campus maps. NTU itself is very nice. The campus is beautiful and has a large library that's great for studying in. The cafeteria near the language center (in the 學生活動中心) is pretty good. There's a lot of stores, housing, and restaurants within five minute walking distance of the campus... finding things in Taipei in general is really easy. On the bottom floor of the language center is a bulletin board that makes it very easy to find language exchange partners. Finding an native speakers to practice with is very, very important if you want to really learn Chinese.

New students are required to show up at NTU a week before classes start in order to register and take a placement test. Registration went very smoothly and the staff was very nice. The optional placement test had no time limit. The first part was a written test broken into three sections. The first section was correcting grammar, the second was answering reading comprehension questions, and the third was writing an essay. The first two sections were graded immediately, after which I was sent to a different room for an oral test. A teacher looked over my results, read my essay, and then talked with me a bit in Mandarin. Afterwards, the teacher placed me. My Mandarin was very limited and although I could read many characters, I could barely write any, so I was just happy to not be placed in the lowest class. Although I didn't realize it at the time, you can buy your books from the CLD office at this point since you know your class level.

On the Friday before classes started, we had an orientation. The orientation was pretty useless, but only took an hour or two.

I bet the program quality really varies based on your teacher and classmates. I feel my teacher, 蔡美雲, was excellent. My classmates were also very good and hard working. We all refused to speak English to each other, even though we often spent time together outside of class. Their ages varied between 22 and 37, they came from all over the world. I had 5 classmates total. By looking at the class list, it seemed almost all classes had the full 6 students.

The program itself was basically working through the Practical Audio and Visual Chinese textbooks. (Although the most advanced classes moved on to different texts.) My class started at Book One Chapter 6 and ended at Book Two Chapter 8. We covered a chapter every three or four days. It seems all the classes working on the Practical Audio and Visual Chinese textbooks covered about one book in the three months.

Each day we had class for three hours. Only Mandarin was spoken. Homework takes at least half an hour if you rush through it, but it's much better if you spend more time on it. My teacher would correct whatever I wrote, no matter if it was assigned or not. After getting the introductions and review done, classes basically followed a four day loop.

- First Day -
Give an oral presentation. Usually this was reciting a memorized essay from the textbook.
Take a test over the previous material. This usually took one and a half hours.
Begin learning the vocabulary for the next chapter. The teacher would add many comments and the students were required to form sentences using the vocabulary.
Homework: Practice writing the new vocabulary words.

- Second Day -
Listening and Writing test. The teacher would say a sentence twice and the students must write the pinyin and Chinese characters for that sentence.
Finish the vocabulary and begin going over the grammar.
Homework: Write sentences using the vocabulary

- Third Day -
Listening and Writing test.
Finish going over the grammar.
Homework: Do the Workbook chapter, which is grammar and writing drills.

- Fourth Day -
Listening and Writing test.
Role Play situations, practice listening to dialogs, and work through more examples.
Homework: Write an essay.

The main benefit in all this is the teacher's guidance. In addition to the teacher pointing out gotchas, she also constantly corrected errors, whether in speaking or writing. I felt she did very well in pointing out problems I hadn't noticed by myself and explaining problems to me my wife was unable to explain clearly. I felt I learned a lot in the three months I was there. The program is what you make of it.

As a side note, to help make the most of my short time in Taiwan, I also had one on one Mandarin lessons on the side. My teacher was Peter Su and he was really excellent. His times and lessons were very flexible. These additional lessons allowed me to learn the subjects I wouldn't be able to cover during my short stay in the CLD program. I'd definitely suggest looking him up for some one on one lessons, here's his web site: http://petersonsu.blogspot.com/.

Thursday, April 21, 2011

PS3 Controller on PC

(This was actually a really old post, which I dredged up so I could add a notice mentioning MotionInJoy, which I'm currently using. It has a lot of options and works perfectly on Windows 7 with no problems. It shows ads, but I'm pretty sure it doesn't install anything nefarious on your system. So... use MotionInJoy instead of whatever I talked about here. MotionInJoy avoided all the annoying driver signing this old post talked about too.)

I got a Playstation 3 controller to work with windows as a game controller, which is awesome. I'm not using it over Bluetooth, I have the controller plugged into the USB port. I've found a lot of fun indie games that I intended to play for the PC (La Mulana, Cave Story, Knytt), but wanted a controller to maximize enjoying them.

Besides the hardware, all you need is the driver and setup executable. You can get these over at http://ps3-hacks.com. It may not necessarily work very easily... I couldn't get the controller to work on my XP desktop (I'm almost positive it's due to conflicts with other drivers, but don't want to waste anymore time debugging), but it worked immediately without any problems on my Vista laptop. My suggestion would be to give up (or reinstall your entire system) if you follow the instructions and it still doesn't work. Make sure to press your PS Home button before complaining that it doesn't work.

I also have a x64 Windows 7 machine at home. By following this guide, I've been able to get the PS3 controller working. The (huge) downside is that the application uses an unsigned driver, which means you have to run Windows 7 in a special mode. The guide will explain that a little more. By the way, I do not suggest changing system properties to always allow unsigned drivers. It just doesn't seem like a good idea, plus, it puts an annoying watermark on your background.

After getting the controller to work, I had problems with actually using it to play games. Some of my games didn't give me very good joypad mapping options, mainly in not supporting all of the PS3's 16 buttons. But then I found XPadder... check out http://www.xpadder.com! (Note that versions 5.3 and below are free (softpedia link), but versions above 5.3 must be purchased. I suggest supporting the other Jonathan's efforts.) XPadder easily lets you map keyboard key(s) to any button on any gamepad supported by windows. It is REALLY awesome. I can even play Guilty Gear and pull off supers with the press of one button since it lets you map sequences.

Suddenly, fighting games (Guilty Gear), platformers (Cave Story), and RPGs (Ys) are something I'm willing to play on my PC.

Also, using PS2 Emulators with save states for my old games is pretty awesome.

Sunday, April 17, 2011

Wayback Machine

So, the internet wayback machine has proven useful to me time and time again.

If you don't know, the internet wayback machine makes text backups of... pretty much the entire internet. Text only... but really, the text is generally the most devastating loss of a missing website. The site does a really good job of keeping timely backups of changes.

I've used the wayback machine to recover an old site I had made when I was in middle school. I thought I had lost all of it forever... granted what I found was very embarassing and much less amazing than I remembered, but I was very happy to find it again.

I've used the wayback machine to find pages that had been removed, sometimes with information that the webhost was hoping to get off the internet.

And I've used the wayback machine in my job, to find tutorials that had lost their home. I'd follow links to dead pages, but be able to read the information anyway thanks to the wayback machine.

The wayback machine is more than a toy and when you need it, it's definitely nice it's there.

Sunday, November 28, 2010

Hex Editing Programs

So, I got obsessed over the past two weeks or so "solving" archive files. This involved trying to extract the resources from video game archive files. Even if I don't care about the result, it was like solving a puzzle to figure out how to get the resources out. I'll probably write about it sometime.

What I wanted to point out now is the hex editor I used. To solve archive formats, you need to open up the archive files as binary. I started off using Textpad, since it's my text editor of choice on windows. It's not that convenient though... after reading some tutorials, I settled on Hex Workshop.

Hex Workshop lets you easily copy and paste binary, allows you to easily set bookmarks to binary fragments, easily lets you color-code the binary, easily lets you jump to specific offsets, lets you have multiple files open simultaneously, and has a hex calculator. I heartily recommend it. It is pretty pricey (~$90)... but that's pretty much the price of two video games. I think it's worth it as I've had so much more fun doing this than playing games recently. Hex Workshop



On another note, on a slow day, I played around with Cheat Engine. It was a lot of fun. Cheat Engine lets you easily mess around with Windows memory. The most obvious use is changing game memory to give you unlimited whatever. It's really fun to play with in general and comes with a great tutorial that'll get you started. If you have some time, give it a try. http://www.cheatengine.org/

Sunday, October 31, 2010

C# Web Service Plain Text Response

It took me far longer than I expected in order to figure out how to return plain text from a C# web service. I'm not sure why this took so long for me to figure out, but if it wasn't just me, then maybe this post can help other people out.

The Problem: When writing a web service endpoint in C#, if the return type is a String, the result will be an XML formatted string.

For example, the following web service:
  1. public String TestServiceA(Stream input)
  2. {
  3. return "Some kind of Text";
  4. }
returns the following string:
  1. <string>Some kind of Text</string>
It isn't that big a deal and the contained text can be easily parsed out, but it wasn't what I wanted and extra parsing code somehow seems wrong. I wanted the result to simply be the text I set.

The Solution: The return type needs to be a Stream.

So now the following web service:
  1. public Stream TestServiceB(Stream input)
  2. {
  3. MemoryStream ms = new MemoryStream();
  4. StreamWriter sw = new StreamWriter(ms);
  5. sw.Write("Some kind of Text");
  6. sw.Flush();
  7. ms.Position = 0;
  8. return ms;
  9. }
returns the expected result:
  1. Some kind of Text

Thursday, September 30, 2010

Router and Bridge

Router and Bridge

At home we're basiscally using five computers, one computer for each one of us. We all need internet access, we don't want anyone to have to use wireless, and it would be nice if we can all see each other's shared data. We have two 4 LAN Port routers, a D-Link 624 (wireless) and a D-Link 604. Those routers have worked very well for us, much better than Linksys routers have worked. We decided to have one router act as a bridge. Since one port from 604 would connect to one port from 624 (making them kind of act as a single router) we would have a total of six LAN ports. I feel it's really common knowledge how to set up a router, but making the other router act as a bridge isn't as clear. These are the steps to do this and they should be pretty adaptable for any routers.

1. Set up the first router as normal.
2. Connect a PC directly to the second router (and not the first router.)
3. Reboot the PC.
4. Log in to the secondrouter (usually defaulted at 192.168.0.1, with User Name = admin and no password).
5. Go to the DHCP menu and disable DHCP by checking "Disabled" for DHCP Server and Static DHCP.
6. Go to the LAN menu and change the IP Address to 192.168.0.99. (It can't conflict with the first router.)
7. Click Apply to save the settings. (You lose the connection to the second router since its IP address changed.)
8. Connect one of the second router's Local (LAN) ports to the first router.

Tuesday, August 31, 2010

Free Quality Burning Software

http://www.imgburn.com/

This summer I needed to burn an DVD ISO Image, but I was away from home and didn't have any burning software on my laptop. So I needed something free. A quick search turned out ImgBurn, which worked for me very well, seemed very well made, and was very simple to use. So if you need free CD/DVD burning software, I recommend that you try ImgBurn.