Generate 001,002... name increments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Generate 001,002... name increments

lechristophe
Hi folks,

I'm programming a macro function that checks if a given file exists and
if so, automatically iterates the name to avoid overwriting previous
macro outputs.

Is there a simple way to generate a name suffix with beginning zeros
like 01,02,03...10,11,12...99 ? I could write a function to transform
index number into zero-containing suffixes, but I'm wondering if iy
already exists in the macro language or in Java.

If it does'nt exist, maybe this function could be added to the decimal
to string d2s() function by adding a second argumnt that specifies the
number of figures before the coma (the other decimal argument specifying
the number of decimals after the coma).

something like

a=3

d2s(a,2,0)="03"
d2s(a,3,4)="003.0000"

or a function "integer to string" that would incorporate such a feature...



Christophe Leterrier
Reply | Threaded
Open this post in threaded view
|

Re: Generate 001,002... name increments

dscho
Hi,

On Thu, 30 Aug 2007, Christophe Leterrier wrote:

> Is there a simple way to generate a name suffix with beginning zeros
> like 01,02,03...10,11,12...99 ? I could write a function to transform
> index number into zero-containing suffixes, but I'm wondering if iy
> already exists in the macro language or in Java.
>
> If it does'nt exist, maybe this function could be added to the decimal
> to string d2s() function by adding a second argumnt that specifies the
> number of figures before the coma (the other decimal argument specifying
> the number of decimals after the coma).

function d2s(number, width, character) {
        number = toString(number); // force string
        character = toString(character);
        for (len = lengthOf(number); len < width; len++)
                number = character + number;
        return number;
}

Hth,
Dscho
Reply | Threaded
Open this post in threaded view
|

Re: Generate 001,002... name increments

jmutterer
In reply to this post by lechristophe
You can use this pad( ) function :

Jerome.

print (pad(3,5,4));
print (pad(32,5,4));

function pad (a, left, right) {
while (lengthOf(""+a)<left) a="0"+a;
separator=".";
while (lengthOf(""+separator)<=right) separator=separator+"0";
return ""+a+separator;
}



while (lengthOf(""+a)<l) a="0"+a;
print (a);

On 8/30/07, Christophe Leterrier <[hidden email]> wrote:

>
> Hi folks,
>
> I'm programming a macro function that checks if a given file exists and
> if so, automatically iterates the name to avoid overwriting previous
> macro outputs.
>
> Is there a simple way to generate a name suffix with beginning zeros
> like 01,02,03...10,11,12...99 ? I could write a function to transform
> index number into zero-containing suffixes, but I'm wondering if iy
> already exists in the macro language or in Java.
>
> If it does'nt exist, maybe this function could be added to the decimal
> to string d2s() function by adding a second argumnt that specifies the
> number of figures before the coma (the other decimal argument specifying
> the number of decimals after the coma).
>
> something like
>
> a=3
>
> d2s(a,2,0)="03"
> d2s(a,3,4)="003.0000"
>
> or a function "integer to string" that would incorporate such a feature...
>
>
>
> Christophe Leterrier
>
Reply | Threaded
Open this post in threaded view
|

Java Virtual Machine problem

Winnok H. De Vos
Dear List members

I have recently upgraded my laptop to Windows Vista and reinstalled imageJ.
At first this worked fine. I tried to raise the memory up to 1500MB, but
after that ran into problems. Restarting ImageJ returned the error message

"Java Virtual Machine Launcher"
Could not create the Java virtual machine

I then reinstalled imageJ. It relaunched after install. I verified the
memory, which again was set to 640MB and tried another relaunch. This
returned the same error message. I removed JAVA and imageJ from my computer
and reinstalled them both again, but without success; I have not found a
similar problem in the archives.

Is anyone familiar with this problem and knows how to deal with it?
Many thanks in advance.
Kind regards,
winnok
Reply | Threaded
Open this post in threaded view
|

Re: Java Virtual Machine problem solved

Winnok H. De Vos
In reply to this post by jmutterer
Dear

It appeared the computer somehow remembered the larger memory setting. I
discovered this by running ij.jar from the cmd. In this way imageJ was able
to start up and here I did find the larger memory setting in the imageJ
memory options menu. Adjusting it here, turned everything back to normal.
Regards,
winnok


-----Original Message-----
From: werk [mailto:[hidden email]]
Sent: vrijdag 12 oktober 2007 15:30
To: 'ImageJ Interest Group'
Subject: Java Virtual Machine problem

Dear List members

I have recently upgraded my laptop to Windows Vista and reinstalled imageJ.
At first this worked fine. I tried to raise the memory up to 1500MB, but
after that ran into problems. Restarting ImageJ returned the error message

"Java Virtual Machine Launcher"
Could not create the Java virtual machine

I then reinstalled imageJ. It relaunched after install. I verified the
memory, which again was set to 640MB and tried another relaunch. This
returned the same error message. I removed JAVA and imageJ from my computer
and reinstalled them both again, but without success; I have not found a
similar problem in the archives.

Is anyone familiar with this problem and knows how to deal with it?
Many thanks in advance.
Kind regards,
winnok
Reply | Threaded
Open this post in threaded view
|

Re: Java Virtual Machine problem solved

Michael Weber-4
Hi Winnok,

the amount of memory being used by ImageJ is stored in the ImageJ.cfg (a
simple text file). So there is no need to reinstall.

If you would like to use more then ~1.5-2 GB, you have to use 64bit Java
on a 64bit system.

cheers,
Michael


werk wrote:

> Dear
>
> It appeared the computer somehow remembered the larger memory setting. I
> discovered this by running ij.jar from the cmd. In this way imageJ was able
> to start up and here I did find the larger memory setting in the imageJ
> memory options menu. Adjusting it here, turned everything back to normal.
> Regards,
> winnok
>
>
> -----Original Message-----
> From: werk [mailto:[hidden email]]
> Sent: vrijdag 12 oktober 2007 15:30
> To: 'ImageJ Interest Group'
> Subject: Java Virtual Machine problem
>
> Dear List members
>
> I have recently upgraded my laptop to Windows Vista and reinstalled imageJ.
> At first this worked fine. I tried to raise the memory up to 1500MB, but
> after that ran into problems. Restarting ImageJ returned the error message
>
> "Java Virtual Machine Launcher"
> Could not create the Java virtual machine
>
> I then reinstalled imageJ. It relaunched after install. I verified the
> memory, which again was set to 640MB and tried another relaunch. This
> returned the same error message. I removed JAVA and imageJ from my computer
> and reinstalled them both again, but without success; I have not found a
> similar problem in the archives.
>
> Is anyone familiar with this problem and knows how to deal with it?
> Many thanks in advance.
> Kind regards,
> winnok
Reply | Threaded
Open this post in threaded view
|

Re: Java Virtual Machine problem solved

ara-2
Hi Michael, or anyone else who can help!

I am having the same problem as Winnok.  I increased the memory in ImageJ too far, and it gave the "could not create java machine" error message.  I uninstalled and reinstalled ImageJ and that didn't help.  Reading your suggestions, it looks like I can change the memory elsewhere, but unfortunately I'm not extremely computer savvy and am not sure what exactly to do.  I'm using ImageJ in my research but only in a very simple way.  Can you give me easy to follow simple instructions on how I can decrease the memory so that it works again?  I don't know how to access the text files you mentioned...

Thank you SO much for your time!!!  I really appreciate it!  I'm at a standstill until I get this figured out.  
amy


<quote author="Michael Weber-4">
Hi Winnok,

the amount of memory being used by ImageJ is stored in the ImageJ.cfg (a
simple text file). So there is no need to reinstall.

If you would like to use more then ~1.5-2 GB, you have to use 64bit Java
on a 64bit system.

cheers,
Michael