Tuesday, April 29, 2008

Helpful Windows Shortcuts

A list of helpful windows shortcuts to get you through the workday:
  • Shift+Del - Delete the file forever (Not to recycle bin)
  • Alt+tab - move between windows
  • Win+r - bring up the run Dialog
  • Ctrl+alt+break - minimize/maximize a terminal service window
  • Win+m or Win+d - show the desktop (again to undo)
  • Menu Key - same as right-clicking
  • Alt+F4 - close a window
  • Win+e - windows explorer
  • Win+l - lock computer
  • Win+break - bring up system properties
  • Ctrl+Shift+Esc - bring up task manager
  • F2 - rename a file

Did I miss some? Post your favorite as a comment.

Monday, April 21, 2008

Removing a Company Screensaver

Our company recently pushed out one of those motivational screen savers - you know, the ones with the cute little pictures and annoying little sayings. Of course, since they don't want you to be able to remove the screen saver they disable the "Screen Saver" tab in your machine's "display properties" window and there's no obvious way to turn off the miserable thing. The answer - hack the registry.

Open registry editor: Start -> run -> regedit.exe
Navigate to HKEY_CURRENT_USER -> Control Panel -> Desktop

To simply remove the screen saver, change the ScreenSaverActive key from 1 to 0.

To get rid of the corporate screen saver, look for the key SCRNSAVE.exe. The value of this key is the path to the screen saver. You can navigate to this path and delete/rename the file or change the path to point a different screen saver.

Enjoy your motivationless day!


Wednesday, April 9, 2008

Ldifde

The trickiest setup I've done involved single signon into a "double-hop" kerberos configuration. While recently troubleshooting one of these setups I rediscovered a great little tool by the name of ldifde (LDAP Data Interchange Format). This is windows 2000 server tool that comes with the resource tools kit. The main purpose of ldifde is to act as a generic ldap migration tool and is included with windows for to allow an admin to import and export active directory data. The tool has another use though, its a great way to query active directory for SPNs. SPN's do not show up in the standard AD browsing interface and are generally manipulated using the setspn tool (also included in the windows resource toolkit). This works fairly well untill you want to find out what user has an SPN instead of which SPNs a user has. Setspn doesn't have any way to reverse lookup - this is where ldifde comes in.

In my case I was setting up a kerberos "double-hop" configuration where the user logs into a web application and then accesses data on a seperate sql server. This is a very tricky setup to begin with (see http://www.microsoft.com/technet/prodtechnol/windowsserver2003/technologies/security/tkerbdel.mspx for a more detailed discription) and one of the possible pitfalls is having duplicate SPNs assgined. If two different users have the same SPN, the system won't work because SPNs must be unique to ensure proper communication. Ldifde can easily tell us if this is a problem.

In order to see all the SPNs on the domain assigned to an a server named myServer on mydomain.com:
ldifde -f ldifdeoutput.txt -l serviceprincipalname -r "(serviceprincipalname=*/myServer.mydomain.com)"

In order to see all the SPNs on the domain assigned to an MSSQL Service:
ldifde -f ldifdeoutput.txt -l serviceprincipalname -r "(serviceprincipalname=MSSQLSvc/*)"

where -f is the output file in your home directory, -l is what LDAP field to query for, and -r is the LDAP search string.

Below is the entire man page for ldifde:

General Parameters
-i Turn on Import Mode (The default is Export)
-f filename Input or Output filename
-s servername The server to bind to
-c FromDN ToDN Replace occurrences of FromDN to ToDN
-v Turn on Verbose Mode
-j Log File Location
-t Port Number (default = 389)
-? Help

Export Specific Parameters
-d RootDN The root of the LDAP search (Default to Naming Context)
-r Filter LDAP search filter (Default to "(objectClass=*)")
-p SearchScope Search Scope (Base/OneLevel/Subtree)
-l list List of attributes (comma separated) to look for in an LDAP
search.
-o list List of attributes (comma separated) to omit from input
-g Disable Paged Search
-m Enable the SAM logic on export
-n Do not export binary values

Import Specific Parameter
-k The import will go on ignoring 'Constraint Violation' and 'Object
Already Exists' errors

Credentials Parameters
-a Sets the command to run using the supplied user distinguished name
and password. For example: "cn=yourname,dc=yourcompany,dc-com
password"
-b Sets the command to run as username domain password. The default is
to run using the credentials of the currently logged on user.

Tuesday, April 8, 2008

RIA Technology Evaluation


Overview


This post evaluates 3 alternative technologies for implementing RIA: Ajax, Adobe Flex, and Microsoft Silverlight. Each of the three has strengths and weaknesses when compared across any single dimension, which makes it difficult to determine which technology is the correct choice for a particular problem.

This table compares the three technologies across a number of distinct criteria. Each criterion is weighted between 1 and 10 based on my own subjective evaluation. Depending on the project you might assign very different weightings. A breakdown of the criteria along with rationale for the ratings is captured below.




Scoring
If a technology has a clear strength in a particular category it is shaded green and gets the full weight added to its total value. If there are concerns in a category it is shaded yellow and given half the weight added to its total value. Red signifies that the category is a weakness of the technology choice and it is given a value of .1 of the total weight.

Based on the criteria and weightings Flex has a slight edge over Silverlight and Ajax.


The Criteria

Maturity / Adoption

This is ranked very high above, since there is a high risk of unanticipated issues with technologies that have not yet proven themselves.

Ajax has been around for several years now, and is used in one form or another by a very large percentage of major websites. There are a large number of toolkits and libraries available (Dojo, Tibco, Scriptaculous, GWT, etc.)

Flex has been around since 2004. It is currently on the 3rd major version. Many major companies have begun developing Flex applications (Business Objects, SAP, Fedex, etc.), but Flex is still considered a young technology.

Silverlight is a Microsoft competitor to Flex that was first released in 2006. It is seen as being a direct competition to Flex. There are fewer Silverlight applications than Flex, but it is likely that Microsoft will close the gap over the next 2 years. One notable early adopter is Netflix, which uses Silverlight for Video on Demand.

Programmer familiarity

Programmer familiarity with a technology is rated very high, since this will have a direct relation to how efficiently programmers can write robust code.

Ajax- Virtually all web developers have good knowledge of the fundamentals of Ajax development: Javascript, HTML, JSON, XML.

Flex - There is a relatively low percentage of developers with hands-on experience with Flex.

Silverlight - While few developers have actually used Silverlight, version 3.0 and above supports all .NET languages, and development can be done directly in Visual Studio. For .NET developers the transition should be relatively easy.

Productivity Tools
Clearly more powerful and useful productivity tools available is a substantial plus. All 3 technologies have a good story here.

Ajax – Lots and lots of tools in the Ajax space: intelliJ6+, Eclipse, Firebug, etc.

Flex – Flex Builder is a powerful (if sometimes clunky) IDE. IntelliJ also has support for Flex.

Silverlight – Uses Visual Studio, and all the power that comes with it.

Availability of technical support
Having responsive support to address issues and questions is very useful.

Ajax – Most support is typically via forum posting. If a commercial toolkit is purchased there may be further support options.

Flex – With the Flex Builder purchase technical support is available, both for the IDE and Flex development generally. There are additional support packages that get quicker and more complete assistance with issues (http://www.adobe.com/support/programs/flex/?tab:plans=1)

Silverlight – MSDN support, plus standard support packages.


Licensing
This criterion is meant to capture any possible conflicts that might arise between an open source or commercial license and TH software.

Ajax – Need to evaluate any open source licenses on a case by case basis.

Flex – The SDK is MPL, but anything built on top of it is not bound by the license (like Java).

Silverlight – Commercial software, unlimited use.

Cost


Ajax – Most libraries are open source and free

Flex – The SDK is free, although strong incentive to buy the Flex Builder IDE (Standard Edition $249, Professional Edition $699)

Silverlight – Requires Visual Studio (~$249 Standard Edition)

Ease of installation


Ajax – No installation. All current browsers with javascript enabled support Ajax calls.

Flex – Virtually every browser has Flash installed. Users may need to be upgraded to the latest version, but this is straightforward and causes few concerns.

Silverlight – Few browsers have Silverlight installed. While installation is a simple process, users and/or IT may have concerns about installing a relatively unknown plugin.


Support for advanced visuals/multimedia
This category captures sophisticated video integration and graphics manipulation, scalar vector graphics, etc. This is rated very low, although there are some examples of where BI vendors have used these capabilities to create attractive interfaces (e.g. Business Objects: http://information.ondemand.com/istore)

Ajax – No.

Flex – One of the core strengths.

Silverlight – Also a core strength, plus excellent support for scalar vector graphics.


Local file storage

This could be very useful to create a quick and responsive application. We could choose to store things like subset/measure/attribute lists and other metadata locally, for example, to allow instantaneous load.

Ajax – Using a cookies can store up to 64K.

Flex – 2G is available by default. Unlimited file space can be requested.

Silverlight – I believe Silverlight is similar to Flex here.

Workflow support


This category captures development workflow. I.e. the people designing the controls, layout, look & feel are often different than the ones wiring up events and defining behaviors.

Ajax – I haven’t been able to find any tools that target this sort of support.

Flex – Flex Builder includes a fairly intuitive IDE for design and layout.

Silverlight – Includes 2 separate IDEs, one for designers (Espresso Blend), and one for developers Visual Studio.

Performance (JIT compilation)


Ajax – Javascript is interpreted script in all browsers (except for Firefox 3). This results in significantly slower performance than Flex or Silverlight, which are byte compiled. There is a great demo showing relative performance at http://on10.net/Blogs/tina/microsoft-silverlight-chess/. It shows Silverlight evaluating 1 million+ nodes compared to ~1000 nodes in Javascript, using the same chess playing algorithm.

Flex – Byte compiled, fast runtime.

Silverlight – Byte compiled, fast runtime.

Real-time messaging
Pushing information to the client has traditionally been a difficult problem with Web based development, since HTTP is a request/response protocol. There is often a strong need to do this, however. For example, to inform a user that a report has finished.

Ajax – There are a few “hack” options to get around HTTP. For example, the “Comet” approach involves the browser making a request, then having the server hold it open for as long as possible, responding at the point it wants to send a message. These sorts of options are clearly sub-optimal.

Flex – Flex Data Services will attempt to establish a non-HTTP connection, at which point true server push is possible. If not, it falls back to one of the HTTP “hacks” like Comet. The SDK makes explicit provisioning for doing this sort of communication.

Silverlight – I couldn’t find documentation, but I heard from a Silverlight guru that there is a similar capability to Flex.

508 Compliance

Ajax – Making Ajax applications 508 compliant can be complicated by the fact that screen readers cannot interpret partial-page refresh.

Flex – Many of the standard Flex controls have built in support for accessibility. Also, Flex inherits all the accessibility advantages of Flash Player 7, including support for Microsoft Active Accessibility (MSAA) (see http://www.adobe.com/macromedia/accessibility/features/flex/overview.html).


Silverlight – Poor accessibility in 1.0, has many new capabilities to better support 508 in 2 and above.

Text quality

Ajax – HTML rendered within a browser has very high text quality.

Flex – Flex 1.0 had somewhat poor text quality, font rendering has improved substantially in 2 and 3.

Silverlight – Has good font rendering.

Control set


Ajax – There are many, many Ajax libraries with large and robust control libraries.

Flex – Flex has a large set of standard controls, plus a set of advanced charts and controls that come with the professional license.

Silverlight – The current version of Silverlight has a relatively poor set of controls. The library seems best tailored at this point for multimedia applcations.

Charting/Grid components

Ajax – There are commercial and open source grid controls available in the Ajax space. Many I have seen appear to have good features and are powerful, although they may have performance issues with large sets of rows. Some Ajax toolkits include charting as well, although charting is typically done either server side or within a Flash player (e.g. http://www.zapatec.com/website/main/products/grid/demo.jsp#countries.html)

Flex – Charts and Grids are Flex’s bread and butter. See http://examples.adobe.com/flex3/devnet/dashboard/main.html. One notable control is the OLAPDataGrid, which we might be able to take advantage of.

Silverlight – There are some charts and grids being developed by outside parties for Silverlight, but the standard control set is still pretty limited.

Printing

Ajax – Ajax printing is bound by the same limitations as any HTML printing.

Flex – There is much more control than in the HTML world about how content is rendered on a printed page.

Silverlight – Similar to Flex, Silverlight includes a printing API.

Maintenance

This category captures how well the technology supports well structured, maintainable code.

Ajax – Javascript supports writing maintainable code, it requires a fair amount of discipline by the development team.

Flex – Flex code structure encourages practices which aid in writing reusable and maintainable code. It has a clean separation between presentation (.msxml files_, which contain the control definitions and layout, and the action script files which define logic. Custom composite controls can be easily defined by creating separate msxml files.

Silverlight – Similar in many respects to Flex in terms of structure.

Security

In the Web 1.0 world developers were starting to get a good handle on security. It was understood that any information posted within a web app needs to be thoroughly validated server side to guard against any malicious requests. Also, it was clearly understood that any information passed to the client would be accessible to the user, so you can’t count on sensitive data like usernames/passwords being hidden.

With RIA some of these rules seem to get forgotten. Across all technologies it is common for controls to support sophisticated client side validation. This is useful, but not sufficient for security.

Also, with communication happening asynchronously, passing objects rather than documents back and forth, it is easy to forget that intercepting and deciphering these objects is trivial.

Unfortunately, I haven’t seen anything in any of the technologies which attempt to formalize security practices. For example, Flex and Silverlight could have options to encrypt objects (not only “across the wire” but up to the point where the application de-serializes the object.

Support for Functional testing

Ajax – There are several functional testing frameworks that work well in the Ajax space, including Selenium and Sahi.

Flex – New frameworks, including RIATest (http://riatest.com/) are available.

Silverlight – Need more info here, but my understanding is that the MS functional testing framework works with Silverlight.

Support for Unit testing

Ajax – New tools like JSUnit can be used to unit test Ajax code.

Flex – Visual FlexUnit

Silverlight – The standard options in the .NET space work here: NUnit, NMock, etc.

Tuesday, April 1, 2008

Solve Order Hijacking in Analysis Services 2000 and Mondrian

Here’s another example of cube SOLVE_ORDER settings causing issues when interacting with query solve order.

If a calculated member is defined in a query which references a cube calculated member, the solve order of the query member can override the other calculated member.

For example, with the following query [maleMinusFemale] is defined with a SOLVE_ORDER of 3000. It’s set this way to make sure it always has higher precedence than [ratio].

Gender.override wraps maleMinusFemale, however, and sets a SOLVE_ORDER lower than [ratio]. When evaluating gender.override, the SOLVE_ORDER of maleMinusFemale relative to other calculated members no longer matters, since gender.override SOLVE_ORDER is what is considered at the point of evaluation.


Members defined in the cube:

member gender.maleMinusFemale as 'gender.m - gender.f', SOLVE_ORDER=3000, FORMAT_STRING='#.##'

member measures.[ratio] as 'measures.[unit sales] / measures.[sales count]', SOLVE_ORDER=10

------------------------------------------

Query:

WITH

MEMBER gender.override as 'gender.maleMinusFemale', SOLVE_ORDER=5, FORMAT_STRING='#.##'

SELECT {measures.[ratio],
measures.[unit sales],
measures.[sales count]} on 0,
{gender.override, gender.maleMinusFemale} on 1

FROM sales


Ratio

Unit Sales

Sales Count

override

10.72727

-236

-22

maleMinusFemale

-0.05

-236

-22

With SSAS 2005 the solve order cannot be “hijacked” in this way. Cube members are scoped separately and are evaluated first, unless explicitly overridden in the query (with ‘SCOPE_ISOLATION=CUBE’). The example above demonstrates that SSAS 2005 solve order scoping is more sophisticated than simply shifting cube member solve order lower than query members during evaluation, since problems like this could still happen if any interaction between cube and query solve order is permitted.

Thursday, March 27, 2008

Analysis Services 2000 vs. 2005: SOLVE_ORDER

Analysis Services 2000

With Analysis Services 2000 the solve order of members defined within a query and the solve order of members in the cube are evaluated at the same time. This means that if you have a calculated member in an MDX query that has a lower solve order than a member defined in the cube then the query member would be evaluated first. For example, consider the following query.

WITH
MEMBER Time.Difference as '[Time].[1997].[Q2]-[Time].[1997].[Q1]', SOLVE_ORDER=10
SELECT
{Measures.[Store Sales Ratio]} on 0,
{Time.Difference, [Time].[1997].[Q2], [Time].[1997].[Q1]} on 1

FROM
Sales

Where [Store Sales Ratio] is defined as '[Measures].[Store Sales Net]/[Measures].[Store Sales]' in the cube and given a SOLVE_ORDER of 100.


Store Sales Ratio

Difference

0.6

Q2

0.6

Q1

0.6


Looking at these results, you may expect Difference to evaluate to 0, since the Q2 value minus the Q2 difference should be subtracting the two ratios. Since the [Store Sales Ratio] solve order is higher, however, it is evaluated after the [Difference] calculation, i.e.

(( [Unit Sales], Q2 ) – ( [Unit Sales], Q1 ) )/ (( [Store Sales], Q2 ) – ( [Store Sales], Q1 ))

This is probably not what is desired, since you would expect a difference calculation to typically be evaluated on the final value of the measure, not on the components.

To get the desired value in AS2K, the only real option is to change either the cube or the query solve order. Unfortunately, if you’re using a client which automatically generates MDX changing the query may not be feasible. And there may be other forces which dictate particular solve order of cube members. On more than one occasion this has left us with no good solution.

Analysis Services 2005

With SSAS 2005 the notion of “scope” was added to solve order. The solve order of the cube is in its own scope, and is evaluated before any of the calculation in the query. So running the same query above in SSAS 2005 produces the expected result:


Store Sales Ratio

Difference

0

Q2

0.6

Q1

0.6


For the occasions where you actually want to have evaluation interact with the cube solve order, you can specify “SCOPE_ISOLATION=CUBE” within the query members definition.

See http://msdn2.microsoft.com/en-us/library/ms144787.aspx for more details about scope isolation and when you would use it.

Aggregate() changes

A related change is related to the Aggregate() function. In AS2K if the Aggregate() function had a higher solve order than what it was evaluating it would throw an error. It did this because there is no generic way of determining how to aggregate over a calculated member. Aggregation is really something that applies to base measures.

The fact that Aggregate members were required to have lower solve order produced headaches in my environment, because some client tools will specify a higher solve order for a member which uses Aggregate(). To counteract this we would set cube members to have solve orders higher than what we would ever expect the client to choose, which was a hacky and unreliable alternative (and also produced some of the unexpected values mentioned earlier).

In SSAS2005, on the other hand, Aggregate() has been enhanced to always apply to the base components of a expression, regardless of solve order. This is exactly the sort of behavior we would expect, and greatly reduces the constraints around solve order assignment within the cube.

Monday, March 24, 2008

Collection of Bash Tips

I ran across a selection of bash tips at http://www.shell-fu.org/lister.php?top. Many of them are very specific but here are a few that seem to come up daily:

Using expansion to move a file aside without having to type the file name twice

> cp ReallyLongFileNameYouDontWantToTypeTwice{,.orig}


Running a second command with the same arguments as the previous command, use '!*' to repeat all arguments or '!:2' to use the second argument. '!$' uses the final argument.
> cd /home/user/foo
cd: /home/user/foo: No such file or directory
> mkdir !*
mkdir /home/user/foo


Don't search history by grepping
~/.bash_history, or repeatedly hitting the up arrow, instead use CTRL+r (or '/' in vi-mode) for search-as-you type. You can immediately run the command by pressing Enter.

Make a whole directory tree with one command
Use the -p option to mkdir and make all parent directories along with their children in a single command.
>mkdir -p tmp/a/b/c


Use history to SUDO last command
Forget that your running as underprivileged? No need to retype the command.
> rpm blah
Permission denied
> sudo !!


Bash fork bomb
Don't forget the bash fork bomb. DO NOT TRY THIS AT HOME... Posted here so that you don't see this in a forum or a mailing list and use it without knowing:
>:(){ :|:& };:


Explanation:
:()
defines a function called : (accepts no arguments)
{ :|:& };
This is the function: It calls the function itself and pipes the output to the same function ":" and puts the process in the background. (Recursive invocation) with ; it ends the function definition
:
Calls the function and creates havoc.

Use ALT+. to insert last parameter
In bash (or anything using libreadline, such as mysql) press ALT+. to insert the last used parameter from the previous line.
Ex:
> vim some/file.c
> svn commit


Selected Bash Keystrokes:
Ctrl-U - Cuts everything to the left
Ctrl-W - Cuts the word to the left
Ctrl-Y - Pastes what's in the buffer
Ctrl-A - Go to beginning of line
Ctrl-E - Go to end of line