Machine ID
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Machine ID
I'm trying to get a unique ID number for a machine and so far I've managed to find a function that enables you to get the MAC address of whatever PC you're working on. That's great, except that things change if you go and replace the network card on said machine, making existing code useless. I need a way to identify a PC by it's unique serial number for (cash float purposes) so if anyone has any ideas, I'd appreciate it.
The timer I asked for a couple of weeks ago works beautifully by the way. Thanks.
The timer I asked for a couple of weeks ago works beautifully by the way. Thanks.
-
- Livecode Opensource Backer
Re: Machine ID
On mac:
Built-in Ethernet, Hardware (MAC) Address
Built-in Firewire, Hardware (MAC) Address
(See system profiler -> Network -> Location. Check out the doc on the apple website but this should different from the airport mac address which can change if you change the network card. If built-in... not supposed to be able to change it. )
Anyway, it looks like this is to work within a networked environment. What about keeping a master file somewhere on a server. On application startup, you check for the existence of a file "unique_id" stored locally. If that file doesn't exist locally, you simply create a new unique id (not yet listed in the master file with all IDs) and store that unique ID locally.
With that solution, you could have your application work in a U3 (movable disk) environment.
Marielle
Built-in Ethernet, Hardware (MAC) Address
Built-in Firewire, Hardware (MAC) Address
(See system profiler -> Network -> Location. Check out the doc on the apple website but this should different from the airport mac address which can change if you change the network card. If built-in... not supposed to be able to change it. )
Anyway, it looks like this is to work within a networked environment. What about keeping a master file somewhere on a server. On application startup, you check for the existence of a file "unique_id" stored locally. If that file doesn't exist locally, you simply create a new unique id (not yet listed in the master file with all IDs) and store that unique ID locally.
With that solution, you could have your application work in a U3 (movable disk) environment.
Marielle
-
- Livecode Opensource Backer
Re: Machine ID
Can you post it here?Squirly wrote:I've managed to find a function that enables you to get the MAC address of whatever PC you're working on.
I got it from Sons of thunder http://www.sonsothunder.com/devres/revo ... env001.htm
It works, no problem. But the point is that I have to be able to identify a certain machine at any time (it's a touch screen cash register) in order to keep up with the cash float. If you replace the network card of the machine, it obviously gets a new MAC address, making the whole thing kinda useless. Isn't there a machine ID one can use?
It works, no problem. But the point is that I have to be able to identify a certain machine at any time (it's a touch screen cash register) in order to keep up with the cash float. If you replace the network card of the machine, it obviously gets a new MAC address, making the whole thing kinda useless. Isn't there a machine ID one can use?
-
- Livecode Opensource Backer
Note that this "apple system profiler" is found in older versions. The script above doesn't work on my machine (Mac OS10.4.8 ).Squirly wrote:I got it from Sons of thunder http://www.sonsothunder.com/devres/revo ... env001.htm
Apple System Profiler 2.1.2 was released on October 21, 1998. This software requires an iMac or PowerPC-based Power Macintosh, PowerBook or Performa computer running North American English Mac OS 7.6, 7.6.1, 8.0, 8.1 or 8.5
To get that info on my system you need this shell call:
Code: Select all
system_profiler SPNetworkDataType|grep -e "MAC Address:"|awk '{print $0}'
For older systems, in the script above, you will have to change the part "get Appletalk Address" to something that gives you a unique ID.
Last edited by marielle on Wed Nov 29, 2006 5:31 pm, edited 2 times in total.
-
- Livecode Opensource Backer
By experience, I know that it is easy to try and force a solution we have in mind into the system. It's often beneficial to take the time to stop and think about what your minimum requirements actually are.Squirly wrote:I have to be able to identify a certain machine at any time (it's a touch screen cash register) in order to keep up with the cash float.
The question that comes to my mind when I take that approach is "do you really need to get some magic number from the system profiler". And the answer I have based on a very incomplete understanding of the problem is no, you don't need to take a risk to have your application not functioning anymore in 1-3 years time because the information you try to read out of the system profiler or the windows equivalent has slightly changed of format.
If all machines are known a priori (rather than have unknown machines connecting), then all you need is on each machine a small file that contains a unique ID that you created whatever way you decided.
If all machines are networked, then you can create this number anytime a new machine connects and store it locally.
Now if the difficulty is about generating a random string while making sure a unique number is given to each machine, here is some code
Code: Select all
on mouseUp
put field "machineIDs" into tListOfId
put createrandom(9, tListOfId, 1) & cr after field "machineIDs"
end mouseUp
function createrandom pLength, pList, pCount
put generateRandomString(pLength) into tRandom
if tRandom is not among the lines of pList then
return tRandom
end if
-- If we make it here, this means that the random number
-- already exists in the list, let's generate a new one then
-- Possibility for infinite recursion, have some code to offer
-- a graceful exit
if the shiftkey is down then exit to top
add 1 to pCount; if pCount > 10 then
answer "something bad happened"
exit to top
end if
-- Generate a new number
get createRandom(pLength, pList, pCount)
end createrandom
function generateRandomString pLength
put empty into tRandom
repeat with x = 1 to pLength
put random(10)-1 into tRnd
-- so that the number never starts with 0
if x = 1 then put random(9) into tRnd
put tRnd after tRandom
end repeat
return tRandom
end generateRandomString
You may have to just physically assign generated ID's to each machine
that your program is installed on.
If you're distributing your program to these machines via the internet...
(Or if the machines are phoning in to download the program...)
You use Rev or something else as a CGI program on a server. Machine
requests it's copy of your program to install. CGI program creates a
unique ID and places it in a text file, then zips up that file along with your
program. Then it sends the zipped file to the machine that requested it.
Now each time that machine runs your program, it grabs it's ID from
that text file and sends the id along with whatever else transaction data
it's sending. Do this for each and every machine that will use your
program.
Well, not sure that'd work for your needs or not, but it's more than
possible to do something like that in Rev. But basing on hardware is
never safe, and just for the reason you already realized.
-Garrett
that your program is installed on.
If you're distributing your program to these machines via the internet...
(Or if the machines are phoning in to download the program...)
You use Rev or something else as a CGI program on a server. Machine
requests it's copy of your program to install. CGI program creates a
unique ID and places it in a text file, then zips up that file along with your
program. Then it sends the zipped file to the machine that requested it.
Now each time that machine runs your program, it grabs it's ID from
that text file and sends the id along with whatever else transaction data
it's sending. Do this for each and every machine that will use your
program.
Well, not sure that'd work for your needs or not, but it's more than
possible to do something like that in Rev. But basing on hardware is
never safe, and just for the reason you already realized.
-Garrett
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Location: London, UK
- Contact:
-
- Livecode Opensource Backer
I discovered today this illustrated in your stack on the user space:Mark Smith wrote:get shell("uuidgen")
Rev Online > User Space > Mark Smith > libUUID
Do you see a problem with me adding that stack as well as others (4Panes, AudioWaveForm, Genetic Carpets) to the gallery? You don't have to do anything. I will take a screenshot, reuse the description, make a direct link to the stack within revonline... and send you an email to check that everything is to your liking before making it public.
-
- Posts: 179
- Joined: Sat Apr 08, 2006 11:08 pm
- Location: London, UK
- Contact:
Marielle, sorry I missed this post and never replied. Please feel free to put anything of mine from RevOnline on your site. The more places things can be found, the less likely it is that we have to re-invent the wheel.marielle wrote:I discovered today this illustrated in your stack on the user space:Mark Smith wrote:get shell("uuidgen")
Rev Online > User Space > Mark Smith > libUUID
Do you see a problem with me adding that stack as well as others (4Panes, AudioWaveForm, Genetic Carpets) to the gallery? You don't have to do anything. I will take a screenshot, reuse the description, make a direct link to the stack within revonline... and send you an email to check that everything is to your liking before making it public.
Best wishes,
Mark
-
- Livecode Opensource Backer
Great! I was away for a few days... I will update the gallery early next week.Mark Smith wrote:Marielle, sorry I missed this post and never replied. Please feel free to put anything of mine from RevOnline on your site. The more places things can be found, the less likely it is that we have to re-invent the wheel.
Marielle