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
Avenging Dentist
Oct 1, 2005

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

code:
SELECT title 
FROM movies
WHERE NOT REGEXP_LIKE(title,'\s');

Adbot
ADBOT LOVES YOU

Inspector Chan
Jul 9, 2002

I like the third option: I keep the disc, and throw you both off.
That works too :lol:

I didn't know you could use 'NOT' with REGEXP_LIKE.

You know how there's always that one lady in class that talks about her kids/dogs/whatever? This is an online class and one has appeared:

Rodney Chops
Jan 5, 2006
Exceedingly Narrow Minded
I'm not that experienced of a programmer. But I use VB alot at work. For my job I get some of the information I need off a website. On the website there are drop 5 drop down boxes, and a command button to start the query. It just returns one number to the page. I have lists combinations of these boxes I need to manually put in, then click GO. Then write the number in an excel sheet. There must be some way to automate this.

The extention of the site is .aspx so thats the microsoft .Net type stuff right? Where would I start to learn how to write something to help me, or is it not possible to do this because of security type stuff?

I help take care of a webserver with a webpage that has some feilds you can fill in for feedback. There are spambots that fill in the blanks with garbage all the time, so it must be possible. Just not sure where to start. VB.net maybe?

csammis
Aug 26, 2003

Mental Institution

blueninja posted:

:words:

This is worth its own thread :) Just to boil it all down, your goals for the client-server communication foundation are:
  • Low bandwidth consumption because your client devices have expensive bandwidth costs.
  • Able to host it at a third party server.
  • Try not to reinvent the wheel or have a ton of tedious work because it's a hobby.
  • Cross-platform (sort of, clients are j2me and server hasn't been decided).

Is this about right?

Rodney Chops posted:

I'm not that experienced of a programmer. But I use VB alot at work. For my job I get some of the information I need off a website. On the website there are drop 5 drop down boxes, and a command button to start the query. It just returns one number to the page. I have lists combinations of these boxes I need to manually put in, then click GO. Then write the number in an excel sheet. There must be some way to automate this.

Something like AutoIt may be your best bet.

Hypnobeard
Sep 15, 2004

Obey the Beard



Rhusitaurion posted:

Question for those familiar with Erlang:

What's the usual way of implementing a lookup table in Erlang? I just want to convert between ASCII and EBCDIC, and a simple 256-entry lookup table is the usual way, but I can't figure out how it's done.

ETS table, I think. Probably two, one for ASCII->EBCDIC and one for EBCDIC->ASCII (assuming you need the conversion both ways).

Rodney Chops
Jan 5, 2006
Exceedingly Narrow Minded

csammis posted:

Something like AutoIt may be your best bet.

Awesome! This is exactly what I'm looking for. Thanks a million.

pankus
Jul 30, 2003
I have some variable names that I want to be clear, but can't find a way to shorten them while still remaining readable.
code:
countryAnnualProductionByStream(11,220,1980:2030) !(stream,country,year)
countryAnnualProductionAggregate(220,1980:2030)   !(country,year)
regionAnnualProductionByStream(11,220,1980:2030)  !(stream,country,year)
worldAnnualProductionAggregate(1980:2030)         !(year)
Does anyone have suggestions or some reading on variable names? I looked through Code Complete for some ideas but I can't really fit them to any guidelines.

csammis
Aug 26, 2003

Mental Institution

pankus posted:

I have some variable names that I want to be clear, but can't find a way to shorten them while still remaining readable.
code:
countryAnnualProductionByStream(11,220,1980:2030) !(stream,country,year)
countryAnnualProductionAggregate(220,1980:2030)   !(country,year)
regionAnnualProductionByStream(11,220,1980:2030)  !(stream,country,year)
worldAnnualProductionAggregate(1980:2030)         !(year)
Does anyone have suggestions or some reading on variable names? I looked through Code Complete for some ideas but I can't really fit them to any guidelines.
Off the top of my head,
code:
countryAnnualStreamProd
countryAnnualAggrProd
regionAnnualStreamProd
worldAnnualAggrProd
I don't know about the rest of your dataset, but these all have annual in common - if that's constant, it could be removed entirely since it's known that these data are all annuals.

As long as you use consistent and non-conflicting abbreviations, and you document them somewhere, you'll be fine.

Boz0r
Sep 7, 2006
The Rocketship in action.
Does anyone know if there is some sort of cool algorithm for cutting up a random convex/concave polygon into triangles in a smart way, or if it's impossible to do automatically?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Boz0r posted:

Does anyone know if there is some sort of cool algorithm for cutting up a random convex/concave polygon into triangles in a smart way, or if it's impossible to do automatically?

If you know that a closed polygon is convex, you can divide it into triangles by just picking a point and drawing segments to all the non-adjacent points. Concave polygons will be a major problem; depending on your application, though, you might be able to use negative polygons to some effect. What are you trying to do?

Avenging Dentist
Oct 1, 2005

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

rjmccall posted:

If you know that a closed polygon is convex, you can divide it into triangles by just picking a point and drawing segments to all the non-adjacent points. Concave polygons will be a major problem; depending on your application, though, you might be able to use negative polygons to some effect. What are you trying to do?

He can just use BSP to transform a concave polygon into a union of convex polygons.

blueninja
Sep 24, 2005

csammis posted:

This is worth its own thread :) Just to boil it all down, your goals for the client-server communication foundation are:
I think you're right, here it is:
http://forums.somethingawful.com/showthread.php?threadid=2971766

blueninja
Sep 24, 2005

Rodney Chops posted:

I'm not that experienced of a programmer. But I use VB alot at work. For my job I get some of the information I need off a website. On the website there are drop 5 drop down boxes, and a command button to start the query. It just returns one number to the page. I have lists combinations of these boxes I need to manually put in, then click GO. Then write the number in an excel sheet. There must be some way to automate this.

The extention of the site is .aspx so thats the microsoft .Net type stuff right? Where would I start to learn how to write something to help me, or is it not possible to do this because of security type stuff?

I help take care of a webserver with a webpage that has some feilds you can fill in for feedback. There are spambots that fill in the blanks with garbage all the time, so it must be possible. Just not sure where to start. VB.net maybe?

There might be a few different approaches depending on the website. The common theme is wget and a script (although this is of course not the only possible solution).

The easiest one would be if it's a simple GET form in which case you code the selections in the URL and could easily write a script to get the data with wget. The next step up is that it's a POST form which is only slightly more difficult. Again you could use wget only this time you'd encode the selections in a parameter to wget. Then you might need to login and this could either be standard http-login stuff or some cookie based thing. Again, wget can do this. The last and most difficult option is if it's some sort of web2.0 ajax thingy which doesn't refresh the webpage inbetween requests but since you say there is a command button I'd guess it's not this version. Even if it were it'd still be possible but you'd have to use some sort of library send requests and to decode the data returned from them, probably a bit above beginner level.

Is there any possibility that we could take a look at the website in question to help decide or is it private stuff?

Rhusitaurion
Sep 16, 2003

One never knows, do one?

Tolan posted:

ETS table, I think. Probably two, one for ASCII->EBCDIC and one for EBCDIC->ASCII (assuming you need the conversion both ways).

I had looked into ETS tables, and they looked like a pain in the rear end. What I ended up doing is horribly abusing matching on a 256-byte binary, defined as a constant:

code:
ebc2asc(C) -> <<_:C/binary, Char, _/binary>> = ?EBC2ASC, Char.
Ugly, but it seems to work. I'm not sure if this is actually works in constant time, it might be just as bad as using lists:nth().

Dominoes
Sep 20, 2007

How do I make a simple 2-column table in CSS? I have a main division, and I have a division for left and right. I put a left in and a right in, then repeat and it seems to work, but Amaya gives me an error about not being able to use the divs more than once. So, I turned them into classes and now it doesn't line up. There has to be an easy way to do something so simple.

Dark Odor
Jul 14, 2007

Dominoes posted:

How do I make a simple 2-column table in CSS? I have a main division, and I have a division for left and right. I put a left in and a right in, then repeat and it seems to work, but Amaya gives me an error about not being able to use the divs more than once. So, I turned them into classes and now it doesn't line up. There has to be an easy way to do something so simple.

code:
<table>

Dominoes
Sep 20, 2007

Nvm, the class widths were too much, dumb question.

Dominoes fucked around with this message at 06:38 on Oct 1, 2008

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS

Dominoes posted:

How do I make a simple 2-column table in CSS? I have a main division, and I have a division for left and right. I put a left in and a right in, then repeat and it seems to work, but Amaya gives me an error about not being able to use the divs more than once. So, I turned them into classes and now it doesn't line up. There has to be an easy way to do something so simple.

CSS tables are unbelievably lovely. Just forget about trying to use XHTML Strict for now.




I'm writing a program that injects a Dll into another process in C. I've got the injector and the dll working fine, I just can't actually figure out how to call the dll's functions. Considering the way that most hits on google gloss over this point, I get the impression that it's really easy using LoadLibrary or GetModuleHandle or something.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane
Is there any way to get sh, in the context of a shell script, to interpret a given string as a variable name. I'm trying to do an assignment like:

var1=\$$var2

Where var2 will be a number, so I want to get the var2-th command line argument and store it in var1, yet the code as written acts like var1='$var2'

Is there any way to get around this?

Plastic Jesus
Aug 26, 2006

I'm cranky most of the time.

ante posted:

I'm writing a program that injects a Dll into another process in C. I've got the injector and the dll working fine, I just can't actually figure out how to call the dll's functions. Considering the way that most hits on google gloss over this point, I get the impression that it's really easy using LoadLibrary or GetModuleHandle or something.

What are you trying to do after injection? Are you attempting to hook calls to another DLL or just execute on your own code? You can't really force a process to call your DLL's functions (well, except DllMain()).

10011
Jul 22, 2007

PT6A posted:

Is there any way to get sh, in the context of a shell script, to interpret a given string as a variable name. I'm trying to do an assignment like:

var1=\$$var2

Where var2 will be a number, so I want to get the var2-th command line argument and store it in var1, yet the code as written acts like var1='$var2'

Is there any way to get around this?

eval "var1=\$$var2" works, but I'm sure there's a better way.

dagard
Mar 31, 2005

PT6A posted:

Is there any way to get sh, in the context of a shell script, to interpret a given string as a variable name. I'm trying to do an assignment like:

var1=\$$var2

Where var2 will be a number, so I want to get the var2-th command line argument and store it in var1, yet the code as written acts like var1='$var2'

Is there any way to get around this?

Maybe something like this?

code:
VARPSN="2"
SKIPVAR="1"
echo "I skipped ${!SKIPVAR}"
echo "Looking for ${!VARPSN}"
Which outputs like this:

./skipvar.sh a b c e d f g
I skipped a
Looking for b

bertholomule
Sep 5, 2003
berticus
My question pertains to excel VBA.

If I had a 35000-entry list of records in the following form:

Author / Editorial Position

...and wanted to parse the sheet for the number of times each author's name occurred under a specific position (there are only three or four types of positions), is there a simple macro/vba based way to do it?

I'd like the results to look like this.

Author_1 / Editorial_Position1: 42
Author_1 / Editorial_Position2: 9
Author_2 / Editorial_Position1: 10
Author_2 / Editorial_Position2: 0
Author_2 / Editorial_Position3: 5
.
.
.
Author_N / Editorial_Positiona: aCount
Author_N / Editorial_Positionb: bCount

If this isn't feasble, any other ideas? Thanks a TON!

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS

Plastic Jesus posted:

What are you trying to do after injection? Are you attempting to hook calls to another DLL or just execute on your own code? You can't really force a process to call your DLL's functions (well, except DllMain()).

I'm trying to pass variables to a function in my Dll. One way or another I need to get my program and the injected Dll communicating.

BadBeatsCrewDerk
Jul 18, 2005

WHAT IT DEW
BAD BEATS CREW
I'm thinking about writing a program in Java that parses local files, then submits some of that info to a form on a website, then parses the resulting returned webpage for some info and outputs it (command line or GUI is fine). What's a good starting point for that? I'm well versed in regexps and Java in general, just not sure what I should be looking at for the part where it has to enter the info on the website and "submit" it.

Alternately, I could do this in Perl. I'm less familiar with Perl, but I can do the regexp stuff.

hey mom its 420
May 12, 2007

You don't actually have to fill out forms. All it has to do is make a HTTP POST request that contains all the same data that a request made from the form would. Use the Firefox extension live http headers to see what the POST request looks like when you fill out and send that form and to which URL it is made. Then just make a POST request to the same URL with the same POST data from your Java code.
As to how you make a POST request from Java, I wouldn't know exactly.

tef
May 30, 2004

-> some l-system crap ->

CryptoDerk posted:

Alternately, I could do this in Perl. I'm less familiar with Perl, but I can do the regexp stuff.

If you pick perl: http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm

Orlen
Oct 25, 2005
custom user title
Hey guys,

Is it possible to prove

P \/ ~ P

using coq?

It's obviously always true, but I can't seem to prove it using coq, I've been at it for the last half hour trying various things but I'm completely stuck, and not getting anywhere.

LLJKSiLk
Jul 7, 2005

by Athanatos
C# WebService Declarations

I'm designing a WebService which will return some datasets, and handle manipulations of a SQL Server database.

Simple question:
Is there any reason I can't use a class declaration of the connectionstring and connection (SqlConnection(connString)) and simply call open()/close() in each method?

Or should I use per-method declarations?

(This is a service that dozens may be using at first, but thousands in the future as we build new front-ends for different states/counties in the country.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Orlen posted:

Hey guys,

Is it possible to prove

P \/ ~ P

using coq?

It's obviously always true, but I can't seem to prove it using coq, I've been at it for the last half hour trying various things but I'm completely stuck, and not getting anywhere.

That's only always true in classical logic, which is a subset of what coq allows. The simplest thing is to assert Axiom classic : forall p : Prop, p \/ ~ p. somewhere and rely on that. You may also want to look at Logic.Classical_Prop or google for "excluded middle" and "intuitionist logic".

BangersInMyKnickers
Nov 3, 2004

I have a thing for courageous dongles

VBScript question:

I have our domain workstations execute a batch script that checks a log file for the set date of the local admin password and then invokes a .vbe script if it needs to be changed. It looks something like this:

code:
'Encoded VBScript to change Administrator password
'**Start Encode**
strComputer = "."
strAdminUsername = "Administrator"
Set objUser = GetObject("WinNT://" & strComputer & "/" & strAdminUsername)
objUser.SetPassword "P4ssW0rd"
One of the weaknesses here is that the batch script passes the work off to the VBScript and just assumes everything works correctly. I would like to use the Wscript.Quit method to return 0 upon successful completion and 1 if an error is encountered, but I don't really know what the hell I am doing in VB and am just hacking bits together. Any ideas?

Encryptic
May 3, 2007

Bonus posted:

Maybe you can give it an onEnterFrame event where it checks if the button is in its roll-over state but the mouse is not on it. If that's the case, then fire the roll-off event.

Thanks for the suggestion - I did end up giving up on this because it doesn't seem like Flash can handle what I wanted to do.

There seems to be gently caress-all in the way of tutorials or documentation on this kind of thing on the web - every tutorial I've seen on making Flash menus just has the menu disappear instantly by jumping back to the beginning of the timeline. That works for me and I'm not going to keep blowing time on this since it was a minor issue anyway.

ndb
Aug 25, 2005

So, I'm writing a Java server that is serving a MySQL database. I have the server up and running, all is well.

I also have a simple HTML form page with Javascript on it, that GETs and POSTs information from the Java server to the page and back and forth.

My problem is this: the way I wrote the server, a socket has to be accepted. I was hoping that even though Javascript seems to not have support for sockets, I was hoping to do something like 'http://localhost:8888". But it doesn't seem to work.

I'm thinking it's because the page never connects to the socket, because it's waiting for a connection, and waiting for something to accept the connection. I'm extremely new to Javascript, especially with connecting to servers.

Is there anyway I can get past this or at least something I can read?

EDIT: So right now I'm thinking it's because Javascript probably sends through socket 80, which I can't use because it gets me a BindException. Hmmm. Anyway to force Javascript to send to a different socket?

ndb fucked around with this message at 23:44 on Oct 3, 2008

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS
PHP supports sockets.

ndb
Aug 25, 2005

It's probably more like having bad form, but can I just use PHP when sending/recieving requests, and use Javascript for all the...let's say mechanical parts of the scripts?

Standish
May 21, 2001

Clock Explosion posted:

So, I'm writing a Java server that is serving a MySQL database. I have the server up and running, all is well.

I also have a simple HTML form page with Javascript on it, that GETs and POSTs information from the Java server to the page and back and forth.

My problem is this: the way I wrote the server, a socket has to be accepted. I was hoping that even though Javascript seems to not have support for sockets, I was hoping to do something like 'http://localhost:8888". But it doesn't seem to work.

I'm thinking it's because the page never connects to the socket, because it's waiting for a connection, and waiting for something to accept the connection. I'm extremely new to Javascript, especially with connecting to servers.
XMLHTTPRequest (which I presume is what you're using here) can only connect back to the same port on the same server it came from.

quote:

PHP supports sockets.
PHP won't run in the browser.

ante
Apr 9, 2005

SUNSHINE AND RAINBOWS

Standish posted:

PHP won't run in the browser.

No, but most webservers support PHP, so I'm assuming he has access to it.




If you need to use sockets on odd ports, I think your only options are PHP(or some other language that you can run server-side like Perl) or a Java applet(which will basically run like poo poo).

Standish
May 21, 2001

ante posted:

No, but most webservers support PHP, so I'm assuming he has access to it.
That won't help with the problem of getting a page served from http://example.com:80 to make an XMLHTTPRequest connection back to a Java server listening on http://example.com:8888. (to be fair though, the original problem description isn't exactly clear.)

The quick and dirty way to solve this problem would be to have the Java server on port 8888 serve up the HTML page, that will allow the page make XMLHTTPRequests back to port 8888.

Standish fucked around with this message at 10:38 on Oct 4, 2008

ndb
Aug 25, 2005

I guess I'll try to make things more clear.

The HTML page is served from localhost:80, I assume. The Java server is listening on localhost:8888. They are supposed to interact through XmlHttpRequest objects. However, due to the nature that Javascript doesn't support sockets, and that Java won't let you bind to port 80, they don't notice each other's presence, and thus, the server just stays still, no matter what you do on the HTML page.

The Java server isn't noticing the presence of the page, and I'm assuming Standish's solution would work. It makes sense to me, at least, and something I probably should've done from the beginning.

Adbot
ADBOT LOVES YOU

Plastic Jesus
Aug 26, 2006

I'm cranky most of the time.

ante posted:

I'm trying to pass variables to a function in my Dll. One way or another I need to get my program and the injected Dll communicating.

There isn't any real way to force the host process to execute anything in your DLL (outside of hooking). You get a chance to do whatever you want in your DllMain(), but after that your DLL won't be doing anything unless explicitly called by the host process.

I guess that I still don't understand precisely what you're trying to do.

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