Wednesday, January 13, 2016

Using "Crystal Report" with "Visual Studio 2010"


First shocking news is Crystal Report tool is not included by default with Visual Studio 2010. To come back from this shock, download crystal report tool from following link

=>
http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0.exe
After install don't forget to restart your computer. Because this is WINDOWS. Then after creating your first report if you get the following exception -
Could not load file or assembly 'file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies.

Than open App.Config file. Then find the attribute useLegacyV2RuntimeActivationPolicy and change the value to "true"


Happy Coding..........

Dynamic query and Incorrect syntax near 'GO' error.


This is in
codeproject... :)

Fun! hah?

Thursday, November 5, 2015

ACM problem set 10300 - Ecological Premium

Hello there.

Ecological premium is a very easy problem. Just you have to look at datatype. Consider following test case -

Input:-

1
10
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999


Output:-
99998000010

And following table is showing all fundamental integer types of variables in C:


Keyword Size Range Format Specifier
int 2 -32768 --> +32767 %d
long 4 -2,147,483,648 --> 2,147,438,647 %ld
long long 8 −9223372036854775807 --> +9223372036854775807 %lld
unsigned int 2 0 --> 65535 %u
unsigned long 4 0 --> 4,294,967,295 %lu
unsigned long long 8 0 --> 18446744073709551614 %llu


So carefully choice datatype.

Happy coding.


Friday, July 31, 2015

ACM problem set - 100 - The 3n+1 Problem

2 months ago when I have started solving ACM ad-hoc problems, I started with The 3n+1 problem. And I have failed to solve as usual. Then next few days I was thinking some complex solutions for that problem but my misfortune. I have failed again and again I have failed. 

Then I have focused on other ad-hoc problems. Solved some and learned that, "Sticky with Story!". The story of some ad-hoc problems have written in such way that readers started to think like they are going to solve a dynamic greedy np-hard problem. :D :D :D. One of my academic fellow who already competed regional math olympierd in Indonesia 2 times, he also gave-up ACM for this The 3n+1 problem!!

Here I am giving some clue for them who have tried this problem already and becoming frasted :)

clue 1: look at data type: declare all of your variables long (%ld)

clue 2: input would not always be given in sorted order. check whether first number < second number

clue 3: Show output in given order: If you swap first number and second number at the beginning of your program then be careful when showing output.

clue 4: If you got Time Limit Exit then check - does your program terminates correctly?
To terminate your program write program like this - 
while( scanf("%ld %ld", &firstNumber, &secondNumber) != EOF )
{
     // ... rest of your code ...
}

clue 5: The program algorithm is given in story. so you do not need to think about new algorithm.

clue 6: after each output there will be a new line. so,
printf("%ld %ld %ld\n", printNumberOne, printNumberTwo, output);

clue 7: debug, debug and debug if you get wrong output.

This problem is a Brute Force problem. so think straight.

Happy coding.



Thursday, July 16, 2015

ACM problem set - 10055 - Hashmat the Brave Warrior

Hello all. Today is my last fasting day of this Arabic fiscal year. I am preparing myself to celebrate EID-day tomorrow. But I am missing my family a lot. Without them nothing could be fulfilled.

Today I was looking into an acm problem 10055 - Hashmat the brave warrior. At first I was disappointed by the problem setter by thinking that, what a easy problem!  - Simple subtraction. And wrote code in 2 minutes and got 3 times penalty from online judge.  

What the hell!! simple subtraction :(
Then I read the problem again and again and found the tricks hidden in story. :)

You can try once. just find the tricks. you do not need to solve.

Happy coding.