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
Dijkstracula
Mar 18, 2003

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

litghost posted:

Could getting the map output help here? It would at least tell you which module it is in.
Yep, I dumped the contents of /proc/PID/maps so I know what library it is (and it's the one I expected and the region of pages are executable so I'm reasonably sure that despite my discomfort with the x86_64 address space I'm getting correct results), but I'm not sure I'm calcuating the offset given to me correctly so I was kind of hoping for an all-in-one solution that at least didn't require an awk script or something :)

Dijkstracula fucked around with this message at 01:55 on Jul 18, 2010

Adbot
ADBOT LOVES YOU

Nodrog
Apr 17, 2002

by angerbeet
Not sure if this is the right thread, but how can I write a script which initialises a new screen session, creates 3 separate sessions within screen, and then runs a certain program in each of the sessions? If a screen session already exists then a script like

code:
#!/bin/bash
screen -X screen <program1>
screen -X screen <program2>
etc
makes new sessions within it, but how can I make it work if there isnt already a screen session?

Nodrog fucked around with this message at 04:31 on Jul 18, 2010

mr_jim
Oct 30, 2006

OUT OF THE DARK

Nodrog posted:

Not sure if this is the right thread, but how can I write a script which initialises a new screen session, creates 3 separate sessions within screen, and then runs a certain program in each of the sessions? If a screen session already exists then a script like

code:
#!/bin/bash
screen -X screen <program1>
screen -X screen <program2>
etc
makes new sessions within it, but how can I make it work if there isnt already a screen session?

You could try using pidof or pgrep to see if there is a running session, and start one if necessary.

mr_jim fucked around with this message at 04:39 on Jul 18, 2010

Nodrog
Apr 17, 2002

by angerbeet
Thanks, but I mean how do I start a session of screen so that it runs in the background, so I can send commands to it? "screen &" doesnt work.

Also I've just realised the way I was sending commands to an existing screen session doesnt work properly either. Lets say I want to run a copy of R (a programming language) in a new screen session. Then I can do "screen -X screen R" and it works fine. But if I want to start up R with some command line arguments like "screen -X screen R < script.r" (which is meant to start R and execute script.r) then it doesnt work. Ive tried

screen -X "screen R < script.r"

and that doesnt work either. Im guessing the < character is breaking it?

mr_jim
Oct 30, 2006

OUT OF THE DARK

Nodrog posted:

Thanks, but I mean how do I start a session of screen so that it runs in the background, so I can send commands to it? "screen &" doesnt work.

From looking at the man page, "screen -d -m" will do what you want. I'm not sure about the second part of your question.

For what it's worth, tmux seems to be more amenable to scripting. This page has an example of starting a session, creating windows, and starting commands from a script. If tmux is available on your system, or you can install it, it might be worth looking in to.

mr_jim fucked around with this message at 13:49 on Jul 18, 2010

Look Around You
Jan 19, 2009

Hey guys, I was wondering where I could find some programming exercises for someone who's had a few college courses in programming but hasn't taken any courses in it since then and wants to get back up to speed and get better at various languages. I've had Intro, Discrete Math, and Data Structures, all passed with B+'s or higher, but I stopped because a medicine I was taking kinda put me in a fog and made it harder to work on math and logic. I'm thinking of possibly getting a minor in CS to get background in case I want to work as a programmer (I would try to get an MS in this case), or in case I just wanted to keep programming as a hobby.

The short version is I'm looking to pick programming back up and need some things to do. Also, I'd like to learn some GUI frameworks if there's anything on those (Cocoa, GTK+, etc.).

Thanks!

_aaron
Jul 24, 2007
The underscore is silent.

Look Around You posted:

Hey guys, I was wondering where I could find some programming exercises for someone who's had a few college courses in programming but hasn't taken any courses in it since then and wants to get back up to speed and get better at various languages. I've had Intro, Discrete Math, and Data Structures, all passed with B+'s or higher, but I stopped because a medicine I was taking kinda put me in a fog and made it harder to work on math and logic. I'm thinking of possibly getting a minor in CS to get background in case I want to work as a programmer (I would try to get an MS in this case), or in case I just wanted to keep programming as a hobby.

The short version is I'm looking to pick programming back up and need some things to do. Also, I'd like to learn some GUI frameworks if there's anything on those (Cocoa, GTK+, etc.).

Thanks!
http://codingbat.com/ is a good site for just really simple Java exercises. You run them right in the browser, so it's very easy to fly through a bunch of them without having to worry about setting up an IDE. You'll need to learn that eventually, but for just getting your feet wet, this is a good starting point.

After that, maybe try some problems at https://www.projecteuler.net. It's a bunch of math problems that you solve by programming.

Dessert Rose
May 17, 2004

awoken in control of a lucid deep dream...
Another place to look is TopCoder. They have an incredible array of varying difficulties of coding problems and you can solve them with Java, C# or C++. They also have competitions, if you like that sort of thing.

RedHasSandles
Mar 24, 2008

Woah dudes!
I don't know if this is the right place to be asking this, but Google recently updated their image search to use some crazy new interface that I'm not used to. The old interface is still available but you have to scroll all the way to the bottom of the results (all of the results) and click "Switch to basic version" to access it, and then it only lasts until you navigate away then you have to click it again.

What how does this relate to programming? Well I was hoping someone could help me out with a greasemonkey script to do this automatically. I don't know anything about greasemonkey so I wouldn't know where to begin.

Vanadium
Jan 8, 2005

Look Around You posted:

Hey guys, I was wondering where I could find some programming exercises

http://code.google.com/codejam/contests.html and http://www.facebook.com/careers/puzzles.php have a bunch of not-so-trivial problems to solve, maybe they are fun!

quote:

Also, I'd like to learn some GUI frameworks if there's anything on those (Cocoa, GTK+, etc.).

I think the best you can do here is working through their non-reference documentation (like the free Gtk+ "book"), then imitating how other people do things in the framework.

BigRedDot
Mar 6, 2008

Vanadium posted:

http://code.google.com/codejam/contests.html and http://www.facebook.com/careers/puzzles.php have a bunch of not-so-trivial problems to solve, maybe they are fun!


I think the best you can do here is working through their non-reference documentation (like the free Gtk+ "book"), then imitating how other people do things in the framework.
Yes, but for god's sake don't start with gtk.

Vanadium
Jan 8, 2005

Gtk+ is the only gui framework that does not make me tear my hair out five minutes into it. :rant:

It takes at least half an hour or so.

Mental Filler
May 5, 2007

She can ride or walk
either leave it or love it
Is there any way to access the itunes Applescript reference without having a Mac with itunes installed available? I'm assuming the Windows version doesn't include this but I can't find it in anywhere else and it would be the most useful thing.

BigRedDot
Mar 6, 2008

Vanadium posted:

Gtk+ is the only gui framework that does not make me tear my hair out five minutes into it. :rant:

It takes at least half an hour or so.

I guess the grass is always greener... gtk is what I am stuck using at work, and I hate, hate, hate it. Do you do everything by hand? The glade app is mediocre, amateur, barely-functional toy software.

Vanadium
Jan 8, 2005

I honestly do not do much with it and can see how it is a great deal inconvenient, and no, I do not like glade either. I like the gtkmm API and most other language bindings a great deal more than other frameworks', and Gtk+ seems to do a bunch more plumbing for me like properly layouting poo poo or dealing with fonts and whatnot. :shobon:

ToxicFrog
Apr 26, 2008


:raise: I use Glade constantly and love it. It's spoiled me on other GUI frameworks because seriously, gently caress laying out all of my widgets using code, I have better things to do, like writing the actual program logic.

BigRedDot
Mar 6, 2008

ToxicFrog posted:

:raise: I use Glade constantly and love it. It's spoiled me on other GUI frameworks because seriously, gently caress laying out all of my widgets using code, I have better things to do, like writing the actual program logic.
I have nothing against gui layout designers, good ones anyway. I only asked about doing things manually because arguably in the gtk case that would actually be less painful. As for (not) avoiding boilerplate code, only today I had to explicitly write a one line callback just to hide a widget when a button is clicked, as if I should give a crap about trivialities like that. I'd love glade if it weren't garbage[*]. Even Interface Builder is better and that's saying alot.

[*]It crashes, it vomits gtk errors and warnings all over the console, it's painfully sluggish, half the time it flat-out refuses to let you select widgets by clicking on them, the UI is (irony!) sloppy and kludgy and inconsistent, it lacks trivial but useful features, signal autoconnect is a cruel joke, it makes many common tasks needlessly complicated...

...and don't even get me started about glade-2 (which I am still stuck using on a few platforms) where such exotic features as "cut and paste", and "undo" never actually functioned at all. Like I said, it's toy software, akin to some undergrad team project, and similar in quality.

BigRedDot fucked around with this message at 02:45 on Jul 22, 2010

Clockwork Sputnik
Nov 6, 2004

24 Hour Party Monster
Oracle/Site Studio/FCKeditor question

I have a client that I believe wants me dead.

Today my they sent me the following message:

batshit insane client posted:

I need you to make a customization to the FCK editor to add an option list that produces an idocscript service call.

-add an option list right next to size called PZN

-when the user clicks on an option...say BasePay...it will produce <!--$execute(BasePay)--> in the editor, but you will only see it in source mode

- you will of course have to make some additions to the js files

I think there was something out of the box that did something similar. it showed a small icon in the editor and rendered differently on the page...cant remember what it was. I basically need a custom version of that.

Honestly guys, I don't know what the gently caress here. I'm cool with Oracle and Site studio, buzzing right along there. But out of nowhere I'm hit with a request to modify poo poo I just enduse.

Should I:
a) Ask for help on the forums
b) Tell the client it's out of my league
c) Tell the client I'll do it for $??? then farm it out?
d) Ask you guys what resources I need to learn how to do this, stay up late not loving sleep for a couple days and make like it was no big deal to the client?

I'm feeling a little from column "a" and a little from "d".

Claeaus
Mar 29, 2010
Why do I get

error: ‘ifstream’ was not declared in this scope
error: expected ‘;’ before ‘infile’

with this code:
code:
#include <fstream>

int main(void)
{
    ifstream infile;
    return 0;
}
I'm on Ubuntu if that has something to do with it.

Edit: Fixed it

Claeaus fucked around with this message at 15:04 on Jul 23, 2010

baquerd
Jul 2, 2007

by FactsAreUseless

Claeaus posted:

Why do I get

error: ‘ifstream’ was not declared in this scope
error: expected ‘;’ before ‘infile’

I think it's because ifstream is not fstream.

Claeaus
Mar 29, 2010

baquerd posted:

I think it's because ifstream is not fstream.

ifstream is in fstream.

But you can't forget using namespace std! :downs:

Vanadium
Jan 8, 2005

Just use std:: everywhere, then you do not have to remember to put the using thing elsewhere. :colbert:

POKEMAN SAM
Jul 8, 2004

Vanadium posted:

Just use std:: everywhere, then you do not have to remember to put the using thing elsewhere. :colbert:

Just modify your fstream header and add the using statement there! :awesome:

BigRedDot
Mar 6, 2008

Ugg boots posted:

Just modify your fstream header and add the using statement there! :awesome:

Please don't suggest this within earshot of my coworkers.

darkforce898
Sep 11, 2007

I need to navigate a folder structure that looks like this

code:
level1a
-level2a
--level3aa
---[lots of pictures]
--level3ab
---[lots of pictures]
-level2b
--level3ba
---[lots of pictures]
level1b
etc... basically a bunch of folder with subfolders terminating in pictures. What I want to do is find pictures that are under a certain file size and show them to the user. The user would then decide if they want to keep or delete them.

Right now I am using VBScript and it works pretty much alright.

I can get this to work by opening the image in the default image viewer and then popping up a message box. What I want to do is have the image open up next to the yes/no option. Like this:

code:
--------------------
|                  |
| -----       Yes  |
| |   |            |
| |   |       No   |
| -----            |
--------------------
I have found one way that involves using LoadPicture(path) but this doesn't work in 64bit systems. Is there any way to to do this now?

transient
Apr 7, 2005
Two questions.

The first is basically to be pointed in the right direction for getting a better than basic understanding of html and css. I've been through the W3 stuff but need some more.

Second, because the excel thread requires archives

I'm generating a report from google analytics which requires me to build a data sheet so the eventual report can look nice for the people who read it. The reporting on the adwords campaigns (or really anything else that might come up similar) will change size as different campaigns are added. Is there a way to automatically adjust for new rows in the data table to display in my actual report sheet? As it stands it's no problem if the current table decreases in size, I don't know how to adjust for larger rather than just adding space in my current sheet in case things show up there.

shrughes
Oct 11, 2008

(call/cc call/cc)

transient posted:

The first is basically to be pointed in the right direction for getting a better than basic understanding of html and css. I've been through the W3 stuff but need some more.

You've read http://www.w3.org/TR/html4/ and read http://www.w3.org/TR/CSS2/?

If you've read them already, then make some webpages.

Hughmoris
Apr 21, 2007
Let's go to the abyss!
I am aimlessly trying to teach myself Perl and/or Python, mainly because I'm bored. I have extremely basic knowledge with programming in general. I've decided on a project I can work towards other than a 'number guessing' game.

I want to create a program that will look at a website for upcoming DVD releases, pull the names of the new releases and send them to me in an email. Could somebody point me in the direction to try and achieve something like this? What topics or subjects would cover this type of program? Would it be simpler with perl or python, considering I'd have to teach myself how to do it with either language.

*If what I'm trying to do is way too complicated for a beginner, let me know.

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

Hughmoris posted:

I am aimlessly trying to teach myself Perl and/or Python, mainly because I'm bored. I have extremely basic knowledge with programming in general. I've decided on a project I can work towards other than a 'number guessing' game.

I want to create a program that will look at a website for upcoming DVD releases, pull the names of the new releases and send them to me in an email. Could somebody point me in the direction to try and achieve something like this? What topics or subjects would cover this type of program? Would it be simpler with perl or python, considering I'd have to teach myself how to do it with either language.

*If what I'm trying to do is way too complicated for a beginner, let me know.

WWW::Mechanize
Email::Sender

Shouldn't be too bad at all

Hughmoris
Apr 21, 2007
Let's go to the abyss!

Otto Skorzeny posted:

WWW::Mechanize
Email::Sender

Shouldn't be too bad at all

Thanks for the links. WWW::Mechanize looks intimidating as hell but I think I can handle the Email::Sender. I was just toying with Python and I figured out how to open up the website and write all of its contents to a text file. I'll see if I can use Perl to search the text file for a specific string format like:

[code]
<a href="/dvd/DVmfGsqoQVoWqq"><img src="http://c0181311.cdn.cloudfiles.rackspacecloud.com/DVmfGsqoQVoWqq_2_s.jpg" width="125" height="178" alt="Sutures" title="Sutures" /></a>
[code]

Then print whatever is between the quotation marks following alt=

Hughmoris fucked around with this message at 20:54 on Jul 25, 2010

tripwire
Nov 19, 2004

        ghost flow

Hughmoris posted:

Thanks for the links. WWW::Mechanize looks intimidating as hell but I think I can handle the Email::Sender. I was just toying with Python and I figured out how to open up the website and write all of its contents to a text file. Now, the title of the movie can always be found in the text file in this format:

code:
some stuff
alt="Office Space"
some stuff
Now, I'm assuming I can just write a function that will look for alt=" " and print whatever is between the quotation marks into a new text file. Then repeats itself until the end of the file. Its a rather large text file, having about 4500 lines.

Am I over simplifying this?
What youre talking about sounds fragile.

If you are more comfortable with python, my recommendations are twill and pyquery. Twill itself is just a wrapper around mechanize's functionality and will take care of things like logging into the website, saving cookies if need be, submitting forms and that kind of thing. You can call twill's get_html method and feed the results into pyquery to enable you to manipulate the contents of the page easily. With pyquery, finding the alt text for an image could look like this:
code:
import twill
from pyquery import PyQuery as pq

twill.commands.go('www.somewebsite.com')
document = pq( twill.commands.browser.get_html() )

#the argument to the pyquery object is a css selector.
query_result = document('div a img')
#in this case you can read it as "return any html nodes for an image within an anchor within a div"

if len(query_result) == 1:
    alt_text = query_result.attr.alt

Hughmoris
Apr 21, 2007
Let's go to the abyss!

tripwire posted:

What youre talking about sounds fragile.

If you are more comfortable with python, my recommendations are twill and pyquery. Twill itself is just a wrapper around mechanize's functionality and will take care of things like logging into the website, saving cookies if need be, submitting forms and that kind of thing. You can call twill's get_html method and feed the results into pyquery to enable you to manipulate the contents of the page easily. With pyquery, finding the alt text for an image could look like this:
code:
import twill
from pyquery import PyQuery as pq

twill.commands.go('www.somewebsite.com')
document = pq( twill.commands.browser.get_html() )

#the argument to the pyquery object is a css selector.
query_result = document('div a img')
#in this case you can read it as "return any html nodes for an image within an anchor within a div"

if len(query_result) == 1:
    alt_text = query_result.attr.alt


Thank you for the input and example. I'm really not comfortable with any language. I can manage loops and conditional statements for both at the moment, thats about it. I will definitely look at twill and pyquery though.

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

Hughmoris posted:

Thanks for the links. WWW::Mechanize looks intimidating as hell but I think I can handle the Email::Sender. I was just toying with Python and I figured out how to open up the website and write all of its contents to a text file. I'll see if I can use Perl to search the text file for a specific string format like:

[code]
<a href="/dvd/DVmfGsqoQVoWqq"><img src="http://c0181311.cdn.cloudfiles.rackspacecloud.com/DVmfGsqoQVoWqq_2_s.jpg" width="125" height="178" alt="Sutures" title="Sutures" /></a>
[code]

Then print whatever is between the quotation marks following alt=


WWW::Mechanize is very featureful, which makes it look more complex than it is. If you search on the CPAN search site, you'll find a package full of examples of its use. Additionally, although Perl has the best support for regular expressions and other text-munging facilities of any language in the history of the universe (the standard regex library other languages use is called PCRE, which stands for Perl-compatible regular expressions), you probably want to use an html parser rather than trying to parse HTML with regexes for a whole host of reasons I won't go into here; in my Mechanize projects, I've used HTML::TreeBuilder for this purpose of parsing the html I get.

fizzbin
Dec 13, 2006

gooo
http://pastebin.com/H2jd6dVF

This is driving me insane. I can't for the life of me get ConfigurationManager in C#/.net to work!

If the 'configuration.Sections.Add("Login", loginConfig);' is in there, I get an XamlParseException if either 'loginConfig.SectionInformation.ForceSave = true;' or 'loginConfig.Email = "ffff";' are there.

Right now I'm just trying to save an Email address as a string...

If they're not there but the Sections.Add is the resulting file is:
code:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="Login" type="GoogleVoiceDesktop.MainWindow+LoginConfig, GoogleVoiceDesktop,
            Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" allowLocation="true"
            allowDefinition="Everywhere" allowExeDefinition="MachineToApplication"
            overrideModeDefault="Allow" restartOnExternalChanges="true" requirePermission="true" />
    </configSections>
</configuration>
Which looks Godly wrong.

fizzbin fucked around with this message at 00:50 on Jul 26, 2010

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction
Don't recall the specifics, but it looks like you're going to have to actually define a block with that section name.
code:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="Login" type="GoogleVoiceDesktop.MainWindow+LoginConfig, GoogleVoiceDesktop,
            Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" allowLocation="true"
            allowDefinition="Everywhere" allowExeDefinition="MachineToApplication"
            overrideModeDefault="Allow" restartOnExternalChanges="true" requirePermission="true" />
    </configSections>
    <Login>
        <add key="Email" value="abc@def.com" />
    </Login>
</configuration>
Can't recall how to do that in code off the top of my head, though


E: Err, well maybe that's it, but I see your class is LoginConfig but your section is Login. Maybe that's it? I just cant remember off the top of my head and I don't have access the code I wrote for this stuff right now, sorry :|

Factor Mystic fucked around with this message at 02:29 on Jul 26, 2010

blarzgh
Apr 14, 2009

SNITCHIN' RANDY
Grimey Drawer
This may be a stupid question... no wait, it is in fact a stupid question:

Why, when streaming a video, does it not always buffer the video far enough in advance? I assume that translated from layman's terms "buffering" means "giving the information enough space between the download and the length of the video so as to avoid playback interruptions; so why is playback ever interrupted? I ask only because I'm waiting for a GIANT GAY PO - because I'm sure the answer is interesting. Interest me.

fizzbin
Dec 13, 2006

gooo

blarzgh posted:

This may be a stupid question... no wait, it is in fact a stupid question:

Why, when streaming a video, does it not always buffer the video far enough in advance? I assume that translated from layman's terms "buffering" means "giving the information enough space between the download and the length of the video so as to avoid playback interruptions; so why is playback ever interrupted? I ask only because I'm waiting for a GIANT GAY PO - because I'm sure the answer is interesting. Interest me.

Same reason why droughts occur, the supply rate is dynamic so it's impossible to exactly predict the amount required to buffer to create seemless playback through out the length of the video.

Though I'm honestly not sure if they do sometype of downloadrate based buffer size.

MrMoo
Sep 14, 2000

From a scalability point of view you want the servers to be rate limited so they have enough headroom for latency of the majority of the client base but not too much to cause too much server resource overhead that eats into the maximum number of simultaneous clients.

It's an interesting CS/engineering issue that causes basic HTTP delivery to win out in real terms as it is always cheaper to deliver TCP offloaded HTTP streams than dynamic RTSP streams.

Too Poetic
Nov 28, 2008

This might be more of a math question but it's beyond me. I'm not even sure if it's possible.

Basically I'm trying to find a solution to a combination.

Like let's say theres an item that raises the value of another item when used in several different categories but not all of them. There are several items and I'm trying to figure out in what quantity and which combination they would need to be used to reach a certain final value.

Like

Base 0, 0, 0, 0
Item 1 5, 0, 5, 0
Item 2 0, 5, 5, 0

and I'd be trying to get a final value of something like
10, 5, 15, 0

I hope that's clear enough. If someone could even point me in the right direction I'd be quite grateful.

Adbot
ADBOT LOVES YOU

HFX
Nov 29, 2004

MrMoo posted:

From a scalability point of view you want the servers to be rate limited so they have enough headroom for latency of the majority of the client base but not too much to cause too much server resource overhead that eats into the maximum number of simultaneous clients.

It's an interesting CS/engineering issue that causes basic HTTP delivery to win out in real terms as it is always cheaper to deliver TCP offloaded HTTP streams than dynamic RTSP streams.


What are you talking about?

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