|
Richard Deeming wrote: Not quite. GUIDs aren't entirely random, so you'd only need 2122 to get a collision with a specific GUID. To get a collision anywhere within the set of generated GUIDs, you'd only need to generate around 261 GUIDs.
Yep - Mark has posted about my brain glitch[^], too.
People becoming wiser in order to notice the stupid things they did back in the young days. This doesn't mean that they really stop doing those things. Wise people still do stupid things, only on purpose.
|
|
|
|
|
What was working well on Windows NT 4 does not work on Windows XP. What am I doing wrong? It starts Paint in a new window with the correct file, but the keys do not get sent to it.
Dim PaintCommand As String, PaintPath As String
Call PaintDir(PaintPath)
PaintCommand = PaintPath & "MSPAINT.EXE " & Filename1
If InStr(PaintPath, "WINNT") Then
Xnothing = Shell(PaintCommand, 1)
SendKeys "%FA{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{UP}{UP}{UP}{TAB}{ENTER}Y%FX", True
End If
If InStr(PaintPath, "WINDOWS") Then
If IsVista() = 1 Then
Exit Sub
Else
Xnothing = Shell(PaintCommand, 1)
SendKeys "%FA{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{UP}{UP}{UP}{UP}{UP}{UP}{TAB}{ENTER}YY%FX", True
End If
End If
|
|
|
|
|
You're launching Paint, but not waiting for it to start before sending keys to it.
This is one of the long list of problems with using SendKeys...
If you're using VB.NET, you should being the Process class to start another process, not Shell.
|
|
|
|
|
Thanks for your response. How best do I wait until Paint has started?
Should I need AppActivate PAINT or MSPAINT? It does not work, and I can't find the name of the program.
Even causing a delay by unnecessary calculations did not solve the problem. The focus does not shift to the Paint window. It send the keys to the window in the VB6 program.
modified 23-Oct-13 7:24am.
|
|
|
|
|
It's already going to be activated.
You have to use the Process class to start Paint, then you call the WaitForInputIdle method on it which will block your code until Paint starts and is ready for input. Then you can use SendKeys.
The problem with SendKeys is what if the user clicks on some other app? All the keys you're sending will then go to that application, not Paint...
|
|
|
|
|
Dave Kreskowiak wrote: It's already going to be activated. Not in VB6; there's a feature that prevents other apps from stealing the focus.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
The code he posted hints that he's using VB6, but we don't know for sure. He hasn't said what he's actually using.
But, you are correct.
|
|
|
|
|
Dave Kreskowiak wrote: It's already going to be activated. You have to
use the Process class to start Paint, then you call the WaitForInputIdle method on it which will block your code until
Paint starts and is ready for input. Then you can use SendKeys. The problem with SendKeys is what if the user
clicks on some other app? All the keys you're sending will then go to that
application, not Paint...
Yes, I am using VB6 on Windows XP.
The focus does not go to Paint. AppActivate also does not do anything either with the name or with the process number.
The user is nobody other than me, so there is little risk of the user clicking another window while Paint is doing its job in 1 second or so.
How do I use WaitForInputIdle? Is that some API command?
|
|
|
|
|
THe entire problem is that you Shell Paint and then you immediately try to Activate it or SendKey to it. Well, Paint hasn't started yet, so those operations do nothing because Paint doesn't have a window yet.
You have to wait for Paint to start and show itself before you can do anything else with it.
In VB.NET, this is two lines of code, uising the Process class. In VB6, it's a bunch more. You don't have a Process class and, hence, you don't have WaitForInputIdle either. You have to write this code yourself.
In VB6, you'd launch Paint, then call the Win32 API function OpenProcess to get the process handle, pass that handle to the Win32 function WaitForInputIdle, then call ReleaseProcessHandle on the handle you got. Seems simple enough, right? Try getting the handle to a Process that hasn't completely started yet...
|
|
|
|
|
I am a little novice in VB programming. I am trying to write a program related to Retail sales where I need to move the MRP to other fields whenever the MRP changes. I have three fields which I intend to update as and when MRP Changes. So the first time the MRP Changes the old MRP will move to MRP1 field. Subsequently to MRP2 and MRP3 field. Next time it should again update MRP1. Can anybody help me on how to do this using SQL updates. I am using VS2008 with MySQL.
|
|
|
|
|
You're going to have to confirm what your database schema is laid out like.
From the sounds of it, you're doing it VERY wrong. You should not have columns in the same table, labeled MRP, MRP1, MRP2, ... and moving the data from column to column. This results in having only a limited, fixed number of updates possible.
|
|
|
|
|
Hi Dave
Thanks for the reply. The Database schema is as follows:
Prodcode Varchar(15)
MRP Double(15,2)
MRP1 Double(15,2)
MRP2 Double(15,2)
MRP3 Double(15,2)
I actually did not understand why you say that the updates will limited. I can understand that the information with respect to MRP changes will be limited to 3 + current. This is ok with me. I don't want to create another table to keep this information as the requirement of keeping the details of MRP change will be enough with a level of 3. Also since I am dealing with FMCG products, and since the rate changes are quite frequent, with huge number of SKUs, I don't want to create another table and utilize additional disk space.
|
|
|
|
|
It's not the correct way of doing this, but, it's your system...
What you lose doing it your way is the ability to roll back any mistakes. History values will be lost if your updates exceed 3 and you try to roll it back. Also, if the user makes a mistake and hits your UPDATE button twice (if not handled properly!), say, in a web app, you could commit the same change to the record more than once and not be able to roll it back.
It's possible to do in a single SQL UPDATE statement. From my feeble memory...
UPDATE yourTable
SET
MRP = @parameterNewValue,
MRP1 = MRP,
MRP2 = MRP1,
MRP3 = MRP2
WHERE Id = @parameterRecordId
|
|
|
|
|
Hi Dave
Thank you so much for the reply. I agree that this is not the correct way of doing it but this is what is the requirement. I know that by keeping a separate table I will not only have the benefit of rollback to any times backward but also I can produce many important reports like price change frequencies, % price changes etc.
Thanks again
|
|
|
|
|
Yeah, you can also do "many important reports" by doing it the correct way. Sure, the SQL is a little more complicated, but it's a LOT safer for your data.
|
|
|
|
|
What you should be doing (as Dave implied) is redesign your table structure so there is 1 MRP field on your product table and a related table containing the history of the MRPs
lnkProductMRP
ProductID int
MRP Double(15,2) (why is this 2 decimal places and not an int)
Modified DateTime - when it was changed
ModifiedBy varchar(##) - who did the deed
Reason varchar(###) - Why the change of MRP
This retains your history past 3 events, allows roll back, and records the person and reason for the change.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have been searching the far reaches of the web trying to find a way to import all of my rss feeds into openoffice base. From what I have gathered so far is that it is possible with VBA code but could not find it anywhere. I think this should not be that difficult.
Also, I have been trying to find a way to forward emails to same database. Is there a way to setup a database email address to send mail to? I have already tried to forward the emails to rss feed but that is not without errors.
Please assist me in anyway, thank you.
|
|
|
|
|
Show us some code, for each of the two questions you have. However, e-mails might not be sendt an masse, as some providers have rules on how many can be sendt as a SPAM filter.
|
|
|
|
|
Hello,
I would like to make a duplicate of the currently open document via a VBA macro.
That is, when running the macro, it will use the current active document as source and make a copy of it without saving it to a file.
The current document may be modified (changes were not yet saved to a file), and it could be based on a specific template, with headers/footers/fields.
The new copy, should have an identical content (including headers/footers/fields) as the original, based on the same template but with a new name and not saved to a file yet. (The user may save it later if required)
Is this possible?
Thanks in advance.
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
Perhaps something like this will work for you.
Sub CopyDoc()
Dim sourcedoc As Document
Set sourcedoc = Application.ActiveDocument
Dim newdoc As Document
Set newdoc = Application.Documents.Add(Template:=sourcedoc.AttachedTemplate.FullName, Visible:=True)
sourcedoc.Range.Copy
newdoc.Range.Paste
sourcedoc.Activate
Set sourcedoc = Nothing
Set newdoc = Nothing
End Sub
|
|
|
|
|
I have been working on a minecraft (game) launcher and so far everything is going good. But I want it to do something more.. like install different versions. The way the official launcher does it by reading the .json file. Here is an example of one of the json file:
{
"id": "1.6.4",
"time": "2013-09-19T20:52:37+05:00",
"releaseTime": "2013-09-19T20:52:37+05:00",
"type": "release",
"minecraftArguments": "--username ${auth_player_name} --session ${auth_session} --version ${version_name} --gameDir ${game_directory} --assetsDir ${game_assets}",
"libraries": [
{
"name": "net.sf.jopt-simple:jopt-simple:4.5"
},
{
"name": "com.paulscode:codecjorbis:20101023"
},
{
"name": "com.paulscode:codecwav:20101023"
},
{
"name": "com.paulscode:libraryjavasound:20101123"
},
{
"name": "com.paulscode:librarylwjglopenal:20100824"
},
{
"name": "com.paulscode:soundsystem:20120107"
},
{
"name": "argo:argo:2.25_fixed"
},
{
"name": "org.bouncycastle:bcprov-jdk15on:1.47"
},
{
"name": "com.google.guava:guava:14.0"
},
{
"name": "org.apache.commons:commons-lang3:3.1"
},
{
"name": "commons-io:commons-io:2.4"
},
{
"name": "net.java.jinput:jinput:2.0.5"
},
{
"name": "net.java.jutils:jutils:1.0.0"
},
{
"name": "com.google.code.gson:gson:2.2.2"
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.0",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx",
"version": "^10\\.5\\.\\d$"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.0",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx",
"version": "^10\\.5\\.\\d$"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.0",
"rules": [
{
"action": "allow"
},
{
"action": "disallow",
"os": {
"name": "osx",
"version": "^10\\.5\\.\\d$"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "org.lwjgl.lwjgl:lwjgl:2.9.1-nightly-20130708-debug3",
"rules": [
{
"action": "allow",
"os": {
"name": "osx",
"version": "^10\\.5\\.\\d$"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl_util:2.9.1-nightly-20130708-debug3",
"rules": [
{
"action": "allow",
"os": {
"name": "osx",
"version": "^10\\.5\\.\\d$"
}
}
]
},
{
"name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1-nightly-20130708-debug3",
"rules": [
{
"action": "allow",
"os": {
"name": "osx",
"version": "^10\\.5\\.\\d$"
}
}
],
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
},
{
"name": "net.java.jinput:jinput-platform:2.0.5",
"natives": {
"linux": "natives-linux",
"windows": "natives-windows",
"osx": "natives-osx"
},
"extract": {
"exclude": [
"META-INF/"
]
}
}
],
"mainClass": "net.minecraft.client.main.Main",
"minimumLauncherVersion": 4,
"synced": false
}
I wanted to know how to read this (format it) properly. Example the above gets formated as:
-Djava.library.path=[]versions\1.6.4\1.6.4_TagCraftMC -cp []libraries\net\sf\jopt-simple\jopt-simple\4.5\jopt-simple-4.5.jar;[]libraries\com\paulscode\codecjorbis\20101023\codecjorbis-20101023.jar;[]libraries\com\paulscode\codecwav\20101023\codecwav-20101023.jar;[]libraries\com\paulscode\libraryjavasound\20101123\libraryjavasound-20101123.jar;[]libraries\com\paulscode\librarylwjglopenal\20100824\librarylwjglopenal-20100824.jar;[]libraries\com\paulscode\soundsystem\20120107\soundsystem-20120107.jar;[]libraries\org\lwjgl\lwjgl\lwjgl\2.9.0\lwjgl-2.9.0.jar;[]libraries\org\lwjgl\lwjgl\lwjgl_util\2.9.0\lwjgl_util-2.9.0.jar;[]libraries\argo\argo\2.25_fixed\argo-2.25_fixed.jar;[]libraries\org\bouncycastle\bcprov-jdk15on\1.47\bcprov-jdk15on-1.47.jar;[]libraries\com\google\guava\guava\14.0\guava-14.0.jar;[]libraries\org\apache\commons\commons-lang3\3.1\commons-lang3-3.1.jar;[]libraries\commons-io\commons-io\2.4\commons-io-2.4.jar;[]libraries\net\java\jinput\jinput\2.0.5\jinput-2.0.5.jar;[]libraries\net\java\jutils\jutils\1.0.0\jutils-1.0.0.jar;[]libraries\com\google\code\gson\gson\2.2.2\gson-2.2.2.jar;[]versions\1.6.4\1.6.4.jar net.minecraft.client.main.Main --username ~ --session - 0 --version 1.6.4 --gameDir| --assetsDir []assets
where ~ is username
[] and | is the %appdata% folder
I can format it manually using a notepad but this takes a lot of time and the process isn't automated. The above is an argument which needs to be passed in order to make the game run.
Any help regarding this would be appriciated
modified 17-Oct-13 14:29pm.
|
|
|
|
|
For reading or writing JSON in .NET, the best place to start is the JSON.NET[^] library.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Dear sir,
I made a project in Visual basic and sql server table,i made a window form where i placed a data grid, in data grid the header and data populated from database table, but i want to change the datagrid column header (not database table column)and populate the data from table programmatically.
|
|
|
|
|
You change the column headers by aliasing the columns in your SQL statement
eg
SELECT Firstname as Forename, LastName as Surname FROM tblPerson
=========================================================
I'm an optoholic - my glass is always half full of vodka.
=========================================================
|
|
|
|
|
|