|
Software2007 wrote: the image shows the right size
where? how?
Software2007 wrote: but can't be opened
when? by what program?
has your app exited already? did you wait a full minute and try again?
Please start taking the answers you get more seriously, and provide more detailed accurate information, so we all can help you more effectively.
|
|
|
|
|
Luc: The image doesn't open up on disk, meaning I can't view the image.
I have split the stream based on '&'. The bytes array apparently is full of them when it comes to image raw binary data. So, I decided to parse the string to the left of "image=". This is not where the problem is, the problem is after parsing, for the remaining image bytes, why can't I open the image correctly if the preceding string happens to be more than 16 chars long? The code above is only psuedo code, in reality this will be much longer string.
modified 4-Jul-12 13:24pm.
|
|
|
|
|
Is it the exact same binary data for both preceding lengths? If not, maybe the stream exceeds the size of your byteArray buffer? The byte array should be initialized at the length of the stream without your preceeding string, not sure if you are doing that in live code but from your example it is a static value. Giving more information on your stream length and maybe even a sample of how you are generating the image would be helpful?
|
|
|
|
|
If that's your best answer to my six questions, it stops here for me. Lacking the info, I'm not going to waste my time guessing what is going on.
|
|
|
|
|
This line was the problem, byte[] byteArray = new byte[10000];
I chose a randomly bigger number 20,000 and it works. But, it still doesn't make lot of sense to me. The bytesread for the image data alone is 5430. So, with extra 17 bytes string, I would think the 10000 would be still big enough?
Is there a way to know how much to allocate instead of just guessing a large number? Stream.length seems to be problematic for me. Remember, this is a network stream that I don't know the size of containing image data.
modified 4-Jul-12 17:25pm.
|
|
|
|
|
That is what I was talking about static values. If this is network stream you either need an end of message marker to make sure you read the whole message or read until nothing is left. You should be able to check what is available on the network stream and if multiple reads are required to get the entire message you may need to do some byte array manipulation (new byte() with current and new and use array.copy...) hope that is helpful.
|
|
|
|
|
Thanks. I will look into it.
|
|
|
|
|
I want to decompile a C# 2010 application. The only thing I have to work with is the deployment and setup project that I obtained from a contract shop. (I am pretty certain the code I obtained from the contract shop is not the most current version of the code.)
In addition, I would like to know what a good open source (free) tool and/or visual studio.net 2010 professional featuret I can use to compare the C#.2010 code. Basically I want to compare code that is in a visual studio.net professional environment to the same some that is obtained from a decompiler tool.
Basically I would like to know if the professional version of visual studio.net 2010 has these features? if so, what are they and how do I access these features.
If this is not avaialble, then what open source (free) tool(s) would you use? Of the tools you recommend, would you let me know if they are setup to work well with each other? Possibly there is one open source tool that would accomplish this goal?
|
|
|
|
|
|
I have not come across anything that is as good as the .net reflector.
Unfortunately, that is not free.
You can use the 30 day trial edition from here[^].
|
|
|
|
|
For decompiling the software, I would recommend DotNetPeek[^]. Be aware, though, that no decompilation process is going to convert the code slavishly back to the original. It may get a good approximation, but in all but the simplest cases, it will not be 100% accurate.
|
|
|
|
|
I have messed with other languages on this but it seems kind of confusing in C#. lol
anyway I want to manage data read in a file. How can I make an array with other variables.
ie:
====================================================
int[] array = new int[24]; //any number
for(int i=0; i<24; i++)
{
array[i]["name"] = binaryReader.readBytes(4);
array[i]["age"] = binaryReader.readInt32();
array[i]["input"] = binaryReader.readStringTerminatedNull();
}
====================================================
Now that was pretty sloppy syntax, but I need help figuring out a way to handle variables of an array like that. Can anyone help?
|
|
|
|
|
====================================================
int[,] array = new int[24, 3]; //any number
for(int i=0; i<24; i++)
{
array[i][0] = binaryReader.readBytes(4);
array[i][1] = binaryReader.readInt32();
array[i][2] = binaryReader.readStringTerminatedNull();
}
====================================================
Note how array is initialised int [,] and [24, 3]
Note how element is referenced 0, 1, 2 not name, age and input
Also int[] can only contain integer values, not strings.
Personally I hate multi-dimensional arrays. I almost always encapsulate them as collections of classes so array[i][0] becomes person.name
"You get that on the big jobs."
|
|
|
|
|
thank you for the reply. But can you implement in code? I understand more C# than english. :p
|
|
|
|
|
This is pseudo code as I'm currently working on a Mac
public class Person
{
public string Name {get, set};
public double Int {get, set};
public string Input {get, set};
public voidMyBusinessLogic()
{
}
}
…..
List<Person> people = new List<Person>();
for(int i = 0, i < recordCount; i++)
{
Person person = new Person();
person.Name = binaryReader.readStringTerminatedNull();
person.Age = binaryReader.readInt32();
person.Input = binaryReader.readStringTerminatedNull();
people.Add(person);
}
"You get that on the big jobs."
|
|
|
|
|
thanks. helped alot!! Much more useful as well
|
|
|
|
|
And if you want to make you life easier look into constructors!
public class Person
{
public Person(string name,double intex, string input)
{
Name = name;
Int = intex;
Input = input;
}
public string Name {get, set};
public double Int {get, set};
public string Input {get, set};
public voidMyBusinessLogic()
{
}
}
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You can't do it like that in C#, C# isn't PHP!
As Rob said, create a class representing your objects (Person?), then have a collection of instances of that class; the collection could be an Array, but most often a List is a lot handier.
|
|
|
|
|
|
DJCRIS12 wrote: as you know i want to export selected columns to an excel file, but if theres another easy way to create a report please let me know
I didn't know.
The simplest way of creating a report is by exporting it as text. The second simplest way is to export is as HTML.
Excell accepts a lot of weird formats; you could save your file as "comma separated values", as HTML/XML and as their native format. I'd recommend the CSV-version, as that would be the most simple to achieve.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I agree with Eddy. I'd go for a CSV format because it's supported by other spreadsheet applications and requires no dependency on Excel.
If you do go with Excel also be aware that if it crashes you can start creating new instances. Unless handled properly.
Depending on where you are, you're also going to have to change the regional settings to US and back again to avoid exceptions.
"You get that on the big jobs."
|
|
|
|
|
I use ExcelLibrary which can be downloaded from Google code
License is GNU LGPL.
|
|
|
|
|
Hi This is Chandra,
working on the google maps in Asp.net with C#.At present i can able to bind the Langitude and latitude from database to Google maps based on selection of country.But, my problem is i want to bind the Sales data information along with Latitude and longitude pushpin.Is it possible? Can any one give me some suggestion on this to implements.
My table Data is looks like in the below format
Country Latitude Longitude Sales
England 51.479117 -3.178 33.32
England 51.478705 -3.177831 33.32
Thanks
Chandrkanth
|
|
|
|
|
Hi all! I had a solution to the problem i faced in my previous post below by calling Series.AddXY(). It worked. However, some of the x-axis labels are missing because of space.
Is there any way I can change the orientation of labels so that they become vertical or diagonally oriented as Excel does it? A lot of the labels have not been shown with the current solution with the labels being horizontal. Thanks.
|
|
|
|
|
Are you using a custom graph library, or is it one you've created yourself?
|
|
|
|