Hi, I am very new to C# but I am modifying an image buffer directly within memory, I am scanning along moving the pointer to get the RGB of each pixel, but I need away to jump around the image memory and read the pixels at random rather than just p++ or p--?
byte* p = (byte*)(void*)pBuffer;
for(int y = 0; y < Height; y++)
for(int x = 0; x < Width; x++)
int srcB = p;
int srcG = p;
int srcR = p;
Hi, the problem is I have only used Blitz Basic before and I could jump to a pixel, eg GetColor(129,280)"Width,Height", with pointers I have to scan along the image for the data, I dont know how to jump to the pixel data I want?
For a 24 bit bitmap, the location of a pixel can be calculated with:
scan0 + y * scan + x * 3
(Note that for a bitmap that is stored upside down, which is the common way, scan0 points to the last line, and scan is a negative value.)
Your code for looping the image is incomplete. The lines might not be stored end-to-end in memory, you have to skip any extra bytes between the lines (calculated by scan - x * 3). Also, if the bitmap is stored upside down, you will either get the data upside down, or only getting garbage after the first line read.
Despite everything, the person most likely to be fooling you next is yourself.
when the last reference to an object (such as a byte array) is given up, the object becomes collectable.
byte myArray=new byte;
myArray=new byte; // old array is abandoned
myArray=null; // second array is abandoned
} // third array is abandoned (myArray out of scope)
Collectable means the garbage collector, when it decides to run, would find and collect the object.
However it will only run when there is a need to run, unless you force it with one of the GC
methods. Doing so is almost always a bad idea, since a GC run is costly, and temporarily blocks all
the threads; therefore the GC should only run when necessary, i.e. when there isn't enough
free memory to satisfy a new SomeThing() request.
I have an application in wcf with dualHttp
Is there a way to know if the server is shutting down suddnly unexpectidly like if some one do a restart?
Is there a way for the server to knmow if the same thing for the server to know if the client shuts down unexpectedly?
Now since I have got the report working and displaying properly, I'm struck @ this thing and I've got lots of confusion revolving this.
I've got a table with 5 fields in which date was splitted in 4 columns as DD, MM, YY1 and YY2. Using dataset (C#.Net), I've added a new column and concatenated these 4 fields into one and made it look like a date field (mm-dd-yyyy) and this field is a String field. Now the actual problem is that I want to display report based on a Date Range Selection from my Form (i.e 2 Textboxes for Start Date and End Date). I've not much clear idea as how to proceed validating the records as it can't be done at the database level since my database doesn't have anything like a Date Field.
Luc, there is nothing much I can do on the database coz it resides on the AS400 IBM iSeries server and that's the way how dates are stored in mainframe systems.
Then regarding the "looking like date field", its infact the the date itself which is stored in a string field and if I'm not wrong that can be converted into integer or date field..........that's wht i think...........am i right............???
and moreover, i need help on the logical part of how to proceed on it.........
Luc, that's the way they do it in mainframe server. But the thing is that I'm looking for something which could actually help me in doing the date range comparison at the code level. Normally we do it at the database level but since my database doesn't have a date field, I've to do it at the code level. I'm saying so, coz my code concatenates the 4 different fields into one field and display it as date field on crystal report. So if there are chances of any comparison for date range then it has to be done at code level only coz that's the place where its actually shown up as date field.
Did i confused you...........????
To be more clear, I want the date range comparison to be done exactly after the code where its concatenating the fields.............and the code for the same is as given below:
I wouldn't fetch all records and do it on client side, because it would unnecessarily create high load on the database server and fetch more records than actually needed. Can't you do something like this on server side?
WHERE YY >= startyear
AND MM >= startmonth
AND DD >= startday
AND YY <= endyear
AND MM <= endmonth
AND DD <= endday
I totally agree with what you guys are saying, but please let me know whether I can use the SELECT statement on DataSet the same way as we use on Database tables coz I don't have the datefield in database table, its only the newly created DataSet which is holding the DateField.
Now its the newPDS DataSet, which is having the DateField. So, now please tell me a way to apply the date range thing within this piece of code. (Date range from Form is entered in 2 Textboxes as START_DATE and END_DATE in the format of DD/MM/YYYY.