Region Locked DVDs and Mac Book Pro

Recently I got a MacBook Pro 2008 from my office. I love the machine but I was completely disappointed when I inserted Italian Job DVD. I was asked to change the region to 2/4 and I stay in region 5. I own the original copy of the DVD and unfortunately, there is no Region 5 copy available in India. It was never the issue for me because in Windows, VLC media player could easily bypass these region codes and ignore it conveniently.

DVD Regions Map
DVD Regions Map

I own few more DVDs belonging to 2/3/4 regions. I own another DVD player (my PlayStation 3) and that is also region locked. Now I have two very expensive machines and lots of original DVD titles yet can't play any of them. I don't know who created this *stupid* protection system which prohibits user from playing legal copies!

I tried various things on my Mac -

  • Using VLC media player for OS X
  • Using utilities like MacTheRipper for decrypting the dvd
  • RegionX for changing the region indefinite times

None of the above works. I have almost read thousand blog / forum posts related to DVD region issues with Mac but everything was completely failure. Apparently MacBooks have this "MATSHITA DVD-R   UJ-867" super drive which has no way of getting around the protection. I don't want to replace the firmware to region free as it will void my company laptop warranty which makes me crazy.

Now what reward I got by paying for the legal versions of the DVDs? In India any English movie DVD will cost you around Rs. 399-699 which is considerably expensive. You pay Rs. 800-1000 for 1 month of the internet connection. Why I will not be tempted to download nicely ripped DivX movie from torrent instead of buying freaking expensive DVDs which don't play at all?

Now can I demand my money back for these movies? Can I illegally download the DivX rip of the movie and play it on my laptop and still it will be legal? I really don't know but I will never buy legal DVDs for sure!

Posted in Random | 5 Comments

Things to ponder with Alfresco (Part-II: Workflow Design)

As I mentioned in my earlier post that I will be writing few more posts about the Alfresco. This is second installment in the series. If you are thinking to use Alfresco at the center of your application then it is hard that it will not have a workflow. If your business process is just more than simple workflows mentioned in Alfresco, then for sure you have to write your own business model definition.

If you are planning to do so, here are few lessons I have learned –

  • Simplicity – We got a lot of benefits just by keeping our process definition simple and neat. Don’t add unnecessary steps which will cause confusing steps for the end users.
  • Right things at right place – Alfresco is very flexible in terms of business logic implementation. You will always have multiple options to carry out same operation. Web Scripts, Java classes or Web Service and you are tempted to use different things at times. Decide one approach and stick to it. Put as much as logic in the workflow and don’t spread across the workflow business logic outside the workflow.
  • Loops are evil – Loops in the workflow actions are daunting at times. Rethink on the circular steps in the workflow and make sure you are not violating the “simplicity” rule.
  • Blocking is good sometimes – Next bigger decision is synchronous or asynchronous operations. All the operations which might result in inconsistent states can be synchronous i.e. transactional. Asynchronous operations are better in terms of responsiveness. Sending e-mails could be asynchronous tasks as you people can receive emails after couple of seconds, but if it is related to pushing records to a queue, let it be synchronous. You got the idea!

You should check Alfresco wiki for more details. There is plenty of documentation available for the administration and authoring custom workflows.

Posted in Developer, Java, Programming | 2 Comments

Things to ponder with Alfresco (Part-I: Content Model)

For any content repository, content model definition is similar to the DDL (schema definition) for databases. It is expected in a big application to have evolutionary content model like databases. Updating the table structures or introducing new tables is common in any business application. In content repository, you should also keep in mind that your content model should be open to evolve. Define the content model which will be extensible. Most of the good practices of database design should be applicable here.

Few tips for better content models -

  • Use aspects for specializing types instead of defining content types. There are few advantages of that, aspects can be applied or removed at run-time which gives you much more control over the dynamic nature of types.
  • Aspects also helps in keeping the default set of properties over a content type to be small. Alfresco recommends you to prefer aspects over custom content types.
  • Aspects helps you to logically group properties. This helps your data to be part of multiple groups at the same time. If you have aspects Publishable and Indexable; you can apply or revoke a nature at your will without much hassle.
  • Indexing is very helpful for searchable content. It is useful but use it wisely. The cost of indexing in Alfresco is much higher than cost of index in Databases as this will be full-text search indexes. It will take up more disk space as well as time to index the data. Don't index the content which people are not expect to search! You can define this at the time of content model definition.
  • Versioning is similar to indexing and use this wisely. The content which is versionable is handled separately by Alfresco. This might be affecting performance as your repository size grows. Don't mark content as versionable if you don't plan to maintain revisions for content.

I will continue this series with other experiences with Alfresco. Later.

Posted in Articles, Developer, Programming | Leave a comment

Alfresco: Workflow managed by JavaScript

If you are a regular reader of this blog, you might have figured out that I am currently working on a project involving alfresco at the center and it's a content management system. Earlier I have worked with Content repository (Apache Jackrabbit) and that was a good experience. Alfresco is next step of a content repository which extends it into a full blown content management system and much more. I was working on a problem where we defined a custom (Advanced workflow) to be precise in Alfresco lingo. This workflow was needed to be monitored, managed and accessed only via a webscript as we have used webscripts to do almost everything in our project. I was very pleased to see this, but that is only available in 2.9 labs release (as of now). We are using alfresco 2.2.0 version for our development and that is production stable version, so I have very little choice but go with production version. Alfresco has very limited JavaScript API support for workflow manipulation and that was difficult job for manage. There was no other option than writing custom JavaScript API which allows to manage workflow in Alfresco. We did that and it was very powerful and easy! :) I wanted following features for JavaScript API -

  • Easy to extend
  • Can handle any workflows
  • Provides easy ways to retrieve tasks, definitions, paths etc.
  • Provides as much functionality possible which is available in Alfresco Workflow Console.

Alfresco workflow console is command line interaction component which allows you to manipulate, get information about workflows using simple commands and I wanted to do all that using JavaScript. I started exploring the source code and found a class 'org.alfresco.service.cmr.workflow.WorkflowService'. This class has generic API which allows you to do all the operations possible through workflow console. This bean is used for workflow console operations. So all I needed was expose this bean in JavaScript as root object and start using it. That simple! I wrote a simple java class to expose the bean as follows:

package com.xxxx.yyyy.workflow;
 
import java.util.List;
 
import org.alfresco.repo.processor.BaseProcessorExtension;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.workflow.WorkflowService;
 
public class WorkflowManager extends BaseProcessorExtension {
	private ServiceRegistry services;
 
	public void setServiceRegistry(ServiceRegistry serviceRegistry) {
		this.services = serviceRegistry;
	}
 
	public WorkflowService getWorkflowService(){
		return services.getWorkflowService();
	}
}

The method getWorkflowService() exposes the workflow service to the JavaScript calls. To expose the Workflow Manager as root object in JavaScript create WEB-INF/classes/alfresco/extension/custom-script-context.xml and you will be good! (If you don't know how to do that, read this) Now, you can get the handle of workflow service in JavaScript code. Yet, we need to write a small component which will allow us to retrieve the active workflows, tasks etc. To do so, I wrote a small JavaScript object which provides those functionality to the user.

var workflowService = workflow.getWorkflowService();
 
var W = {
	transitions: function(noderef){
		var task = W._currentTask(noderef);
		var trans = [];
		try{
		var tasks = task && task.path.node.transitions;
		for(var index=0; index < tasks.length; index++){
			trans[trans.length] = tasks[index].id;
		}
		}catch(error){
			// Ignore error
		}
		return trans;
	},
 
	move: function(noderef, command){
		workflowService.endTask(W._currentTask(noderef).id
                , command);
	},
 
	_workflowPath: function(noderef){
		var workFlows = workflow.getWorkflows
                      ("workspace://SpacesStore/" + noderef, true);
		if(workFlows.size()>0){
			return workFlows.get(0).id + "-@";
		}
		return "";
	},
 
	_currentTask: function(noderef){
		var curTask;
		var tasks;
		try{
		tasks = workflowService.getTasksForWorkflowPath
                           (W._workflowPath(noderef));
		if(tasks.size() > 0)
		      curTask = tasks.get(0);
		} catch(Error){
			// Ignore error
		}
		return curTask;
	}
}
 
function initWorkflow(noderef)
{
	var wflow = actions.create("start-workflow");
	wflow.parameters.workflowName
             = "jbpm$xxxxyyyy:abc"; // your workflow name
	wflow.parameters["bpm:assignee"]
             = person.properties.userName;
	wflow.parameters["bpm:workflowDescription"]
             = "Put your description";
	wflow.execute(noderef_for_which_workflow_will_associate);
}

Thats it! The initiate workflow method is used to apply a workflow to a node. Once that is done, the W object can be used to do operations like retrieving the active tasks, ending the workflow and making the workflow transition. Hope that helps. If you need more workflow related information and reading material you can visit following places:

  • JBPM jPDL Documentation (here)
  • Alfresco workflow wiki (here)
  • ECMArchitect Advance Workflow Guide (here)
Posted in Developer, Java, Personal, Programming | Tagged , | 6 Comments

Ubuntu: Firefox 3 beta and unhappy users

Prohibited

Beta software prohibited! (Photo obtained from here)

I was really disappointed over past few weeks about Ubuntu 8.04 release. The major reason of disappointment was Firefox 3 beta 4-5. The browser might be having lot of new things which are amazing, the performance might is improved for JavaScript execution but in reality, the overall performance of the browser wasn't that good. I was experiencing slow browsing speeds, sometimes the browser wouldn't respond and sometimes even crash.

Firefox 3 is still gaining popularity and there are tons of plug-ins which are still not compatible with it. My favorite plugins are no longer usable with Firefox 3 and that was a big drag for me. Firebug was one of them.  The main reason I feel very disappointed was Firefox 3 was in beta!

Ubuntu was simplifying Linux for all the users who don't want to touch command line for writing documents and browsing internet etc. They are doing a great job on that front too. Firefox 3 made me think is it going away from that goal by giving beta software distribution? I will urge Ubuntu community for not including any of the beta software in mainstream distribution for any reason. That might not only discourage non-technical users but also put wrong message on the table.

For those users who have similar problem, they can uninstall the Firefox 3 from synaptic package manager and install Firefox 2 browser instead. Happy browsing!

Posted in Ubuntu | Tagged | 5 Comments