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
tef
May 30, 2004

-> some l-system crap ->
Who knows anything about constraint handling rules (CHR)?

I've been looking to do some type inference and program analysis and it looks to be a simple way to write one.

I've found some work on embedding CHR into HM, but I was wondering if anyone had any pointers?

Adbot
ADBOT LOVES YOU

hey mom its 420
May 12, 2007

I'd say go with Haskell, it's purely functional and really fun to boot. Here's a list of tutorials, also drop by #haskell on freenode and ask questions if you don't get stuff, it's a really friendly channel.

Lamont Cranston
Sep 1, 2006

how do i shot foam
Thanks guys. I'm not necessarily looking to learn a specific language, just to get a grounding in some of the general theory and the paradigm vs OO for example. I'll take a look at some of the Haskell tutorials though and see if I can't get somewhere with that.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

tef posted:

Who knows anything about constraint handling rules (CHR)?

I've been looking to do some type inference and program analysis and it looks to be a simple way to write one.

I've found some work on embedding CHR into HM, but I was wondering if anyone had any pointers?

AFAIK Martin is the one really pushing type-analysis through CHRs, or at least he was before he became Gainfully Employed.

The thing to remember about CHRs is that they're basically a full computation engine, so you quickly become bound by the restrictions of the solver you use. With that in mind, when I was looking into it Chameleon was a purely deterministic solver, and only supported equality constraints as the primitive constraint type, so you were pretty strictly limited in what you could do with it. It's also definitely research software, so don't expect it not to be horrifically buggy beyond the bare minimum required to get papers out the door.

POKEMAN SAM
Jul 8, 2004
I'm working on automating some testing tasks in a very low-level way, and I'd like to do this by emulating a USB keyboard/mouse. I know it sounds silly, but I'd like to run an application that presents itself as a USB device and makes keyboard/mouse messages this way.

Are there any drivers that you guys know of that I can interface with to do this? I imagine there'd be a driver running that my application would talk to, or something.

I'm only confusing myself now, so please tell me one of you knows what the hell I'm talking about.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Ugg boots posted:

I'm working on automating some testing tasks in a very low-level way, and I'd like to do this by emulating a USB keyboard/mouse. I know it sounds silly, but I'd like to run an application that presents itself as a USB device and makes keyboard/mouse messages this way.

Are there any drivers that you guys know of that I can interface with to do this? I imagine there'd be a driver running that my application would talk to, or something.

I'm only confusing myself now, so please tell me one of you knows what the hell I'm talking about.

Most operating systems / windowing environments / Java have some sort of API for injecting simulated system input events; it's all unportable, of course, but it's easier and more portable than writing a driver, which seems like what you're talking about. Is there a reason why such a solution wouldn't work?

POKEMAN SAM
Jul 8, 2004

rjmccall posted:

Most operating systems / windowing environments / Java have some sort of API for injecting simulated system input events; it's all unportable, of course, but it's easier and more portable than writing a driver, which seems like what you're talking about. Is there a reason why such a solution wouldn't work?

It's a series of weird bugs in a DirectX program, and using any of the Windows API functions for moving the mouse around and stuff don't work with the application as far as the bug goes. The only way we've been able to do it is by hand with a real mouse, and the bosses want us to automate this. I tried AutoIt, and it didn't work either, which is why I wanted to pretend as low level as possible to be a mouse.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Ugg boots posted:

It's a series of weird bugs in a DirectX program, and using any of the Windows API functions for moving the mouse around and stuff don't work with the application as far as the bug goes. The only way we've been able to do it is by hand with a real mouse, and the bosses want us to automate this. I tried AutoIt, and it didn't work either, which is why I wanted to pretend as low level as possible to be a mouse.

Worse comes to worst, you can buy one of Silabs' usb "toolsticks" and make it pretend to be a mouse :v::hf::science:

POKEMAN SAM
Jul 8, 2004

Otto Skorzeny posted:

Worse comes to worst, you can buy one of Silabs' usb "toolsticks" and make it pretend to be a mouse :v::hf::science:

I did have an idea of using a second computer to interface with the first computer's USB port, and have them communicate over the network for everything else, but then I'd have to figure out some sort of solution for that.

Edit: Or maybe running it in a virtual machine and somehow interfacing in that way would work...

POKEMAN SAM fucked around with this message at 23:44 on Apr 26, 2009

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Ugg boots posted:

I did have an idea of using a second computer to interface with the first computer's USB port, and have them communicate over the network for everything else, but then I'd have to figure out some sort of solution for that.

Edit: Or maybe running it in a virtual machine and somehow interfacing in that way would work...

Actually having a laptop connected to the usb port impersonating a usb mouse might be a really easy solution, provided there's not some auto-magic networking daemon that would interfere

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Otto Skorzeny posted:

Actually having a laptop connected to the usb port impersonating a usb mouse might be a really easy solution, provided there's not some auto-magic networking daemon that would interfere

USB is not a symmetric protocol; most host controllers are incapable of impersonating slave devices, so you'd need special hardware to mediate the exchange.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

ShoulderDaemon posted:

USB is not a symmetric protocol; most host controllers are incapable of impersonating slave devices, so you'd need special hardware to mediate the exchange.

I want to go hang all the execs of companies that make host controllers where you can't write raw bits; I fear the amount of rope necessary would be expensive.

POKEMAN SAM
Jul 8, 2004
You guys know any way to send USB bits to a VirtualPC VM? This sounds like a good bet right now, I had forgotten about VMs for this problem.

tef
May 30, 2004

-> some l-system crap ->

rjmccall posted:

AFAIK Martin is the one really pushing type-analysis through CHRs, or at least he was before he became Gainfully Employed.

Thanks - it seems that constraint programming is mostly ignored for type systems, although they seem perfectly suited for them

quote:

The thing to remember about CHRs is that they're basically a full computation engine, so you quickly become bound by the restrictions of the solver you use.

I'm planning on implementing success typing using chr in swi/prolog. I don't think it's as limited as the chameleon prototype, or as academic.

But if you know any more I would be grateful.

JadeRaven
Nov 12, 2008
I am having trouble with java. I am trying to call a variable from another class.

say I have


int someint[] = {1234};

how would I call that in another class.

I assume I would need to use a getter, but I must be having some weird syntax problem, because all I get is error's from eclipse.

I have googled and still couldn't really find what I was looking for, but I could just be doing it wrong.

Avenging Dentist
Oct 1, 2005

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

JadeRaven posted:

I am having trouble with java. I am trying to call a variable from another class.

Variables can't be called. Only functions (and methods) can be called. If you mean accessing it via a getter, you just return the value.

JadeRaven
Nov 12, 2008

Avenging Dentist posted:

Variables can't be called. Only functions (and methods) can be called.

Oh gently caress me. I see what I have done. Thanks.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

tef posted:

Thanks - it seems that constraint programming is mostly ignored for type systems, although they seem perfectly suited for them

Well, it depends on what you're trying to do. Again, if you have a solver which works for the sorts of constraints and rules you want to use, then yes, it's very convenient to just state the problem in terms of constraints and CHRs. But constraints at their full generality can be arbitrary-rank theorems in a first-order logic with rules of inference given by the CHRs, so really, whether or not a cookie-cutter solver will work for you is something you actually need to explore. I found that writing programs in CHR was sometimes an interesting formalization strategy, but didn't really have significant practical advantages over writing them in a general-purpose language once the rules got sufficiently subtle and execution-order-dependent.

tef posted:

I'm planning on implementing success typing using chr in swi/prolog. I don't think it's as limited as the chameleon prototype, or as academic.

Yeah, I should've guessed that, really. My experience with it is pretty minimal. I mean, it's incomplete (in the formal sense), just like all the other CHR implementations.

barking frog
Mar 15, 2004

barking frog posted:

I'm writing a C# program and this will seem pretty basic, but I'm not sure on the "proper" control flow.

I want the program to start up in a screen saver type mode. Clicking opens up another small form, and hides the screen saver. The small form launches the main form, and then hides itself. Exiting the main form shows the screen saver form again.

So right now I have something like this:

ScreenSaverForm.cs
- Launch SmallForm.cs
- this.Hide()

SmallForm.cs
- Launch MainForm.cs
- this.Hide()

MainForm.cs
- on event FormClosing- ?

Of course I can pass the ScreenSaverForm reference to SmallForm, and then from SmallForm to MainForm, but this seems a bit messy. Actually the entire thing strikes me as sloppy. There should be some other way of doing this.

Bump

csammis
Aug 26, 2003

Mental Institution

barking frog posted:

Bump

.NET questions megathread

barking frog
Mar 15, 2004

csammis posted:

.NET questions megathread
It's a general GUI control flow question.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

barking frog posted:

It's a general GUI control flow question.
Which you should post in the .NET thread because you're using C# (and presumably WinForms).

JetsGuy
Sep 17, 2003

science + hockey
=
LASER SKATES
Ok, so I've been going nuts wanting to strangle a combination of myself and the google results I've read...

I'm trying to set an alias in my .tcshrc file so that it not only runs the command like it does now, but first gives a colored echo command. I've tried tons of different variations on escape sequences, and nothing seems to be working. It doesn't help that I think teriminal.app for OSX is a piece of poo poo...

I'm running Tiger OSX, and trying to do this out of tcsh... it can't even do something basic like on the command line:

echo \033[34mHello,World

I don't see this -e flag I keep hearing everyone talk about in the help pages Im reading, but when I try putting that in, the computer just goes:

"-e \033[34mHello,World"

echo seems to be taking me far too literally. I must not know how to handle escapes right on tcsh or something... I'm pretty lovely at this...

I'm sorry if this is the wrong place for this, I can't figure out where else to put it. :(

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
tcsh provides a builtin echo command which covers the basic functionality of the standard echo utility with substantially less overhead. If you want something beyond that, you'll need to explicitly invoke /bin/echo.

tef
May 30, 2004

-> some l-system crap ->
the bash built in echo works, /bin/echo doesn't (on osx)


sh -c 'echo -e "\033]0;title prefix\007"'

tef fucked around with this message at 02:32 on Apr 28, 2009

JetsGuy
Sep 17, 2003

science + hockey
=
LASER SKATES
both of those explicitly just returned everything following the echo command... :( Thanks for trying, though.

tef
May 30, 2004

-> some l-system crap ->
I edited my post, but

code:
$ tcsh
% printf "\033]0;title prefixeee\007"
%


this also works.

JetsGuy
Sep 17, 2003

science + hockey
=
LASER SKATES

tef posted:

the bash built in echo works, /bin/echo doesn't (on osx)


sh -c 'echo -e "\033]0;title prefix\007"'

Ok, so this works in the terminal, but when I try to add it into the alias, it has a meltdown. I'm right now just trying to do it in the shell before going into the .tcshrc file and mucking around with sourcing a million times. :v:

code:
sh -c 'echo -e "\033[0;31mTEXT"'
Returns what I want, but when I try;

code:

% alias testing 'sh -c 'echo -e "\033[0;31mTEXT"''
% testing

It claims that 31mTEXT : command not found

I suspect that it's reading the ; as a command break, but I don't see why as it's within the echo command.

zootm
Aug 8, 2006

We used to be better friends.
Does nesting single quotes work like that?

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

zootm posted:

Does nesting single quotes work like that?

No. Also all users of tcsh should hang themselves :)

bitprophet
Jul 22, 2004
Taco Defender
I don't use tcsh, but, why not simply define a function (instead of an alias)? In my bash experience, anytime you find yourself cursing any limitation of the alias functionality, that's when you should be doing a function. Just a thought.

JetsGuy
Sep 17, 2003

science + hockey
=
LASER SKATES

Otto Skorzeny posted:

No. Also all users of tcsh should hang themselves :)

I use tcsh because it's much nicer with IRAF, which uses xgterm and xterm a plenty.

Well... that's what one of my professors told me anyway, and I trust him as his linux knowledge is far better than mine.

bitprophet posted:

I don't use tcsh, but, why not simply define a function (instead of an alias)? In my bash experience, anytime you find yourself cursing any limitation of the alias functionality, that's when you should be doing a function. Just a thought.

This could work. I have a meeting now, but I'll get back to y'all.

bitprophet
Jul 22, 2004
Taco Defender
I'm not 100% sure I follow what you were originally asking for, but if it's simply "echo before actually running a command" you could do something like this, again in bash syntax which may or may not work in tsch:
code:
function echo_then_do_something() {
    echo -e "\033[0;31mTEXT"
    /usr/bin/do_something $@
}
Which would do the echo, then call whatever you want, and the $@ (IIRC, and yet again may-be-different-in-tcsch) would pass in all arguments you give to the function, to the 'real' binary. E.g. echo_then_do_something foo bar results in /usr/bin/do_something foo bar.

Randomosity
Sep 21, 2003
My stalker WAS watching me...
I've got an Apache problem that's a real jerk.

I'm writing a RESTful API using Groovy on Grails. When I run the API locally to test against it, I can make PUT requests just fine. When running the API on Glassfish (our application server) on a different box, PUT requests do not have any parameters passed along with.

Does apache require any special configuration in order for PUT requests to pass along parameters? I know the requests are getting through, they just don't have any parameters (either through Javascript or PHP access to the API)

I've already upgraded the remote server's version of apache. It was at 2.2.6 (Sept 08), and a yum update brought it up to 2.2.9. (July 2008). I did find a email posting from Oct 2007 indicating that there was a bug but it was found and fixed, and I'd assume it was done by the July 2008 release I currently have. Anyone have any ideas before I rebuild apache on the remote machine? (I can't use yum, as our netops team is keeping all our boxes on Fedora 8. greaaaaaat...)

JetsGuy
Sep 17, 2003

science + hockey
=
LASER SKATES

bitprophet posted:

I'm not 100% sure I follow what you were originally asking for, but if it's simply "echo before actually running a command" you could do something like this, again in bash syntax which may or may not work in tsch:
code:
function echo_then_do_something() {
    echo -e "\033[0;31mTEXT"
    /usr/bin/do_something $@
}
Which would do the echo, then call whatever you want, and the $@ (IIRC, and yet again may-be-different-in-tcsch) would pass in all arguments you give to the function, to the 'real' binary. E.g. echo_then_do_something foo bar results in /usr/bin/do_something foo bar.

Best as I can tell from my googling, there is no function support for csh/tcsh. :mad: tcsh is complaining about "badly placed ()s" when i try anyway...

I ended up doing something similiar to this though, I just wrote a shell script with the two commands, threw them somewhere safe, and aliased <scriptname> to 'sh <location>/<scriptname>'

Thanks everyone!

Versus Boredom
Sep 20, 2006
deleted

Versus Boredom fucked around with this message at 01:08 on Apr 30, 2009

Lamont Cranston
Sep 1, 2006

how do i shot foam

theEZkill posted:

I posted in the RoR thread but was told this may be a better area. I'm a total coding newb and my boss wants me to run this RoR script for Twitter.


I'm told RoR isn't really ideal for a script like this- do you guys know of a similar script that will run in something easier than RoR?
This is probably just a straight-up Ruby script. Keep in mind, Ruby is a language, Rails is a web framework written in that language. Rake is something of a "Ruby Make" and lets you run macros (to oversimplify) written in Ruby. For example, you (apparently) have a Rakefile with tasks called "follow_twitter_users" and "stop_follow_twitter_users". I'm not sure what the meaning of the KEYWORDS argument in the first script is but the rest seem self explanatory. Just try typing those commands (obviously with non-dummy arguments) on your command line and see what happens.

Edit - where did your boss get this rakefile? I googled the task names and I came up with nothing.

tef
May 30, 2004

-> some l-system crap ->
I've been asked to set up a cruise control installation.

It's been fun so far.

Unfortunately I've now managed to get it so that after scheduling a build, it is successful but ignored.

[cc]Apr-30 12:25:36 jectController- build-cdm-trunk Controller: build result event: build successful

This appears in the cc logs, but the dashboard remains ignorant.

I'm struggling to find documentation on what feels like an awful, awful, awful product.

Any ideas, or good sources about kicking cruisecontrol until it bleeds?


Alternatively, if there are similar pieces of software for ci that suck a lot less I'd be interested too

zootm
Aug 8, 2006

We used to be better friends.

tef posted:

Alternatively, if there are similar pieces of software for ci that suck a lot less I'd be interested too
Hudson is a drat sight better, and if you can stomach Maven it's apparently not too hard to write your own extensions either. CruiseControl is pretty horrid, yeah.

Adbot
ADBOT LOVES YOU

2FingersToGlory
Apr 7, 2004

I am having a new webiste built and need a bit of advice. The site is pretty much a standard ecommerce site with an ordering system, shopping cart, etc. A local programmer (programmer A) who was reccomended to me proposed programming the site in php and using mysql for database management. However our current hosting company does not support php or mysql. They reccomended someone (programmer B) who proposed programming the site in asp with ms access databases.

We have used our hosting company since the beginning nearly a decade ago and would like to stick with them, but I get the feeling that our site might be better off in the hands of programmer A. Is php more widely used than asp? When we need to find someone to make adjustments or updates to the site down the road, will it be easiter to find someone who does php or asp? Are there any other factors here that are important? Any help with this would be very much appreciated.

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