|
Is there a way to preload the Pegasus Dll's?
Some users have delays of 11-20 seconds in the mybase.new method.
|
|
|
|
|
I'm not familiar with Pegasus, so I can't tell; you might contact the vendor about it.
Is there some license scheme, possibly contacting them in real-time over the Internet?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I need help converting between hex, ascii and back.
I want to type in an alpha numeric like "ABC123" and save as a HEX formatted like this "## ## ## ## ## ## ## ## ## ## ## ##"
Then later read that stored value and return to the text of "ABC123"
I am having trouble reading it and returning to text.
Here is what I try.
value = value.Replace(" ", "")
While (zero)
shorthex = value.Substring(0, 2)
If shorthex = "00" Then
value = value.Substring(2, value.Length - 2)
Else
zero = False
End If
i = i + 1
End While
Dim b((value.Length / 2) - 1) As Byte
Dim x As Integer = b.Length - 1
For i = value.Length - 2 To 0 Step -2
b(x) = value.Substring(i, 2)
x = x - 1
Next
value = Long.Parse(value, Globalization.NumberStyles.HexNumber)
Dim test As String = System.Text.Encoding.ASCII.GetString(b)
When this is done test does not show the valid Text.
Any suggestions?
I can't think of anything cool and nerdy to say.
|
|
|
|
|
Hi Cory,
your question is not really clear to me. How would you turn a six-char string ABC123 into a 24-char string (ignoring spaces)?? Please provide a full example, and/or provide the code that does the expansion.
Anyway, here are some comments on the code shown:
1.
the code is not safe, what if value starts of with all zeroes in it?
2.
Long.Parse is returning a Long, you shouldn't assign the result to value since that is a string.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I want to get string from textbox and write to RFID device formatted in HEX "## ## ## ## ## ## ## ## ## ## ## ##"
so, my goal is to (i think) convert text into Ascii then into hex and then I can save into the format.
Then I want to read from RFID and convert back to the Text. So I think I take formatted hex and convert to hex number and then to ascii number then to Text.
I am getting screwed up on the steps.
I think this will do the Write.
Dim i As Integer
Dim x As Integer
'Create array
Dim bytearray(23) As String
For i = 0 To bytearray.Length - 1
bytearray(i) = "0"
Next
Dim hex As String
Dim text As String = ""
'Change Text into ASCII
hex = Strings.Asc(TextBox1.Text)
'Change Ascii into HEx
hex = Long.Parse(hex, Globalization.NumberStyles.HexNumber)
x = 0
'Put hex into Format
For i = hex.Length - 1 To 0 Step -1
bytearray((bytearray.Length - 1) - x) = hex.Substring(i, 1)
x += 1
Next
'Create full formatted string to write to RFID
If TextBox1.Text<> "" Then
For i = 0 To bytearray.Length - 1 Step 2
text = text + bytearray(i) + bytearray(i + 1) + " "
Next
text = text.Substring(0, text.Length - 1)
If "f" is typed in text box then text variable should say "00 00 00 00 00 00 00 00 00 00 02 58"
I need help converting that back to "f"
I can get it back down to 258 which I think is the hex. I need to know how to convert back to Ascii and then Text.
Any ideas?
Text
I can't think of anything cool and nerdy to say.
|
|
|
|
|
Hi,
AFAIK this is completely wrong.
1. it does not work at all for more than one character since Strings.Asc(string) only looks at the first character of the string.
2. the conversion for a single character does not work (well, it does convert, but in a nonsensical way)
The simple example where original text is "f", it is an ASCII character with numeric value 102 in decimal, which is 66 in hex.
Indeed the outcome of Strings.Asc(TextBox1.Text) is the number 102
ERROR1: you erroneously store that in the string variable named "hex" which now holds "102"
ERROR2: then you parse, i.e. decode, it as if it were a hex number, hence the result is the number 258 since 1*256+0*16+2*1 equals 258.
ERROR3: you again erroneously store that in the string variable named "hex" which now holds "258"
and finally you do a lot of moving around to get some zeroes and spaces
What you probably want is something along these lines:
Sub rfid2()
Dim maxChars As Integer = 12
Dim Text As String = "ABC123 f"
Console.WriteLine("Encoding """ & Text & """ in " & maxChars & " hex chars")
Dim length As Integer = Text.Length
Dim result As String = ""
Dim i As Integer
For i = 1 To maxChars - length
result = "00 " & result
Next
For i = 0 To length - 1
Dim chr As Integer = Strings.Asc(text.Substring(i, 1))
result = result & chr.ToString("X2") & " "
Next
Console.WriteLine("result=" + result)
End Sub
This generates "00 00 41 42 43 31 32 33 20 20 20 66 " where each of the characters is clearly visible in hex.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Ok, that works, but how do I take the ASCII and display the text?
I can't think of anything cool and nerdy to say.
|
|
|
|
|
Hi,
To reverse the process, you need to perform the reverse of the same steps, in reverse order.
AFAIK the reverse of Strings.Asc is Strings.Chr, and the reverse of int16.ToString("X2") is int16.Parse() where you will want the right NumberStyle. I leave the details for you to work out.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Got it! Thank you.
I can't think of anything cool and nerdy to say.
|
|
|
|
|
I would like to save the data logs from the serialport received events into a filename. The problem is, I am running a series of test using the queue collection and I want to save each test in a different filename, (e.g Test 1, Test 2, Test 3, etc). Is it possible to use savefiledialog with it? Or is there some other ways to get around to doing this?
|
|
|
|
|
Hi,
the SerialPort.DataReceived event runs on a separate thread since it is asynchronous to anything you are doing; as such you are not allowed to touch any Control (including Forms, dialogs, and SaveFileDialog object) unless you use the proper InvokeRequired/Invoke method.
Also it does not seem like a good idea to interact with the user from within the DataReceived event, since more data will be arriving while you are waiting for the user's reaction.
Furthermore, the SaveFileDialog is *not* for saving data to a file, it is intended for letting the user *choose* a filename. When you need several file names, you probably want an algorithm to generate a series of filenames (say test###.log where ### is a sequence number)
What you should do is collect the data as it comes in, using whatever means appropriate (maybe a List<string> or a List<byte[]> depending on whether you accept text or arbitrary bytes); and in a different part of your app process or save the data, and interact with the user if and when necessary.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
|
Before any off your settings are called so best bet is the application startup event.
|
|
|
|
|
I can only now delete numbers from acces 2003 and not text. I have tryd this diffrent code, and all of them only delete numbers Eg "888".
It cant delete "myname" or "1 myname" only if everthing is numbers
MyOledbCommand.CommandText = "DELETE * FROM tblokkies WHERE leidraad='" & ListBox1.Items(ListBox1.SelectedIndex) & "'"
MyOledbCommand.CommandText = "DELETE * FROM tblokkies WHERE leidraad = """ & ListBox1.Items(ListBox1.SelectedIndex) & """"
MyOledbCommand.CommandText = "DELETE * FROM tblokkies WHERE leidraad='" & ListBox1.Items(ListBox1.SelectedIndex).ToString() & "'"
My colums is only set to text and leidraad is the primary key.
I don't know if it has to do with my insert to the table, here is the code I am using.
MyOledbCommand.CommandText = "Insert Into Tblokkies " & "(leidraad,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12) " _
& "Values (" _
& "'" & String1 & "', " _
& "'" & String2 & "', " _
& "'" & String3 & "', " _
& "'" & String4 & "', " _
& "'" & String5 & "', " _
& "'" & string6 & "', " _
& "'" & string7 & "', " _
& "'" & string8 & "', " _
& "'" & string9 & "', " _
& "'" & string10 & "', " _
& "'" & string11 & "', " _
& "'" & string12 & "', " _
& "'" & string13 & "')"
|
|
|
|
|
What are you populating ListBox1 with? A collection of objects or are they just strings?
|
|
|
|
|
I am usinf this to fill my listbox1
Do While MyDataReader.Read
ListBox1.Items.Add(MyDataReader("Leidraad"))
Dim MyItem = ListView1.Items.Add(MyDataReader("Leidraad".ToString))
With MyItem
.SubItems.Add(MyDataReader("A1").ToString)
.SubItems.Add(MyDataReader("A2").ToString)
.SubItems.Add(MyDataReader("A3").ToString)
.SubItems.Add(MyDataReader("A4").ToString)
.SubItems.Add(MyDataReader("A5").ToString)
.SubItems.Add(MyDataReader("A6").ToString)
.SubItems.Add(MyDataReader("A7").ToString)
.SubItems.Add(MyDataReader("A8").ToString)
.SubItems.Add(MyDataReader("A9").ToString)
.SubItems.Add(MyDataReader("A10").ToString)
.SubItems.Add(MyDataReader("A11").ToString)
.SubItems.Add(MyDataReader("A12").ToString)
End With
Loop
and these also
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim SqlStr As String
SqlStr = "Select * FROM tblokkies WHERE leidraad='" & ListBox1.Items(ListBox1.SelectedIndex).ToString() & "'"
'SqlStr = "Select * from tblokkies where leidraad = """ & ListBox1.Items(ListBox1.SelectedIndex) & """"
FillTextBox(SqlStr)
End Sub
|
|
|
|
|
OK. Well it all looks fine to me. What I would do is set a breakpoint just before your delete statement and check the value of ListBox1.Items(ListBox1.SelectedIndex) to make sure that you're getting the correct value. Sorry I can't be of more help.
|
|
|
|
|
you can try below below one
MyOledbCommand.CommandText = "DELETE * FROM tblokkies
WHERE leidraad=" & ListBox1.Items(ListBox1.SelectedIndex).ToString() & ""
|
|
|
|
|
Use parameters (oledb.oledbparameter)
Read up on sql-injunctions
|
|
|
|
|
Hi Experts,
I call SAP RFC from VB (VS 2005) for uploading data from SQL Server to SAP custom table. Connection and even RFC call in SAP works fine but I dont understand how I can pass SQL table to RFC in my VB code.
Can you give me your thoughts or any link which will give me some info. on the same on sending table to SAP RFC...it is array insert..
Thanks in advance..
Yogi
|
|
|
|
|
|
Same response to the last time he asked - we don't know. lol.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
We have third party software that has 20 MS Access database. The software resides on two boxes: 1 production and 1 for fail over.
I'm creating an app the copies the databases at different intervals; some monthly, some daily, and some every 30 sec to the fail over box. I plan to use a single class (CopyDB) to handle the copying. My question is: since I have three timers running how do I ensure that I do not get a race condition or that I do not miss one of the copies (monthly, daily) because the class was being used to copy (every 30 sec). Will SyncLock be sufficient?
Thanks in advance for you suggestions
|
|
|
|
|
Doug.Aliff wrote: We have third party software that has 20 MS Access database
If you have 3 timers to handle this those timers should run in there own thread and execute there own code (so each there own instance of the copydb class). So I don't think you'll have a problem with that.
The problems I see are:
0) file locking, but I don't think that's going to be a problem if you only copy the files.
1) time: 20 access database over network in 30sec?
2) performance: doing something this 'heavy' every 30sec is going to take a lot off power.
|
|
|
|
|
First let me offer you my sympathies and condolences, 20 Access DBs
Why do you have 3 times, you may have 3 conditions and different processes for each condition but you only need 1 timer. In your tick event simply test the 3 conditions (duration from last copy for the 3 types), do any copies needed and move on.
I know you have no control over the access Dbs but this DR method actually sounds like a D. If failover is so critical that you need to copy a DB every 30 seconds you have a SERIOUS design problem. Also I think Access used to have a replicate function way back when, you might want to raise that with the vendor.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|