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
haveblue
Aug 15, 2005



Toilet Rascal

Pie Colony posted:

I have a general implementation question...

Suppose I have a ball moving around the screen. Let's say the code for this was moveBall(delta_x, delta_y) so in a loop where delta_x = delta_y = 1 the ball would move at a constant 45 degree angle, one pixel per iteration.

Now how would I write this if the ball could move at any angle? I was thinking about taking the ratio between sin(a) and cos(a), but how am I going to move sqrt(3) pixels at a time? Furthermore, if I call the speed at which the ball moves for d_x = d_y = 1 b, how can I make it so that the ball moves at speed b for any angle?

You're right about how to do movement at any angle (x = cos(angle)*b, y = sin(angle)*b), but you'll have to switch to floating-point coordinates to make it work well.

If you can't do that, google "breshenham algorithm".

haveblue fucked around with this message at 16:51 on Nov 23, 2009

Adbot
ADBOT LOVES YOU

Vinterstum
Jul 30, 2003

Pie Colony posted:

I have a general implementation question...

Suppose I have a ball moving around the screen. Let's say the code for this was moveBall(delta_x, delta_y) so in a loop where delta_x = delta_y = 1 the ball would move at a constant 45 degree angle, one pixel per iteration.

Now how would I write this if the ball could move at any angle? I was thinking about taking the ratio between sin(a) and cos(a), but how am I going to move sqrt(3) pixels at a time? Furthermore, if I call the speed at which the ball moves for d_x = d_y = 1 b, how can I make it so that the ball moves at speed b for any angle?

Read up on vectors. It's pretty much what you're doing already (using two numbers to represent a direction and speed), but more generalized. And yeah you'll probably want to store your speeds and positions as floats, and then use some rounding to figure out which pixels should be drawn to each frame.

Vinterstum fucked around with this message at 17:56 on Nov 23, 2009

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

haveblue posted:

You're right about how to do movement at any angle (x = cos(angle)*b, y = sin(angle)*b), but you'll have to switch to floating-point coordinates to make it work well.

Quake 3 used integral coordinates. (Which, incidentally, is why you can trickjump in it.)

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."
I'm trying to make a batch script that reads a list of file and directory addresses in a .txt file and identifies the files.

code:
FOR /f "tokens=* delims= " %%a IN (%LOGDIR%conflictfiles.txt) DO (
	IF %%a==*.* (
		ECHO %%a
	)
)
Using this as a test, to pick out files as opposed to folders, but the IF statement doesn't seem to work, the line is never printed regardless of if it includes a ".". Is there something wrong with the statement? If I switch the statement for "IF NOT %%a==*.*" I always shows.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Hey kids! It's LAPACK time!

I'm implementing block LU-factorization for a scientific computing class, and after having had less than optimal results by storing my matrix as an array of subblocks (profiling my code showed that 30% of my runtime is spent in integer division calculating offsets into the matrix :psyduck: ), I'm looking at re-implementing it. :sigh:

So I'm staring at the documentation for dgetrf and it dawned on me that perhaps the leading dimension of A need not be equal to m (otherwise, why would they insist on it being a parameter?) I'm not sure how this behaves and I don't want to get too far down the path before realizing that I'm yet again misreading the docs: is it the stride of the array (ie. for some kxk submatrix embedded in some nxn matrix, I can factor this without needing a memcpy or something?)

TheWevel
Apr 14, 2002
Send Help; Trapped in Stupid Factory

TheWevel posted:


edit: I'm also not a programmer so if that's not the best way of doing what I need, what's a better way? Also how could I parse the byte output to something like kilobytes or megabytes?

I figured out a better way to do what I was doing:

code:
@echo off
for /F "eol=; tokens= 1, 2 delims=, " %%I in (ipaddr.txt) do (
for %%R in (\\%%I\c$\VR\errlog.txt) do call :calculate %%~zR %%J)
pause
goto :eof

:calculate
set /a file_size=%1
set /a file_size/=1024 
set hostname=%2
@echo %hostname%'s filesize is %file_size%KB.
It works great.

shrughes
Oct 11, 2008

(call/cc call/cc)

MEAT TREAT posted:

For writing a file check out the PrintWriter class.
code:
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
This class is useful because of all the different print methods that it has.
You should double buffer that output stream to avoid flickering.
code:
PrintWriter out = new PrintWriter(new BufferedWriter(new BufferedWriter(new FileWriter("foo.out"))));

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
Hahahahahahahahahahahahaha

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
I've got a situation where data is stored in two different RDBMS's and I need to essentially do a simple JOIN between two tables that are in the different systems.

I started out by just grabbing all the info from one and doing a giant IN () clause when I query the other database, which gave me the "Packet too large" once my query got over 1MB. The biggest the query will ever be is about 2MB. Should I simply raise the max_allowed_packet variable to allow for my massive IN()? Should I load the data into a temp table and then do a JOIN? What is the fastest solution here? This is in Java and the db server I have control over is MySQL.

Ziir
Nov 20, 2004

by Ozmaugh
I'm teaching myself Fortran because this language is so deeply rooted in my field (computational fluid dynamics) with all the legacy codes that it will never go away no matter how much it's considered dead.

So, I've set up a dual boot with Ubuntu and I've installed gfortran, gnuplot and VIM to get started. I've managed to write a small program to compute the derivative of a specified function (in my case f(x) = sin(2x)) analytically and using a simple finite difference scheme. I figured out how to output the data to a .txt file and figured out how to plot it and everything is gravy EXCEPT the way my data is being outputted is like:

a b c d e
1 2 3 4 5

But I need my data to be formatted like this:

a 1
b 2
c 3
d 4
e 5

Because that's how gnuplot works (it plots column vs column).

Is there a way I can easily transpose the row vector it gives me into a column vector? Or is there a way to just create a column vector? When I define my vector I do a "REAL x(1:5)" which is what all the tutorials I've found online tell me to do.

The way I worked around this problem was basically to put a WRITE statement inside of my DO loop so that on the first iteration it'll write "a 1" and then "b 2" on the next line in the next iteration, but this really can't be memory/cost effective to access and read/write to a file after every single iteration. Plus there has to be an easier way... right?

Edit: I realize that I might be using vector incorrectly. My only other programming experience is with MATLAB and as far as I know, a vector and array are the same thing but I don't think this is the case in other languages.

Ziir fucked around with this message at 08:58 on Nov 26, 2009

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Ziir posted:

The way I worked around this problem was basically to put a WRITE statement inside of my DO loop so that on the first iteration it'll write "a 1" and then "b 2" on the next line in the next iteration, but this really can't be memory/cost effective to access and read/write to a file after every single iteration. Plus there has to be an easier way... right?
Yep, you'd do something like

code:
Do i = 1, n
    Write(*,"(a,I4") FirstArray(i), SecondArray(i)
End Do
or whatever. (It's been awhile since I've touched any Fortran so don't trust my syntax)

Also, in scientific computing/HPC there's a strong desire to get carried away with "oh but is this efficient"...as you gain more experience coding in Not-Matlab (and kudos to you for trying to break out of that), you'll discover that any i/o is painfully slow, so writing out the data to disk will be the bottleneck, not walking the arrays.

In general, don't worry about efficiency of code until you've run it through a profiler.

Ziir
Nov 20, 2004

by Ozmaugh
Thanks. I really should have done this last year when I took my CFD course but at the time I had a pretty hectic schedule and learning another language was the last thing I wanted to do.

Since I've never taking a CS course, here are some other questions:

What exactly does it mean to compile a code? The Wikipedia entry says it gets translated to machine code but I'm not sure what that even means. If the CPU doesn't actually execute the code that I'm writing then why are there so many different languages?

I always thought compile was synonymous to the "make" command in Linux/Unix. But well, it isn't?

And lastly, what is a .out file? Why doesn't Fortran just skip this middle step and write directly to a .txt file instead of making me run the .out file first?

Edit: I lied, one more. It's kind of tedious to run (compile?) my Fortran code, then run the .out file, then start gnuplot and plot my data and then set the axes and titles and such all via command line. Is it possible to just write a script to do this all for me and how?

Ziir fucked around with this message at 18:25 on Nov 26, 2009

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Ziir posted:

What exactly does it mean to compile a code? The Wikipedia entry says it gets translated to machine code but I'm not sure what that even means. If the CPU doesn't actually execute the code that I'm writing then why are there so many different languages?
Your computer does not understand Fortran. Or, C, or Python, or whatever you write. The purpose of a compiler is to translate statements in some language to raw instructions that the processor can execute. So the CPU is, yes, in some sense executing the code that you're writing, but after it's been converted to machine language. There exist many language because different languages abstract the machine code away in different ways - for instance, Fortran's matrix support is far better than C's.

Ziir posted:

I always thought compile was synonymous to the "make" command in Linux/Unix. But well, it isn't?
make runs a script that in turn calls the compiler. Run man make for more information.

Ziir posted:

And lastly, what is a .out file? Why doesn't Fortran just skip this middle step and write directly to a .txt file instead of making me run the .out file first?
OK, some terminology: Fortran is a compiled language, as opposed to Matlab, which is interpreted (that is, it isn't converted to machine language but instead is run inside the Matlab program). So, it's not correct to say "why doesn't Fortran...?" because Fortran is merely a language, and gfortran is the compiler that compiles your Fortran code to an executable. When you run gfortran and don't specify a filename for your program, for historical reasons it defaults to a.out. That is your program. (for fun, type file a.out and you'll see that it's an executable of the ELF type.)

The act of running your program has nothing to do with the compiler - you compile it once, then run all the datasets you want by executing the a.out program.
[/fixed]

Ziir posted:

Edit: I lied, one more. It's kind of tedious to run (compile?) my Fortran code, then run the .out file, then start gnuplot and plot my data and then set the axes and titles and such all via command line. Is it possible to just write a script to do this all for me and how?
So, to reiterate, once you've compiled it you don't need to keep doing it for every .txt file you run it against. Compiling is not running. Yes, you can write a shell script to do this; look at something like this page.

Ziir
Nov 20, 2004

by Ozmaugh

Dijkstracula posted:

OK, some terminology: Fortran is a compiled language, as opposed to Matlab, which is interpreted (that is, it isn't converted to machine language but instead is run inside the Matlab program). So, it's not correct to say "why doesn't Fortran...?" because Fortran is merely a language, and gfortran is the compiler that compiles your Fortran code to an executable. When you run gfortran and don't specify a filename for your program, for historical reasons it defaults to a.out. That is your program. (for fun, type file a.out and you'll see that it's an executable of the ELF type.)

So that we're on the same page, my .f90 file is my code, and my a.out file is the actual program/executable? That means that I can email the a.out file to someone who doesn't have a Fortran compiler installed and they'll still be able to run it?

Dijkstracula posted:

The act of running your program has nothing to do with the compiler - you compile it once, then run all the datasets you want by executing the a.out program.

So, to reiterate, once you've compiled it you don't need to keep doing it for every .txt file you run it against. Compiling is not running. Yes, you can write a shell script to do this; look at something like this page.

The way I understand it is I compile my code to get my a.out program, and then I run this a.out program to generate data that I can use in gnuplot. But if I change my code I'm going to have to recompile it, so that's what I meant.

So what I meant was, I want to be able to write a script that does something like this:

code:
compile datageneration.f90
run a.out # generate data files
gnuplot
set axis, titles, etc
plot data
end
I'll take a look at that site you linked cause it looks like it does what I want it to do.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Ziir posted:

So that we're on the same page, my .f90 file is my code, and my a.out file is the actual program/executable? That means that I can email the a.out file to someone who doesn't have a Fortran compiler installed and they'll still be able to run it?
That's the idea. (So, there's a bit more to the story if, say, you write a Fortran program that uses some BLAS or LAPACK library that the other guy doesn't have, so you'd have to make sure that your colleague and you both agree on using Atlas or GOTOblas or whatever. This is where knowing about shared libraries and how they work is important, since you'll surely be linking against them.)

Ziir posted:

The way I understand it is I compile my code to get my a.out program, and then I run this a.out program to generate data that I can use in gnuplot. But if I change my code I'm going to have to recompile it, so that's what I meant.
That's right. If you want to change the behaviour of your program you have to recompile (hence why having a configuration file or command-line parameters to specify things is handy)

Ziir
Nov 20, 2004

by Ozmaugh

Dijkstracula posted:

That's the idea. (So, there's a bit more to the story if, say, you write a Fortran program that uses some BLAS or LAPACK library that the other guy doesn't have, so you'd have to make sure that your colleague and you both agree on using Atlas or GOTOblas or whatever. This is where knowing about shared libraries and how they work is important, since you'll surely be linking against them.)

That's right. If you want to change the behaviour of your program you have to recompile (hence why having a configuration file or command-line parameters to specify things is handy)

Cool. I don't think I'll need to worry about libraries and such for a while but I'll keep that all in mind when I do.

Ziir
Nov 20, 2004

by Ozmaugh
Another hopefully quick question. I'm reading this page right now on functions and I'm confused with their example. It seems like the example code calls for a function that "they haven't defined yet" because the function is defined later on down the road. Well, in MATLAB, it shits itself if you don't write your code in sequential order. Does it not matter with Fortran?

litghost
May 26, 2004
Builder

Ziir posted:

Well, in MATLAB, it shits itself if you don't write your code in sequential order. Does it not matter with Fortran?

Actually MATLAB doesn't care about order either. Function look up happens at execution.

For Fortran it depends on the compiler, but for the most compilers require functions to be resolved at link time (linking occurs after compilation). Bottom line, you can use functions in any order, but they all must be defined at some time during compilation.

Missing function definitions cause errors like "undefined symbol: _FUNA@8". The @# after the function name is actually the number of bytes that are passed as arguments. So if you define a function with two arguments (_FUNA@8) and call with one or three it will not match (_FUNA@4 or _FUNA@12). Of course this will not prevent all type errors, but it will prevent the biggest mistake.


Return types are a bigger problem for Fortran, so if you do not use "IMPLICIT NONE" it will not catch type mismatch errors with return types.

litghost fucked around with this message at 03:23 on Nov 27, 2009

siger
May 11, 2006
time to unpimp ze auto
edit:wrong thread!

Ziir
Nov 20, 2004

by Ozmaugh

litghost posted:

Actually MATLAB doesn't care about order either. Function look up happens at execution.

For Fortran it depends on the compiler, but for the most compilers require functions to be resolved at link time (linking occurs after compilation). Bottom line, you can use functions in any order, but they all must be defined at some time during compilation.

Missing function definitions cause errors like "undefined symbol: _FUNA@8". The @# after the function name is actually the number of bytes that are passed as arguments. So if you define a function with two arguments (_FUNA@8) and call with one or three it will not match (_FUNA@4 or _FUNA@12). Of course this will not prevent all type errors, but it will prevent the biggest mistake.


Return types are a bigger problem for Fortran, so if you do not use "IMPLICIT NONE" it will not catch type mismatch errors with return types.

Wow, I had no idea about the MATLAB thing. I guess I never really tried it, I just assumed things needed to be in sequential order because it always fusses about undefined variables and such.

Anyway, then is there a way to save functions separately as it's own function1.f90 file so that I can call/run them only if I need to?

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Ziir posted:

Anyway, then is there a way to save functions separately as it's own function1.f90 file so that I can call/run them only if I need to?
In theory, yes, but the "one function per file" idiom is a Matlab thing and you shouldn't do it. Instead, group functions in files according to their functionality.

litghost
May 26, 2004
Builder

Ziir posted:

Wow, I had no idea about the MATLAB thing. I guess I never really tried it, I just assumed things needed to be in sequential order because it always fusses about undefined variables and such.

Anyway, then is there a way to save functions separately as it's own function1.f90 file so that I can call/run them only if I need to?

Of course. As talked about there are shared libraries (.so) which you can use, but you'll mostly want to use object files (.o) and static libraries (.a). If you use the "-c" flag, the compiler will only compile your .f90 file into an object (.o) and not link it (make an executable). You can create a static library (.a) by joining several objects (.o) using ar. The f90 file with the "PROGRAM" statement is generally the last file you compile and then you include all the dependencies (.o, .so, .a) files in the argument list.

This where Makefile files become handy. Here is an example Makefile

code:

F = .f90
O = .o
A = .a
E = 
FC = gfortran

#How to make .o files from .f90 files
%$O : %$F ${MAKEFILE}
<tab here>${FC} -c ${FFLAGS} $<

# List of sources
SOURCES = a$F \
          b$F

# Make list of .o files by replacing the suffix of every file
# in sources
OBJECTS = ${SOURCES:$F=$O}

# Make program from program.f90, the .o files and the Makefile
program$E : program.f90 ${OBJECTS} ${MAKEFILE}
<tab here>${FC} ${FFLAGS} ${filter %$F %$O %$A,$^} -o $@

This is a set of rules to make "program" (which is the first target of Makefile). program depends on program.f90, the .o files for a.f90 and b.f90 and the Makefile itself. $< is a macro that expands to the first dependency, $^ expands to the full dependency list, and $@ expands to the current target. It also knows how to make .o files from .f90 files via the pattery rule.

With this, make knows how to compile program when you start changing the 3 .f90s, and only compiles the .o's that changed (by comparing data stamps of the targets relative to their products. Basically you type make, and it will determine which files to recompile to make the end product.

Read up on make, as it is your friend for any non-trival programming project.

litghost fucked around with this message at 05:20 on Nov 27, 2009

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."
Can anyone tell me why this piece of batch script won't work in a particular location:

code:
FOR /f "tokens=* delims= " %%a IN ([Shared drive address]svn.txt) DO (
	ECHO %%a | FIND "Revision: " > NUL
	IF NOT errorlevel 1 SET LATEST=%%a
)
It's really strange, the script works when I put it in the folder I use to keep all my WIP and test .bats and the like, and when I put it on the shared drive, but put it in a directory that's mapped from another drive (appears as a location on C, is actually on another drive) it enters the loop and outputs

')' unexpected at this time

repeatedly for each line of the svn.txt file. I don't see why the location of the script even matters, can anyone shed light on this? For the sake of convenience, it would be good if this script could work from this location. I don't think the fact the directory is mapped is the issue, I can move it a directory deeper and it works. It really seems to be this one location.

diremonk
Jun 17, 2008

Is it possible to take information from a Word doc and send it to multiple Excel documents?

Currently, I print out a copy of the Word document (program schedule for a tv station) and hand write the episode numbers for shows that we take off a service called pathfire. This isn't the greatest since my coworkers have to read my horrid handwriting.

So is it possible for either a script or maybe a VB app to parse the word document, see the second episode number for Rachel Ray, and then send that to an Excel document labeled Tuesday?

Most of the shows and episode numbers are in the same place from week to week, but sometimes on the weekends the shows get shuffled due to sports.

American Psychonauts
Dec 27, 2005

...but inside doesn't matter
(AS 3) I just did this method that takes any number of arrays and compares them with eachother with the Function compareFunction and runs actionFunction if compareFunction returns true.

Is there a name for something like this? I couldn't find anything like it for Actionscript but it seems like something that would be pretty common.

php:
<?
package biz.hatu.utils
{
    public function compareArrays(arrays:Array, compareFunction:Function, actionFunction:Function):void{
        for each(var array:Array in arrays){
            for each(var array2:Array in arrays){
                for each(var value:* in array){
                    for each(var value2:* in array2){
                        if(compareFunction(value, value2)){
                            actionFunction(value, value2);
                        }
                    }
                }
            }
        }
    }
}
?>

ErIog
Jul 11, 2001

:nsacloud:

diremonk posted:

Is it possible to take information from a Word doc and send it to multiple Excel documents?

Currently, I print out a copy of the Word document (program schedule for a tv station) and hand write the episode numbers for shows that we take off a service called pathfire. This isn't the greatest since my coworkers have to read my horrid handwriting.

So is it possible for either a script or maybe a VB app to parse the word document, see the second episode number for Rachel Ray, and then send that to an Excel document labeled Tuesday?

Most of the shows and episode numbers are in the same place from week to week, but sometimes on the weekends the shows get shuffled due to sports.

It's going to be best to do it the other way around where you generate the word document from the CSV/Excel data. The CSV/Excel data should always be in the same spot.

diremonk
Jun 17, 2008

Not really possible to do it the other way around, the word doc is generated by another department for their use. Only reason we get a copy is to make sure that all of the lovely paid programs are in house.

Thanks for the info though, guess I'll work on my handwriting.

UZR IS BULLSHIT
Jan 25, 2004
Hopefully someone can answer this one. I'm doing some fluid dynamics simulations in MATLAB, and I'm running into a weird problem where the elements of my velocity field becomes complex after a few iterations of my main timeloop. Same thing happens for temperature, density, energy, etc, basically all my variables take on complex values.

The thing is, I've gone over it many times, and there's nowhere in my code where a complex number would be produced by means of taking a square root of a negative number. So I have no clue why this is happening.

I'm far from an expert in computational methods, so basically, my question is this: is it possible that something like small number rounding errors could be causing this problem?

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Complex values can be created by other ways of simply taking the square root of a negative number. For instance, are you taking the eigenvalues of a non-symmetric matrix?

But, to answer your question, no, rounding errors will never create a complex number if you're working in the reals (this is assuming that you're working in a semi-well conditioned problem)

Dijkstracula fucked around with this message at 00:16 on Nov 29, 2009

UZR IS BULLSHIT
Jan 25, 2004

Dijkstracula posted:

Complex values can be created by other ways of simply taking the square root of a negative number. For instance, are you taking the eigenvalues of a non-symmetric matrix?

But, to answer your question, no, rounding errors will never create a complex number if you're working in the reals (this is assuming that you're working in a semi-well conditioned problem)

Well, of the math I'm using in this solution algorithm, square roots are the only thing I could think of that would create a complex number. I am using some matrices, but all matrix operations in my code are done elementwise - I'm definitely not doing anything like finding eigenvalues. Any other ideas?

MrMoo
Sep 14, 2000

fletcher posted:

I've got a situation where data is stored in two different RDBMS's and I need to essentially do a simple JOIN between two tables that are in the different systems.

I was pondering the best method for this too this week, you could try feeding everything into a temporary table.

steve odwyer
Jan 5, 2003

Hey guys, I was directed to this subforum by a friend and told to ask for help here. I'm looking for someone to make me a basic utility that does a bulk find and replace on a directory of .txt documents. When the .txt files are written to my system, lines that should read abcdefghijk are written as abcd***.

What I want to is something that allows me to enter in the characters that I want to appear in the .txt files, and then at the end of the day when I'm finished with my work I can run the utility on all the characters that I've inputted and have them replace what was written to my system.

I'm willing to pay someone for this work, so if you're interested in helping me out, contact me by PM and I'll give more details.

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

What operating system are you running? This is a one-liner in Linux or OSX.


$ cat foo
abcdefghijk
abcdefghijk butts lmao
test
abcdefghijkabcdefghijk
$ sed -ie 's/abcdefghijk/abcd\*\*\*/' foo
$ cat foo
abcd***
abcd*** butts lmao
test
abcd***abcdefghijk


edit: to be clear, substitute \*\*\* with the letters you want to be inserted.

Dijkstracula fucked around with this message at 03:26 on Nov 29, 2009

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?

fletcher posted:

I've got a situation where data is stored in two different RDBMS's and I need to essentially do a simple JOIN between two tables that are in the different systems.

I started out by just grabbing all the info from one and doing a giant IN () clause when I query the other database, which gave me the "Packet too large" once my query got over 1MB. The biggest the query will ever be is about 2MB. Should I simply raise the max_allowed_packet variable to allow for my massive IN()? Should I load the data into a temp table and then do a JOIN? What is the fastest solution here? This is in Java and the db server I have control over is MySQL.

You should probably download the data and create a temp table out of it. For fun chips, index the table afterwards.

Vinterstum
Jul 30, 2003

American Psychonauts posted:


Is there a name for something like this? I couldn't find anything like it for Actionscript but it seems like something that would be pretty common.




Exponential Death? It's actually not that common, since there's usually far more efficient ways of solving a certain problem (like keeping stuff sorted).

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



BizarroAzrael posted:

Can anyone tell me why this piece of batch script won't work in a particular location:

code:
FOR /f "tokens=* delims= " %%a IN ([Shared drive address]svn.txt) DO (
	ECHO %%a | FIND "Revision: " > NUL
	IF NOT errorlevel 1 SET LATEST=%%a
)
It's really strange, the script works when I put it in the folder I use to keep all my WIP and test .bats and the like, and when I put it on the shared drive, but put it in a directory that's mapped from another drive (appears as a location on C, is actually on another drive) it enters the loop and outputs

')' unexpected at this time

repeatedly for each line of the svn.txt file. I don't see why the location of the script even matters, can anyone shed light on this? For the sake of convenience, it would be good if this script could work from this location. I don't think the fact the directory is mapped is the issue, I can move it a directory deeper and it works. It really seems to be this one location.

Can %%a ever have a space in it? I think you need to surround it in quotes when you set latest to it.

nintendo65
Oct 16, 2008

Two universes separated by a membrane! It causes gravity! I have a uni degree in SCIENCE!!1!
What is a good language to use for a moderate - large size database site that is going to be faster than php and is compatible with postgresql? I've considered asp .net, ajax, ruby but I'm out of the loop on what is current. This is for a friend who has no cash which is why he's resorting to someone who hasn't built a website in like 5 years (me).

Contero
Mar 28, 2004

nintendo65 posted:

What is a good language to use for a moderate - large size database site that is going to be faster than php and is compatible with postgresql? I've considered asp .net, ajax, ruby but I'm out of the loop on what is current. This is for a friend who has no cash which is why he's resorting to someone who hasn't built a website in like 5 years (me).

C :xd:

yatagan
Aug 31, 2009

by Ozma

nintendo65 posted:

What is a good language to use for a moderate - large size database site that is going to be faster than php and is compatible with postgresql? I've considered asp .net, ajax, ruby but I'm out of the loop on what is current. This is for a friend who has no cash which is why he's resorting to someone who hasn't built a website in like 5 years (me).

The answer is always Java!

http://jdbc.postgresql.org/

Adbot
ADBOT LOVES YOU

shrughes
Oct 11, 2008

(call/cc call/cc)

yatagan posted:

The answer is always Java!

http://jdbc.postgresql.org/

No really, it's Scala, using Lift

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