string num_to_text[] = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
string tens_to_text[] = { "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };
string power_to_text[] = { "", "thousand", "million", "billion" };
string padIfNeeded (string ans)
{
if ( ans == "" )
{
return "";
}
return " " + ans;
}
string translateHundred (int hundred_chunk)
{
// handle special cases in the teens
if ( hundred_chunk < 20 ) {
return num_to_text[ hundred_chunk ];
}
int tens = hundred_chunk / 10;
int ones = hundred_chunk % 10;
return tens_to_text[ tens ] + padIfNeeded( num_to_text[ ones ] );
}
All the question that scared me now i am trying to scare them .. so that they cant scare others :)
Wednesday, December 28, 2011
Integer to english conversion
Microsoft Azure is currently under CTP (Community Technical Preview)
Tuesday, December 27, 2011
HBASE INDEXING LIBRARY : Copied From http://www.lilyproject.org/
WHAT?
FEATURES
- define indexes consisting of one or more fields
- fields can be high-level datatypes like strings, integers, floats, decimals, date(time)s
- strings can be indexed as plain UTF8, ASCII-folded (= accents removed), or by collator key
- the entries in the index can be in ascending or descending order
- perform equals and range queries on all or a subset of the fields in the index (fields should be used left-to-right, only for the last used field a range can be used)
- results from multiple indexes can be streamingly merge-joined
- unrestricted scalability due to the automatic sharding (and replication) offered by HBase
NEWS
Thursday, December 22, 2011
Install Hadoop
Install Hadoop on a Single Node
- Install an instance of Amazon EC2 with Amazon Linux
A micro EC2 instance may not have enough memory to run Hadoop in pseudo-distributed mode - Login to the created instance
- Install & upgrade software needed by Hadoop
cd sudo yum install rsync sudo yum install java-1.6.0-openjdk
- Download and install the latest stable Hadoop
wget sudo http://mirror.its.uidaho.edu/pub/apache//hadoop/core/stable/hadoop-0.20.... tar -zxvf hadoop-0.20.2.tar.gz
- Move the installation to home
sudo mv hadoop-0.20.2 /home
- (Optional) For better security, create a new user to own the Hadoop
sudo useradd -s /bin/bash -m hdp sudo chown -R hdp.hdp /home/hadoop-0.20.2
- Test hadoop installation
sudo su hdp cd /home/hadoop-0.20.2 bin/hadoop
Hadoop Standalone Operation for Debugging
Wednesday, December 21, 2011
Access data from a WITSML server
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import org.jwitsml.Capabilities;
import org.jwitsml.WitsmlQuery;
import org.jwitsml.WitsmlServer;
import org.jwitsml.WitsmlServerException;
import org.jwitsml.WitsmlVersion;
import org.jwitsml.WitsmlWell;
public class BasicExample {
public static void main(String[] arguments) {
try {
// Identify ourself and our capabilities as WITSML client
Getting WITSML data from the server
// Get all wellbores from a given well instance List<WitsmlWellbore> wellbores = witsmlServer.get(WitsmlWellbore.class, new WitsmlQuery(), well); // Get all rigs from a given wellbore instance List<WitsmlRig> rigs = witsmlServer.get(WitsmlRig.class, new WitsmlQuery(), wellbore); // ... or through the wellbore ID List<WitsmlRig> rigs = witsmlServer.get(WitsmlRig.class, new WitsmlQuery(), "ID-wellbore"); // Both parent and grandparent may be specified List<WitsmlMudLog> mudLogs = witsmlServer.get(WitsmlMudLog.class, new WitsmlQuery(), "ID-wellbore", "ID-well"); // Wells doesn't have parents so we can skip the parent argument List<WitsmlWell> wells = witsmlServer.get(WitsmlWell.class, new WitsmlQuery()); // Attempt to get all rigs! Some servers will accept this approach // while others will require a valid wellbore parent. // The WITSML standard is unclear on this issue. List<WitsmlRig> rigs = witsmlServer.get(WitsmlRig.class, new WitsmlQuery());
Monday, December 19, 2011
Sunday, December 18, 2011
HBase Schema Design - Things you need to know
Monday, December 12, 2011
Nutch Crawl Command
- -dir : dir names the directory to put the crawl in.
- -threads : threads determines the number of threads that will fetch in parallel.
- -depth : depth indicates the link depth from the root page that should be crawled.
- -topN : N determines the maximum number of pages that will be retrieved at each level up to the depth.
Sunday, December 11, 2011
Content Types
SharePoint gets associated with some content type. Any content type gives you a number of reusable
settings. The reusable settings consist of the structure of information, associated workflows, information management policies, field rendering templates, and in the case of documents—document information panels and document formats and templates.
As an example in your organization, you may produce proposals for clients or software defect bug
reports. It is possible that both of these are Word documents, but their meanings are quite different. The workflows that they need to be routed through are quite different and the associated collected metadata on each of these can also be quite different. Therefore, it makes sense to differentiate between them as their own content types.
ADO.NET Data Services and REST
this technology you would use patterns and libraries that make data accessible over simple HTTP-based
technologies. This means that you can access the data over simple HTTP-based URIs and use of
standard HTTP verbs such as GET, PUT, POST, and DELETE. Data is fetched in JSON or ATOM formats, so it is portable across all platforms.
Thursday, December 8, 2011
New APIs in the Windows 7 Shell
This document lists reference topics that have been added for the Windows 7 release. These documents are entirely new. Some older material not listed here also contains new Windows 7-specific content, such as new enumeration, constant, and flag values.
Interfaces
- IApplicationDestinations
- IApplicationDocumentLists
- ICustomDestinationList
- IDelegateItem
- IDesktopGadget
- IExecuteCommand
- IExplorerCommandState
- IFileDialog2
- IFolderViewOptions
- IHomeGroup
- IInitializeCommand
- IInitializeWithBindCtx
- IInitializeWithPropertyStore
- INameSpaceTreeControl2
- INameSpaceTreeControlFolderCapabilities
- INewMenuClient
- IObjectArray
- IObjectCollection
- IObjectWithAppUserModelID
- IObjectWithCancelEvent
- IObjectWithFolderEnumMode
- IObjectWithProgID
- IObjectWithSelection
- IOpenSearchSource
- IParseAndCreateItem
- IPersistSerializedPropStorage2
- IPreviewItem
- IQueryCodePage
- ISearchBoxInfo
- IShellLibrary
- ITaskbarList3
- ITaskbarList4
- IUpdateIDList
- IUserAccountChangeCallback
- IViewStateIdentityItem
How to Register DLL Control Panel Items
Control Panel items that are implemented in a DLL that exports the CPlApplet function have different registration requirements than .exe files. For Windows XP and later systems, new Control Panel item DLLs should be installed in the associated application's folder under the Program Files folder. Items that are stored in the System32 directory with a .cpl extension do not need to be registered; they are automatically shown in the Control Panel. All other Control Panel items usingCPlApplet must be registered in one of two ways:
- If the Control Panel item is to be available to all users, register the path on a per-computer basis by adding a REG_EXPAND_SZ value to theHKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Control Panel\Cpls subkey, set to the DLL path.
- If the Control Panel item is to be available on a per-user basis, use HKEY_CURRENT_USER as the root key instead of HKEY_LOCAL_MACHINE.
Instructions
Step 1:
Add this information to the registry to register the existence of the .cpl file.HKEY_LOCAL_MACHINE Software Microsoft Windows CurrentVersion Control Panel Cpls MyCpl = [REG_EXPAND_SZ] %ProgramFiles%\MyCorp\MyApp\MyCpl.cpl
How to Register Executable Control Panel Items
An example is used here to demonstrate the registration requirements. The example shows how to register a Control Panel item called My Settings as a command object so that it appears in the Control Panel window. The My Settings window also appears when the command
MyApp.exe /settings
is run. Instructions
Step 1:
Generate a GUID for the Control Panel item. The GUID uniquely identifies the Control Panel item. In this example,{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}
is the GUID of the Control Panel item. Step 2:
Using the GUID as a name, add a subkey to the registry as follows.HKEY_LOCAL_MACHINE
SOFTWARE
Microsoft
Windows
CurrentVersion
Explorer
ControlPanel
NameSpace
{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}
(Default) = My Settings
The data for the Default entry is simply the REG_SZ name of the Control Panel item. The Default entry can be useful to identify the GUID entry, but it is optional.
Step 3:
Using the GUID as a name, add a subkey and its entries to the registry as follows.
HKEY_CLASSES_ROOT CLSID {0052D9FC-6764-4D29-A66F-2F3BD9E2BB40} (Default) = My Settings LocalizedString = @%ProgramFiles%\MyCorp\MyApp.exe,-9 InfoTip = @%ProgramFiles%\MyCorp\MyApp.exe,-5 System.ApplicationName = MyCorporation.MySettings System.ControlPanel.Category = 1,8 System.Software.TasksFileUrl = %ProgramFiles%\MyCorp\MyApp\MyTaskLinks.xml
- Default. REG_SZ. The display name for the Control Panel item.
- LocalizedString. Optional. REG_SZ or REG_EXPAND_SZ. The module name and string table ID of the localized name of the Control Panel item. The format is an "at" sign (@) followed by the name of the .exe or .dll that contains the Multilingual User Interface (MUI) string table. Environment variables can be used as a substitute for a part of the path. The path and file name is followed by a comma (,) and a hyphen (-), followed by the ID in the string table.
If the module does not have a string table, then this entry can simply be the display name string. If you use only the display name string rather than a string table, the name does not adjust to the current display language.
- InfoTip. REG_SZ or REG_EXPAND_SZ. A description of the Control Panel item. This information is shown in an InfoTip that is displayed when the mouse hovers over the item's icon. The syntax is the same as that used for LocalizedString, including the option of simply providing a string rather than a string table reference.
- System.ApplicationName. REG_SZ. The canonical name of the item. The command of form
control.exe /name System.ApplicationName
opens the item; for example,control.exe /name MyCorporation.MySettings
. See Executing Control Panel Items for more information on the use of Control.exe. - System.ControlPanel.Category. REG_SZ. A value that declares the Control Panel categories where the item appears. Multiple categories are separated by commas. In the case of the example above, the entry specifies that the My Settings item should appear in both the Appearance and Personalization andPrograms categories. See Assigning Control Panel Categories for possible category values.
- System.Software.TasksFileUrl. REG_SZ or REG_EXPAND_SZ. The path of the XML file that defines task links. This can be a direct file path as shown in the example, or an embedded resource specified as a module name and resource ID such as "%ProgramFiles%\MyCorp\MyApp\MyApp.exe,-31".
Step 4:
Under that same GUID subkey, add the following subkey to the registry to provide the path of the file that contains the icon and the resource ID of the image within that file.
HKEY_CLASSES_ROOT
CLSID
{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}
DefaultIcon
(Default) = %ProgramFiles%\MyCorp\MyApp.exe,-2
Note that while the syntax is otherwise similar to the LocalizedString and InfoTip entries discussed earlier, no '@' character is used as a prefix in the REG_SZ or REG_EXPAND_SZ entry that specifies the path.
Step 5:
Add the following information to the registry to provide the command that is called by the system when the user opens the Control Panel.
HKEY_CLASSES_ROOT
CLSID
{0052D9FC-6764-4D29-A66F-2F3BD9E2BB40}
Shell
Open
Command
(Default) = [REG_EXPAND_SZ] %ProgramFiles%\MyCorp\MyApp.exe /Settings
How to Make Server Controls Browser Compatible Using ASP.NET
Introduction
In modern web development, we need to check the browser compatibility for our web pages. This can include changing the css styles for design issues. Using ASP.NET we can check the browser compatibility without writing a single line of code for the server controls.
Let's check out some code samples:
If we will define css classes like:
.IEStyle{color:Red;}
.FFStyle{color:Blue;}
.DefaultStyle{color:Black;}
Create a Label control in your page.
Label control:
<asp:Label ID=
"lblTest"
runat=
"server"
ie:CssClass=
"IEStyle"
mozilla:CssClass=
"FFStyle"
CssClass=
"DefaultStyle"
ie:Text="You are
in
Internet
explorer.
" mozilla:Text="
You are
in
Firefox.
" Text="
You are
in
other browser."
/>
Getting started with MongoDB
First download the MongoDB binaries from the following site - http://www.mongodb.org/downloads and unzip the downloaded binaries to a folder of your choice. Now you have to create a folder where MongoDB can store the data. This won't be created automatically.
Execute the following command in your shell:
C:\> mkdir \data
C:\> mkdir \data\db
At the last step, lets run MongoDB. Navigate to your MongoDB folder and execute the mongod.exe:
C:\> cd \my_mongo_dir\bin
C:\my_mongo_dir\bin>mongod
Now we are ready to start. If you want to open the shell admin console, use the following command:
C:\my_mongo_dir\bin>mongo
You can also use the web-based admin console - http://localhost:28017/
A detailed guide can be find on the following site -http://www.mongodb.org/display/DOCS/Quickstart+Windows
Featured Posts
Installing And Exploring Auto Dark Mode Software
Windows Auto--Night--Mode: Simplify Your Theme Switching Windows Auto--Night--Mode is a free and lightweight tool that makes switching bet...
-
Configuration config = HBaseConfiguration.create(); Job job = new Job(config,"ExampleReadWrite"); job.setJarByClass(MyReadWriteJo...
-
Print numbers in order : #!/bin/bash for i in $(seq 0 4) do for j in $(seq $i -1 0) do echo -n $j done echo done Will gi...