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
fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
I really like the little outline ruler to the right of the scroll bar in Eclipse, where it will show you where in the file you have a //TODO or if you highlight a variable name it will mark all occurrences of it in the file on the ruler. I'd like to be able to do this for javascript as well. I tried the JSDT plugin for eclipse but it doesn't seem very good. Is there maybe a Outline Ruler like plugin for Notepad++?

Adbot
ADBOT LOVES YOU

wrok
Mar 24, 2006

by angerbotSD
IE 6 Hell:

I have a javascript function fired by the onclick of a listbox. It works fine in all browsers except IE6. In IE6 it lags (i.e. you click on one item, nothing happens, click on another item, it reacts like you just clicked the first time) -- however, if I add an alert() to the function it works fine every time.

I don't know if the code is relevant, since this is more IE being loving-insane than code-specific, but here's the code. Works fine if I uncomment the alert line, and totally hosed if it's not there or commented out.

What the crap is going on? Anybody run into something like this before? I loving hate IE6.


Forget it, I 'figured it out' by adding a delay to the onclick. I loving hate IE6.

wrok fucked around with this message at 13:35 on Aug 28, 2009

Olly the Otter
Jul 22, 2007
Have you tried onChange instead of onClick? Seems like that would work better anyway since it would catch when arrow keys are used to change the selection.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
What's the safest way on Linux or Cygwin to determine the availability of a link library?

Basically I have a module that uses libbfd to extract debugging information from an executable, and in order to use all the symbol table routines I also have to link to libintl and libiberty. This works fine on Cygwin, but apparently on Linux now libintl has been folded into glibc, so on those systems I don't want to try to do a -lintl during my build.

The naive solution would be to just search /usr/lib for the file, but I need to make sure I'm searching the entire library path that gcc might get its libraries from. On the other end of the spectrum is some craziness like this:

    echo "int main() { return 0; }" | gcc -xc++ -o /dev/null - -lintl 2>/dev/null

and checking the process's exit status to determine if it failed or not.

Is there a better way? (I also get the feeling that "-o /dev/null" only does what it does as a happy side-effect, based on some old posts I read about Linux kernel unit tests... I'd hate for some idiot to run this as root.)

me your dad
Jul 25, 2006

nevermind

me your dad fucked around with this message at 11:48 on Sep 1, 2009

litghost
May 26, 2004
Builder

Flobbster posted:

What's the safest way on Linux or Cygwin to determine the availability of a link library?

Basically I have a module that uses libbfd to extract debugging information from an executable, and in order to use all the symbol table routines I also have to link to libintl and libiberty. This works fine on Cygwin, but apparently on Linux now libintl has been folded into glibc, so on those systems I don't want to try to do a -lintl during my build.

The naive solution would be to just search /usr/lib for the file, but I need to make sure I'm searching the entire library path that gcc might get its libraries from. On the other end of the spectrum is some craziness like this:

    echo "int main() { return 0; }" | gcc -xc++ -o /dev/null - -lintl 2>/dev/null

and checking the process's exit status to determine if it failed or not.

Is there a better way? (I also get the feeling that "-o /dev/null" only does what it does as a happy side-effect, based on some old posts I read about Linux kernel unit tests... I'd hate for some idiot to run this as root.)

If it's a dynamic library (.so), couldn't you just use dlopen?

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

litghost posted:

If it's a dynamic library (.so), couldn't you just use dlopen?

No, it's a static library (.a). I want to be able to do this with the standard tools that are available on Linux and Cygwin because it needs to run from Java on either of those systems (it's an Eclipse plug-in that interacts with their C development tools... don't ask.)

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
Then why not just use autotools?

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

Avenging Dentist posted:

Then why not just use autotools?

Because I've never used those tools directly (just from running pre-existing configure scripts), so I wasn't really sure what I was looking for.

Thanks for the pointer, I should be able to piece something together using autoconf.

BigRedDot
Mar 6, 2008

Avenging Dentist posted:

Then why not just use autotools?
Or cmake.

raminasi
Jan 25, 2005

a last drink with no ice
Does anybody know of a good 3D geometry library? I'm basically just looking for something that will let me do boolean geometry operations on polyhedra. This isn't for graphics, so I don't need lightning-fast calculation so much as ease of use and functionality. It can't be GPLed (and probably not LGPLed either), although it doesn't need to be free.

Olly the Otter
Jul 22, 2007
I'm trying to write a custom code profiler using the /Gh and /GH compiler options in Visual Studio. The problem I'm running into is that if a C++ exception is thrown and the stack is unwound to an exception handler, _pexit never gets called for some functions.

Is there any way to explicitly arrange for my code to be called during stack unwinding, the way destructors for local variables magically get called?

Flamadiddle
May 9, 2004

It's a really dumb question, but is there any difference between using != and <> for testing inequality? Specifically in SQL. It doesn't look like it based on googling, but my boss tutted at me for daring to use !=.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

Flamadiddle posted:

It's a really dumb question, but is there any difference between using != and <> for testing inequality? Specifically in SQL. It doesn't look like it based on googling, but my boss tutted at me for daring to use !=.
What SQL dialect? I think most SQL dialects don't accept != so <> is more "portable", but if != works, then you're probably OK. In T-SQL (MS SQL Server) != is the same as <>

Munkeymon
Aug 14, 2003

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



Flamadiddle posted:

It's a really dumb question, but is there any difference between using != and <> for testing inequality? Specifically in SQL. It doesn't look like it based on googling, but my boss tutted at me for daring to use !=.

I don't think the MySQL manual could do any more to say they are the same (to MySQL) without adding flashing red text that says so: http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_not-equal

Flamadiddle
May 9, 2004

It's MSSQL. Thanks for the links. I tried googling, but it's not so useful when searching for symbols.

tripwire
Nov 19, 2004

        ghost flow

GrumpyDoctor posted:

Does anybody know of a good 3D geometry library? I'm basically just looking for something that will let me do boolean geometry operations on polyhedra. This isn't for graphics, so I don't need lightning-fast calculation so much as ease of use and functionality. It can't be GPLed (and probably not LGPLed either), although it doesn't need to be free.
Hyperfun.

raminasi
Jan 25, 2005

a last drink with no ice

tripwire posted:

Hyperfun.
This looks potentially good but has a weird loving license that I probably won't be able to use.

Kimani
Dec 20, 2003

Anime avatar - check
ADTRW poster - check
Defends watching child porn - CHECK!!!
Does anyone know of a good C/C++ API for working with a Tablet PC? Something that lets me get access to both the stylus and the touchscreen, as well as able to poll if either is available ( since some PCs would have just a touchscreen, some just a stylus, and ideally both! )

Also something that's hardware/OS agnostic would be nice. My search for such an API is somewhat troubled - there's talk of such-and-such works under XP Tablet Edition but not any other XP, some things just for Vista, some things just for Windows 7, etc. That's not very handy.

I know of JPen, which does what I want for the stylus, but it's in Java and I don't think is able to differenciate between the touchscreen and the mouse ( but I'd recommend it to anyone in need of something like it! )

If it can read in the mouse and keyboard too, that would be golden. Just something that spouts out a stream of "x did y" where x is keyboard/mouse/touch/stylus and y is clicked/moved/hovered/touched/stylus-lifted/stylus-pressed/stylus-inhover/stylus-outhover. And some other things like pen pressure.

Or might I just be dreaming of such a thing?

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender
It probably doesn't help you at all, but modern Linux exposes all input sources as separate /dev/event devices, which have a fairly straightforward protocol to understand. In order to decide which event device corresponds to which input source, you'd need to deal with dbus and query hal, but that's not too hard.

It's not really a nicely-packaged API, though, and it's extremely Linux specific, but the essentials of what you're asking for does exist.

Chuu
Sep 11, 2004

Grimey Drawer
I have written a C++ program using the nCurses library. It works perfectly on some computers, it's completely garbled on others -- but only when I attempt to resize -- before I resize they're all working perfect.

All I'm doing is when data is pumped in, I check the height/width of the terminal, and put text on the screen based on that. I'm not doing anything fancy with events, all my code is based on the height/width global variables.

All the computers are being connected to via putty, but run a variety of versions of Linux.

How do I begin to debug this? Is there a good document/FAQ out there on exactly how terminal information is stored? Is there a way to do an ugly hack and force nCurses to use "putty" as the terminal?

Dijkstracula
Mar 18, 2003

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

Garbled, how? Is it a formatting issue (ie. correct characters not in the expected place) or are even the characters completely off? What are the differences between the computers that poo poo the bed and the ones that don't In any event, without seeing code, it's hard to tell what the issue is. Maybe post the contents of your SIGWINCH handler?

also, "putty" is not a terminal type, so ncurses doesn't know anything about it.

edit: I just reread your post.

Chuu posted:

All I'm doing is when data is pumped in, I check the height/width of the terminal, and put text on the screen based on that. I'm not doing anything fancy with events, all my code is based on the height/width global variables.
That you're handling window resize operations in a bizzare way might be the cause of your program doing strange things when you try to resize the window, maybe? :confused:

In any event, post the relevant code, look up Unix signals, and implement a SIGWINCH handler. Even if this isn't the cause of your problems, you'll be one step closer to having a reasonably-well written program.

Dijkstracula fucked around with this message at 14:44 on Sep 5, 2009

politicorific
Sep 15, 2007
The forums would be forever grateful if someone would code up a greasemonkey script that combats image spamming.

Can anyone point me in the right direction?

Avenging Dentist
Oct 1, 2005

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

politicorific posted:

The forums would be forever grateful if someone would code up a greasemonkey script that combats image spamming.

Can anyone point me in the right direction?

Sure. http://www.microtoolsinc.com/Howsrs.php

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."
I've had a problem with one of the batch scripts I'm working with. I had a variable with a null value, and when I called the variable it killed the process. I had a process write a new .bat file which just declared a variable, so I could call it later on. However I made a mistake and the batch file would come out like this:

code:
SET VARIABLE=
So later another script calls the new batch file and the variable in it. Let's say the batch with the variable in is called VAR.bat:

code:
IF EXIST VAR.bat CALL VAR.bat
IF NOT EXIST VAR.bat GOTO :LABEL1
IF %VARIABLE% == "" GOTO :LABEL2
IF %VARIABLE% == %VALUE% GOTO :LABEL2

:LABLE1
ECHO Label 1

:LABEL2
ECHO Label 2
VALUE is just an integer declared elsewhere. It seems to me that Label 2 should be called, since it should be detected as null ("") but instead the process just ends. Even if it didnt satisfy any of the criteria, the contents of Lable1 should still be called, right?

zootm
Aug 8, 2006

We used to be better friends.
Your label is LABLE1 (E and L wrong way around) and your jump is to LABEL1 (E and L correct way around). I have no idea what the semantics are when you tell it to jump to a label that doesn't exist so don't know if that's your problem, though.

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."

zootm posted:

Your label is LABLE1 (E and L wrong way around) and your jump is to LABEL1 (E and L correct way around). I have no idea what the semantics are when you tell it to jump to a label that doesn't exist so don't know if that's your problem, though.

That's not it, I just mistyped there. I'm using different variable and label names in the real script.

Mario
Oct 29, 2006
It's-a-me!
If I remember correctly, to test for an empty/undefined variable in MS-DOS batch files, you do something like this:

IF %VARIABLE%x == x

where x is just a nonce appended to the variable because empty variables aren't handled very gracefully (as you've seen).

Kimani
Dec 20, 2003

Anime avatar - check
ADTRW poster - check
Defends watching child porn - CHECK!!!

ShoulderDaemon posted:

It probably doesn't help you at all, but modern Linux exposes all input sources as separate /dev/event devices, which have a fairly straightforward protocol to understand. In order to decide which event device corresponds to which input source, you'd need to deal with dbus and query hal, but that's not too hard.

It's not really a nicely-packaged API, though, and it's extremely Linux specific, but the essentials of what you're asking for does exist.
Cool, I might port this thing to Linux down the line. Who knows.

Anyway, I'm posting again to note that I solved my problem by using Microsoft's RealTimeStylus interface. I decided on using it after seeing this page, as it's pretty much exactly what I needed. It provides that nice OS-supported layer of abstraction that's supposed to work on XP, Vista, and 7, and supports all the things I needed. I quickly wrote up a test app that you move around different boxes if you were using the mouse, the touch screen, hovering the pen, writing with the pen, hovering the eraser, or erasing with the eraser. Works good.

Except that it's part of Microsoft's COM bullshit and I had a hell of a time figuring that out from nothing. ( You need to #include things in the right order, I'd rather not see another CLSID or IID ever again, oh god ) There isn't a whole lot of examples of people using it, and the ones that are out there are often for .NET. There is a very useful example project in the Windows Platform SDK, though, and I referenced enough obscure code snippets from the bottom of the Google barrel to get everything working.

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."

Mario posted:

If I remember correctly, to test for an empty/undefined variable in MS-DOS batch files, you do something like this:

IF %VARIABLE%x == x

where x is just a nonce appended to the variable because empty variables aren't handled very gracefully (as you've seen).

Sorry, I'm guessing "nonce" means something very different where you are.

That's great, anyway, but it's strange, I've inherited a lot of old scripts that use IF %VARIABLE% == "" with no ill effects that I've seen.

Mario
Oct 29, 2006
It's-a-me!

BizarroAzrael posted:

Sorry, I'm guessing "nonce" means something very different where you are.
Batch files are a strange beast... :pedo:

This is more what I was thinking.

sd6
Jan 14, 2008

This has all been posted before, and it will all be posted again
I have a quick question for those already in the field as professional programmers. I'm in my last year of school for an undergrad degree in CS, and I'd like to get a job as a programmer after graduation. Aside from the actual cs classes that are math/theory, most of the implementation classes are in desktop application programming in Java. Outside of coursework, I'm trying to learn other languages and technologies, and I wanted to ask whether you guys think there will be more need for desktop application programmers, or for web application programmers/web developers. I hope to be skilled at both eventually, but is there one that I should be focused on learning more than the other in regards to getting a job?

yatagan
Aug 31, 2009

by Ozma

fge posted:

web application programmers

The demand for this in Java is something like 100 times the demand for desktop Java in my experience. Unless you're a Swing specialist, you're almost certainly going to be working with some web framework or another. Though there are occasional internal business application developers farting around, most of them end up using a web framework anyway.

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."
This should be pretty simple, I want a script to rename any file within a directory with another extension:

code:
REN C:\Scripts\*.bat.template *.bat
Can I not carry the wildcard over like that?

Edit: Got it. Apparently there is weirdness with the way it handles files with two extensions

code:
ren c:\scripts\*.bat.template *b
ren c:\scripts\*.b *.bat
First line cuts the end of name up to the last be, turning the files into .b format, the second turns the .bs into .bats.

BizarroAzrael fucked around with this message at 15:45 on Sep 9, 2009

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."
Wait! I've got another one!

I have a script calling other scripts and directing the output to a .txt rather than the prompt:

code:
CALL script.bat 2>> directory\script.log 1>&2
More complicated than just >> since the script is to run over night and I need that to make it send everything to the file rather than to the command line where it will just be lost.

I hoped to make things tidier by doing this:

code:
SET LOG="2>> directory\script.log 1>&2"
CALL script.bat %LOG%
This doesn't work, it just outputs to the command prompt. I would have thought that such arguments would work since variables can be used as arguments and just about anything else the same as just typing the value in the same place, is this not the case?

yatagan
Aug 31, 2009

by Ozma

BizarroAzrael posted:

code:
SET LOG="2>> directory\script.log 1>&2"
CALL script.bat %LOG%
This doesn't work, it just outputs to the command prompt. I would have thought that such arguments would work since variables can be used as arguments and just about anything else the same as just typing the value in the same place, is this not the case?

I'm not up with DOS programming, but putting something in quotes probably makes it so nothing inside will be interpreted as a command.

BizarroAzrael
Apr 6, 2006

"That must weigh heavily on your soul. Let me purge it for you."

yatagan posted:

I'm not up with DOS programming, but putting something in quotes probably makes it so nothing inside will be interpreted as a command.

Sorry, forgot to mention I tried with and without.

yatagan
Aug 31, 2009

by Ozma

BizarroAzrael posted:

Sorry, forgot to mention I tried with and without.

In most languages, control characters and statements won't ever get parsed as commands when they're inside a variable.

On your specific problem, check out this page:
http://www.robvanderwoude.com/redirection.php

It looks to me that you're redirecting standard out to the logfile, but then you redirect standard out to standard err which is then printed to console. Try ending the original command with 2>&1 instead of 1>&2.

Jo
Jan 24, 2005

:allears:
Soiled Meat
In the rotation component of DES, does each key (K[1] - K[16]) rotate from the PC-1 transformed data, or from the previous K?

I.E. does K[2] rotate twice, (once for K[1] and the again?) or once? Does K[3] rotate four times (once for K[1], once for K[2], twice again?) or once?

Ninja edit: On a similar note, is the input to K[2] the PC-2 shifted K[1] or the PC-1 shifted data?

Really, I'm wondering if each key is independently generated, or if K[1] plays a roll in K[>1].

EDIT 2: Grammar.

Jo fucked around with this message at 05:12 on Sep 11, 2009

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->
Why are you implementing DES?

(I would have thought the diagrams of keyscheduling on wikipedia would be enough to answer your questions)

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