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
Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I wondered if anybody here had opinions on any of those enterprising UML diagram/code generator tools, like Enterprise Architect. I wanted to dabble in something where I could doodle out general designs so people at work can see what crack I'm smoking, but then have it generate the code stubs so I could get right into it afterwards. I generally work with C#, Python, and C++--for example.

Adbot
ADBOT LOVES YOU

clayburn
Mar 6, 2007

Cammy Cam Juice

Rocko Bonaparte posted:

I wondered if anybody here had opinions on any of those enterprising UML diagram/code generator tools, like Enterprise Architect. I wanted to dabble in something where I could doodle out general designs so people at work can see what crack I'm smoking, but then have it generate the code stubs so I could get right into it afterwards. I generally work with C#, Python, and C++--for example.

We use Enterprise Architect for work. Having never used any other software in this domain, I would have to say that EA is alright. I don't use it often, but when I do, I use it to make UML models. Some common actions seem to take a few too many steps to perform, such as adding an attribute or operation to a class. It works well for our team, but I have to imagine there is a better tool out there, especially if you are just wanting to do some UML on your own.

As far as code generation, I know it supports at least C#. I once generated code from one of my models just out of interest. I remember looking at it and thinking that I would rather just write the code out myself. This is probably more on me just not trusting it and preferring to write it from scratch myself. If I get a chance today, I'll try to check out the feature and let you know more specifics on how well it works.

_aaron
Jul 24, 2007
The underscore is silent.

Rocko Bonaparte posted:

I wondered if anybody here had opinions on any of those enterprising UML diagram/code generator tools, like Enterprise Architect. I wanted to dabble in something where I could doodle out general designs so people at work can see what crack I'm smoking, but then have it generate the code stubs so I could get right into it afterwards. I generally work with C#, Python, and C++--for example.
We also use EA at work. It's... alright. For class diagrams, it's pretty decent. As clayburn said, some things seem to take longer/more actions than you'd expect, but it gets the job done. Out of the box, code generation is not great. We end up needing to clean up all of the generated code, to the point where often it would be just as time consuming to write it manually. I believe there's a way to customize the code generation to possibly minimize the need for clean-up, but it's not something we've tinkered with. If all you want is a tool to build class diagrams, though, it's alright for that.

Sequence diagrams are another beast entirely, and I hate the way EA handles them. You have to manually draw lines, drag/drop 'fragment' boxes (things like loops or if/elses), etc. It's all done via drawing on a canvas. It tries to be smart about what you want, making assumptions about how you want the diagram laid out. But it is often terribly wrong, meaning that adding or deleting an action has catastrophic effects on the layout of the rest of the diagram. I much prefer a tool like Quick Sequence Diagram Edit. The diagram is generated from an almost psuedocode-like language. It's got its own quirks, and it's certainly not perfect, but it kills EA for drawing/editing sequence diagrams.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

_aaron posted:

We also use EA at work. It's... alright. For class diagrams, it's pretty decent. As clayburn said, some things seem to take longer/more actions than you'd expect, but it gets the job done. Out of the box, code generation is not great. We end up needing to clean up all of the generated code, to the point where often it would be just as time consuming to write it manually. I believe there's a way to customize the code generation to possibly minimize the need for clean-up, but it's not something we've tinkered with. If all you want is a tool to build class diagrams, though, it's alright for that.

Sequence diagrams are another beast entirely, and I hate the way EA handles them. You have to manually draw lines, drag/drop 'fragment' boxes (things like loops or if/elses), etc. It's all done via drawing on a canvas. It tries to be smart about what you want, making assumptions about how you want the diagram laid out. But it is often terribly wrong, meaning that adding or deleting an action has catastrophic effects on the layout of the rest of the diagram. I much prefer a tool like Quick Sequence Diagram Edit. The diagram is generated from an almost psuedocode-like language. It's got its own quirks, and it's certainly not perfect, but it kills EA for drawing/editing sequence diagrams.
if money were less a concern, is there a clear forerunner in the space? All I can think back on is the Rational software suite, and that was a long time back. I see IBM gobbled them up and now there's a ton of crap with "Rational" in front of it, and I couldn't match anything up in a casual search.

Some of my problem is I'm kind of a newcomer into this space. I've diagrammed classes before to the UML standard, but that's a far cry from claiming to know UML generally. My hope is to have something where I can visually show some technical people with a fair software background what I want to do visually before I start slapping a lot of code together. I figure Enterprise Architect would be fine for class diagrams since the generated code might be half-assed, but it sure generates code better than Powerpoint.

kedo
Nov 27, 2007

So a site I manage for work has apparently been hacked somehow... I went in to make some edits and found a big old chunk of base64 encoded crap on literally every single .php file on the server. Decoded, it looks like this: http://pastebin.com/GsJB58Tm

Can someone who's more PHP savvy than me take a look at that and give me a general idea of what it's doing? I've already removed it all, but I'd like to be able to tell the client what's happened.

edit: Also, has anyone else seen anything like this recently... specifically on a WordPress and/or Dreamhost hosted site?

kedo fucked around with this message at 19:32 on Mar 1, 2012

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

kedo posted:

edit: Also, has anyone else seen anything like this recently... specifically on a WordPress and/or Dreamhost hosted site?
I couldn't tell you if that exact code sequence, but I've seen crap like that happen to me before when I was running a WordPress site on some cheap personal hosting--not Dreamhost. I wasn't keeping WordPress judiciously up-to-date, and the rest was history. Some crap got prepended on to some pages, but also the .htaccess got a pile of junk. The file had a ton of empty lines surrounding some malicious stuff. What would happen is going to my site would generate a ton of popups and redirect all kinds of crap. It would try to come back from time-to-time, I never found the attack vector, and I wanted to do something else with the site, so I switched over to Drupal. So far I have been okay, but I have been better about patching too.

kedo
Nov 27, 2007

Rocko Bonaparte posted:

I couldn't tell you if that exact code sequence, but I've seen crap like that happen to me before when I was running a WordPress site on some cheap personal hosting--not Dreamhost. I wasn't keeping WordPress judiciously up-to-date, and the rest was history. Some crap got prepended on to some pages, but also the .htaccess got a pile of junk. The file had a ton of empty lines surrounding some malicious stuff. What would happen is going to my site would generate a ton of popups and redirect all kinds of crap. It would try to come back from time-to-time, I never found the attack vector, and I wanted to do something else with the site, so I switched over to Drupal. So far I have been okay, but I have been better about patching too.

Yeah I'm thinking this may be a similar case. I doubt the client is keeping WordPress up to date, so I wouldn't be surprised if the hax0r somehow managed to inject code that way. However I'm finding the same code in a whole ton of different locations outside of WordPress, so I'm not too sure.

Johnny Cache Hit
Oct 17, 2011

kedo posted:

Yeah I'm thinking this may be a similar case. I doubt the client is keeping WordPress up to date, so I wouldn't be surprised if the hax0r somehow managed to inject code that way. However I'm finding the same code in a whole ton of different locations outside of WordPress, so I'm not too sure.

Yeah, it probably added some code into any PHP file that it could touch.

This SO answer might help:
http://stackoverflow.com/questions/9421414/what-exactly-does-this-php-exploit-code-found-on-my-app

kedo
Nov 27, 2007

Oops, you are exactly right. Guess I should have googled a little bit better, as that looks like almost the exact same code I'm seeing.

Thanks much!

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



It also looks like it stores some stuff next to the PHP file in .logs/log1.txt so check that out.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Yeah I've cleaned some of these out of friends PHP/WP installs as a favor. It basically hijacks every page (it'll usually get into index.php/footer.php/header.php anywhere it can) to a virus dropper on the remote domain. I believe the browser check is also so it can dodge the google spider and not end up on stopbadware.org

What I do is note the file modified date of the infected files (usually minutes apart). What helps find them is a grep for 'base64decode'; there's some legit files you'll find but it's pretty easy to tell which is bad and which is good. Scrub all those files, be paranoid and check all files modified at the previously noted date/time.

Then, you move on to the FTP log (narrow down to the date/time you grabbed above). Of the 5-6 that I've seen suffering from this 100% of them have been because someone got into the FTP. Find out when the affected files were uploaded, then trace all that IPs access for the whole log. If there's activity there then you can use that as your cleanup guide too (also obviously change the passwords). If there isn't, you're going to have to start looking at exploits.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Maybe a stupid question, never used wordpress, but couldn't you just dump the data, reinstall wordpress, promise yourself you'll upgrade it regularly (hahahaha), then reimport your data?

I wouldn't trust myself to have scrubbed everything after being exploited.

oRenj9
Aug 3, 2004

Who loves oRenj soda?!?
College Slice
Is it mandatory for WordPress to to have write access to all of these PHP files? It seems like making all of the PHP files rx only for Apache would go a long way to preventing this kind of stuff.

duck monster
Dec 15, 2004

Does anyone know where the gently caress I can get a Google maps API V2 key for a website.

Large un-source-code-available java bloblet website needs a google maps API javascript key and the google site just loving leads me on a wild goosechase.

It *used* to be there, but I'm fearing that google jumped the shark and stopped key availability for the API, which might leave us in potentially tens of thousands of hours of "oh gently caress" labor reverse engineering a blob and figuring out how to update it.

Scaevolus
Apr 16, 2007

duck monster posted:

Does anyone know where the gently caress I can get a Google maps API V2 key for a website.

Large un-source-code-available java bloblet website needs a google maps API javascript key and the google site just loving leads me on a wild goosechase.

It *used* to be there, but I'm fearing that google jumped the shark and stopped key availability for the API, which might leave us in potentially tens of thousands of hours of "oh gently caress" labor reverse engineering a blob and figuring out how to update it.

This seems to work.

You register a project, enable the services you want (in this case, Maps v2), and then use the project's API key.

Visti
Apr 26, 2010
Hey guys, I have a real beginner question about scripting in Linux. I know a bit of Python, have had a few Java courses, but I've never actually done anything with it.

What is the easiest way for me to do a Linux CLI menu that a user can navigate around and when choosing a menu it executes OS commands? Curses?

I can execute all the commands I want directly from the CLI and they work fine, I just want a tiny menu that'll run in an infinite loop until I quit out, where I can issue the commands with my directional keys and enter instead of typing/aliasing them all.

Impotence
Nov 8, 2010
Lipstick Apathy
What would be the best way to do voting (via web) that resets on an 8 minute cycle, then running a shell script when votes > a certain number for that 8 minute cycle (to basically cp top_selection.aspx Default.aspx)

I have basically no idea where to start on this, what a database structure would look like, etc. Can't find example code for anything like this either.

oRenj9
Aug 3, 2004

Who loves oRenj soda?!?
College Slice
Are you talking about aggregating the votes every eight minutes? If so, just create a vote table with id(int), vote_type(foreign key [FK]), user_id(FK), and timest(datetime) fields. Then, every eight minutes run a "SELECT COUNT(*) WHERE vote_type = blah AND timest BETWEEN DATE_SUB(NOW(), INTERVAL 8 MINUTES) AND NOW()"*, then add that value to where every you are holding the aggregate sum. Alternatively, you can just remove the between statement and get an aggregate sum, but that would be far less efficient.

* I didn't run that for accuracy, don't yell at me if it doesn't work verbatim.

Impotence
Nov 8, 2010
Lipstick Apathy
Urgh, thanks for the timest(datetime) thing, I was actually going to make a table per vote at first then thought about how stupid of an idea that would turn out to be

How would I manage 'security' and voting fraud? Web proxies and HTTP/SOCKS/SSH tunnels/etc already don't work because the IP has to be on a whitelist. Just check if that one host has voted in the last 8 minutes?

ToxicFrog
Apr 26, 2008


Visti posted:

Hey guys, I have a real beginner question about scripting in Linux. I know a bit of Python, have had a few Java courses, but I've never actually done anything with it.

What is the easiest way for me to do a Linux CLI menu that a user can navigate around and when choosing a menu it executes OS commands? Curses?

I can execute all the commands I want directly from the CLI and they work fine, I just want a tiny menu that'll run in an infinite loop until I quit out, where I can issue the commands with my directional keys and enter instead of typing/aliasing them all.

Probably curses, yeah. Note that "easiest" does not necessarily mean "easy", but this shouldn't be too hard.

oRenj9
Aug 3, 2004

Who loves oRenj soda?!?
College Slice

Biowarfare posted:

How would I manage 'security' and voting fraud? Web proxies and HTTP/SOCKS/SSH tunnels/etc already don't work because the IP has to be on a whitelist. Just check if that one host has voted in the last 8 minutes?

That completely depends on how you manage users. If users must log in, you may use their user id. If not, IP address is certainly a fair way to limit votes, but be aware that there is a one-to-many relationship between IP addresses and users. The best way to prevent most scamming would be to use a create a user id in another table based on the IP address and the user agent. Then just reference it in the voting table. It isn't fool proof, but it works.

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
Are there any medium or large open-source projects that use non-recursive makefiles? I'm working on a tool for build systems, and I'd like to test it on some real codebases, but it can't deal with recursive makefiles for the forseeable future.

shrughes
Oct 11, 2008

(call/cc call/cc)

Otto Skorzeny posted:

Are there any medium or large open-source projects that use non-recursive makefiles? I'm working on a tool for build systems, and I'd like to test it on some real codebases, but it can't deal with recursive makefiles for the forseeable future.

I don't remember v8 having a recursive Makefile.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Biowarfare posted:

How would I manage 'security' and voting fraud? Web proxies and HTTP/SOCKS/SSH tunnels/etc already don't work because the IP has to be on a whitelist. Just check if that one host has voted in the last 8 minutes?

Back when I still ran Fusker my method of detecting duplicate votes was kinda poo poo but it worked for me. Since I had no account system, I used a hash of the user agent + the IP for each vote; being closed-source at the time and a relatively low amount of traffic, I could just rely on security through obscurity. Also there was no visible feedback on the status of a given fusker URL, so you would have to spam enough to change rankings to actually know if your script worked.

It's all in the assumptions you make:

- How important is it to record every vote (it wasn't that important to me, so assumed "duplicates" were just discarded, even if they may not really have been dupes)
- How safe from vote-spam do you want to be (if you don't have accounts, it's practically impossible, so I just chose the above to curb the worst of it)
- How hard do you want it to be to vote (for instance you could use a CAPTCHA, but nobody in their right mind would fill that out just to hit +/- on some poo poo).

Carthag Tuek fucked around with this message at 06:03 on Mar 3, 2012

cmndstab
May 20, 2006

Huge Internet Celebrity!
I'm in the middle of writing an applet for work. I have some coding experience but I've never really written an applet since I took a Java swing course at Uni a decade ago so it's been a slow learning experience.

I have it mostly working how I want now, but there's one thing I can't figure out. At one point I want the user to be able to push a button (from inside the applet, not a HTML form button), which calls a Perl script. The script executes a program server-side that runs (perhaps for several minutes) and routinely outputs to a text file. I'd like this process to run in the background, and while its running the applet continually updates itself based upon whatever is in the output file at any given moment.

My problem is that my applet won't continue execution until the Perl script exits, and even though I've told the Perl script to run the server-side program in the background, it waits until that execution is complete before exiting.

Is there a way to get around this?



Also, one more quick question for people familiar with JApplets - I've been developing my code with a recent version of Java but have found that it won't run on browsers with earlier version of Java, which makes sense. Is there any good reason for me NOT to download a rather early version fo Java to compile my final code in order to ensure it works on as many computers as possible without having to ask them to download the latest version?

Tony Montana
Aug 6, 2005

by FactsAreUseless
Robust file copying in a Windows enviroment.

We usually use Robocopy (along with the rest of the world). I want to do this from within a VBS script.

I can copy the robocopy.exe somewhere and call it, yada yada, but what would be sleeker is if there is a robust file copy facility already built into VBS. Does anyone know? There is the filesystemobject.copyfile method, does this fail the whole copy if it encounters an error?

I guess I'm asking, visual basic scripters, how to you copy files/directories about without having to copy robocopy.exe all over the place?

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

cmndstab posted:

I'm in the middle of writing an applet for work. I have some coding experience but I've never really written an applet since I took a Java swing course at Uni a decade ago so it's been a slow learning experience.

I have it mostly working how I want now, but there's one thing I can't figure out. At one point I want the user to be able to push a button (from inside the applet, not a HTML form button), which calls a Perl script. The script executes a program server-side that runs (perhaps for several minutes) and routinely outputs to a text file. I'd like this process to run in the background, and while its running the applet continually updates itself based upon whatever is in the output file at any given moment.

My problem is that my applet won't continue execution until the Perl script exits, and even though I've told the Perl script to run the server-side program in the background, it waits until that execution is complete before exiting.

Is there a way to get around this?



Also, one more quick question for people familiar with JApplets - I've been developing my code with a recent version of Java but have found that it won't run on browsers with earlier version of Java, which makes sense. Is there any good reason for me NOT to download a rather early version fo Java to compile my final code in order to ensure it works on as many computers as possible without having to ask them to download the latest version?
This would be better in the Java thread and we'd need to see your code to see how you're executing the the Perl script.

Applets have been pretty much deprecated now because of the many security issues that have come up. I'm concerned about how you are executing that Perl script and reading it's output if the applet is running in the client's browser.

But basicallly you need to create a new thread and construct a new Process using a ProcessBuilder and wait for that to finish. Meanwhile in your original thread you can read the output file and notify the user of the progress.

As for your second question, you can specify the target java version that your code is meant to run on, so there is no need to downgrade your version while developing. You'll need to install that version if you want to test it though.

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?

Tony Montana posted:

I guess I'm asking, visual basic scripters, how to you copy files/directories about without having to copy robocopy.exe all over the place?

Maybe this isn't practical for you for some reason, but couldn't you just add robocopy's directory to the global path?

Tony Montana
Aug 6, 2005

by FactsAreUseless

rolleyes posted:

Maybe this isn't practical for you for some reason, but couldn't you just add robocopy's directory to the global path?

I just want to use what is in vbs. I guess I could handle the error codes of the default copy method and basically create my own robust file copier?

rolleyes
Nov 16, 2006

Sometimes you have to roll the hard... two?

Tony Montana posted:

I just want to use what is in vbs. I guess I could handle the error codes of the default copy method and basically create my own robust file copier?

Fair enough. I'm of no further use to you having never really touched VBS, I just thought that might be a simple solution. Assuming the built-in copy returns useful error codes then rolling your own ought to be possible.

cmndstab
May 20, 2006

Huge Internet Celebrity!

MEAT TREAT posted:

This would be better in the Java thread and we'd need to see your code to see how you're executing the the Perl script.

Applets have been pretty much deprecated now because of the many security issues that have come up. I'm concerned about how you are executing that Perl script and reading it's output if the applet is running in the client's browser.

But basicallly you need to create a new thread and construct a new Process using a ProcessBuilder and wait for that to finish. Meanwhile in your original thread you can read the output file and notify the user of the progress.

As for your second question, you can specify the target java version that your code is meant to run on, so there is no need to downgrade your version while developing. You'll need to install that version if you want to test it though.

Thanks for that - I'll read up on threading and the Process class. This is all kind of new to me.

I'm not doing anything particularly clever with the Perl script, there is a perl script server-side that the Java code calls with a URLConnection and sends/receives data from. The data is checked within the Applet to make sure it is nothing undesirable before sending it to the Perl script. Is there anything more I need to take into consideration?

If I set the target version to be something relatively low, I assume it will still work on later versions?

Thanks again for the help, I'll read up on those links now.

ToxicFrog
Apr 26, 2008


cmndstab posted:

If I set the target version to be something relatively low, I assume it will still work on later versions?

From the manual for javac:

code:
             -target version
                Generate class files that target a specified version of the VM. Class files
                will run on the specified target and on later versions, but not on earlier versions
                of the VM. Valid targets are 1.1 1.2 1.3 1.4 1.5 (also 5) and 1.6 (also 6).

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
In practice there are pretty serious reasons to want to use Java 1.5 over previous versions. That update added, among other things, generics, foreach loops and the modern Collections framework.

baquerd
Jul 2, 2007

by FactsAreUseless

Internet Janitor posted:

In practice there are pretty serious reasons to want to use Java 1.5 over previous versions. That update added, among other things, generics, foreach loops and the modern Collections framework.

In practice I've also seen some pretty serious speed increases with 1.6 and some good concurrency additions, but 1.5 is definitely the big one features wise.

Standish
May 21, 2001

Internet Janitor posted:

In practice there are pretty serious reasons to want to use Java 1.5 over previous versions. That update added, among other things, generics, foreach loops and the modern Collections framework.
Anyone still running a java version that old is undoubtedly part of a botnet by now so they have bigger problems than whether they can run your applet.

Johnny Cache Hit
Oct 17, 2011
Hi fellow programmers. This question isn't really all that related to programming, but it's something we all deal with every day, so this is probably the best place to ask:

What should I be sitting on?

I just switched jobs and ended up with a lovely terrible office chair, and now I'm going home with an aching back and feeling miserable. I know plenty of the problem is that I'm a lumpy goon that isn't active enough, and that's on the list of things to fix, but this uncomfortable chair isn't helping.

I've looked at kneeling chairs, at saddle chairs, at Aerons and SAYLs and everything in between. Does anyone have advice for a good chair? I'm willing to spend money for something nice, but I don't want to just go buy an Aeron because it's expensive.

kedo
Nov 27, 2007

I'm looking for recommendations for a solid, relatively easy to understand/use canvas animation library. Extra points if it plays nicely with jQuery.

I ran across a couple (including KineticJS which seems like a good option), however I've yet to actually try any of them. Processing.js is another option I was looking at, but it seemed like it had a bit steeper learning curve which I unfortunately just don't have the time for at the moment. :smith:

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

Kim Jong III posted:

What should I be sitting on?

SHSC has a thread on this subject, give it a read and see if anything strikes your fancy.

Johnny Cache Hit
Oct 17, 2011

PDP-1 posted:

SHSC has a thread on this subject, give it a read and see if anything strikes your fancy.

I knew there had to be a thread about this somewhere. Thanks!

Adbot
ADBOT LOVES YOU

Bodhi Tea
Oct 2, 2006

seconds are secular, moments are mine, self is illusion, music's divine.
I'm about to try my hand at making a web app and I have a very basic db question. I'm planning to use the tmdb api to get movie information.

Say, for example, that a user will search for a movie and then add it to his list of favorites. He should also be able to view movie information.

Would I save the movie information (from tmdb) for each movie added to his list in a 'movies' table? In this case, if he were to theoretically add every movie on tmdb, the 'movies' table would be a mirror of the tmdb database.

The other option would be to make a request to to tmdb whenever movie info is needed.

Sorry if I'm being unclear.

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