|
Michael Schäuble wrote: I was hoping there'd be some general method in .net how I could explore what such a file exposes.
Files tend not to expose anything, but are (mainly) just a stream of bytes, written in a predetermined order. The only way, generally, to access the content is to get a document that describes their format. Occasionally it is possible to figure it out by using a hexdump of their content but with more complex files that is becoming more difficult.
MVP 2010 - are they mad?
|
|
|
|
|
I have a (Zed) graph with a Y Axis and a Y2 Axis, but the major amd minor ticks come at difference spacings leaving a ragged axis with the two jumbled up on both sides.
Is it possible to turn off the repeat of the Y Axis ticks on the Y2 Axis and vice versa. I have tried everything I can think of to try and get the spacings the same, but fix one and another dataset breaks it. I can't see a setting that is recognisable to me for doing this.
It is not a problem if the scale of the two axis is different.
|
|
|
|
|
Hi,
I have developed a class library to be used in a Windows project as well as a web project. Because I am developing plugins for a 3rd party CMS, the web project requires me to add some references to the class library so that I can comunicate with the CMS from my plugins. The back office Windows application, however, doesn't have the referenced CMS files available so the application fails.
Do I need to copy all the referenced files to each machine where I want to use the class library, even though the Windows app doesn't require them (none of the class library procedures called from the Windows app uses the referenced CMS files). Or is there some way I can exclude them when compiling the class library for the Windows App?
Thanks for your time.
|
|
|
|
|
If the Windows app does not use the portion of the common library that interacts with the CMS system, I would move the portion that does interact with the CMS into another library. Then you would end up with something like the following:
Windows app --> common library <-- Web project --> CMS plugin
|
|
|
|
|
OK Gideon that's great, thanks for your time and advice
|
|
|
|
|
Experts i have mostly figured out the code i need howevr am slightly stuck!
I have a database which works fine, i want to delete a record that i have highlighted,
code :
dim lbk as long
lbk = Adodc2.recordset.bookmark
Adodc2.refresh
Adodc2.recordset.move lbk
Adodc2.recordet.delete
This code will delete the last record and not the record selected
Im sure that there is something little in this code which isn't working, if anybody can help that would be great
Cheers
Dan
|
|
|
|
|
offroaderdan wrote: Adodc2.recordset.move lbk
should be :
Adodc2.recordset.bookmark = lbk
Are you sure the type of lbk is long ?
|
|
|
|
|
Thanks for that. However it comes up with run time error 3001, in conflict....
ummm just so i read your post write the code should go
dim lbk as long
lbk = Adodc2.Recordset.bookmark ' same as below
Adodc2.refresh
Adodc2.recordset.bookmark = lbk ' this is near enough repeated
adodc2.recordset.delete
Thanks again for the reply
and yeah i am sure that lbk is long as it will delete a record but not the one i want!
|
|
|
|
|
I seem to remember that the Bookmark property is a variant
|
|
|
|
|
Creating a report in Team Foundation Server(TFS) and my parameter is set as an array and I want to be able to display this array. I want to be able to switch the array to a list and then be able to show what is selected out of the list by the parameter the user selects. Can someone help please??
|
|
|
|
|
Hi all.
I have two functions to generate MD5 checksum of a file. The problem is that when I am computing checksum of some files, then sometime both functions are generating same hashvalue for same file but for some files both functions are generating different values.
The functions I am using are below :
function 1
Public Function GetMD5(ByVal file As String) As String
Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
Dim f As FileStream = New FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
md5.ComputeHash(f)
Dim hash As Byte() = md5.Hash
f.Close()
Dim buff As StringBuilder = New StringBuilder
Dim hashByte As Byte
For Each hashByte In hash
buff.Append(String.Format("{0:X1}", hashByte))
Next
Return buff.ToString()
End Function
function 2
Public function DoChecksum(ByVal file As String) as string
Dim csp As New MD5CryptoServiceProvider()
Try
Dim stm As FileStream = New FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
Dim hash As Byte() = csp.ComputeHash(stm)
stm.Close()
Dim computed As String = BitConverter.ToString(hash).Replace("-", "")
return computed
End function
Tell me where is the problem. Is there any problem in writing code or anything else.
Also suggest me how could I verify that file is modified or not by MD5 checksum.
Thanks.
Gagan
|
|
|
|
|
I think thats your problem:
buff.Append(String.Format("{0:X1}", hashByte))
{0:X1} means that all values between 0 and 15 are only display as 1 hex char while
16 - 255 are displayed with 2 hex chars.
But
BitConverter.ToString(hash).Replace("-", "")
always uses 2 hex chars for every value between 0 and 255.
Change {0:X1} to {0:X2} and it should work.
Greetings
Covean
|
|
|
|
|
Thanks, it worked.
Suggest me what should I do to verify that a file has modified by its hashvalue.
Thanks.
Gagan
|
|
|
|
|
You need to compare the hash value of the file against the value you got at a previous point in time, i.e. keep a record of all the hash values when you first index/create/whatever, the file.
|
|
|
|
|
I do not exactly understand what you mean.
To verify if some file was modified, I would compare the now new computed hash value with the one
of a previous computed hash value (for example at creation time of the file).
To compare these 2 values you could to a string or byte array compare.
Is this the answer you were looking for?
Greetings
Covean
|
|
|
|
|
Actually I want to check whether file is modified,infected or corrupted by some viruses or malascious programs. Since you all told to compare hashvalues with previous computed one, I have no hashvalue at previous time.
So if you have any idea to do so suggest me..
Thanks.
Gagan
|
|
|
|
|
Your stuffed then without knowing the original hash!
Use some virus checking software then.......there are plenty of them on the net, some free, some paid for.
|
|
|
|
|
If you don't know the hash value of the uncorrupted version of this file, then you will not be able to check for some file corruption.
In a good anti-virus-software there are many ways to reach this goal (in general they combine the following steps):
1. (very simple) Check the last-modified property of the file.
2. Do a first scan of all files and store the hash value of these files, after that the software
can check if the file was modified.
3. Scan the file data for some known virus-signatures (short byte sequences extracted from an infected file/virus).
4. Do a heuristic file scan.
Greetings
Covean
|
|
|
|
|
Thanks for your help. I got what I wanted.
But I have still some doubts. As you suggested the approach, I have confusin in (3) Scan the file data for some known virus-signatures (short byte sequences extracted from an infected file/virus).
Could you explain this??
|
|
|
|
|
For example this is the signature of EICAR-testvirus/testfile.
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
If you insert this string in a file (for ex. in a textfile), every anti-virus program should find an infection of this file! (but its not dangerous in any way)
See this wikipedia article.
This quote I found somewhere in the net:
"A virus signature is an unique string of bits, or the binary pattern, of a virus. The virus signature is like a fingerprint in that it can be used to detect and identify specific viruses. Anti-virus software uses the virus signature to scan for the presence of malicious code."
Greetings
Covean
|
|
|
|
|
These questions have been asked and answered a week ago, see here[^].
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
I have use a datagrid in my sales software, now when the user select any item and qty i want to calculate its value in another columns.
say for example:
Col "Items"
Col "Qty"
Col "Rate"
Col "Total Value" - I want to calculate the total value.
Thanks,
Sohil Masani
|
|
|
|
|
Here is a code snippet that I found online a while ago that helps:
Try this code in DataGrid CellEndEdit Events (note: this will sum the items
not multiply. So you will just modify it to check whether the cells have values and then multiply the values. i am to lazy to retype it)
Dim iTotal As Integer = 0
With DataGrid1
For i As Integer = 0 To .ColumnCount - 2
If Not IsDBNull(.Rows(e.RowIndex).Cells(i).Value) Then
iTotal += .Rows(e.RowIndex).Cells(i).Value
End If
Next
.Rows(e.RowIndex).Cells(.ColumnCount - 1).Value = iTotal
End With
modified on Wednesday, January 27, 2010 2:59 AM
|
|
|
|
|
Hi Sohil,
You can use the Datagridview_CellEndEdit() for manipulating the calculations. For example, from the below, suppose your "qty" column number is 3 or your "rate" column is 4 then, it can be...like the following
Private Sub MyDataGrid1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles MyDataGrid1.CellEndEdit
If e.ColumnIndex = 3 or e.columnIndex = 4 Then
Try
MyDataGrid1.CurrentRow.Cells("total value").Value = MyDataGrid1.CurrentRow.Cells("qty").Value * MyDataGrid1.CurrentRow.Cells("rate").Value
Catch ex As Exception
End Try
End If
End Sub
|
|
|
|
|
Developer,
I am looking for a code which retrieves data from the listview to textbox, combobox...etc. When I click on listview recode, I want it data pass to those textbox, combobox.
Thanks,
Chuon Visoth
Angkor Wat - Cambodia
asp.net - c sharp beginner
|
|
|
|