Try BitConverter.ToSingle[^] - can't guarantee it will work, it depends on the originator floating point format. If it give ridiculous values, try swapping the byte order:
ABCD -> DCBA
Then try it again.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
This will make the floating point equivalent of the 4 byte integer interpretation of the bytes (i.e. "08 01 00 00" will make you 264.0), not the IEEE single precision floating point number represented there.
I'm simply creating the controls from the code behind by calling the respective constructor and now i am looking to make those controls created from code behind draggable though I tried AjaxDragPanelExtender for this but the controls were not retaining their position on postback.
FirstOrDefault is your clue. If not found, it will return the default value for DateTime which is DateTime.MinValue.
if (complete_date != DateTime.MinValue)
if (complete_date != default(DateTime))
null is default for reference types such as classes and interfaces, for value types such as structs there is normally a static readonly field or property available such as MinValue or Empty, or you can use the parameterless constructor to get the default, or default(...) as above.
DateTime is a ValueKind, so comparing it with null isn't very useful (it'll always not be null).
If your LINQ query doesn't find any rows, then FirstOrDefault() will return a default instance of the requested data type (DateTime, in this case).
There's a clue in the name
If you want to know if you found any rows or not, either test the query first (e.g. Any()) before evaluating First(), or compare the returned value with the default DateTime value (DateTime.MinValue, IIRC). If you do that however, you won't be able to tell the difference between no rows, and rows where the first had the minimum datetime value.
SELECT CASE WHEN COALESCE(title2, title)='RUNTIME PARAMETER'
It is ok but I want them not to be written in the function because anyone developer can mess it up. There will be lot of queries which will get run time parameters also from functions.
I want it somewhere so that it is safe. But it should be available during run time, means if i want to replace a query the i should be able to so that without the need of building and deploying the files.
One way i was thinking is to use either resource files or config files but i cannot make mind. I don't want the performance to take a hit yet to maintain flexibility and maintainability.
Using resource files means to load read text which will incur some performance loss but is better than config files as they are not safe and easily readable.
I have a question about a C# 2008 application that calls C# 2008 application by using 'Process exec_calc = new Process();'. Curretnly the first C# 2008 application creates output excel spreadsheets that are emailed out to customers.
Now the first C# application will count the number of rows that are generated on the excel spreadsheet. The first program will insert a new row into a customer table that is setup by customer number and count in a sql server 2008 r2 database. Now the first program will call the second C# application and pass that program the customer number.
When the second C# program runs, it will obtain the customer number from the arguements that where passsed to it. Now the second C# program will read the Customer table to obtain the row that was inserted into the customer table by the first C# program.
This process will continue until all of the customer records have been processed.
The second program will now call a web service with this information. This design needs to stay since 95% of the entire new design has been tested and works. This design will stay since it will make the code production ready within a few weeks.
My question is updating and accessing the customer table. Will I have any deadlock issues? Do I need to consider permission problem(s) and/or access problems that I need to consider? If so, what are the problems and what do I need to do to solve the problem(s)?
I want to make a simple media player in C# and I used QuartzTypeLib library to read the video and this perfect. But, in the next step I want my player to support ability to add subtitle to the movie.
I googled it but i didn't find any thing that simple and useful for me.
Can any one help, please.