Wednesday, October 19, 2011

HDD External Hard Drive Corrupted and Unreadable

go to command prompt start-run-cmd enter

type chkdsk/r drive path example chkdsk/r d:

press enter

Thursday, July 14, 2011

MS DOS get timestamp in yymmdd format

:: get date pattern in yymmdd format
:: example set mydate=%date:~4,2%%date:~7,2%%date:~12,2%
:: by default %date% ---> mm/dd/yy

set yy=%date:~12,2%
set mm=%date:~4,2%
set dd=%date:~7,2%
set hr=%time:~0,2%
set mi=%time:~3,2%

SET tday=%yy%%mm%%dd%_%hr%%mi%
SET logfile=%tday: =%

Wednesday, July 6, 2011

Bali 5D4N Itinerary - Quick Summary

Day 1
- Check-in @ Febri's
- Free and easy in Kuta
- Dinner in Discovery Mall

Day 2
- Pura Taman Ayun (Royal Family Temple), Mengwi
- Candi Kuning market
- Pura Ulun Danu (the temple by the lake), Lake Bratan
- Lunch: Ayam Betutu
- Jatiluwih Rice Terraces
- Tanah Lot
- Dinner at Jimbaran Bay
- Free and easy in Kuta

Day 3
- Tanjung Benoa (watersports)
- Dreamland beach, Padang Padang beach
- Uluwatu
- Lunch at Bebek Tepi Sawah
- Check in @ Green Field
- Spa!
- Dinner - Pork Ribs

Day 4
- Art villages: Batuan (painting), Celuk (silver and gold craft), Mas (Wood)
- Batubulan and Sukawati market
- Lunch at Ibu Oka
- Stop by coffee plantation for luwak coffee
- Kintamani
- Tegalallang rice terrace
- Bebek Bengil
- Free and easy in Ubud

Day 5
- Ubud Palace, Ubud market
- Goa Gajah
- Adieu!

Bali Luwak Coffee - Abian Sari Coffee Plantation

Another much talked about Bali attraction is Luwak Coffee, supposedly the most expensive coffee in the world. It's actually quite common across Indonesia, and not just Bali alone =)

Why is it so famous? Well, basically we are ingesting coffee made of cat shit. Or to be more exact, civet cat shit.

Coffee 'produced' by the civet cat lose much of the bitterness but preserve the aroma / fragrance. Note that there is no specific blend of Luwak coffee - it could be Arabica, Robusta or pretty much anything. It depends on what is fed to the civet cat!

From bali - kintamani, luwak coffee

Green Field Hotel, Ubud

During our last 2 nights in Bali, we stayed at Green Field Hotel in Ubud.
Again, we found it on tripadvisor ;)

Green Field consists of several bungalows perched on the edge of paddy fields. It's fairly close to another well-known Ubud lodging, Tegal Sari.

From bali - green field hotel, ubud

Tuesday, July 5, 2011

Wood Carving in Bali

Wood carving (Mas) is among the big 4 crafts available in Bali. The abundance of natural, quality wood combined with talented craftsmen make up a thriving industry.

From Tanah Lot

Everywhere in Bali we can see stores selling items made from wood. They can range from little souvenirs and knickknacks, to elaborate works of art and timber furniture fit for a king.

Monday, July 4, 2011

Bali Beaches - Tanjung Benoa and Padang-padang

Tanjung Benoa is a beach dedicated to watersports. There are at least 10 types of watersports available, from jet skis to parasailing. This is a must-go place for adrenaline junkies!

The beach stretches along for quite a few kilometers and there are all sorts of water activities going on, both on the beach and in the sea.

From bali - nusa dua

The sun was scorchingly hot so we didn't stay for long, not being a fan of outdoor activities =)

Bali rice terraces - Jatiluwih, Tegallalang

Bali is also famous for her beautiful rice terraces.
I am told that there is no fixed harvest season in Bali. In order to view the rice terraces at their most beautiful, there is no definite date!
If you arrive sometime before April, it's highly likely that you can view the paddy fields before harvest time in all its green splendor.

The first rice field terrace that we visited was Jatiluwih.

From bali - terraced rice fields

It is nestled among the hills, and provides a stunning panoramic view of the rice fields.

Sunday, July 3, 2011

Bali Attractions - list of entrance fees

Uluwatu + sarong & belt rental (extra 60k for tour guide) - 3000 Rp
Pura Taman Ayun (Royal Temple) - 3000 Rp
Pura Ulun Danu, Lake Bratan - 10000 Rp
Pura Tanah Lot - 10000 Rp
Jatiluwih rice terrace - 4000 Rp
Kintamani : entrance - 10000 Rp
Gunung Kawi Temple - 6000 Rp
Pura Tirthe Empul - 6000 Rp
Gua Gajah - 6000 Rp
Bersakih: 10k entrance, 10k tour guide, 5k sarong rental - 10000 Rp
Garuda Wisnu Kencana GWK - 50000 Rp

Pura Taman Ayun, Mengwi

Pura Taman Ayun, also known as the Royal Family Temple, is one of the famous attractions in Bali.
It is located near Mengwi (somnewhere South of Bali).

The temple grounds are surrounded by a moat and there is a small pathway where the public can access, to walk around the main temple compound.

From bali - mengwi & lake bratan

Kuta and Legian, Bali

Strolling in Kuta and Legian can be quite a breeze. The cool sea breeze takes away the scorching heat of the sun, and the pavements are decent enough for pedestrians with a lot of trees providing shade.

From bali - kuta

There is only one setback - the narrow road is filled with cars and motorcycles. The air quality is, to put it frankly, very bad.

Due to the lack of time we stuck mainly to the main roads - Jln Karthika Plaza, along Kuta beach, and Jalan Legian. There's a charming blend of branded outlets, shopping malls, handicraft, pubs and novelty shops along the entire stretch - it is truly a feast for the eyes.

Febri's Hotel & Spa - Kuta, Bali

After going through the extensive list of Bali hotels in Trip Advisor, we finally settled on Febri's Hotel & Spa.

Located on Jalan Karthika Plaza, it's actually located in the Tuban area and not Kuta. Kuta is within walking distance though - roughly a 15-minute stroll along the main road. The airport is around 5 minutes away by car.

Upon check in we were welcomed with a refreshing drink of pineapple juice and cold face towels.
We were pleasantly surprised to find that the hotel has not one but TWO swimming pools!

From bali - kuta

Wednesday, June 15, 2011

List of banned sites in Malaysia - June 2011

Well, well, well.
Looks like Malaysia is moving backwards and trying to fight a losing battle against file piracy, as the GAMEN resorts to blocking popular sites such as:
Ware z bb,Pir ate bay,Mo vi e2k,Me g aupl oad,M ega v ideo,Pu tloc ker,Depo si tfi les,Fi les erve,F il es tu be,D uck lo ad

But.. wait a minute!
The Government is only making service providers implement the block by DNS!!
So how now??!!!

You have 3 ways to get your way around.
1, Make a DNS lookup online and get the IP address. Type it directly into your browser.

2, Change your DNS server. I like Google's Public DNS (8.8.8.8 and 8.8.4.4!) If you don't know how to change, read the instructions.

3, Use a proxy server to access sites. Where to get the sites? Again, google is your best friend.

Happy bypassing!

Friday, June 3, 2011

Silkroad Eprise: Publish page using C# Powercode

using System;
using System.Web;
using DotNetScriptEngines;
using System.Data;
using System.Data.SqlClient;

namespace Custom.EprisePublishPage{
class Publish {

// The 'main' entry point must exist.
public static void Main(String[] args){
EpsClient eps = new EpsClient(args[0]);
String objectId = "183880"; // the page object ID "<$client.URL.ObjectID>";
try
{

EpsEditPage pageToPublish = eps.GetEditPage(objectId);
pageToPublish.Save();
pageToPublish.SubmitForApproval("Some Comments here");
pageToPublish.Publish("Some Comments here");

}
catch (Exception ex)
{
eps.Write(ex.ToString());
}
}
}
}

Thursday, June 2, 2011

C# Accessing a MasterPage's variables

Place this block of code in Page_Load()

((myMaster)this.Master).strPageTitle = "Some String";

myMaster being the name of the MasterPage class.

Sunday, May 29, 2011

C# Read Excel file (.xls) using JET OLEDB Provider

public static void extractExcelContent()
{
string path = "D:\shared\file.xls";
if (File.Exists(path))
{
//create the "database" connection string (FOR EXCEL)
string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=\"" + path + "\";" +
"Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1;\"";
//create the database query
string query = "SELECT * FROM [FirstExcelSheet$]";

//create a DataTable to hold the query results
DataTable dTable = new DataTable();

//create an OleDbDataAdapter to execute the query
using (OleDbDataAdapter dAdapter = new OleDbDataAdapter(query, connString))
{
try
{
//fill the DataTable
dAdapter.Fill(dTable);
if (dTable.Rows.Count > 0)
{
foreach (DataRow row in dTable.Rows)
{
string fiscalDate = row["FiscalDate"].ToString();
string currency = row["Currency"].ToString();
double rate;
double.TryParse(row["Rate"].ToString(), out rate);
try
{
//do something
}
catch (Exception ex)
{
Console.Writeline("Error while updateExchangeRate: " + ex.ToString());
}

}
}
}
catch (InvalidOperationException e)
{
Console.Writeline(e.ToString());
}
dAdapter.Dispose();
}

//Optional: rename file
DateTime dtNow = DateTime.Now.AddDays(-1);
File.Move(path, path + dtNow.ToString("yyyy-MM-dd"));
}

}

Very quick way to generate Excel file from C#. LOVE IT!

Download the DLL from Google Code and include it in the C# project.
http://code.google.com/p/excellibrary/

//Create the dataset
DataSet ds = new DataSet();

//Set the locale for each
ds.Locale = System.Threading.Thread.CurrentThread.CurrentCulture;

//Create connection
SqlConnection sConn = new SqlConnection();
sConn.ConnectionString = ConnectionString;
sConn.Open();

// Execute stored procedure and fill dataset
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "sp_sample_stored_procedure";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = sConn;

SqlParameter param = new SqlParameter("Name", SqlDbType.NVarChar);
param.Direction = ParameterDirection.Input;
param.Value = name;
cmd.Parameters.Add(param);

SqlDataAdapter sAdapter = new SqlDataAdapter(cmd);
sAdapter.Fill(ds);
sConn.Close();

//Populate Excel worksheet from the data set
ExcelLibrary.DataSetHelper.CreateWorkbook("file.xls", ds);

Login to a website and download file using C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Configuration;
using System.IO;

namespace HttpBrowsing
{
class SimulateHttp
{
private HttpWebRequest request;
private CookieContainer cookieContainer = new CookieContainer();

public bool doLogin(string uid, string pwd, string url)
{
// Create a request using a URL that can receive a post.
request = (HttpWebRequest)HttpWebRequest.Create(url);
request.CookieContainer = cookieContainer;

// Set the Method property of the request to POST.
request.Method = "POST";

// Set the ContentType property of the WebRequest.
request.ContentType = "application/x-www-form-urlencoded";

// Create POST data and convert it to a byte array.
string postData = "user_name=" + uid + "&user_password=" + pwd;
byte[] byteArray = Encoding.UTF8.GetBytes(postData);

// Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length;
request.KeepAlive = true;

// Get the request stream.
using (Stream dataStream = request.GetRequestStream())
{
dataStream.Write(byteArray, 0, byteArray.Length);
}

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
response.Cookies = request.CookieContainer.GetCookies(request.RequestUri);
response.Close();
return true;

}

public void downloadFile(string url, string fileName)
{
// Create a request using a URL that can receive a post.
request = (HttpWebRequest)HttpWebRequest.Create(url);
request.CookieContainer = cookieContainer;

// Set the Method property of the request to GET.
request.Method = "GET";

// Get the response.
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(responseStream))
{
using (StreamWriter writer = new StreamWriter(fileName, false))
{
writer.Write(reader.ReadToEnd());
writer.Flush();
writer.Close();
}
}
responseStream.Close();
}
response.Close();
}
}

public void doLogout(string url)
{
// Create a request using a URL that can receive a post.
request = (HttpWebRequest)HttpWebRequest.Create(url);
request.CookieContainer = cookieContainer;

// Set the Method property of the request to POST.
request.Method = "GET";

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
response.Close();
}

}

Documentum Transformation Service (DTS) rendition fails intermittently

Once in a while the DTS to transform documents would fail without any special reason.
This error appears in the DTS logs: "Error: The remote server machine does not exist or is unavailable"

A machine reboot is needed in order to get services back to normal. However, this does not completely resolve the problem and the same thing happens again after some time.

Workaround:
1. Open the registry editor (Start->Run->Regedit).
2. Navigate to the following key HKEY_LOCAL_MACHINE\SOFTWARE\Adlib\Adlib FMR\Adlib Express\Default.
3. On the right hand pane, set the value of AvailMemUsageLimit to 0 (Double click and type the value in).
4. Stop all services (adlib and CTS):
- Documentum Content Transformation Services (also stop Documentum Content Transformation Monitor Services)
- Documentum CTS Admin. Agent
- Adlib Exponent Connector
- Adlib Exponent Manager
- Adlib Express Server
- Adlib FMR

5. Restart the CTS services(cts will restart adlib)
- Documentum Content Transformation Monitor Services (Monitor will restart Documentum Content Transformation Services)
- Documentum CTS Admin. Agent

Wednesday, March 9, 2011

DQL to get all renditions associated with a document

Was trying to deleted unwanted renditions in Documentum when I came across this annoying message:
"You cannot delete the primary rendition"

So it happens that I have TWO pdf renditions for one document and I am unable to remove the older one as both renditions had the same name. I ended up having to delete it using DQL Editor.

1. Get the r_object_id of document
select * from dm_document where object_name = 'XXXXX.doc'

2. Get all renditions associated with that document
select * from dmr_content where any parent_id='09000578802351ee' and full_format='pdf'

3. Identify the non-primary rendition(s). The Physical path is probably pointing to some cache directory in the results from (2).

4. To remove any unwanted renditions:
DELETE dmr_content object WHERE r_object_id = '06000578802136ef'

Hide the Home tab in SAP portal

Here’s an example of how it can be done:
1. Copy role as delta link: e.g. RFx Respondent (from User Administration: Portal Content -> Content Provided by SAP -> specialist -> SRM7.0 -> Core -> Roles -> RFx Respondent)
2. Open the Role and set the properties for the "Home" folder (top-level navigation):
Entry Point - No; Initial State of Navigation Panel – Always Close; Invisible in Navigation Areas – Yes
3. Assign the new role to user instead of the original/default RFx Respondent

Thursday, March 3, 2011

DQL to get workflow of document

Given the document name XXX018.doc

SELECT r_object_id FROM dm_document WHERE object_name = 'XXX018.doc'
or
SELECT r_object_id FROM dm_document WHERE object_name LIKE 'XXX018%'

select * from dm_workflow
where r_object_id in (select r_workflow_id
from dmi_package
where any r_component_id in (select r_object_id
from dm_sysobject (all)
where i_chronicle_id in (select i_chronicle_id
from dm_sysobject where r_object_id='09000578802335ad'))) and r_runtime_state='1'

Wednesday, March 2, 2011

DQL to find details based on workflow item

Based on this information, get the workflow details and document.
Started workitem: "4a000578800d9915" in docbase "ecmdocbase"

1. Get workflow id from package id
select r_workflow_id from dmi_workitem where r_object_id = '4a000578800d9915'

2. Get workflow details
select * from dm_workflow where r_object_id = '4d0005788004d500'

3. Get the document id from workflow package
select r_component_id from dmi_package where r_workflow_id = '4d0005788004d500'

4. get the document name
select * from dm_document where r_object_id = '0900057880210948'

running command line programs in remote servers

Download pstools from sysinternals.
Inside the package there's a tool called psexec.

Launch psexec from command line.
e.g. \\servername -u -p

Sunday, January 30, 2011

how to install perl modules

One of the simplest ways to install Perl Modules, with ActiveState Perl Package Manager.

If you're lucky enough to host your Perl apps in a server without firewall and proxy constraints...
Just launch DOS and run ppm!
e.g.
c:\>ppm
ppm>install PAR-Packer
bla bla bla....
ppm>exit

If your server is residing behind a firewall or is using proxy, the most common problem you will see is "Could not locate a PPD file for package xxxX".
A simpler alternative (than consulting the network admin and setting proxy env vars) would be to:
Search for PPM packages at http://ppm4.activestate.com/ or numerous other repositories such as http://www.bribes.org/perl/ppmdir.html
Download the Perl module archive (tar.gz) and the .ppd file, and place them in a local directory. Make sure the path does not contain spaces.
Launch ppm from command line and set the repository to your local directory.
e.g.
c:\>ppm
ppm>set rep Local c:\perl\addon
ppm>set
ppm>install PAR-Packer

Thursday, January 27, 2011

How to create exe from Perl files

Option 1: Use a Perl package such as PAR or PAR-Packer.
Assuming you have installed ActiveState ActivePerl, just go to command prompt and run the following:
ppm (launch perl package manager)
search (confirm the package available for download)
install

More info:
PAR-Packer: http://search.cpan.org/~rschupp/PAR-Packer-1.008/lib/pp.pm
example: pp -o packed.exe source.pl

Option 2: Use Perl2Exe.
http://www.indigostar.com/perl2exe.php
Download the version compatible with your Perl Installation and unzip the contents. Refer to the readme for more info.
Basically the command should just be perl2exe yourscriptname.pl

Option 3:
Use perlcc built-in command. I 'm not sure whether this works for Windows though.

Tuesday, January 25, 2011

web based administration for SQL server 2005

Purpose: a relatively fast and economical solution to administer SQL Server 2005 over the web. Ever heard of php myAdmin?

Main components needed in the host server:
- SQL Native Client
- Microsoft SQL Server 2005 Management Objects Collection* (optional)
- Microsoft SQL Server 2005 Backward Compatibility Components
- SQL Web Data Administrator (For my case I am using SQL Server 2005)

Both SQL Native Client and Microsoft SQL Server 2005 Management Objects Collection can be found from Microsoft Downloads: http://www.microsoft.com/downloads/en/details.aspx?familyid=DF0BA5AA-B4BD-4705-AA0A-B477BA72A9CB&displaylang=en

SQL Web Data Administrator is an open source project as of now; it is not officially supported by Microsoft. Use at your own risk!

Steps:
1. Download the required executables from Microsoft Library.
2. Download SqlWebAdmin source code from codeplex. Codeplex is an open source repository for .NET code. http://sqlwebadmin.codeplex.com/. Setup instructions can be found in the project site so I'm not going to elaborate.
3. Compile the source code locally if needed.
4. Install SQL Native Client (sqlncli.msi) and Microsoft SQL Server 2005 Backward Compatibility Components (SQLServer2005_BC.msi). For the latter, it is sufficient to pick SQL Distributed Management Objects (SQL-DMO) feature and disable all other features.

Alternatively, you can download the free lite version of myLittleAdmin at http://www.mylittletools.net/en/welcome.aspx

Tuesday, January 18, 2011

where can I find Oracle Client 9i?

Go to http://edelivery.oracle.com/EPD/Search/handle_go

Select the two check boxes and click on Continue.
In the next page select Oracle Database as Product Pack and pick OS.

Click Go for Searching.
in the result sheet, Click on 'Oracle9i Database Release 2 (9.2.0.1.0) Media Pack for Microsoft Windows'

Click download on for 'Oracle9i Client Release 2 (9.2.0.1.0) for Microsoft Windows 98/NT/2000/XP'

Lost installation product key?

Remote login to similar server and run regedit.
Locate the entries - it's probably under My Computer - HKEY_LOCAL_MACHINE - SOFTWARE
If you're lucky you might find the product key in the registry.
Related Posts Plugin for WordPress, Blogger...