Posted by: L J Arthur Neil | December 29, 2012

Viewing CHM Files in Windows – Fix for “Navigation was cancelled”

Right click on CHM file saved to your Computer in Windows Explorer select “Properties” on the General tab and click “Unblock” button.

Sometimes unregistered HTML Help viewer component can also causes this problem, try to register it by running command in command prompt “regsvr32 hhctrl.ocx”.

Weird and Funny, but works;

When you do, open with -> .chm file, uncheck the “Always ask before opening this file” . That solved the issue for me.

The post Viewing CHM Files in Windows – Fix for “Navigation was cancelled” appeared first on Neural Orbit.

Posted by: L J Arthur Neil | December 29, 2012

Maximum number of rows in Postgresql and other limits

Maximum Database Size Unlimited
Maximum Table Size 32 TB
Maximum Row Size 1.6 TB
Maximum Field Size 1 GB
Maximum Rows per Table Unlimited
Maximum Columns per Table 250 – 1600 depending on column types
Maximum Indexes per Table Unlimited

The post Maximum number of rows in Postgresql and other limits appeared first on Neural Orbit.

Posted by: L J Arthur Neil | December 29, 2012

Always remember those who serve

In the days when an ice cream sundae cost much less, a 10-year-old boy entered a hotel coffee shop and sat at a table. A waitress put a glass of water in front of him.
“How much is an ice cream sundae?” the boy asked.

“Fifty cents,” replied the waitress. The little boy pulled his hand out of his pocket and studied the coins in it.

“Well how much is a plain dish of ice cream?” he inquired. By now more people were waiting for a table and the waitress was growing impatient. “Thirty-five cents”, she brusquely replied. The little boy again counted his coins.

“I’ll have the plain ice cream”, he said. The waitress brought the ice cream, put the bill on the table and walked away.

The boy finished the ice cream, paid the cashier and left.

When the waitress came back, she began to cry as she wiped down the table.

There, placed neatly beside the empty dish, were two nickels (US coin worth 5 cents) and five pennies (US coin worth 1 cent). You see, he couldn’t have the sundae because he had to have enough left to leave her a tip. Though with the money he had he could have afforded an ice-cream-sundae.

The post Always remember those who serve appeared first on Neural Orbit.

Posted by: L J Arthur Neil | December 29, 2012

Thanksgiving Day

So what exactly is Thanksgiving Day?

Thanksgiving is about togetherness, love, caring about others and not yourself. It is about giving thanks to the heavenly father for all that he has provided. It’s the day that we give thanks. And we eat A LOT!

When did it first start?

Thanksgiving was started by the pilgrim settlers. The Pilgrims came to America from England. They were an oppressed religious group seeking religious freedom. They celebrated it with a feast for coming to the New World. With a lot of obstacles in front of them, they had to over come. This was in the year 1621.Native Americans helped the “Pilgrims” survive a horrible winter. The celebration was born.

Didn’t hear anything about feast yet:

Wait..we are there. The pilgrims were having no luck with farming and many of the settlers were dying off due to illness. But thanks to the Native’s farming tips, the pilgrims had an awesome autumn harvest. So to mark the occasion and to say ‘thanks’, the settlers decided to have a massive feast. The pilgrims went to hunt for some meat with their ‘Old World’ guns. This frightened the Natives who thought their new English buddies were actually preparing for a surprise war, so they knocked around to see what was happening. However, when they saw that the English were just hunting for food they decided to join in and they scored a massive amount of meat for their feast.

After they had collected enough food for a three day feast, the pilgrims and the Natives had one big party to celebrate the good harvest – as was the tradition in olde England. The ate, drank, sang and danced until they couldn’t handle it anymore.

so, Do people in England celebrate Thanksgiving?

No, people in England do not celebrate the holiday of Thanksgiving. England doesn’t have an official national Day of Thanksgiving on the order of the holiday in Canada and the United States of America. But the English have the general European tradition of a thanks for the harvest. Nowadays, thankfulness for the harvest is celebrated at different times and in different places throughout England. The celebration may be by a church, a community, or an organization.

The post Thanksgiving Day appeared first on Neural Orbit.

Posted by: L J Arthur Neil | December 29, 2012


Professor began his class by holding up a glass with some water in it. He held it up for all to see & asked the students “How much do you think this glass weighs?”

’50gms!’ ….. ’100gms!’ …..’125gms’ …the students answered.

“I really don’t know unless I weigh it,” said the professor, ” but, my question is: What would happen if I held it up like this for a few minutes?”
‘Nothing’ ..the students said.

‘Ok what would happen if I held it up like this for an hour?’ the professor asked.

‘Your arm would begin to ache’ said one of the student

“You’re right, now what would happen if I held it for a day?”

“Your arm could go numb, you might have severe muscle stress & paralysis & have to go to hospital for sure!”
.. ventured another student & all the students laughed

“Very good.

But during all this, did the weight of the glass change?”
asked the professor.

‘No’. Was the answer.

“Then what caused the arm ache & the muscle stress?”

The students were puzzled.

“What should I do now to come out of pain?” asked professor again.

“Put the glass down!” said one of the students

“Exactly!” said the professor.

Life’s problems are something like this.
Hold it for a few minutes in your head & they seem OK.

Think of them for a long time & they begin to ache.
Hold it even longer & they begin to paralyze you. You will not be able to do anything.

It’s important to think of the challenges or problems in your life,
But EVEN MORE IMPORTANT is to ‘PUT THEM DOWN’ at the end of every day before You go to sleep..

That way, you are not stressed, you wake up every day fresh &strong & can handle any issue, any challenge that comes your way!

So, when you leave office today,
Remember to

The post PUT THE GLASS DOWN ! appeared first on Neural Orbit.

Posted by: L J Arthur Neil | December 29, 2012

Simple and easiest custom two legged oauth implementation – Java + PHP

For 2 legged oauth authorization model, we need to just address the following things;

  •     Which application is making the request
  •     Whether the request has been tampered by a third party while in transit

With this, I tried the below steps to arrive at a custom ouath implementation. Feedback and suggestions are welcome.

Client Side:

  • Client will be given with an appId and a secretKey when he registers himself at the server site.
  • Whenever the client makes an api request he has to pass the token/signature along with the request.


$url = “http://localhost:8080/oauth/testRest?apiKey=abcd1234&nonce=234567234&points=5&userId=1&token=gftrh234hdf345dfg456″;

// make the call to the API, which returns valid XML
$xml = callWebService($url);

  • To generate the token client has to use HMAC-SHA1 algorithm ( This can be any algorithm which the client and server developers decide together.
  • Generating the token; Create a token with the secretkey, nonce and the params which are going to be passed to the server; (This will make sure the message has not been tampered)

      (E,g) for url http://localhost:8080/oauth/testRest?apiKey=abcd1234&nonce= 1234567234&points=5&userId=1&token=gftrh234hdf345dfg456;

echo hash_hmac(‘sha1′, ‘method=testRest?apiKey=abcd1234&nonce= 1234567234&points=5&userId=1&token=$token&more_params’, ‘PRIE7$oG2uS-Yf17kEnUEpi5hvW/#AFo’);

  • where nonce is the utc time in millisecond  (This is helpful to verify at the server side to whether its a new req/when it was generated)
  • token is a HMAC-SHA1 signature
  • and “PRIE7$oG2uS-Yf17kEnUEpi5hvW/#AFo” is the secretkey of the client

That’s it. There is nothing much needed at the client side.

Server side:

  • On the server side the server will try to generate the token/signature from the parameter passed using the secret_key of the client(identified using appId param from its databse).
  • If the client token and the server generated token matches the access will be granted.
  •  In addition to this server will also verify the REFERRER to make sure the right source is making the request. But this can’t be trusted. (The REFERRER can be obtained from the client while registering for appId and SecKey).
  • To give access to specific period of time we can make use of ‘nonce’ field. ‘nonce’ is the utc time in milliseconds. We can verify this at the server side and see how old is the request.

Sample client side implementation in PHP and server side implementation in Java for your reference.

PHP Code: (client)


//webservice url with the nonce which will be passed to server
$requestParams = “apiKey=abcd1234&nonce=” . current_millis();

//signature is created based on these params and passed as token to the web service – the private key used here is known only to client and server which is not passed via query string
$token = hash_hmac(‘sha1′, $requestParams, ‘PRIE7$oG2uS-Yf17kEnUEpi5hvW/#AFo’);

//complete webservice url – params + nonce + token
$url = “http://localhost:8080/oauth/testRest?” . $requestParams . “&token=” . $token;

//make webservice request
$ch = curl_init ($url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
$page = curl_exec ($ch);

echo $page;

//the following method gives utc time in millisecond

function current_millis() {
list($usec, $sec) = explode(” “, microtime());
return round(((float)$usec + (float)$sec) * 1000);

Java Code: (Server)

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Hex;

//controller method to receive params from client
public String testRest(){
HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get(ServletActionContext.HTTP_REQUEST);
//we need to remove the token from the query string and for the remaining query string we need to identify the signature (the signature is generated in server with the same logic used in client – HMAC SHA1)
String qs = request.getQueryString().replace(request.getParameter(“token”), “”).replace(“&token=”, “”);

String nonce = request.getParameter(“nonce”);
//the private key used here is known only to client and server which is not passed via query string
String newSig = hmacSha1(qs, “PRIE7$oG2uS-Yf17kEnUEpi5hvW/#AFo”);

//the server generate signature and the client signature are matched here. Also the request is served only if it has come to server within 30 seconds.
If (request.getParameter(“token”) == newSig &&( (int) (((System.currentTimeMillis() – Long.parseLong(nonce)) / 1000) < 30 )
Reject the request


//HMAC-SHA1 method
public static String hmacSha1(String value, String key) {
try {
// Get an hmac_sha1 key from the raw key bytes
byte[] keyBytes = key.getBytes();
SecretKeySpec signingKey = new SecretKeySpec(keyBytes, “HmacSHA1″);

// Get an hmac_sha1 mac instance and initialize with the signing key
Mac Mac = Mac.getInstance(“HmacSHA1″);

// Compute the hmac on input data bytes
byte[] rawHmac = mac.doFinal(value.getBytes());

// Convert raw bytes to Hex
byte[] hexBytes = new Hex().encode(rawHmac);

//  Covert array of Hex bytes to a String
return new String(hexBytes, “UTF-8″);
} catch (Exception e) {
throw new RuntimeException(e);

The post Simple and easiest custom two legged oauth implementation – Java + PHP appeared first on Neural Orbit.

To solve this issue, first you need to add the following lines in your config file (struts.xml);


It seems like that the value in struts.multipart.maxSize is passed to commons-fileupload. If the uploaded file exceeds this value, the message
you mentioned is displayed. BUT: if we set this value quite high (so that commons-fileupload is not complaining about it), the Struts
FileUploadInterceptor checks again for the parameter maximumSize, which is passed in the action-definition. (In my case I don’t want to have
files bigger than 120000 bytes.) If the file-size exceeds this value, the message declared in struts.messages.error.file.too.large is loaded. So, set the max value in the outer block (multipart.maxSize) and now your custom file upload validation message shoul come.

Create file and add the messages;

struts.messages.error.content.type.not.allowed=Please upload a valid file. The allowed file types are; jpg, gif. bmp, doc, xls and pdf
struts.messages.error.file.too.large=File is too large. Max allowed size is 1.5 MB.

And finally in struts.xml:

            <interceptor-ref name=”fileUpload”>
                <param name=”maximumSize”>1572864</param>
                <param name=”allowedTypes”>


This should handle the issue.

The post Struts2 – Fix for invalid File upload validation message(The request was rejected because its size exceeds the configured maximum) appeared first on Neural Orbit.

Posted by: L J Arthur Neil | December 29, 2012

SQL – Select Count(*) vs Count(1) vs Count(column)

COUNT(*) operation counts all rows matches with query’s condition.

COUNT(column) operation on the other hand counts all non-null values in that column from rows fed to it by matching the query’s condition

count(1) is same as count(*) and there is no difference between this two. “1″ is a non-null expression: so it’s the same as COUNT(*). The optimiser recognises it for what is is: trivial.

The above three varies depending on the Database you use, and make sure you verify yours before implementing it.

The post SQL – Select Count(*) vs Count(1) vs Count(column) appeared first on Neural Orbit.

The problem is the access permissions to the file. Postgres user does not have access to the file we try to use and it throws out this error;

ERROR: could not open file ‘myFile.txt” for reading: Permission denied SQL state: 42501

Make sure to update the owner of the file to ‘postgres’ and try using the COPY command again. All should go well.

In case of windows, you may have to try as below;

1. Right click on the file
2. Go to ‘properties’ menu
3. Note the “Groups or usernames” section and make sure user ‘postgres’ is there.
4. If user ‘postgres’ is not shown out there, click edit and try to add the postgres user by searching your computer.(Make sure you are not searching in the network)
5. Once you have changed the user, it should be fine now,

In case of Linux, use the following commands;

chown postgres myFile.txt

chmod u+r myFile.txt

The post PostgreSQL – permissions errors while using COPY command in windows/Linux appeared first on Neural Orbit.

Posted by: L J Arthur Neil | December 29, 2012

How to fix Remote Desktop disturbing screen issues

You shall try the following options while dealing with Remote desktop.

1.    Launch Remote Desktop Connection.

2.    On the Login screen where you give IP address of the remote machine, find the link “Options” and switch to Display tab.

3.    Drag the sidebar under Display configuration from Small to Large (Full Screen).

4.    Click Connect to check the issue.

All should be well now.

The post How to fix Remote Desktop disturbing screen issues appeared first on Neural Orbit.

Older Posts »