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
Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog

Orzo posted:

This is a start, but what happens when there's a number of jumbled updates all in one session? Maybe I forgot to specify in the original problem that a save consists of a potential total reordering of a list, not necessarily just moving one item.

I had assumed that your UI had users perform re-ordering one element at a time (like some sort of drag-and-drop).

Adbot
ADBOT LOVES YOU

baquerd
Jul 2, 2007

by FactsAreUseless

Orzo posted:

This is a start, but what happens when there's a number of jumbled updates all in one session? Maybe I forgot to specify in the original problem that a save consists of a potential total reordering of a list, not necessarily just moving one item.

with only 3 updates--move H and K to low numbers and stick J between the values of D and E. It's easy to see that because it's such a small list, but could you write the algorithm?

Correct. The database has a column called 'Stack Rank.' In code, it's just a List<T> (C#).

So you have a List with associated rankings, and the user re-orders it. You're talking about updates affecting multiple tasks at once, so this is not real time. When the user is done, they will submit their changes which take place atomically. At that point, you have an ordered List that can be re-ranked arbitrarily, but you want to minimize the number of ranking changes. You have an SQL double to use for ranking.

Smugdog Millionaire posted:

Why not just set the rank to halfway between the adjacent elements, and if you add to the front/back of the list set it to the nearest integer outside the range?
Doubles have a 52-bit fraction, which can handle quite a number of halvings.

The problem is not what will happen today or tomorrow, but what will happen next year when you start having precision rounding problems after some jackass put a task between two others 54 times over the year?

You could certainly do that, and have a lower bound tolerance that forces a full database re-ranking or have a maintenance task that re-ranks them every week or so, but it's still unstable.

You're not going to be able to get a perfect solution here, where each ranking change only affects at most one task, and have it stable forever.

Edit:
What you could do it have an acceptable tolerance of something like 2^16 precision before re-ranking more elements. So that if a re-ordering change would require a rank value requiring greater precision than 2^16, you re-position the surrounding tasks until an upper bound is reached of something like 2^8 required precision for each task.

baquerd fucked around with this message at 21:02 on Oct 17, 2011

floWenoL
Oct 23, 2002

baquerd posted:

The problem is not what will happen today or tomorrow, but what will happen next year when you start having precision rounding problems after some jackass put a task between two others 54 times over the year?

You could certainly do that, and have a lower bound tolerance that forces a full database re-ranking or have a maintenance task that re-ranks them every week or so, but it's still unstable.

You're not going to be able to get a perfect solution here, where each ranking change only affects at most one task, and have it stable forever.

Instead of doubles, you can use strings with lexicographic order and treat them as, say, base-26 numbers between 0 and 1. (e.g., 'abbcz' would map to .0,1,1,2,26)

baquerd
Jul 2, 2007

by FactsAreUseless

floWenoL posted:

Instead of doubles, you can use strings with lexicographic order and treat them as, say, base-26 numbers between 0 and 1. (e.g., 'abbcz' would map to .0,1,1,2,26)

What does "abbcz" represent (is is legal to have more than one rank per task?) and how do you translate that into the required database double rank value for task a, b, c, and z that minimizes rank movement for arbitrary re-ordering?

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!

baquerd posted:

So you have a List with associated rankings, and the user re-orders it. You're talking about updates affecting multiple tasks at once, so this is not real time. When the user is done, they will submit their changes which take place atomically. At that point, you have an ordered List that can be re-ranked arbitrarily, but you want to minimize the number of ranking changes. You have an SQL double to use for ranking.
Yes, I believe this is all correct. It's actually Team Foundation Server, which does use SQL under the hood, but there's an abstraction layer.

quote:

The problem is not what will happen today or tomorrow, but what will happen next year when you start having precision rounding problems after some jackass put a task between two others 54 times over the year?

You could certainly do that, and have a lower bound tolerance that forces a full database re-ranking or have a maintenance task that re-ranks them every week or so, but it's still unstable.
Edit:
What you could do it have an acceptable tolerance of something like 2^16 precision before re-ranking more elements. So that if a re-ordering change would require a rank value requiring greater precision than 2^16, you re-position the surrounding tasks until an upper bound is reached of something like 2^8 required precision for each task.
We had actually already talked about a similar solution, where if the system detects some threshold has been reached it just does a full re-ordering. You can probably get more efficient than that, like you suggested, but it's barely worth the complexity since it would happen so rarely.

baquerd
Jul 2, 2007

by FactsAreUseless

Orzo posted:

We had actually already talked about a similar solution, where if the system detects some threshold has been reached it just does a full re-ordering. You can probably get more efficient than that, like you suggested, but it's barely worth the complexity since it would happen so rarely.

As a practical solution, you might consider both a maintenance task to reorder the tasks that will all but eliminate real-time list re-ordering, and the threshold. Be sure to consider the case of someone reordering enough elements in a single reordering that would overflow your precision.

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
So, after some thought, here's the algorithm I'm leaning towards, I'm not sure if it covers all cases or is maximally efficient, but it seems like a good start...

Given the original list and the new list, start by finding the longest common uninterrupted sequence. For example, let's say we start with

ABCDEFGHIJKLMNOP

and it's reordered to

ABJCDEFGPHIKMNOL.

Take the longest sequence, CDEFG, and mark that section as 'complete.' We're not going to update any of those items.

We're left with:
ABJ on the left
PHIKMNOL on the right.

Now, take the left side and find the longest sequence that is (a) in the original string and (b) had an original rank less than the rank of the leftmost element of the 'divider' CDEFG, which is 'C'. If none exists, we'll have to re-rank every element.

In this case, the answer is 'AB'. On the right side, the answer is 'MNO'.

Recurse, performing a similar 'split'. On the left side, we split to <empty> and J. since J is 'bad' (it was originally to the right of CDEFG) we need to re-rank it, and simply put it between the values of B and C.

On the right side, we get PHIK and L, etc.

How does this sound? I think this might be a good solution, possibly even optimal, although I haven't really analyzed how long it takes. I don't think it's that long.

csammis
Aug 26, 2003

Mental Institution
In the schema where I work whenever we have ordered lists of items we use a cross table to hold sequence information for items in lists:

code:
ITEMLIST
--------------
LIST_ID  PK
LIST_NAME

ITEM
--------------
ITEM_ID   PK
ITEM_NAME
ITEM_VALUE
ITEM_WHATEVER

ITEM_SEQ
--------------
LIST_ID \
         PK
ITEM_ID /
SEQ_NUM
We simply blow away the ordering and re-write rather than do an update on each data row (which may be under contention for other queries on item values) or rely on jacked-up ordering schemes. Is there any way you can separate the Stack Rank?

Also if you haven't yet you might want to consult the database thread


e: I just now saw that you don't have control over the DB format. Goondolences :(

floWenoL
Oct 23, 2002

baquerd posted:

What does "abbcz" represent (is is legal to have more than one rank per task?) and how do you translate that into the required database double rank value for task a, b, c, and z that minimizes rank movement for arbitrary re-ordering?

"abbcz" represents the number (0/26 + 1/26^2 + 1/^26^3 + 2/^26^4 + 25/26^5). There's no double rank; the rank is stored as a string. For every two distinct string ranks, there's always a string rank in between them, so you never need to 're-rank'.

The only downside is that the ranks may grow to arbitrary sizes. But with careful management you can mitigate this for all but the most pathological cases.

Edit:
Eh, I guess I didn't read the original question closely enough. If he's stuck with using doubles, then there's not much you can do.

floWenoL fucked around with this message at 03:12 on Oct 18, 2011

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!

floWenoL posted:

"abbcz" represents the number (0/26 + 1/26^2 + 1/^26^3 + 2/^26^4 + 25/26^5). There's no double rank; the rank is stored as a string. For every two distinct string ranks, there's always a string rank in between them, so you never need to 're-rank'.

The only downside is that the ranks may grow to arbitrary sizes. But with careful management you can mitigate this for all but the most pathological cases.

Edit:
Eh, I guess I didn't read the original question closely enough. If he's stuck with using doubles, then there's not much you can do.
As stated, the eventual degradation of double is not important, as it's acceptable for us to run a cleanup job periodically, or even check every update if the entire list needs to be reordered from 1 to n.

What I am looking for here is the raw algorithm where the minimum number of items need saving, not necessarily the format in which the field is saved.

also check your PMs

tef
May 30, 2004

-> some l-system crap ->

Golbez posted:

Is there any resource or book to help me learn coding project organization? Lately, my projects involve looking at the scope of work and starting to code. Not diagramming what functions and classes are needed, just diving in and cleaning up as I go along. I don't think this is terribly sustainable, so I want to learn how to design a project before I start coding. Every time I try, I just end up muddled and start coding anyway.

   The trick to designing software up-front is to understand your problem before you start writing code. If you don’t understand your problem, you might have to write some code first to explore your ideas.

   There is an old adage, ”Everything should be built top-down, except the first time”. Re-writing code as you understand the problem is inevitable, but the experience of solving similar problems will make the task less Sisyphean.

   The standard advice of ‘use source control’ and ‘write some tests’ apply here too, both of these are had to live without when re-writing code. I’d also like to recommend the books:
      “The Practice of Programming” — Kernighan and Pike
      “The Unix Philosophy” — Gancarz (There is a 2nd edition entitled “Linux and the Unix Philosophy”)

note—There is a similarly named book by one ‘Eric S. Raymond’, avoid it.

   I tend to write a very small amount of code to solve a problem, because I know I’ll revisit it later and have to add new things. Instead of planning your code up-front, you should be worried about how you’re going to change it later. Avoid repeating constants in your code, pass in dependencies, try to keep the components of your program loosely coupled.


Golbez posted:

It works, but after multiple rewrites because I discovered I was doing the whole thing wrong. Since I don't have any documentation written up of how I want it to be, I'm going through haphazardly, possibly duplicating efforts and having to rewrite things when I realize that, logically, the idea I had in my head won't work.

No one plans before putting pen to bytes? :v:


   Programming at heart is a discipline of thought. With a little experience, you can spend a little more time thinking about your problem and how your solution works, iterating the ideas in your head or on paper, and less time iterating in front of a command line. Sometimes it is easier to hash things out in code though.

   Finally I would strongly advocate you spend some time reading other peoples code and trying to understand the design behind it. Although writing code may be more satisfying, you will learn design from the good and bad examples you find in other peoples code. That and if you are programming professionally, much time is spent working what the gently caress your co-workers have been up to—a useful skill to have.

tef
May 30, 2004

-> some l-system crap ->

qntm posted:

So, I'm reading about how left-recursion is a show-stopper for recursive descent parsers. And apparently there are various ways around this: use a different kind of parser which likes left-recursion, and rewriting the existing parser to limit depth or something using some advanced algorithm.

Left recursion represents an infinite loop in a top down parser, they can be expanded infinitely without consuming input. So you must remove left recursion from your grammar, or cap the depth of the expansion, or use something that isn’t a pure top down parser.

quote:

It's also possible to rewrite the grammar to a weakly equivalent grammar which isn't left-recursive. This has a problem though because it results in different parse trees with the wrong associativity.Can't you just modify the parse tree back to what it should be using the same rewrite rules in reverse?

Yes, and many people do such a thing, along with other parse-tree cleanup. Some people abandon associativity instead.

http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm outlines most of the techniques for incorporating precedence and associativity within recursive descent. My favourite is ‘Precedence Climbing’, a type of Left Corner Parsing.

I could go on about left corner parsing all day, but roughly it is a form of top down/bottom up parsing. Left recursive rules are ignored in parsing until a suitable non-terminal is recognised. It is actually quite easy to implement and rears its head in a number of places. It is the same technique in Pratt Parsing, as well as the method used in Packrat parsers to handle left recursion.

(note: introducing left recursion can make grammars ambiguous without precedence and associativity)

tef
May 30, 2004

-> some l-system crap ->

Orzo posted:

So, after some thought, here's the algorithm I'm leaning towards, I'm not sure if it covers all cases or is maximally efficient, but it seems like a good start...

How does this sound? I think this might be a good solution, possibly even optimal, although I haven't really analyzed how long it takes. I don't think it's that long.

this sounds like adaptive merge sort (ala timsort). If you split your input into ascending and descending runs. This has some nice run time properties.

Modern Pragmatist
Aug 20, 2008
So I'm having trouble wrapping my mind around the best way to approach this problem. I have a Contour class that basically contains control points and a spline. I have written a basic Level Set algorithm (evolves the contour). Ideally I would like to be able to have this algorithm operate on both Contour objects and just plain x,y coordinates:

code:
con = Contour(x,y)
newcon = LevelSet(con)
or
code:
xx,yy = LevelSet(x,y)
I can think of the following ways to accomplish this:

1) Write LevelSet to be a standalone function that requires x and y inputs and then write a LevelSet method for the Contour class that basically calls it and then manipulates the output to yield the new Contour object

2) Write a LevelSet class that accepts either a Contour object or x,y coordinates as input and returns the correct output based on the input type

Is there any particular advantage to one way over the other?

Additionally, I don't want to crowd my Contour class with a million different contour evolution techniques. It would be nice to have an abstract ContourEvolution class that i could subclass for LevelSet, OpticalFlow, etc. that could take a Contour as input. Does this seem like a reasonable design goal?

I just want to make sure that my algorithms are accessible in their raw form as well (calling them without creating a Contour object).

Sorry if this question was kind of rambling. I can clarify if necessary.

TasteMyHouse
Dec 21, 2006
Any chance anyone is experienced with utilizing the DSP core on the beagleboard xM?

Tres Burritos
Sep 3, 2009

So I was thinking about making a switchover back to ubuntu when I realized that I have no idea how to display visual elements in linux. At all. All I've ever done for programming in linux is some command line stuff / shell scripting. All of my graphical / display knowledge comes from Visual Studio, XAML, and android XML layouts. Where do I even begin to research? What do people recommend?

TasteMyHouse
Dec 21, 2006
GUI Stuff: Qt, FLTK, WxWidgets
Graphics in general: SFML, SDL, OpenGL, etc.

abelwingnut
Dec 23, 2002


General programming question:

MVC is simply a programming philosophy wherein there are three defined aspects, model, view, and controller, and they are kept as separate entities but interact to one another in defined ways.

So let's use the forums as an example. I am typing this post on a page from the view who got information from the model who got information from the database. When I click 'Submit Reply' this body of text will be fed to a controller. The controller then feeds this text to the model who then sends this information to a database. The database sends a confirmation to the model who then sends an alert to the view and the view churns out a new page based on my submitted text.

Is that the general idea?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
I think you mostly get it. View is the HTML, controller is the PHP, model is the data(base). Where you're likely off course is the end of your story: it's the controller's job to update the view with new data from the model. The view and the model never talk directly to one another.

abelwingnut
Dec 23, 2002


pokeyman posted:

I think you mostly get it. View is the HTML, controller is the PHP, model is the data(base). Where you're likely off course is the end of your story: it's the controller's job to update the view with new data from the model. The view and the model never talk directly to one another.

Ok. So the database sends a confirmation to the model who then sends a confirmation to the controller. The controller interprets this confirmation and sends its interpretation to the view.

I guess I'm confused because of the Wikipedia diagram seen here:



Given what you're saying shouldn't it be more like:

CLIENT <---> VIEW <---> CONTROLLER <---> MODEL ? I'm not sure why the view is separated from the client in Wikipedia's diagram, I guess. They seem one in the same.

Opinion Haver
Apr 9, 2007

My understanding is that the view is the part of the PHP scripts on the server that output HTML, whereas the client is the web browser that renders that HTML, submit HTTP requests, etc.

ToxicFrog
Apr 26, 2008


Tres Burritos posted:

So I was thinking about making a switchover back to ubuntu when I realized that I have no idea how to display visual elements in linux. At all. All I've ever done for programming in linux is some command line stuff / shell scripting. All of my graphical / display knowledge comes from Visual Studio, XAML, and android XML layouts. Where do I even begin to research? What do people recommend?

For medium-and-larger GUI stuff you probably want to look into Qt or GTK+; both are widely used, mature, cross-platform GUI libraries with design tools (because gently caress trying to do all of your layout in code). Qt is the preferred toolkit for KDE apps, and GTK+ for GNOME apps, but in practice you can use either. Both also support OSX and Windows (although GTK+'s OSX support was kind of poo poo last I checked), so if you're planning to release for more than just linux, this is helpful.

For small stuff you can still use those, but if you're just making a really minimal (eg, two text boxes and a button) GUI, you might find it faster to use whatever your language's "default" toolkit is - iup for lua, tkinter (I think?) for python, etc.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Abel Wingnut posted:

CLIENT <---> VIEW <---> CONTROLLER <---> MODEL ? I'm not sure why the view is separated from the client in Wikipedia's diagram, I guess. They seem one in the same.

Like yaoi prophet said, the client is the web browser sending HTTP requests. In that sense, the client is indeed interacting with the controller when sending a request.

What I had in mind was more like a desktop window system, where the windows are views, and you have some model for data and a controller to bridge the two. In that case, the client doesn't interact directly with the controller code, and goes through the view instead.

On the web, it doesn't quite work like that.

MononcQc
May 29, 2007

I much prefer the MVP (Model-View-Presenter) approach. The big difference is visible there:

In concept, MVC allows this kind of communication:


I don't know why the view should ever gain a direct access to the model, but the MVP approach basically serializes MVC so the View can't directly access the models:

wiki posted:

  • The model is an interface defining the data to be displayed or otherwise acted upon in the user interface.
  • The view is an interface that displays data (the model) and routes user commands (events) to the presenter to act upon that data.
  • The presenter acts upon the model and the view. It retrieves data from repositories (the model), persists it, and formats it for display in the view.

so:
code:
               Client
                 |
 MODEL <---- PRESENTER -----> VIEW
I generally don't like the MVC step where:

wiki posted:

A view queries the model in order to generate an appropriate user interface (for example the view lists the shopping cart's contents). The view gets its own data from the model. In some implementations, the controller may issue a general instruction to the view to render itself. In others, the view is automatically notified by the model of changes in state (Observer) that require a screen update.

And so MVP makes much more sense in my opinion given I think separating models from how they should be presented makes sense, and the presenter/controller should be in charge of fetching whatever is needed from the model.


----
EDIT:
MVC or MVP cannot be seen as the browser or the database directly. It's all taking place on the server.

The client will be the browser making HTTP requests or Websocket requests or whatever you want. The Controller/presenter will be that bit of PHP/Python/Ruby/Whatever that reacts to queries, tells you what view to make load itself with given resources (in MVC) or what Model to fetch and format to fit within a given view (MVP).

The View itself will be templates you'll have prepared before-hand in MVP, and maybe any dynamic script that can access either some of the data put in place by the controller or directly call the models in the MVC approach.

The models will be any interface to allow to find wherever your data is. This usually means a module or class that wraps operations like SQL queries, opening files or even RPC calls.

Again, MVC/MVP are ideally a software thing to let you abstract away things like the browser or storage. You cannot directly call the database the model and go on your merry way, it would be a bit of a loss for the abstraction there.

MononcQc fucked around with this message at 13:09 on Oct 20, 2011

mister_gosh
May 24, 2002

Not sure which thread this belongs in, crossposting this from web design thread:

I have an application which works best and installs cleanly on Jetty, however I've heard that enterprise ready applications should be on Tomcat and that Jetty is meant for development only.

Is this true or did I hear misinformation? I'm trying to google articles on it but not coming up with much to back it up one way or the other.

The application is a queue broker (apache activemq) and is the only thing the servlet container would be needed for on this server. It is, however, a very important service it is providing.

Orbis Tertius
Feb 13, 2007

I'm working on a desktop-esque UI for an intranet site (something like this, though I'm not using ExtJS). The end-users are not computer savvy, as a group, and I was instructed to spend some time making the UI feel 'familiar' to windows or OS X, if I could.

For alot of the mouse input events I'm using a high fidelity timer thing (based off the Mootool's animation Fx base class), to detect stuff like spazzy users moving the cursor really fast over elements that have mouseover behaviors, to distinguish between single clicks to style an icon 'active' vs double clicks that do some UI action, etc.

Anyways, I realized I've spent maybe the last hour and half or so tweaking millisecond intervals to make the double-click-open-window action 'feel' right. Yeah, I'm that guy. Does anyone know where I would find, say, Windows 7 default delays for that sort of stuff? My googling turned up alot of 'how to tweak window' sites, I guess I was hoping to find some repository of UI minutiae. Alternately, anyone know where in the registry I would look to find that sort of stuff?

tef
May 30, 2004

-> some l-system crap ->
The only thing that comes to mind is this http://www.chrisharrison.net/index.php/Research/ProgressBars

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!
I haven't ever done any sort of Javascript UI programing, but wouldn't you just want to watch for a double-click event and thus let the OS that the users are "used to" handle the timing?

Orbis Tertius
Feb 13, 2007

Jethro posted:

I haven't ever done any sort of Javascript UI programing, but wouldn't you just want to watch for a double-click event and thus let the OS that the users are "used to" handle the timing?

I rely on the onClick and onDblClick events for most of the clickable, icon-like UI elements - but, the icons I'm working on now have a separate events for mouseover, single click event, and double click as well as being draggable/sortable (which comprises a slew of input events).

Rather than have separate onMousedown+onMouseup+onClick+onDblclick+onMousemove events, and juggling a bunch of boolean values to determine an icon's behavioral 'state' on the firing of each attached event in isolation, I decided to use less events while using sets of short-duration, high-frequency timers with callback functions to determine the state changes and micromanage the UI behavior.

For example, instead of having separate single and double click events I just have one click event and keep track of the number of clicks - if two occur with a given time interval, it's a double click. the double click time window closes after a certain point, but at a longer interval a new single click event will occur (un-styling the element, as caused by the initial single click event). Alongside those is a repeating timer that checks to see if the 'drag' ui behavior needs to start, and when it does I just clear the intervals on the other timers to turn off that other behavior, and turn it all back on by restarting the timers when needed. It feels more elegant than using variables to track the state, maybe that's just me. There's certainly less code and it's more organized, but my problem now is I have to decide all these intervals (milliseconds) for all the different timers.

These aren't mission critical decisions by any means, but it's the sort of thing I can see myself blowing an afternoon on, and if I could just plug in some values from somewhere I'd be happy.

tef posted:

The only thing that comes to mind is this http://www.chrisharrison.net/index.php/Research/ProgressBars

That's very interesting and right up my alley, thank you. Because my timer thing is extended from Mootools Fx class, I can have my timer intervals make use of easing transitions...but that's kind of going down the rabbit hole.

update -

MSDN comes through with this excellent article on mouse/pointers and UI design, and from that I found docs for the 'SetDoubleClickTime' function, which states that the default interval within which two mouse clicks register as a double-click is *drumroll* 500ms.

Orbis Tertius fucked around with this message at 19:42 on Oct 21, 2011

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
efb

I'm not sure I see the advantage of doing it the way you're doing instead of events.

OneEightHundred fucked around with this message at 20:35 on Oct 21, 2011

pseudorandom name
May 6, 2007

There's the clear disadvantage that you've broken accessibility.

Senator Woofington
Aug 1, 2009

by Ozmaugh
This is probably a really stupid question but I wanted to get started again working with php, mysql, html etc etc. Basically I want to write a website that features hosting predominately. Its mostly a project for myself. Anyway what utilities or development environments would you guys recommend for such a project? I am running windows 7 64-bit. Thanks in advance!

shrughes
Oct 11, 2008

(call/cc call/cc)

Senator Woofington posted:

This is probably a really stupid question but I wanted to get started again working with php, mysql, html etc etc. Basically I want to write a website that features hosting predominately. Its mostly a project for myself. Anyway what utilities or development environments would you guys recommend for such a project? I am running windows 7 64-bit. Thanks in advance!

Get VirtualBox and install Ubuntu (64-bit version), get the requisite packages.

Don't use PHP.

Ziir
Nov 20, 2004

by Ozmaugh
I'm looking for something (free) that can read a Fortran file and then generate a nice and colorful flowchart based on function and subroutine calls and so on. Surely this must exist?

Shaocaholica
Oct 29, 2002

Fig. 5E
Does anyone know how I can something similar to this but instead of a single sequential process, spawn multiple processes/threads?

code:
#! /usr/local/bin/tcsh -fb

foreach some_file ( `find . -type f -name \*.poo` )
    echo $some_file
    convert $some_file $some_file:r.pee
end
Doesn't have to be tcsh.

nielsm
Jun 1, 2009



Shaocaholica posted:

Does anyone know how I can something similar to this but instead of a single sequential process, spawn multiple processes/threads?

Parallel make?
Write a rule for the conversion you want and then make a target that depends on the outputs you want. Somehow.

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

Shaocaholica posted:

Does anyone know how I can something similar to this but instead of a single sequential process, spawn multiple processes/threads?

code:
#! /usr/local/bin/tcsh -fb

foreach some_file ( `find . -type f -name \*.poo` )
    echo $some_file
    convert $some_file $some_file:r.pee
end
Doesn't have to be tcsh.

code:
#! /usr/bin/env perl

for (split '\n', `find . -type f -name \*.poo`){
    if (fork) {
        print "$_\n";
        system("convert $_ $_:r.pee");
    }
}
Or something to that effect. If you're a python guy, forking is almost as easy, but i think you might have to import os.fork or sth

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
code:
#!/bin/sh

forked=0
for f in `find tools -type f -name \*.h`; do
   if ((forked > 5)); then wait; forked=0; fi
   (sleep 3 && echo $f) &
   let ++forked
done
wait
The rate-limiting is not strictly necessary but probably a good idea.

defmacro
Sep 27, 2005
cacio e ping pong

Shaocaholica posted:

Does anyone know how I can something similar to this but instead of a single sequential process, spawn multiple processes/threads?

code:
#! /usr/local/bin/tcsh -fb

foreach some_file ( `find . -type f -name \*.poo` )
    echo $some_file
    convert $some_file $some_file:r.pee
end
Doesn't have to be tcsh.

If you'd rather stick to the shell, give parallel a try.

defmacro fucked around with this message at 22:23 on Oct 25, 2011

Adbot
ADBOT LOVES YOU

ToxicFrog
Apr 26, 2008


Shaocaholica posted:

Does anyone know how I can something similar to this but instead of a single sequential process, spawn multiple processes/threads?

code:
#! /usr/local/bin/tcsh -fb

foreach some_file ( `find . -type f -name \*.poo` )
    echo $some_file
    convert $some_file $some_file:r.pee
end
Doesn't have to be tcsh.

Bash version:

code:
#!/bin/bash

find . -type -f -name '*.poo' | while read file; do
    echo "$file"
    # guessing here what $some_file:r.pee does in tcsh
    convert "$file" "${file/.poo/.pee}" &
done
Unlike rjmccall's version, this one doesn't rate-limit, but it does handle filenames with whitespace correctly.

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