Thursday, February 24, 2011

Reportviewer print - blank pages

If a blank page is inserted after printing each page of a report (created with the Reportviewer control in Visual Studio 2010), narrow the width of the report in .rdlc file.

Friday, February 18, 2011

Learning stored procedures

Advantages of sp:
- capable of handling very complex queries
- utilizes resources of the db server not the app server
- convenient for moving app from platfrom to platform - business logic stays with the db

Sp structure:
CREATE PROCEDURE [PROCEDURE NAME]

/*
variables:
@variableName type
*/

AS

/*
SQL statements
*/

Wednesday, February 16, 2011

What is ADO .NET Entity Framework

- a set of data access APIs
- targeting ADO .NET 4.0
- EFv4 (2nd edition) shipped with .NET 4.0 and VS 2010
- Entity Data Model is treated indepenently from its underlying datastore

WHAT IS LINQ??

- stands for Language Integrated Query
- able to query objects, ADO .NET (dataset, database, entities), XML

LINQ - http://msdn.microsoft.com/en-us/magazine/cc337893.aspx

LINQ to Entities - http://www.linqdev.com/PublicPortal/publicportal/linq-to-entities.aspx

Sunday, December 6, 2009

My copy command

This can only handle a line of 1500 characters...

#include
#include
#define LINESIZE 1500+1

int main(int argc, char *argv[]) {
FILE *src;
FILE *dest;
src = fopen (argv[1], "r");
dest = fopen (argv[2], "w");
char sf[LINESIZE];

if (src) {
while (1 == fscanf(src, "%[^\n]\n", sf)) {
sf[strlen(sf)+1] = '\0';
fprintf(dest, "%s\n", sf);
}
fclose(src);
}
else {
printf("Cannot open source file.\n");
}
fclose(dest);
return 0;
}

Printing a file backwards

int main(){
Student S;
fstream fback("std.bin",ios::in| ios::binary);
fback.seekg(-(sizeof(Student)), ios::end);
while (!fback.read((char *)&S, sizeof(Student)).fail()) {
cout << S << endl;
fback.seekg(-2 * (sizeof(Student)), ios::cur);
}
return 0;
}

Sunday, November 29, 2009

++, --: yet another prove why they should be avoided

I was doing a walk through from one the old tests:

x = -2.1;

after the line...

x = -x++;

3 compilers assigned 3 different values to x:

VC++: 3.1 - incremented, negated (not necessarily in this order), assigned
linux: -1.1 - incremented, assigned (why never negated?)
borland: 2.1 - negated, assigned (never incremented)