Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Lareous
Feb 19, 2008

EAT THE EGGS RICOLA posted:

In that case, my initial reply is what I would do, there's no need to persist the data unless you're going to be using it for something else too.

Alright good deal, I'll try it out. Thanks!

Adbot
ADBOT LOVES YOU

Computer viking
May 30, 2011
Now with less breakage.

Lareous posted:

Alright good deal, I'll try it out. Thanks!

Right - I guessed "pre-populated" referred to things you already knew about the candidate before they filled out the form. :)
In that case, it really is just a case of stuffing the form fields into a PDF generator of your choice; no database required. If you want to store it, text files are fine, though databases handle locking and such for you if there might be simultaneous submits.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!
If you're having them fill out stuff like a W-2, you probably don't want to store that anywhere after you've sent it, given that it might contain confidential information (like SSN). In fact, you should probably do what you can to make sure that you delete the resulting form after it's been sent (or after you've given up trying to send it if there's a failure).

QuarkJets
Sep 8, 2008

At work, we have an an HTML page on our LAN that gets periodically updated by a person who runs a MATLAB script that just modifies the HTML page. We want to reduce the number of MATLAB licenses, so someone suggested rewriting the script in Python and maybe just have it running as a cron job. This seems like a reasonable improvement, but is there a better way?

nielsm
Jun 1, 2009



QuarkJets posted:

At work, we have an an HTML page on our LAN that gets periodically updated by a person who runs a MATLAB script that just modifies the HTML page. We want to reduce the number of MATLAB licenses, so someone suggested rewriting the script in Python and maybe just have it running as a cron job. This seems like a reasonable improvement, but is there a better way?

Sounds like a sensible solution. Depending on exactly how complex the HTML output needs to be, you might also benefit from a templating engine such as Jinja2. As long as you just need to generate static pages, you can do without a full application server stack, so you probably shouldn't bother looking into any of those.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm kind of curious about pathfinding algorithms and such for something I'm trying to write for Minecraft. One of the mods adds something called "turtles" which is kind of a homage to turtles in Logo. The mod uses Lua to program the things. To some extent, the API is kind of weak so that the whole thing doesn't become too overpowered, but I persist anyways. I've been trying to make a general-purpose builder that would work off a text file of a building plan When loaded, it gives it a 3d array, where each element is an ID for what material to place there, if any. Assuming, say, that I want to iterate every element inside this 3d array, I came up with a nice-enough algorithm that saves on movement and placement time (these operations do consume time and some turtle energy). However, it was meant to assume I visit every position of the 3d array. It gets more complicated when dealing with things like "don't care" elements, or especially "do not go" elements. So:

1. Given something that works by moving up, down, and turning
2. Some areas of off limits
3. Other areas need to be explicitly cleared, although nothing needs to be placed there
4. Some spots are not of any concern
5. The input is a 3d array of these elements, as well as some for spots where I need to place down something

Are there some basic algorithms to attempt to efficiently handle the situation that I can look up?

Jewel
May 2, 2009

Rocko Bonaparte posted:

I'm kind of curious about pathfinding algorithms and such for something I'm trying to write for Minecraft. One of the mods adds something called "turtles" which is kind of a homage to turtles in Logo. The mod uses Lua to program the things. To some extent, the API is kind of weak so that the whole thing doesn't become too overpowered, but I persist anyways. I've been trying to make a general-purpose builder that would work off a text file of a building plan When loaded, it gives it a 3d array, where each element is an ID for what material to place there, if any. Assuming, say, that I want to iterate every element inside this 3d array, I came up with a nice-enough algorithm that saves on movement and placement time (these operations do consume time and some turtle energy). However, it was meant to assume I visit every position of the 3d array. It gets more complicated when dealing with things like "don't care" elements, or especially "do not go" elements. So:

1. Given something that works by moving up, down, and turning
2. Some areas of off limits
3. Other areas need to be explicitly cleared, although nothing needs to be placed there
4. Some spots are not of any concern
5. The input is a 3d array of these elements, as well as some for spots where I need to place down something

Are there some basic algorithms to attempt to efficiently handle the situation that I can look up?

Say you have an area like this (. is to clear, X is "don't go there")

code:
XXXXX
X.X.X
X...X
X.XXX
 ^ (Turtle)
It's hard to figure out the optimal path to explore each route. It's kinda a travelling salesman problem if you break it down into routes. Which is NP-hard, so it's not something a really slowly updating program like a turtle could solve, even inefficiently. I think, at least. And then there's the cases of

code:
XXX
X.X
XXX
Where the turtle can't really "pathfind" to the point.

The best solution I'm thinking of right now is a floodfill where it starts from where the turtle is and floods outwards, using some kind of pathfinding to wherever the flood fill reaches a new area, to work out some semi-optimal routes around that avoid backtracking.

So if you had this:

code:
 ^X^ (Continues up to wherever)
X.X.X
X...X
X.X.X
X...X
X.XXX
 ^ (Turtle)
The floodfill would go up here (X's replaced with spaces for clarity)

code:
 ^ ^ (Continues up to wherever)
 5 7 
 476 
 3 5 
 234 
 1   
And at the middle 7 it would say "okay, I can't spread any more, mark this as a path to go to" and will hit that path along the route of 1->6 following the shortest path branches then backing to the point where the branch began (6). Something like that. This seems to be basically tree traversal if you're looking for algorithms.

Another method would be:
  • Follow the closest path (floodfill, first dead end is closest)
  • Mark each tile you dig as "complete", floodfill again from that point and repeat.

Last method I can think about is segmenting the spots to dig into cubes, and pathfinding/clearing out based on those cubes rather than the individual tiles in them, but this method is a bit more complex, especially on such a rudimentary API.

With regards to placing blocks, I'd either separate dig/place into separate routines unless you can explicitly work out if placing a block won't obstruct you, or, check if you can place it while going backwards along the route after it's been marked as "completely cleared".

Jewel fucked around with this message at 06:02 on Feb 13, 2014

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I think you have the right idea about what I was saying. All I could come up with was np-hard stuff too. That might be okay if the work size isn't really that disgusting. The biggest thing I want to build is a dome of diameter 120 blocks, going up something like 50 blocks. Well, that is 720000 blocks, so I have to kind of think about that. I guess there's also reducing the scale of the work set by trying to subdivide it and then having some alternate lookup for handling the seams. I was worried about things like unreachable spaces. For what I was doing, it shouldn't happen . . . on purpose. I could see in general use somebody could end up trying to do that when trying to make some mechanism or something else that in its initial state is completely enclosed.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Treat it as a TSP and use some of the approximation algorithms out there.

it is
Aug 19, 2011

by Smythe
My company has a grails webapp with spring security. We have a dev environment, and a test environment. They are running the same code. I have a User object, and a Role object, and a UserRole object on both of these environments. They're identical. When I call /data/roles/showAll on dev, it works properly. When I call /data/role/showAll on test, it returns the json {error:"access denied"}. What could possibly be causing this? How are you supposed to fix this? Why would the same program with the same inputs generate different outputs?

EAT THE EGGS RICOLA
May 29, 2008

it is posted:

My company has a grails webapp with spring security. We have a dev environment, and a test environment. They are running the same code. I have a User object, and a Role object, and a UserRole object on both of these environments. They're identical. When I call /data/roles/showAll on dev, it works properly. When I call /data/role/showAll on test, it returns the json {error:"access denied"}. What could possibly be causing this? How are you supposed to fix this? Why would the same program with the same inputs generate different outputs?

Is test actually calling /data/role/showAll instead of /data/roles/showAll?

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.
I have a lua script that needs to grab a recursive directory listing for a very large folder. I'm running on windows and I am using this thing called filefind https://github.com/jjensen/luaplus51-all/blob/master/Src/Modules/filefind/doc/us/index.md

The problem is that this can take up to 10 seconds (while users are waiting). I'm wondering if there is a faster way to do this. Since these folders don't change often, I'd like to cache off the data somehow... but how do I check the folder timestamps without doing the whole iteration anyway? Edit: subsequent runs will only take a fraction of the time because of OS caching, but that first run is always very slow.

How does something like git check tens of thousands of files for changes so quickly? Maybe this filefind thing is just slow?

baby puzzle fucked around with this message at 02:01 on Feb 14, 2014

IAmKale
Jun 7, 2007

やらないか

Fun Shoe
I need some regular expression help. If I have a string containing a mix of Japanese kana and Roman characters, how can I match all continuous Roman characters and get it back as a single match?

For example, if I'm matching "ki", "kiく", "かki", or "かkiく", I want to get back "ki". Right now I'm using [a-zA-Z]* but this won't match anything if there's any kana in the string. I tried getting rid of the asterisk but that just returned single English letters at a time. How do I make this work?

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Karthe posted:

I need some regular expression help. If I have a string containing a mix of Japanese kana and Roman characters, how can I match all continuous Roman characters and get it back as a single match?

For example, if I'm matching "ki", "kiく", "かki", or "かkiく", I want to get back "ki". Right now I'm using [a-zA-Z]* but this won't match anything if there's any kana in the string. I tried getting rid of the asterisk but that just returned single English letters at a time. How do I make this work?

What language? In any case, you might want to use [a-zA-Z]+ instead.

Python 3:
Python code:
In [1]: strings = ["ki", "kiく", "かki", "かkiく"]

In [2]: import re

In [3]: pattern = re.compile('([a-zA-Z]+)')

In [4]: for i, s in enumerate(strings):
   ...:     m = pattern.search(s)
   ...:     if m:
   ...:         chars = m.group(1)
   ...:         print('String {} matched; chars extracted: {}'.format(i, chars))
   ...:
String 0 matched; chars extracted: ki
String 1 matched; chars extracted: ki
String 2 matched; chars extracted: ki
String 3 matched; chars extracted: ki
EDIT: damnit the HTML character escapes weren't in what I pasted here. Pretend that I typed strings = ["ki", "ki\u304f", "\u304bki", "\u304bki\u304f"] above, since at least vBulletin won't mangle \u character escape sequences.

EDIT 2: testing ["ki", "kiく", "かki", "かkiく"]

EDIT 3: okay, vBulletin seems to double-escape non-ASCII characters inside the [code] tag.

Lysidas fucked around with this message at 22:44 on Feb 14, 2014

it is
Aug 19, 2011

by Smythe
In grails, how do you save a list of objects to the DB with one database hit? Is there an easy way to say "here's a giant list of objects, put them all over there at once. I know some of these things have the same ID as other things, I don't care what they are, I want those gone and these in?"

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

it is posted:

In grails, how do you save a list of objects to the DB with one database hit? Is there an easy way to say "here's a giant list of objects, put them all over there at once. I know some of these things have the same ID as other things, I don't care what they are, I want those gone and these in?"

In SQL Server you would pass table parameters to a stored procedure, then within it do INSERTs or UPDATEs (or MERGEs if you're really cool) to do everything in one shot. Other databases offer a special %rowtype to pass an array of rows to a stored procedure which IIRC can be used in a similar way.

e: just noticed you said Grails. No idea there, sorry.

IAmKale
Jun 7, 2007

やらないか

Fun Shoe

Lysidas posted:

What language? In any case, you might want to use [a-zA-Z]+ instead.
That worked perfectly, thanks! This is for an Android app, so I'm using Java's Matcher to search strings. I had everything but the regex figured out.

Rahtas
Oct 22, 2010

RABBIT TROOP FOREVER!
e: Reposted question as I don't know how to get rid of that god-awful image I linked in this original.

Only registered members can see post attachments!

Rahtas fucked around with this message at 20:23 on Feb 16, 2014

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Rahtas posted:

If there is a better way to submit the code / file, please let me know.

Head to https://pastebin.com and copy/paste the file in there. Set syntax highlighting to XML, hit submit, then come on back with a link to the pastebin.

Rahtas
Oct 22, 2010

RABBIT TROOP FOREVER!

pokeyman posted:

Head to https://pastebin.com and copy/paste the file in there. Set syntax highlighting to XML, hit submit, then come on back with a link to the pastebin.

Thanks!


Original question:

This is probably the most unintuitive way to do something, but here's my process:
I am trying to write a .bat file that will go through and iterate on a bunch of files. The problem that arises is that I'm trying to utilize a program to perform some manipulations on these files. The program opens an xml file, performs some an action, and that's it. The files are all numbered sequentially. The xml file stores the file name its working on. I want to be able to find the file name in the xml and since the file name is just a number, to iterate to the next file. The problem is, I cannot find the file name in the xml. I know it stores it somewhere in the xml because when I remove the file the xml refers to, it says "Cannot find file 28.jpg" for instance.

Any help towards how to locate the file name within the xml would be super appreciated. I have added the pastebin link at the bottom, so you can have a look at it. The file is named gt-GT.xml and the file that this particular xml file is looking for is 28.jpg. My best effort was to open the xml, ctrl+f and type in "28.jpg". It returns 0 results, but that's the extent of my knowledge.

Thanks in advance!

http://pastebin.com/jKRZfgSn

SurgicalOntologist
Jun 17, 2004

I'm pretty sure your presumptions about how the program works are incorrect. Why don't you just back up to the beginning and tell us what program it is, and what workflow you're trying to automate. In other words, if you wanted it to process each file, could you do so "by hand"?

To actually answer your question, I don't think the XML file is doing what you think it's doing. There are no filenames in there.

Rahtas
Oct 22, 2010

RABBIT TROOP FOREVER!

SurgicalOntologist posted:

I'm pretty sure your presumptions about how the program works are incorrect. Why don't you just back up to the beginning and tell us what program it is, and what workflow you're trying to automate. In other words, if you wanted it to process each file, could you do so "by hand"?

To actually answer your question, I don't think the XML file is doing what you think it's doing. There are no filenames in there.

Gotcha.

I am trying to get some text from some images. The program I am trying to used is called GTText (https://code.google.com/p/gttext/downloads/list). I want to create a bat file to do this as I have ~ 300 images (sequentially numbered) to do this for.
When you load an image into the program you can then 'save as' and it will save and create an XML file. If you load the xml file via the program "file" -> "open project" it brings back up the image. You can run the program from a command line and pass into it the file name of an xml file to load and it will work and load the image. The file that I provided in the pastebin (http://pastebin.com/jKRZfgSn) is one such save file the program created.
Now, I know that somehow this program is directing itself towards 28.jpg via the save file. If I can find that reference, then I'd like to make a bat file that will edit the xml, load the program, process and image, paste the results in a notepad, then repeat through all the images I need done.

I don't know if there is an easier way to do this, but that's my plan thus far. I don't know if it will work, but I do know that to progress further with it I need to find where that 28.jpg is. I need to hunt it down, and I don't know what I'm doing with xml, pretty much.

almostkorean
Jul 9, 2001
eeeeeeeee
I recently realized that I'm lacking a lot of experience in data modeling. In my current job all of the modeling decisions are done by managers, but I'm having trouble modeling my personal project. Is there a good book or something to read on this topic?

SurgicalOntologist
Jun 17, 2004

Rahtas posted:

Gotcha.

I am trying to get some text from some images. The program I am trying to used is called GTText (https://code.google.com/p/gttext/downloads/list). I want to create a bat file to do this as I have ~ 300 images (sequentially numbered) to do this for.
When you load an image into the program you can then 'save as' and it will save and create an XML file. If you load the xml file via the program "file" -> "open project" it brings back up the image. You can run the program from a command line and pass into it the file name of an xml file to load and it will work and load the image. The file that I provided in the pastebin (http://pastebin.com/jKRZfgSn) is one such save file the program created.
Now, I know that somehow this program is directing itself towards 28.jpg via the save file. If I can find that reference, then I'd like to make a bat file that will edit the xml, load the program, process and image, paste the results in a notepad, then repeat through all the images I need done.

I don't know if there is an easier way to do this, but that's my plan thus far. I don't know if it will work, but I do know that to progress further with it I need to find where that 28.jpg is. I need to hunt it down, and I don't know what I'm doing with xml, pretty much.

Hmm. So you can load in a saved project (XML) from the command line but not an image?

For what you want to do, you shouldn't need to know anything about XML, just how to do as simple find/replace in text. However, everything in that XML seems generic. Maybe generate an XML for another file and then we can compare them?

it is
Aug 19, 2011

by Smythe

it is posted:

In grails, how do you save a list of objects to the DB with one database hit? Is there an easy way to say "here's a giant list of objects, put them all over there at once. I know some of these things have the same ID as other things, I don't care what they are, I want those gone and these in?"

OK so after some googling I'm pretty sure that the proper way to do this is to create an aggregator class for this object, then call save on the aggregator. So if I have to save a giant pile of Butt objects, I make a ButtAggregator class that hasMany Butts. I write all my Butts to the ButtAggregator and save the ButtAggregator.

Rahtas
Oct 22, 2010

RABBIT TROOP FOREVER!
Okay, I found out that the GTText program actually creates 3 xml files, 2 in sub directories - one of which had the file info that I want to manipulate.

My problem is now this. http://pastebin.com/RjrFH8H6
I am trying to make a .bat file to go through the xml file to iterate 1.png through to 300.png. Right now I have the code limited to 5 just for testing purposes.

The problem is, I do not know why in the substitution line:

set newline=!newline:%%i.png=!number!!

it is not using the value for the variable 'number'. I have tried it with percent symbols (%number%) and with exclamation points (!number!) and neither seem to work. At one point I added a pause at the end of the script with echo enabled and I can see that the 'number' variable is being updated correctly. However, in the replace line of the code, it doesn't seem to recognize it as a variable.
I'm guessing that this is just a syntax error, but I don't know what 'language' I'm working with in a .bat file (if it even is one), much less the syntax for it. Most of what I have cobbled together is just different bits of code I've been able to google.

Any help would be appreciated :)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Rahtas posted:

The problem is, I do not know why in the substitution line:

set newline=!newline:%%i.png=!number!!

it is not using the value for the variable 'number'. I have tried it with percent symbols (%number%) and with exclamation points (!number!) and neither seem to work. At one point I added a pause at the end of the script with echo enabled and I can see that the 'number' variable is being updated correctly. However, in the replace line of the code, it doesn't seem to recognize it as a variable.
I'm guessing that this is just a syntax error, but I don't know what 'language' I'm working with in a .bat file (if it even is one), much less the syntax for it. Most of what I have cobbled together is just different bits of code I've been able to google.

This is usually called something like "string substitution" and "variable interpolation", with various synonyms used for each word within those quotes. I think part 5 of this page might be relevant.

Rahtas
Oct 22, 2010

RABBIT TROOP FOREVER!

pokeyman posted:

This is usually called something like "string substitution" and "variable interpolation", with various synonyms used for each word within those quotes. I think part 5 of this page might be relevant.

I appreciate it, but unfortunately, I don't know enough of the theory of what I'm working with to be able to apply what you linked for me. Can you tell me what I should look at, more specifically in the linked page? I looked at / tried to use some of the stuff in part 5 - the find and replace. When I did that my 'number' variable started working better, but the 'newline' variable stopped, haha.
I can tell that there are some specific rules that govern / define the usage and interbreeding of !'s and %'s, but I don't know what they are. I would look up more on my own, but I don't even know what 'language' I'm working with here.
I feel I'm super close to getting this working, but I just need to know how to get the 'number' variable in the replace line to be interpreted not-literally.

DholmbladRU
May 4, 2006
Dont know if this is the proper place, howeve I am sure some of youall freelance so I thought id give it a try. I just started doing freelancing and it is a learning process. If I am performing a development job based on a SOW that does not outline intellectual property rights, who owns the intellectual property?

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

DholmbladRU posted:

Dont know if this is the proper place, howeve I am sure some of youall freelance so I thought id give it a try. I just started doing freelancing and it is a learning process. If I am performing a development job based on a SOW that does not outline intellectual property rights, who owns the intellectual property?
Consult a lawyer, because it almost certainly varies by jurisdiction.

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

DholmbladRU posted:

Dont know if this is the proper place, howeve I am sure some of youall freelance so I thought id give it a try. I just started doing freelancing and it is a learning process. If I am performing a development job based on a SOW that does not outline intellectual property rights, who owns the intellectual property?

Misogynist posted:

Consult a lawyer, because it almost certainly varies by jurisdiction.

It varies both by jurisdiction (at least on a country-by-country basis; the US has less state-by-state variation here due to the exclusive federal patent and copyright regime) and type of intellectual property (copyrights and patents have wildly different answers in the United States, and software is treated specially by comparison to other copyrights in many countries).

DholmbladRU
May 4, 2006
Ah, well unfortunately elance specifies intellectual property within the terms of use.

Rahtas
Oct 22, 2010

RABBIT TROOP FOREVER!
I suppose if there is no quick fix to my question, can anyone tell me the language batch files use so I can try to learn of little of it as necessary?

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!
Windows/DOS batch commands are their own language.

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

Rahtas posted:

I suppose if there is no quick fix to my question, can anyone tell me the language batch files use so I can try to learn of little of it as necessary?

Batch sucks but if you gotta use it, here:

http://en.wikipedia.org/wiki/Batch_file

Alternatively you should use PowerShell or really something like Cygwin so you can get a proper bash shell.

leftist heap
Feb 28, 2013

Fun Shoe
Anyone else spend way too much time waffling on languages and frameworks to use for their side projects? It's a recurring problem for me. Any strategies for coping with it? I always hate to give up on whatever I'm missing from language/framework X.

Rahtas
Oct 22, 2010

RABBIT TROOP FOREVER!

Zaphod42 posted:

Batch sucks but if you gotta use it, here:

http://en.wikipedia.org/wiki/Batch_file

Alternatively you should use PowerShell or really something like Cygwin so you can get a proper bash shell.

I've seen powershell hanging out on street corners, so I'll go take another look at it. My only concern is that its just another language I'll have to learn. I'm really just hoping for a quick fix as this is not something I need hardly ever. So hopefully powershell is pretty clean. I'll google cygwin, too, while I'm at it. Why the hell not.

e: More bad news, I'm on windows 8. I got sent to this site: http://www.microsoft.com/en-us/download/confirmation.aspx?id=34595 to get powershell, but there doesn't seem to be a version of the download for windows 8. Am I out of options?

Rahtas fucked around with this message at 20:12 on Feb 18, 2014

nielsm
Jun 1, 2009



I'm quite sure PowerShell is a core feature of Windows 8, not a separate download. You might have to enable it in the Turn Windows features on/off control panel on some versions.

Rahtas
Oct 22, 2010

RABBIT TROOP FOREVER!

nielsm posted:

I'm quite sure PowerShell is a core feature of Windows 8, not a separate download. You might have to enable it in the Turn Windows features on/off control panel on some versions.

Well look at that. You're absolutely right. Thanks. Okay, I have powershell! Yay!
Okay, now here is a new problem, haha. I am using this code:
http://pastebin.com/TiGxK3K4
to go through a text file containing "1.jpg 2.jpg 3.jpg 4.jpg 5.jpg".
I would expect that the output should be "2.jpg 3.jpg 4.jpg 5.jpg 6.jpg".
However, the output I'm getting is "6.jpg 6.jpg 6.jpg 6.jpg 6.jpg 6.jpg".
Its especially odd because if I change the ".jpg" in the code on either side of the search and replace portion:
(strNewText = Replace(strText, (intRep&".jpg"), (intNext&".jpg"))) so that both sides don't match, then it works fine. So if the second part is intRep&".cat" then my output is:
2.cat 3.cat 4.cat 5.cat 6.cat

I'm guessing this is a simple issue. Any ideas?

Rahtas fucked around with this message at 22:43 on Feb 18, 2014

Adbot
ADBOT LOVES YOU

nielsm
Jun 1, 2009



Your file initially contains:
1.jpg 2.jpg 3.jpg

In first iteration intRep is 1 and intNext becomes 2. You then replace all occurrences (a single one) of "1.jpg" with "2.jpg". Your file now contains:
2.jpg 2.jpg 3.jpg

In the next iteration, intRep becomes 2, and intNext becomes 3. You then replace all (two) occurrences of "2.jpg" with "3.jpg". Your file now contains:
3.jpg 3.jpg 3.jpg

One possible workaround is to do the replacement backwards, start with the largest number and work downwards.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply