|
Check if the FTP server is supporting the File Transfer Protocol HASH Command for Cryptographic Hashes[^] (see at the bottom of that document for a list of FTP server software).
If so, you can create the hash for the local file using the same algorithm as marked in the FEAT response (or change the algorithm to be used) and compare it with the data returned from the HASH command.
[EDIT]
If not, check if the server supports one of the non-standard commands to return the check sum of a file. These are usually named like the algorithem.
[/EDIT]
Otherwise you would have to download the file to a different location and compare.
modified 2-May-18 11:08am.
|
|
|
|
|
Hi
Many apologies if this has been asked before, for the life of me I cannot find an answer (perhaps using the wrong search terminology).
Basically I've two tables in SQL - aircraft and status (they are linked with a foreign key) .
I've also got a form which has a combobox on it. This combobox contains 4 values which are located in status:
FMC
PMC
U/S
UNAVAIL
I've coded that part so that combobox displays above mentioned values (works fine):
Dim cboSelect As SqlDataAdapter = New SqlDataAdapter("SELECT condition FROM dbo.status", connection)
Dim cbox As New DataTable
cboSelect.Fill(cbox)
With cboServ
.DisplayMember = "condition"
.DataSource = cbox
End With
The problem I'm having is having the combobox display the actual value that is being used in the aircraft table. The record in aircraft (column name condition) is UNAVAIL. At the moment the Combobox defaults to FMC.
I know the SQL (well the query works whether its correct for VB or not I don't know)
SELECT condition FROM dbo.aircraft WHERE avNum='XXXXX'
Any help much appreciated TIA
|
|
|
|
|
Evenings im trying to solve this problem: i need to find all the possible results (using: +, -, *, /) from 4 numbers that we type in let´s say 4 text boxes and sho these results in a listbox or similar.
Im a bit lost as im no expert in programming and any help would be great
thanks in advance
|
|
|
|
|
Assuming only two numbers in each calculation. Then for each number, perform the operation with each of the other three numbers. In the case of add and multiply you need to check and ignore duplicate calculations.
|
|
|
|
|
Hi thank you for your reply. Im still trying to sort the math part of it. I think this involves over 2000 operations and if this is correct i dont think i can figure out the code cause really i dont know that much. I could do some "if" or "for each" or some "do while" stuff but if you guys think this is gonna take more than that please tell me
Thanks
|
|
|
|
|
I don't know where you got the number 2000 from, but maybe your original question was not complete.
|
|
|
|
|
Ok maybe i wasnt clear cause english is not my main language. We need to consider the 4 números everytime
Ex: a+b+c+d, a+b+c-d, a+b+c*d, a+b+c/d, etc
|
|
|
|
|
So the sequence is:
+ + +
+ + -
+ + *
etc.
I think that is a permutation of 3 out of 4 which is about 64 (a long time since I studied mathematics).
|
|
|
|
|
Exactly and also the numbers chance positivo aswel cause a/b is not the same as b/a
|
|
|
|
|
Sounds like a good candidate for a recursive algorithm.
To get the results for four numbers, you need to combine:
- The first number
+ the results for the other three numbers; - The first number
- the results for the other three numbers; - The first number
* the results for the other three numbers; - The first number
/ the results for the other three numbers;
For example:
Public Shared Function AllResults(ByVal ParamArray numbers() As Integer) As IEnumerable(Of Integer)
If numbers Is Nothing OrElse numbers.Length = 0 Then Return Enumerable.Empty(Of Integer)
Return AllResultsIterator(numbers, numbers.Length)
End Function
Private Shared Iterator Function AllResultsIterator(ByVal numbers As IEnumerable(Of Integer), ByVal length As Integer) As IEnumerable(Of Integer)
Dim n0 As Integer = numbers.First()
If length = 1 Then
Yield n0
Return
End If
For Each result As Integer In AllResultsIterator(numbers.Skip(1), length - 1)
Yield n0 + result
Yield n0 - result
Yield n0 * result
If result <> 0 Then Yield n0 \ result
Next
End Function NB: This will include duplicate results.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Oh, this looks good, i will try it later. Many many thanks
|
|
|
|
|
First of all apologies if I posted in wrong forum and im a complete newbie to programming so need things idiot proof if you know what I mean.
What I need to do is I have a .vbs of which runs into a .DOS and need to add a few things. The person who wrote the original has since left my work where I got it from .
I have posted below parts of the script where I think it needs to go but if wrong just let me know and I will post the whole script.
1) When it puts it into a folder I need it to ask me to input a password . When password input I then need it to move onto the .VBA command of zipping
2) What I also need is instead of it just creating a 7Z file with the name of zipped.7z I need it to be the same name as what the folder was called originally.
1) Think needs to go here just before where it says "all files moved"...
On Error Goto 0
For Each objFile In objDLFolder.Files
objFSO.MoveFile objFile.Name, strNewFolder & "\"
Next
objWShell.Popup "All files moved.", 0, "Done", vbInformation Or vbSystemModal Or &h00040000&
dim dotbat
set dotbat=createobject("wscript.shell")
dotbat.Run "C:\Users\icc.cctv\Documents\DONOTDELETE1.bat", 1, True
set dotbat=Nothing
2) I think it needs to go somewhere in there ...
cls&echo ENTER THE STATEMENT INTO FOLDER,
echo THIS WINDOW WILL CLOSE IN 5 SEC.
) else (
cls
7z a -t7z "C:\Downloads\zipped.7z" "C:\Downloads"
echo.&echo ALL FILES MOVED^^!
)
timeout 5 /NOBREAK >nul&exit/b
As said im compleely new so go easy on me please
|
|
|
|
|
glenn masters wrote: 1) When it puts it into a folder I need it to ask me to input a password . When password input I then need it to move onto the .VBA command of zipping You'd want to do that in the VBS part (not VBA, its not an application macro), as that has some easier ways to get user-input than the console has. Use the InputBox Function[^] and put the text into a variable.
glenn masters wrote: 2) What I also need is instead of it just creating a 7Z file with the name of zipped.7z I need it to be the same name as what the folder was called originally. So you'll need the original name of the folder that is being archived, do some string-manipulation probably to remove the path-part, and re-use that name when executing the archiving-command. Again, done from the VBS part; don't start adding it to the project at once; write it in a new VBS and get it working first, then integrate with the solution.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Hi,
I would need the following encryption/decryption source to work in VB6.
Public Function Encrypt(ByVal plainText As String) As String
Dim passPhrase As String = "1234567890"
Dim saltValue As String = "0987654321"
Dim hashAlgorithm As String = "SHA1"
Dim passwordIterations As Integer = 2
Dim initVector As String = "@1B2c3D4e5F6g7H8"
Dim keySize As Integer = 256
Dim initVectorBytes As Byte() = Encoding.ASCII.GetBytes(initVector)
Dim saltValueBytes As Byte() = Encoding.ASCII.GetBytes(saltValue)
Dim plainTextBytes As Byte() = Encoding.UTF8.GetBytes(plainText)
Dim password As New PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations)
Dim keyBytes As Byte() = password.GetBytes(keySize \ 8)
Dim symmetricKey As New RijndaelManaged()
symmetricKey.Mode = CipherMode.CBC
Dim encryptor As ICryptoTransform = symmetricKey.CreateEncryptor(keyBytes, initVectorBytes)
Dim memoryStream As New IO.MemoryStream()
Dim cryptoStream As New CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write)
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length)
cryptoStream.FlushFinalBlock()
Dim cipherTextBytes As Byte() = memoryStream.ToArray()
memoryStream.Close()
cryptoStream.Close()
Dim cipherText As String = Convert.ToBase64String(cipherTextBytes)
Return cipherText
End Function
Public Function Decrypt(ByVal cipherText As String) As String
Dim passPhrase As String = "1234567890"
Dim saltValue As String = "0987654321"
Dim hashAlgorithm As String = "SHA1"
Dim passwordIterations As Integer = 2
Dim initVector As String = "@1B2c3D4e5F6g7H8"
Dim keySize As Integer = 256
' Convert strings defining encryption key characteristics into byte
' arrays. Let us assume that strings only contain ASCII codes.
' If strings include Unicode characters, use Unicode, UTF7, or UTF8
' encoding.
Dim initVectorBytes As Byte() = Encoding.ASCII.GetBytes(initVector)
Dim saltValueBytes As Byte() = Encoding.ASCII.GetBytes(saltValue)
' Convert our ciphertext into a byte array.
Dim cipherTextBytes As Byte() = Convert.FromBase64String(cipherText)
' First, we must create a password, from which the key will be
' derived. This password will be generated from the specified
' passphrase and salt value. The password will be created using
' the specified hash algorithm. Password creation can be done in
' several iterations.
Dim password As New PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations)
' Use the password to generate pseudo-random bytes for the encryption
' key. Specify the size of the key in bytes (instead of bits).
Dim keyBytes As Byte() = password.GetBytes(keySize \ 8)
' Create uninitialized Rijndael encryption object.
Dim symmetricKey As New RijndaelManaged()
' It is reasonable to set encryption mode to Cipher Block Chaining
' (CBC). Use default options for other symmetric key parameters.
symmetricKey.Mode = CipherMode.CBC
' Generate decryptor from the existing key bytes and initialization
' vector. Key size will be defined based on the number of the key
' bytes.
Dim decryptor As ICryptoTransform = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes)
' Define memory stream which will be used to hold encrypted data.
Dim memoryStream As New IO.MemoryStream(cipherTextBytes)
' Define cryptographic stream (always use Read mode for encryption).
Dim cryptoStream As New CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read)
' Since at this point we don't know what the size of decrypted data
' will be, allocate the buffer long enough to hold ciphertext;
' plaintext is never longer than ciphertext.
Dim plainTextBytes As Byte() = New Byte(cipherTextBytes.Length - 1) {}
' Start decrypting.
Dim decryptedByteCount As Integer = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length)
' Close both streams.
memoryStream.Close()
cryptoStream.Close()
' Convert decrypted data into a string.
' Let us assume that the original plaintext string was UTF8-encoded.
Dim plainText As String = Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount)
' Return decrypted string.
Return plainText
End Function
|
|
|
|
|
|
Why are you still using VB6? It is a dead language.
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
I'm trying to set NumericUpDown control to Flatsyle.
Setting Borderstyle as FixedSingle effects only to the numberbox.
Is there a way to set also the up/down buttons to flatstyle?
jtpaa
|
|
|
|
|
|
Hi , I'm try to run my VB script which was working fine all the while, but suddenly getting the "Run-time error '9' for Subscript out of range" on my script fro the below code line:
SchemaMandatory = SchemaDetailSplit(2)
The script to take the 3 items:
- Fields
- DataType
- Mandatory
can someone help to advise what I'm missing here
|
|
|
|
|
You are trying to access an array item with an index that is outside the limits of your array. Look at your code and the data. What does SchemaDetailSplit(2) actually return?
|
|
|
|
|
I have this app made in vb6 which use ms access database, when install this app the .mdb file and other files gets store in the app folder i.e. c:\program files\my app\ and my software works fine. But when I install the same installation program in other system or computer the .mdb file gets store in C:\Users\xxx\AppData\Local\VirtualStore\ and its read and update the data from there only. And when trying to export the data to ms-excel its does not get exported though it did not give any error message.
I just wonder what could be the problem with this exporting and the storing the mdb file in this location, I have installed this app on windows 7 system.
Would be very grateful if anyone can give help or suggestion on this.
Thank you
Zela
|
|
|
|
|
Starting with Windows Vista, folder virtualisation has been intruduced. System folders like the program files folder are protected from being used for user files and access is redirected to the VirtualStore of the current user.
But even with older Windows versions it was not recommended to use the program files folder for user data.
Your problem is that the installation program is run with administrative priviliges and can therefore create files and folders in the program files directory. But accesses from the application itself will be redirected to the VirtualStore folder.
That you did not get any error message when the database can't be found is another sign of bad application design (besides storing user data at the wrong place).
If you have access to the source of the application and the installation program you should update both to use a common data folder. The most common is
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
If not, you should ask the developer for an update.
As a last resort, execute the application with administrator priviliges.
|
|
|
|
|
Thank you very much Jochen Arndt for your helpful response. I kind of a little bit understand now how things happen as I run the app with administrator privileges it kind of work now such as extracting data report to ms-excel. The coding is done by me making some modification from code downloaded from the internet.
Well let say it does not matter if the software read the data from virtualstore folder but what i want to make is exporting the data to ms excel. when I run the app through vb without compiling extraction of the data to ms excel works fine. But when I compile it as .exe and run the software, extraction of the data to ms excel works fine in some system but on some system it just does not make any output even though it report as is has done. Could you please guide me on how to rectify this error, since this app is to be utilized by a group of people and if they can't export the report in ms excel it would be kind of useless.
Would be grateful if you could please suggest any idea on this.
Thank you.
|
|
|
|
|
If it is your application use a common folder for the database as already suggested. Than you will have no problems and do it as recommended. All you have to ensure then is that the installation program creates that folder.
|
|
|
|
|
The above error i.e. extracting data to ms excel occurs especially on windows 10, it does not make any extraction at all, but when run the program or the exe file as an admin its work fine, would be grateful if any one help me solve this problem.
Thank you.
|
|
|
|