|
Ceros_X posted:I'm working in Excel and trying get some cell formats to display what I want them to... I've got 3 alternatives: The first one (shown in column C/D) has the following code: C1: =IF(MOD(A1,0.1)>0,100*A1,IF(MOD(A1,1)>0,10*A1,A1)) D1: =IF(MOD(A1,0.1)>0,"CP",IF(MOD(A1,1)>0,"SP","GP")) The second one (column F) has: F1: =IF(MOD(A1,0.1)>0,CONCATENATE(100*A1," CP"),IF(MOD(A1,1)>0,CONCATENATE(10*A1," SP"),CONCATENATE(A1," GP")) The third one (column H) has: H1: =FormatCoins(100*A1) For this last one, I've defined a small VBA helper to avoid a big messy formula: code:
Sebbe fucked around with this message at 01:16 on Apr 30, 2010 |
# ? Apr 26, 2010 12:00 |
|
|
# ? May 14, 2024 06:31 |
|
Imagine that, quote != edit. Anyway, for further Excel questions, there's the Small Excel Question Not Worth Its Own Thread thread.
|
# ? Apr 26, 2010 12:01 |
|
Thanks! I checked the first post of this thread for an Excel thread, but it's not in the OP - maybe someone could add it? Also, the formulas are nice, but I was trying to do it with the cell formating options. This will work, it's just for some dumb rear end mundane gear calculator (although I may wind up submitting it to HeroForge so I didn't want the sheet to be ghetto). I'll probably just add the values and then hide the column and use your solution (the one from column F) for the price display and the one with the VBA solution for the grand total. Thanks a lot! (I'll PM you a link to the finished product if you want).
|
# ? Apr 26, 2010 15:11 |
|
I have the following problem, and I do not know how to logically approach it: I have N different time intervals of the form [a,b] (e.g. the time interval [5,9] consists of the times 5, 6, 7, 8, and 9). The problem is to determine the intersection of these N time intervals, where some will overlap, and some will not. For example, if I have [19,23], [3,7], [5,19], and [44,48], the resulting intersection I want is [3,23], [44,48]. Right now I am able to take all the start and end points of each time interval and sort them in ascending order [3, 5, 7, 19, 19, 23, 44, 48] and have an accompanying vector [s, s, e, s, e, e, s, e] of which point is a start or end. I am lost as to how to use this information to come up with the resulting intersection, and I am open to new strategies. Any ideas?
|
# ? Apr 27, 2010 05:05 |
|
Jose Cuervo posted:I have the following problem, and I do not know how to logically approach it: Conceptually all you need to do is merge all the ranges that overlap. When no ranges overlap each other, the remaining ranges are the answer.
|
# ? Apr 27, 2010 05:21 |
|
Jose Cuervo posted:I have the following problem, and I do not know how to logically approach it: Don't you mean union?
|
# ? Apr 27, 2010 05:23 |
|
Jose Cuervo posted:I have the following problem, and I do not know how to logically approach it: You're talking about the union. Jose Cuervo posted:Right now I am able to take all the start and end points of each time interval and sort them in ascending order [3, 5, 7, 19, 19, 23, 44, 48] and have an accompanying vector [s, s, e, s, e, e, s, e] of which point is a start or end. You're real close. Now you need to walk through the s/e array, left to right, and keep "score", where the score is the number of opening braces minus the number of closing braces. The score starts at zero. Whenever the score increases from zero to one, "output" an open brace and the number at the current index. Whenever the score decreases from one to zero, "output" the number at the current index and a closing brace. Then clump adjacent intervals that end and then start on the same number, like you have with 19. That's more work than necessary An alternate implementation: Sort by the lower bound, and then pop two intervals and push one interval, occasionally outputting when you have a complete interval. code:
|
# ? Apr 27, 2010 05:25 |
|
shrughes posted:You're talking about the union. Doh! Of course I meant union. I do not understand the code you wrote, but I will try and implement the 'score' keepeing procedure you outlined, and see how I fare. EDIT: I am working in C++, and I implemented what I think you meant. It seems to work for the examples I have tried on it, but I am at a loss to explain why this method of keeping score works. DO you have any explanation, or a link to an explanation of why this works? Jose Cuervo fucked around with this message at 05:59 on Apr 27, 2010 |
# ? Apr 27, 2010 05:33 |
|
Jose Cuervo posted:EDIT: Imagine yourself walking along the number line, from left to right. Every time you enter one of the intervals, you add 1. Every time you leave one, you subtract 1. Scaevolus is gay. The score tells how many overlapping intervals you're in. So as long as it's nonzero, you're inside one of the intervals. shrughes fucked around with this message at 09:20 on Apr 27, 2010 |
# ? Apr 27, 2010 08:35 |
|
shrughes posted:Imagine yourself walking along the number line, from left to right. Every time you enter one of the intervals, you add 1. Every time you leave one, you subtract 1. Scaevolus is gay. Gotcha. Thanks so much.
|
# ? Apr 27, 2010 14:37 |
|
chocojosh posted:Not exactly. We use DependencyProjects for our UserControls, but I haven't fully wrapped my head around the details and haven't even really looked into Attached Properties. WPF is huge and it feels like every month for the past six I've been learning new parts of it.
|
# ? Apr 27, 2010 16:52 |
I'm having trouble figuring out a way to find how many digits are in an integer. I need to write a program that adds up the individual digits in a integer, but the only thing I cannot find out is how to get that number of digits for my algorithm. This is in assembly language also, but that shouldn't make a difference.
|
|
# ? Apr 27, 2010 18:30 |
|
Popete posted:I'm having trouble figuring out a way to find how many digits are in an integer. I need to write a program that adds up the individual digits in a integer, but the only thing I cannot find out is how to get that number of digits for my algorithm. This is in assembly language also, but that shouldn't make a difference. ceil(log10(n+1)) is the number of digits to the left of the decimal in a positive number n, but the naive algorithm for adding the digits in a number should not need to know how many digits it has.
|
# ? Apr 27, 2010 18:33 |
Right I have that formula 10^(n-1) but the n part is the problem. n is the number of digits in the integer. I don't know of a way to find n, are you saying there is a way to add up the digits without knowing this?
|
|
# ? Apr 27, 2010 18:44 |
|
Popete posted:Right I have that formula 10^(n-1) but the n part is the problem. n is the number of digits in the integer. I don't know of a way to find n, are you saying there is a way to add up the digits without knowing this? The formula ShoulderDaemon posted gives you the number of digits, not their sum. To sum the digits without calculating how many there are: code:
|
# ? Apr 27, 2010 19:08 |
Alright thanks, you're right that is much simpler then I was trying to make.
|
|
# ? Apr 27, 2010 19:54 |
|
I'm looking to automate some repetitive stuff I need to do on some bespoke software at work (pressing buttons, filling in text boxes, etc.) I'm not allowed to install software but is there any functionality within Visual Basic that comes with Office that would allow me to do this? Edit: Looks like VBA can interact with other applications by simulating keystrokes, mouse clicks, etc. Long Wang fucked around with this message at 18:43 on Apr 28, 2010 |
# ? Apr 27, 2010 22:21 |
|
I have written a small program in C++ using Microsoft Visual Studio. The inputs to the program are 4 different integers (number of machines, number of machine groups, number of workers, number of jobs). I want to run the program with 2000 different combinations of these inputs on another computer that does not have Visual Studio. I have heard that I can compile my program into an exe file (?), and then pass each combination of inputs to it using a batch file, but I cannot find any help as to how to do this. Can anyone give me some help/advice on how to do this, or point me to some resources that would help me with this issue?
|
# ? Apr 28, 2010 13:04 |
|
Jose Cuervo posted:I have written a small program in C++ using Microsoft Visual Studio. The inputs to the program are 4 different integers (number of machines, number of machine groups, number of workers, number of jobs). I want to run the program with 2000 different combinations of these inputs on another computer that does not have Visual Studio. I have heard that I can compile my program into an exe file (?), and then pass each combination of inputs to it using a batch file, but I cannot find any help as to how to do this. Yes, you will need to compile your program into an executable (there are other options but don't worry about those). Google "visual studio how to make exe" or whatever. Now then, if the idea is to run 2000 different random combinations, the easiest solution may be to code in your C++ program a loop that randomizes the variables and runs your program 2000 times. Failing that, instead of using a batch file I would have your program read in a file with the inputs you want to use. So a line of your program would have four comma separated values that you would read in, parse, and run.
|
# ? Apr 28, 2010 13:09 |
|
Ceros_X posted:I checked the first post of this thread for an Excel thread, but it's not in the OP - maybe someone could add it? It is in the OP
|
# ? Apr 28, 2010 22:24 |
|
csammis posted:It is in the OP My reading are failz
|
# ? Apr 28, 2010 23:35 |
|
(ignore this post...moving to SQL thread)
Chumpington fucked around with this message at 09:59 on Apr 29, 2010 |
# ? Apr 29, 2010 09:42 |
|
I have a minor problem that I am trying to solve as quickly as possible. I am in the process of importing a legacy access database into a mySQL database via the program that uses the mySQL database (Archivists' Toolkit). Everything is ready to go, except for one little hiccup. I have an xsd file that is supposed to parse one field into its sub categories, but for some reason it is not doing that. Rather than troubleshoot this file I think it will be faster to just fix it in either Access or Oxygen. The character that denotes parsing is the period. Right now, in xml, the field is displayed in one of the following combinations (just for example, the characters are arbitrary for the example): <accessionNumber>Need.DOG.accssn007.345</accessionNumber> <accessionNumber>Need.DOG.accssn007</accessionNumber> <accessionNumber>Need.DOG</accessionNumber> <accessionNumber>Need</accessionNumber> They need to show up, in xml, as: <accessionNumber><part1>Need</part1><part2>DOG</part2><part3>accssn007</part3><part4>345</part4></accessionNumber> There are, at maximum, 4 parts. Most are only 2 parts. etc. Is there a way I can use the find replace function in Oxygen to do this while keeping all the information between the periods and the <accessionNumber></accessionNumber> tags? If not, can I do this in Access 2007 via either find/replace or a query to the accessionNumber field? Worse comes to worse I can do it by hand, but would rather not do so for 1600 records if possible. Thanks in advance!
|
# ? Apr 29, 2010 14:14 |
|
I am trying to perform some substring manipulation in bourne shell script and it just is not working for me. Basically I have a string $a from which I wish to remove the contents of string $b and place the result into string $c. I've tried various different ways such as tr (won't treat a string as a string, insists on removing all the characters within it) and sed (just doesn't work, hangs the program for some reason, using format "sed 's#$a#b#g' as suggested somewhere or other.) It's distinctly possible i've just been staring at this for too long and am missing an obvious solution but it's starting to get quite annoying. Any help would be greatly appreciated.
|
# ? Apr 29, 2010 17:12 |
|
This is probably a stupid question, but I'm sick and my brain won't work. I'm very new to msbuild, and I'm trying to get it to work with these solutions under team foundation. It seems to be overriding the outdir defined in each project. How can I get it to not do that? We seem to be using the default settings in Microsoft.TeamFoundation.Build.targets, and I see a bunch of settings for outdir and publishdir. I don't know what I need to set to get it to just use the settings in the vcproj files. The problem seems to be that it's creating exp files somewhere, but not using them in dependent projects and instead finding some outdated files. Now that I think about it if it's overriding the outdir folder, everything should be going to the same place so that shouldn't be the problem. In any case, this totally screwed up the manual build that the other techs are used to anyway, so my coworker's changes won't fly. I don't have access to the build machine right now, so I'm stuck there. I should probably set up the build to run on my own machine, but I'm not sure how to do that within TFS. Plus I am critically low on hard drive space. Anyway, if someone out there knows much about msbuild, I'd appreciate some help.
|
# ? Apr 29, 2010 17:47 |
|
Taz posted:I am trying to perform some substring manipulation in bourne shell script and it just is not working for me. Basically I have a string $a from which I wish to remove the contents of string $b and place the result into string $c. I've tried various different ways such as tr (won't treat a string as a string, insists on removing all the characters within it) and sed (just doesn't work, hangs the program for some reason, using format "sed 's#$a#b#g' as suggested somewhere or other.) In Bash you can do c=${a//$b/}, not sure if that works in plain old Bourne shell. If you want to use sed you cannot use single quotes around the command, because variable substitution does not happen within single quotes, so you might want to try sed "s#$a#$b#g", but if either of your variables contains the separator character you choose (in your case, "#") then the sed command won't work either.
|
# ? Apr 29, 2010 17:57 |
|
The1ManMoshPit posted:In Bash you can do c=${a//$b/}, not sure if that works in plain old Bourne shell. If you want to use sed you cannot use single quotes around the command, because variable substitution does not happen within single quotes, so you might want to try sed "s#$a#$b#g", but if either of your variables contains the separator character you choose (in your case, "#") then the sed command won't work either. I'm getting "Bad substitution" for the first one and the sed command just hangs like it did before. I suspect that something else is going on to make sed do that but I can't for the life of me work out what it is. I purposefully chose # as the delimiter by the way, as my variables are paths and contain the "/" so commonly used.
|
# ? Apr 29, 2010 18:03 |
|
I guess it's possible that style of substitution (the first double-slash means replace all occurences) doesn't work in Bourne. Wait, for your sed command are you just running sed as its own thing? sed expects input on STDIN, so you need to actually do c=`echo $a | sed "s#$b##g"`. I also noticed an error in your sed command that I didn't catch before (you were replacing all $a's with $b's, not replacing $b's with nothing).
|
# ? Apr 29, 2010 18:10 |
|
Taz posted:I'm getting "Bad substitution" for the first one and the sed command just hangs like it did before. I suspect that something else is going on to make sed do that but I can't for the life of me work out what it is. I purposefully chose # as the delimiter by the way, as my variables are paths and contain the "/" so commonly used. Sed, by default, reads from stdin and writes to stdout. The "hanging" is likely just it waiting for you to provide input. As I understand it, you want to strip all $b from $a and store results in $c? That is to say, if a="foo bar baz" and b=" b", c should be "fooaraz"? Try: code:
ToxicFrog fucked around with this message at 18:23 on Apr 29, 2010 |
# ? Apr 29, 2010 18:21 |
|
I suspect the case is true that I was staring at it for too long. That makes total sense now. Thanks both of you.
|
# ? Apr 29, 2010 18:40 |
|
I have a stupid newbie type question. I've got a plain text file that has a list of people going on a trip. I'd like to create a form on our intranet page that removes the line containing a name that the user submits. For instance, if the text file looks like:code:
I can do this either in asp with vbscript or in perl. Somebody please help me. I'm a computer janitor. I just fix stuff. I think I could write the form, but the scripting is beyond me.
|
# ? Apr 29, 2010 19:53 |
|
ToxicFrog posted:E: beaten like a pinata full of Perl developers. Oh well you can just suck the fattest part of Randal Schwartz's rear end in a top hat! ;3
|
# ? Apr 29, 2010 21:48 |
|
Beary Mancrush posted:I have a stupid newbie type question. I've got a plain text file that has a list of people going on a trip. I'd like to create a form on our intranet page that removes the line containing a name that the user submits. In Perl, untested: code:
It accepts form input with any number of fields named "name", ideally via POST. It will ensure no other instance is trying to change the data file, then filter out all lines matching any of the names provided. It is case-sensitive and whitespace-sensitive. When it's done, it will replace the old data with the filtered data, and redirect the user to /updatesuccessful.html on the same host. Edit: Made the script marginally less likely to break. ShoulderDaemon fucked around with this message at 22:03 on Apr 29, 2010 |
# ? Apr 29, 2010 21:57 |
|
Anybody clever with Haskell? I've made myself a calculator for an assignment, but I've just realised something I missed. It's an RPN calculator, but for whatever reason they want it to be able to display in infix form, specifically using show. My problem is, I can't seem to figure out how to use/overload show for a list. code:
Any ideas?
|
# ? Apr 30, 2010 01:21 |
|
That's not what Show is for. The Show typeclass isn't for making pretty or distorted views of what a value looks like. It seems the general rule is that it should return an expression that when evaluated would produce a value indistinguishable from the one you're showing. Anyway, you can't have what you want. You'll need to make an explicit [Expr] -> String function or wrap your list of Exprs in a new datatype.
|
# ? Apr 30, 2010 01:37 |
|
Thanks for confirming that, I realise that it's not for doing that kinda thing and that I could write my own function for it, but for some reason they want me to use show. I guess I should wrap them, but then I'll have to rewrite the whole rest of the program. Time to talk to my lecturer I think.
|
# ? Apr 30, 2010 01:44 |
|
Pantsmaster Bill posted:I guess I should wrap them, but then I'll have to rewrite the whole rest of the program. Not the whole program!
|
# ? Apr 30, 2010 02:24 |
|
shrughes posted:Anyway, you can't have what you want. You'll need to make an explicit [Expr] -> String function or wrap your list of Exprs in a new datatype. Apparently someone forgot how Show String is implemented. code:
That said, if the professor wants show [Num 4, Num 3, Plus] to print 4 + 3, you should do it and not raise pedantic points about code design.
|
# ? Apr 30, 2010 03:16 |
|
rjmccall posted:Apparently someone forgot how Show String is implemented. Agh, gently caress you! I suck.
|
# ? Apr 30, 2010 04:00 |
|
|
# ? May 14, 2024 06:31 |
|
rjmccall posted:Apparently someone forgot how Show String is implemented. Awesome cheers, I'll look into that! He wants everything in bracketed infix form, with numbers displayed as doubles (what the christ). More questions possibly later!
|
# ? Apr 30, 2010 09:03 |