|
i used gzipstream to compress a file of dat format . it was saved with the extension of gz and was successed then decompressed it .the file was decompressed successfully, but it was unable to run , the media player said that the file is corrupted , can any one say why this happen and ,is it only the text files the gzipstream and deflatestream supports?
|
|
|
|
|
No, you can compress any file type you like. your code is broken, or the library is broken.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello experts,
I develop and desktop application using C#.NET 2005.
I want to improve the functionality of the application and want to do some code optimization.
Is their any idea...? Like how to make classes, variables declaration etc types of things...?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
I'm sure you already know how to create classes and variables. Really, the question is, what makes you think it needs improving, what are you trying to improve and where are the bottlenecks ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Ya you are right I know how to make class and variables...
But I read some where use sealed classes instead of public class <class name=""> if you don't want to inherit it again so that make your code faster.
use generics instead of hash table and array list etc.
So I need the guidelines what to do and what not to make efficient C#.net code.
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Pankaj - Joshi wrote: But I read some where use sealed classes instead of public class if you don't want to inherit it again so that make your code faster.
Possible. I doubt it has a huge effect tho.
Pankaj - Joshi wrote: use generics instead of hash table and array list etc.
Always use the generic containers, that's a no brainer. It will only speed things up for containers of value types, but. No boxing, you see.
Pankaj - Joshi wrote: So I need the guidelines what to do and what not to make efficient C#.net code.
Again, it's very unlikely that you've written code that will get a whole lot faster if you change what sort of containers you use. What sort of app is it, and what makes you think it could be faster ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I know I know I know Yes I already know what I written and how I do that...
I also want to know what are the best ways to make your code efficient..?
In simple language I'm talking about code optimization ...
Why are you talking about the other things...
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
With that attitude, this[^] is about all you're going to get now. Now, seriously, how hard is it to type that into Google??
|
|
|
|
|
This is something on which u r the best one to decide as u see the code more than anybody on codeproject so i think you have to decide what to you and what not to.
|
|
|
|
|
Ya I already know that....
But I want to know what are the best ways to make your code efficient..?
Regards
Pankaj Joshi
If you want to shape your dreams into reality, please wake-up...
|
|
|
|
|
Pankaj - Joshi wrote: But I want to know what are the best ways to make your code efficient..?
one way would be to change your attitude slightly and not annoy long standing members of this forum. Notice how the answers from CG stopped suddenly?
Stop saying 'ya, I already know that'.
Define fast. Define slow. How do you know something needs optimising? What is your benchmark for this?
If you really think a piece of code is slow, post it here and the comments will flow.
Small angry dogs
|
|
|
|
|
I use sql server 2000 with c# and I have made a database table name administrator which consist of three field (a_id,user_name,password).I also entered the data into it from the sql query.I have made the form that the user can input user_name and passord. I have already fetched the data from database table and I need to update the database table fields. how can i do.
|
|
|
|
|
Replace the SQL that is selecting the data, with SQL that inserts the new data
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi guy
can any bodey help me our i want to turn off my ups through my dot net application,
any help code , link .
thanks in advance
hello
|
|
|
|
|
The manual that came with the UPS is what you need. if it doesn't say that it offers that sort of functionality, then you probably cannot do it
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Any one know where I can find information, I could not Google any thing.
It's a font name.
|
|
|
|
|
I think it's more of a corrupted font name. It's impossible to say which one it really is.
|
|
|
|
|
Hi All,
I am using C# 2.0. I have a form with few controls such as Panel, TextBox, ListBox, GridView and etc. I am trying to resize all the controls in runtime when user resize the form by dragging form borders and I am doing this by setting Anchor property of all the controls to all sides (right,left,top,bottom) and the Dock property = None. Everything works fine ,but if I set form property AutoScroll = true then controls doesn’t resize. Any idea why? Please help.
Thanks in advance!
A.Asif
|
|
|
|
|
BEcause it scrolls instead of sizing ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have an application that needs to record data in a database and the particular date when that data was written to the database. More, I need customers to be able to retrieve data from the database by date or date range. To that end, the MS Access database I'm using has a field called TestDate of type Date/Time, and I set up two date/time pickers to allow customers to select a date or date range from which to get data.
All this works well and good until I change my regional/language options so the date format changes, say from mm/dd/yyyy to dd/mm/yyyy. Then, although the MS Access database updates the TestDate data automatically to reflect the change in date/time format and my date/time pickers in the C# appilcation reflect the altered format, the result of executing SQL statements based on the date/time pickers does not return the correct data from the database.
Rather, selecting all data from December 10, 2007 retrieves data from October 12, 2007. By contrast, if I select, say November 29, 2007, the correct data is returned. Something, then, is getting confused about ambiguous dates.
Any suggestions would be appreciated.
|
|
|
|
|
You are storing using DateTime fields from the textboxes aren't you, rather than using a string? More importantly, you are using a parameter to put the field into the database aren't you?
If you want to force a UTC date, then you use the U format qualifier with the DateTime. For example
DateTime dt = DateTime.Now;
Console.WriteLine(dt.ToString("U"));
|
|
|
|
|
Yes, I am using a parameterized query to insert new records into the database and storing the data using the DateTime data type rather than a string.
Still, somewhere between picking the datetime for the SELECT statement and retrieving the data from the database, the date time format gets lost in translation. If I select a non-ambiguous date such as 13/09/2007 (September 13, 2007), execution of the SQL command returns the correct data, but selecting an ambiguous date, such as 3/12/2007 (intending December 3, 2007) returns erroneous data. The report shows 12/3/2007 (March 12, 2007), but the value of the date prior to the execution of the SQL statement is 3/12/2007 (December 3, 2007).
|
|
|
|
|
Hi, I'm learning C# by lurking the forums, but have much experience in Access. This solution works in Access, and I think it will work in C# but haven't tested yet.
In an Access query you have to enclose the date in # to force american date format.
This is how I do this (In Access)
Function ScriptaUDF(Datum As Date)
ScriptaUDF = "#" & Trim(Str(Month(Datum))) & "/" & Trim(Str(Day(Datum))) & "/" & Trim(Str(Year(Datum))) & "#"
End Function
So whenever I need a date in a query I use:
where (((Table.datefield) = " & ScriptaUDF(Me!Datefield) & "))
I hope this helps
|
|
|
|
|
That's interesting. The problem I've been having occurs, seemingly, during the execution of the SQL statement. I enclose my SQL SELECT statements with a # sign currently, so
"SELECT * FROM Table WHERE Date BETWEEN #" startdate #" AND #" endate"
If the # character forces an American date format, that would explain much, I think.
|
|
|
|
|
How would I specify a date in a SQL expression without forcing the american date format? Is there something I can use to insert a date in the SQL query without using the # sign? Or, if I use the # sign, can I simply force the format that is needed?
|
|
|
|