Posts

Building Hadoop on Windows

Hadoop requires the following application :- 1) Ant (unzip and set PATH to point to this folder) 2) JDK (unzip and set PATH to point to this folder). I'm using JDK 1.6 Update 14 for this build. 3) Cygwin (svn + openssh) Download hadoop source code using svn from the following url: http://svn.apache.org/repos/asf/hadoop/core/trunk Go to the folder that you've download and build by typing ant (Press enter) That's all.

Configure PHP on Window 7 IIS

Assuming that you have downloaded and unzip php-5.2.9-2-Win32.zip to c:\php5. Here's how you configure PHP 1. Start IIS -- Start->Run->Inetmgr 2. Switch to Feature View, then click on Handler Mappings. 3. Add Script Map and use the following configuration a) Request Path = *.php b) Executable = C:\php5\php5isapi.dll c) Name : PHP_SCRIPT (You can use other name if you want) 4. Try running your PHP. That's it. (You might want to do a iisreset). I've enable ALL World Wide Web Services ---> Application Development Features ---> ISAPI Extension & ISAPI Filters ON in Turn Windows features on or off. If you face issue connecting to mysql :- a) Try troubleshoot using phpinfo(); Try to see if you have configure mysql correctly. b) you can copy php_mysql.dll & php_mysqli.dll to c:\windows\system32;

DataTable does not have AsEnumerable

I have problem locating my AsEnumerable extension method in my DataTabe (System.Data). Thank god for this post by Angel (http://blogs.msdn.com/angelsb/archive/2007/02/23/does-not-contain-a-definition-for.aspx) I was able to find this method once i have added reference to the following assembly. C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll Try to do a dummy Build and you should be able to get it.

Building IKVM Source

Building IKVM Source Setup 1. Download IKVM source code from http://sourceforge.net/project/showfiles.php?group_id=69637 2. Download classpath-0.95 from (http://www.frijters.net/classpath-0.95-stripped.zip) 3. Download openjdk6-b12 from (http://www.frijters.net/openjdk6-b12-stripped.zip) Unzip openjdk6-b12 and classpath-0.95 into the unzipped IKVM Source. For example ikvm-0.38.0.2 --- classpath-0.95 --- openjdk6-b12 Tool required (Other version of these tools might work) :- 1. Nant (i used 0.86 Beta1) 2. JDK 1.6 Update 13 (or lower) 3. VS 2008 or 2005 4. .Net Framework in particular (cl - vc compiler, ilasm) To Compile ---------------------------------- 1. Run nant to compile the required assembly 2. Use VS2008 to build IKVM source (CTRL + Shift + B) That's it.

Example JQuery event when posting Form using multipart/form-data

JQuery event to use once your form is fully posted to the server $(document).ready(function() { $("#target_upload").load(function () { //// Put in code to execute after the iframe is loaded or posted //// }); }); Sample of your Form :- <form id="uploadPhotoFrm" enctype="multipart/form-data" action="upLoaderPhoto.php" method="POST" onsubmit="return true;" target="target_upload"> <iframe id='target_upload' name='target_upload' src='' style='width:1px;height:1px;border:0'></iframe> <li> <input id="uploadedfile" type="file" title="Upload a file to showcase your portfolio" size="20" name="uploadedfile"/> </li> <li> <input type="submit" name="subBtn" class="standardButton" value="Upload" onclick="uploadImageCmd...

Unity - Dependency Injection Types

You can use RegisterType or App.config to achieve the same objectives. static void Main(string[] args) { IUnityContainer container = new UnityContainer(); UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); section.Containers.Default.Configure(container); //// You can override with container.RegisterType (); CoreService svc = container.Resolve (); svc.ExecuteService(); } Sample Service classes public class CoreService { [Dependency] public IService MyService { get; set; } public void ExecuteService() { MyService.SayHello("Jeremy"); } } public class CustomerService : IService { string IService.SayHello(string Username) { return "Customer Service " + Username; } } Sample App.Config File <?xml version="1.0" encoding="utf-8" ?> <configuration...
Sample App.Config type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />

Passing Parameter from C# to IronPython

Code in Python ///////////////////////////////////////////////// def calc(a, b): return a+b print calc(x,y) ///////////////////////////////////////////////// C# code to pass parameter into the IronPython code ScriptScope ScriptingScope = null; ScriptEngine ScriptingHostingEngine = null; ScriptingHostingEngine = IronPython.Hosting.Python.CreateRuntime().GetEngine("python"); ScriptSource ScriptRequest = ScriptingHostingEngine.CreateScriptSourceFromFile("c:\\del\\expression\\ScriptingTest\\ConsoleApplication1\\Program.py"); ScriptingScope = ScriptingHostingEngine.Runtime.CreateScope(); ScriptingHostingEngine.SetVariable(ScriptingScope, "x", 100); ScriptingHostingEngine.SetVariable(ScriptingScope, "y", 200); ScriptRequest.Execute(ScriptingScope);

Cool way to extract PropertyInfo

var VarPropertyEnum = from ReflectionEntity in Source.GetType().GetProperties()  select new { ReflectionEntity.Name, PropertyValue = ReflectionEntity.GetValue(Source, null).ToString(), PropertyDataType = ReflectionEntity.PropertyType }; However this only works if you have a simple data type.  :(

Cool way to add existing .Net DLL into Silverlight Project

I found this information from this link    http://www.netfxharmonics.com/2008/12/Reusing-NET-Assemblies-in-Silverlight To summarize :- 1. ildasm MyClass.dll /out:MyClass.il Disassemble your code and change the mscorlib version to 2:0:5:0;  .assembly extern mscorlib  {  .publickeytoken = (7C EC 85 D7 BE A7 79 8E ) // .z\V.4..  .ver 2:0:5:0 } }   You also need to change the public token key  7C EC 85 D7 BE A7 79 8E         Then you may need to remove public key from your generated IL file   .publickey = (00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00   // .$..............                 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00   // .$..RSA1........                 B5 FC 90 E7 02 7F 67 87 1E 77 3A 8F DE 89 38 C8   // ......g..w:...8.                 1D D4 02 BA 65 B9 20 1D 60 59 3E 96 C4 92 65 1E   // ....e. .`Y>...e.                 88 9C C1 3F 14 15 EB B5 3F AC 11 31 AE 0B D3 33   // ...?....?..1...3                 C5 EE 60 21 67 2D 97 1...

RodentStore (Phillipe Cudre Mauroux, Eugene Wu and Samuel Madden)

Increase application database domain requires substantial amount of re-engineering effort such as caching or transaction. RodentStore is an adaptive storage engine that uses declarative storage algebra to specify logical schema in a disk. Central to this idea are 1) ability to support table using different physical representation 2) use storage algebra to specify data layout. Database Administrator --------> Algebra sepcification -----> Algebra Interpreter -----> Storage Backend. Interesting part of this artcile is RodentStore is not limited to SQL database but ORM like Django / Ruby on Rails. Physical Layout Challenges faced a) Translating Algebra expression with array completion b) Storage rendering algorithm is 'declarative'. --- leaving many item open for example how data are stored. Deciding what to do when a mix of data placement algorithm for example old and new is used. Adaptive storage engine is going to be an interesting project especially in porting databa...

F# / C# - from Chris Smith's Blog on F# tutorial .....

F# Code #light let square x = x * x let numbers = [1 .. 10] let squares = List.map square numbers printfn "N^2 = %A" squares open System Console.ReadKey( true ) C# Code using System; using System.Linq; class Program { static void Main() { Func square = x => x * x; int[] numbers = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; var squares = numbers.Select(square); Console.WriteLine("N^2 = {0}", squares.Aggregate("", (s, i) => s + " " + i)); Console.ReadKey(true); } }

$post / $each with JQuery

Let's say you want to do a JQuery $post and then use $each to traverse through the result. this exampel show how it can be accomplished. Example JSON data set generated using Php or other scripting languages :- {"items":[{"memberID":"1","memberName":"Julia Boris","profileInfo":"jaya jaya"},{"memberID":"1","memberName":"Julia Boris","profileInfo":"michael "},{"memberID":"1","memberName":"Julia Boris","profileInfo":"89898989"}]} From the browser you can use the following codes to do an AJAX Post. Notice the I purposely pass dummy data to the other end. Somehow it returned text instead of JSON if i do not pass dummy data. You can do some debugging by displaying return "data". If you can see the content of your data as shown example above, then you might not be returning JSON data type - ...

Speculation - Distributed Transaction for improving performance, reliability and fault tolerance in Distributed Environment

Coming up ....

Extracting and Query a Comprehensive Web Database - M. Cafarella, UWS

Tremendous amount of information lost takes place in existing web database that tries to fit crawled information into a specific domain / predefined domain. This is because information is 'forced' into a pre-defined domain. This paper improves extraction model for web databases. Architecture Web crawl ---> Multimodel Extraction --> Entity Database --> Multimodel Transaction ---> User Query This paper proposed the use of dynamic domain generation approach. Challenges faced by this approach are a) Web Extraction - Generating the E-R model is going to a challenge as different domain maybe generated for the same topic. For example George W Bush or President George Bush. How do you know that these are the same domain? Data reconciliation is a huge issue. (Dong, A Halevy and Madhavan - Reference Reconciliation in Complex Information Space) (Singla and Domingos - Entity Resolution with Markov logic) b) Entity - Relation - A component that contains entity extracted from t...

Building MySQL

MySQL Building from Source Pre-requisite: 1. Install VS C++ Express Edition 2. Microsoft Platform SDK **** very important **** Build Process 1. Add Path to cMake installation Path 2. Configure your VS2005 Express to Microsoft Platform SDK by going to Tools->Options->Projects and Solutions->VC++ Directories->Library files Library files :- Add D:\Program Files\Microsoft SDKs\Windows\v6.1\Lib Include D:\Program Files\Microsoft SDKs\Windows\v6.1\Include 3. Go to your source path and issue the following command \win\configure.js WITH_INNOBASE_STORAGE_ENGINE WITH_PARTITION_STORAGE_ENGINE 4. Execute win\build-vs8.bat (if you're using Vs2005) and this will generate a VS solution file called MySQL.sln 5. Open up the solution file and build it. Goto --> Properties --> Set your configuration; Then right click on MySQL (specific component) and select Build.

Building Mozilla on Windows Vista and VS2008.

1. Install your Visual Studio - VS2008 (older versions are supported as well) 2. Install Microsoft Platform SDK depending on what Windows you're on 3. Install MozillaBuildTool from ( http://ftp.mozilla.org/pub/ mozilla.org/mozilla/libraries/ win32/MozillaBuildSetup-1.3. exe ) 4. Setup your Mozilla configuration by creating a file called . mozconfig in your installed source root folder This is configuration for building firefox ac_add_options --enable-application=browser mk_add_options MOZ_CO_PROJECT=browser 5. Choose your Visual Studio version by executing this is c:\mozilla_build (default directory for installing MozillaBuildTool above) start-msvc6.bat start-msvc71.bat (VS 2003) start-msvc8.bat (VS 2005) start-msvc9.bat (VS 2008) 6.Run make -f client.mk build 7. Once your firefox gets build it should be in the firefox-3.0.5-source\ mozilla\dist\bin\firefox.exe. Now you may try to run your build version of firefox by double clicking on it. Unfortunately the above instruction d...

Creating ASPCOM to consume WCF Web Service

I'm trying to send messages. The process goes something like this :- ASP ---(server.createobject)--> COM Object ----(invoke method)----> WCF Web Service All running on IIS. So i can send messages from ASP COM to WCF Web Service. Typical processes to do this is : a) Make your DLL ComVisible b) Sign it c) regasm (ok to skipped coz VS might register for you automatically) d) gacutil e) To place your App.config file during deployment, go and update Web Service Configuration file ----> w3wp.exe.config/aspnet_wp.exe.config. I did this before. Just couldn't figure out why it slipped my mind.

Flex Web Service Simple / Complex Data Type

Let's say you want to invoke a WCF/ASMX web service using Flex and you need to pass in simple and also complex data type. This is my web service (I'm using ASMX) . SayHi requires Username parameter of type string. While Welcome method uses a complex data type as its parameter. [WebMethod] public void SayHi (string Username ) { } [WebMethod] public void Welcome(Person p) { } public class Person { public string Name { get; set; } public string Ability { get; set; } } To show how it is called in Flex just use the following MXML code With MXML : function InvokeService():void { svcTest.SayHi("Jeremy"); } function InvokeComplexType():void { var p = new Person(); p.Name = "Jeremy"; p.Ability = "Coder"; svcTest.Welcome(p); } Using Actionscripts The code here is almost the same with MXML markup. function InvokeService():void { ...

Reinstating Grub after XP installs

Boot up Linux with your bootable Cd or u can simply type a) linux rescue - this will allows you to boot up your linux b) grub c) find /grub/grub.conf it will display something like (hd1,1) d) root (hd1, 1) e) setup (hd0) Reboot your system and you can see grub is loaded.