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
5436
Jul 11, 2003

by astral

ErIog posted:

I think you might be overthinking what you want to do. Open your bookmarks from the sidebar. You can drag any link on a page over to the sidebar, and it will become a bookmark. With some minor organization this solution will give you 80% of what you want.

Uhhh how am I going to do that when I'm on my phone and out? Also how will I know who sent what? That would also require a lot of bookmark management.

Adbot
ADBOT LOVES YOU

ErIog
Jul 11, 2001

:nsacloud:

5436 posted:

Uhhh how am I going to do that when I'm on my phone and out? Also how will I know who sent what? That would also require a lot of bookmark management.

I apologize for not thinking about your phone when you never mentioned it, and only talked about a Firefox extension.

5436
Jul 11, 2003

by astral

ErIog posted:

I apologize for not thinking about your phone when you never mentioned it, and only talked about a Firefox extension.

My bad, but I was thinking it would work by just parsing chat logs so when you open your browser it would grab links from when you use your phone or other peoples computers. I mean it would be ideal if google just implemented it. The idea of manually grabbing links from chat boxes seems outdated in todays internet, especially when you can log all your gchats.

Dijkstracula
Mar 18, 2003

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

So either I'm not using Valgrind correctly or I have a serious misunderstanding of how it handles basic blocks.

I'm writing a Valgrind plugin and so just to get my feet wet I'm throwing Lackey, the example tool, at a trivial C program (empty main() ). However, it's giving me very bizzare values for a program that literally has four instructions, (push, mov, pop, ret):

ntaylor@ntaylor-loonix:~/code/loopy/tests$ ../valgrind-3.5.0/vg-in-place --tool=lackey --trace-superblocks=yes --log-fd=1 ./sequential | sort | uniq -c | sort -nr | head
1249 SB 0400a3dc
1249 SB 0400a3d0
1105 SB 0401605c
1036 SB 04016050
587 SB 04008f30
319 SB 0401669b
282 SB 04008c78
282 SB 04008c52
282 SB 04008c44
282 SB 04008c37


Since there are no jmps in this program, there should only be one basic block, and that should only ever get executed once, so where the hell are these things coming from? :smith:

MrMoo
Sep 14, 2000

Dijkstracula posted:

Since there are no jmps in this program, there should only be one basic block, and that should only ever get executed once, so where the hell are these things coming from? :smith:

I would presume a tonne of hooks for glibc.

pseudorandom name
May 6, 2007

Dijkstracula posted:

Since there are no jmps in this program, there should only be one basic block, and that should only ever get executed once, so where the hell are these things coming from? :smith:

You probably know more about valgrind than me at this point because you're the one writing the plugin, but perhaps valgrind's decompiler/recompiler generates a bunch of extra basic blocks?

Cooter Brown
Sep 24, 2004

I'm trying to pick a scripting language thats right for me. I just need something I can pick up quickly, works with windows, and has the ability to:
  • Read\Parse files easily
  • Create files
  • Won't let me accidentally corrupt files
  • Good methods for using command line utilities (I have to use lots of lovely batch files at work and I want to extend their functionality)

Some 'nice to haves' are
  • Ability to connect to MS SQL Server 2005
  • Loosely typed
  • Doesn't need to be compiled
  • Framework can be installed on a machine with a single file (Although I'd suck a dick for something that could be run as a standalone executable type of thing. It would be nice to send scripts to clients without having to ask them to install something else first)
  • Windows registry access

Currently, I'm leaning towards Python but I'm sure there are others out there I should check out. My coding background is a little .net, lots of javascript with a raging boner for jQuery.

Cooter Brown fucked around with this message at 06:54 on Mar 10, 2010

hlfrk414
Dec 31, 2008
  • Read\Parse files easily
  • Create files
  • Won't let me accidentally corrupt files (?)
  • Good methods for using command line utilities (I have to use lots of lovely batch files at work and I want to extend their functionality)

Some 'nice to haves' are

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Is there a term for games that scale with hardware? A lot of old games look dated when played on newer hardware. Is there some sort of technique that helps prevent against this so that visually, a game is always as stunning as can be?

ErIog
Jul 11, 2001

:nsacloud:

Triple Tech posted:

Is there a term for games that scale with hardware? A lot of old games look dated when played on newer hardware. Is there some sort of technique that helps prevent against this so that visually, a game is always as stunning as can be?

The only real way to future-proof the look of a game is to use a style that ages well. Notice, SNES-era games aged a lot better than games from the PSX/N64 era. Blizzard is the best example of this in the modern era. The art styles for their polygonal games all are done in a way that makes them look good, but doesn't really make you wince when you go back to them 5 years later as much as a game like Half-Life 1 does.

The closest thing to what you're talking about, that is currently in widespread use, is called Level of Detail. It's a concept for lowering the amount of detail for objects that are further away from the player in order to prioritize the rendering of objects close to the player. It's just a concept, though. There are a million different ways to implement LoD in a game engine.

Polygonal detail increases have kind of hit a wall because of the amount of time and money it takes to create very high complexity 3d models. It's become a lot more about shaders and high-res textures to sell the look of a game. That's why most of the recent leaps forward in terms of video card technology have been about increasing the number of shader processors to get more and more complex shaders going at once.

That's why a game like Crysis scales as well as it does. The geometry isn't extremely highly detailed. So if you turn off most of the shaders, use low-res versions of the textures, and use the low-complexity LoD versions of polygonal models Crysis would be able to run on drat near any "modern" computer. It would look like poo poo, but it would run. There was a mod for Doom 3 back in the day that did all of these things, and it was able to get Doom 3 running on Voodoo2 era hardware.

http://www.firingsquad.com/media/gallery_index.asp/244

Recently, video card manufacturers have been experimenting with hardware tesselation where the video card will automatically fill out objects with more polygons in order to give the appearance of more detail. It will never be retroactive, though. It will always require the game developers to specify how that tesselation should happen otherwise the video card has no way of knowing exactly what type of detail it should be filling in.

The second prong to this is texture resolution. Higher resolution textures always look better at higher resolutions, but the same problems apply to textures as do photos from a digital camera. If you take a picture with a 1MP camera, there's no automatically add detail to make it look like it came from a 12MP camera. The only fix for this I've ever seen has to do with procedurally generating textures, and that's really only ever been done in the demo scene in order to save space.

Here's a link to a demo that uses this technique: http://www.theprodukkt.com/kkrieger Note, the size of one of the screenshots of the game is about a third the size of the entire game.

If a game developer really wanted to, they could over-engineer their game to future-proof it pretty well. The reason game developers don't is because the size of the game data would have to be a lot larger to accomodate this, and it would take them time to put in all the detail that is going to be required for a game 10 years down the road. Game developers want their game to sell this year, next year, or 2 years down the road. It doesn't make sense to devote a ton of resources to something gamers aren't going to be able to experience for a bunch more years than that. Both Crysis and Doom 3 kind of did this. They had Super-Ultra-Mega-High graphical settings that were, by design, impossible to play on the current generation of hardware circa when those games launched.

ErIog fucked around with this message at 22:59 on Mar 10, 2010

jupo
Jun 12, 2007

Time flies like an arrow, fruit flies like a banana.

Cooter Brown posted:

I'm trying to pick a scripting language thats right for me. I just need something I can pick up quickly, works with windows, and has the ability to:
  • Read\Parse files easily
  • Create files
  • Won't let me accidentally corrupt files
  • Good methods for using command line utilities (I have to use lots of lovely batch files at work and I want to extend their functionality)

Some 'nice to haves' are
  • Ability to connect to MS SQL Server 2005
  • Loosely typed
  • Doesn't need to be compiled
  • Framework can be installed on a machine with a single file (Although I'd suck a dick for something that could be run as a standalone executable type of thing. It would be nice to send scripts to clients without having to ask them to install something else first)
  • Windows registry access

Currently, I'm leaning towards Python but I'm sure there are others out there I should check out. My coding background is a little .net, lots of javascript with a raging boner for jQuery.

Since you say you've done lots of Javascript you should know that back in the day you could use JScript (Microsoft's version of Javascript) via Windows Scripting Host. I doubt Microsoft broke this after XP but XP was the last Windows OS I used so I can only assume it still works. It has access to COM so you can connect to dabatases via ADO and access the registry as well.

Having said all that, while this would be the path of least resistance for you, you should definitely keep leaning towards Python.

Cooter Brown
Sep 24, 2004

hlfrk414 posted:

jupo posted:


Thanks, I will give JScript a try since I need to get some things out the door quickly but python will definitely be my long term weapon of choice.

hey mom its 420
May 12, 2007

I'm just learning prolog, so say you have:
code:
beat(ali, frazier).
beat(ali, foreman).
beat(ali, liston).
beat(frazier, ali).
beat(foreman, frazier).
how do get prolog to tell you, say, how many people Ali has beaten?

tef
May 30, 2004

-> some l-system crap ->
findall/bagof/setof

http://www.swi-prolog.org/pldoc/man?predicate=findall/3

findall(P, beat(ali, P), L) where L is the list of people ali beat.

ufarn
May 30, 2009
I want to set up a ridiculously simple blog on a server. I've already chosen the CMS and host, and done the HTML and CSS, but I don't know jack about the basics. I'm sure I could find an ancient article that would be obsolete by now, so if there is a Setting Up a Blog for Dummies or something like that online, I'd appreciate it.

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?
Which CMS? They usually have instructions, not really sure what you're asking. Some providers even have one click installs, might wanna double check that.

ufarn
May 30, 2009

Triple Tech posted:

Which CMS? They usually have instructions, not really sure what you're asking. Some providers even have one click installs, might wanna double check that.
ExpressionEngine.

If it's as easy as it sounds, I'll just fidgit around with it and write when I get stumped.

supster
Sep 26, 2003

I'M TOO FUCKING STUPID
TO READ A SIMPLE GRAPH
Does anyone know of a calculator plugin for Eclipse that lets me evaluate simple math expressions easily while using the editor? The one plugin I could find was ECalculator and it sucks.

Flobbster
Feb 17, 2005

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

supster posted:

Does anyone know of a calculator plugin for Eclipse that lets me evaluate simple math expressions easily while using the editor? The one plugin I could find was ECalculator and it sucks.

It's not exactly what you're asking for, but you could use the DrJava plugin for this. It creates a view in your workbench that acts as an interactive Java console, and you could just enter expressions directly into it.

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
Flobbster: the standalone DrJava IDE is pretty nifty. I'd imagine the Java REPL could be really handy for teaching an introductory Java course.

In the past, I've often used Processing as the same kind of code sketchpad.

Flobbster
Feb 17, 2005

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

Internet Janitor posted:

Flobbster: the standalone DrJava IDE is pretty nifty. I'd imagine the Java REPL could be really handy for teaching an introductory Java course.

I haven't used it that much personally; I only know about it because I maintain a pre-configured Eclipse distro that we have the Java and C++ students in our program download (and that other universities have started using as well). We've historically always included DrJava with it, but I don't know how much our students use it, because we tend to encourage them that if they want to test something in one of their classes, don't just run in a REPL, look at the output and then forget about it, but put it in a JUnit test case that will get checked every time they build.

Oisin
Jul 22, 2009
I'm taking a Prolog course and I'm stuck on one specific question. It asks for a predicate allConnected(L) to take a list L of atoms [a,b,c...] and determine, based on previously given facts, a subset of those atoms which are all connected.

For example:
% the facts of connection are stated
edge(a,b).
edge(b,c).
edge(c,a).
edge(b,d).

Therefore, L will be [a,b,c,d]. All this is given and there are no duplicate elements in L. Now allConnected(L) should return:

L = [a,b,c] since a,b, and c ALL connect to each other, meaning if you are at one node you can get to any of the others in the list by one edge.

The code I have been messing around with looks like this:

http://pastebin.com/ZKkLhGBK

If you're troubled with answering class assignments, please just give me a point in the right direction as I've been stuck on this problem for awhile now. It seems that in Prolog you can hover around the answer for awhile and still be completely wrong unless you hit it on the nose.

EDIT: Spelling mistake in pastebin, should be isConnected. This was not the problem. *

tef
May 30, 2004

-> some l-system crap ->

Oisin posted:

I'm taking a Prolog course.

:toot: I'll come back to this question in a bit, i'm stuck in an all day meeting today

p.s. have you been taught about findall/3

http://www.swi-prolog.org/pldoc/man?predicate=findall/3

tef fucked around with this message at 15:52 on Mar 16, 2010

tef
May 30, 2004

-> some l-system crap ->

Oisin posted:

If you're troubled with answering class assignments, please just give me a point in the right direction.

it's hard to nudge you in the right direction without giving the answer away, so, uh, erm.

code:
% facts
edge(a,b).
edge(b,c).
edge(c,a).
edge(b,d).


% rules

% helper predicate
connects(A,B) :- edge(A,B); edge(B,A).


% fully_connected_subset(+Set, ?Subset)
% Subset is bound to a fully connected subset of Set

% if the set is empty, the subset is empty
fully_connected_subset([],[]).

% if the set is a singleton, the subset is the same, if the
% atom connects to something
fully_connected_subset([X],[X]) :- connects(X,_).

% otherwise, take the first element of the set,
% find all of the connected atoms, and work out
% the intersection with the remaining nodes, 
% before passing all this to an auxillary predicate.

fully_connected_subset([H|T], O) :-
    \+ T = [],
    all_connected_edges(H,E),
    intersection(E,T,I),
    next_subset(H,I,T,O).


% if the intersection is non empty, the return will be
% the head + the fully_connected_subset of the intersection
next_subset(H,I,_,[H|O]) :- \+I=[], fully_connected_subset(I,O).

% alternatively, we can ignore the head, and the return
% will be the f_c_s of the tail
next_subset(_,_,T,O) :- fully_connected_subset(T,O).

% or, we can just return the head, if it is a connected atom.
next_subset(O,_,_,[O]) :- connects(O,_).

% find all connected edges of A
all_connected_edges(A,P) :- setof(N,connects(A,N),P).
I think this might be right I have no idea.


edit to add: once you have setof/findall this code pretty much writes itself.

tef fucked around with this message at 16:25 on Mar 16, 2010

krnhotwings
May 7, 2009
Grimey Drawer
I've got a pretty simple question to put out. For binary search trees, is it possible to have a right child and not a left child? ie. the root has a left child, and this left child (we'll call it 'node') has no left child. Do we assume that 'node' has no right child? Or is it possible that it can have a right child?

Here's a diagram to help visualize:
code:
    r
   / \
  n
 / \
x   ?

r = root
n = node
x = non-existant left child
? = Can this child exist?

The1ManMoshPit
Apr 17, 2005

krnhotwings posted:

I've got a pretty simple question to put out. For binary search trees, is it possible to have a right child and not a left child? ie. the root has a left child, and this left child (we'll call it 'node') has no left child. Do we assume that 'node' has no right child? Or is it possible that it can have a right child?

Here's a diagram to help visualize:
code:
    r
   / \
  n
 / \
x   ?

r = root
n = node
x = non-existant left child
? = Can this child exist?

Yes it's possible. Here's an example.

code:
    5
   / \
  3
 / \
    4
If you put constraints on your tree it may become impossible but there's no reason at all why a tree couldn't just be nothing BUT right children, like

code:
5
 \
  6
 / \
    7
   / \
      8
       \
       ...
is still a BST, just a really poorly balanced one.

The1ManMoshPit fucked around with this message at 06:03 on Mar 18, 2010

krnhotwings
May 7, 2009
Grimey Drawer

The1ManMoshPit posted:

is still a BST, just a really poorly balanced one.
Ah, okay. I was under the assumption that a BST must be sorted/balanced for it to be a BST. Thanks for the clarification.

ToxicFrog
Apr 26, 2008


BSTs must be sorted (ordered) for them to be useful as a search tree. However, they don't need to be balanced.

The trees given as examples are ordered (an in-order traversal of them will give 3-4-5 and 5-6-7-8 respectively), but not balanced.

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY
I'm trying to build a primitive election simulator, but one of the things I'm having trouble with is a good way to generate the preference votes: I want them to be "biased" so that some candidates will have a higher ranking on average than others. Anyone know an algorithm for this?

Avenging Dentist
Oct 1, 2005

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

coffeetable posted:

I'm trying to build a primitive election simulator, but one of the things I'm having trouble with is a good way to generate the preference votes: I want them to be "biased" so that some candidates will have a higher ranking on average than others. Anyone know an algorithm for this?

Isn't this just a weighted sample? Make an array of the cumsum of the probabilities and then generate a random number and figure out which element in the sample it falls into.

haveblue
Aug 15, 2005



Toilet Rascal
There's a discussion of nonuniform RNGs on page 79 of this thread.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

coffeetable posted:

I'm trying to build a primitive election simulator, but one of the things I'm having trouble with is a good way to generate the preference votes: I want them to be "biased" so that some candidates will have a higher ranking on average than others. Anyone know an algorithm for this?

Hooray! A question that's vaguely within my field!

You'll need to define a vector of voting probabilities, so that a given voter votes for candidate 1 with probability p1, for candidate 2 with probability p2, etc. If you already know what voting probabilities you want then you can implement it yourself like AD suggested. Alternatively if you have access to a probability library that has a function for simulating multinomial distributions you can use that.

If you want to simulate a random vector of voting probabilities, then I suggest you model it as a Dirichlet distribution with appropriate parameters. You can simulate from this by renormalising a vector of Gamma random variables - any good probability/stats library should have a function for simulating gamma rvs.

This is also a pretty good reference for random variable simulation, but it's more probability than CS-oriented.

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Avenging Dentist posted:

Isn't this just a weighted sample? Make an array of the cumsum of the probabilities and then generate a random number and figure out which element in the sample it falls into.

yeah, i'm doing something like this at the moment. unfortunately i'm wanting to generate 2-3 million preference ballots (in batches of a thousand or so, generating a new set of probabilities for each), and my vain hope was that there was some clever algorithm to do this kind of thing.

p79 might help though - the aliasing method is interesting if nothing else.

e: Ok, nevermind, doctortristan is fantastic. That final link especially - I'm a maths guy, not a programmer so it's perfect. Cheers :)

coffeetable fucked around with this message at 23:35 on Mar 18, 2010

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

coffeetable posted:

yeah, i'm doing something like this at the moment. unfortunately i'm wanting to generate 2-3 million preference ballots (in batches of a thousand or so, generating a new set of probabilities for each)

Ok, if you're simulating large numbers of votes using the same probability vector you should definitely simulate that as a multinomial random variable, using an appropriate prob/stats library.

To clarify what I mean by this, if there are r candidates and n voters cast their votes with identical probabilities (p1,..., pr), then the vector of votes for each candidate (n1,...,nr) has a multinomial distribution. Any good implementation of this will be able to simulate (n1,...,nr) in a time that is O(r), rather than O(n).

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

DoctorTristan posted:

Ok, if you're simulating large numbers of votes using the same probability vector you should definitely simulate that as a multinomial random variable, using an appropriate prob/stats library.

To clarify what I mean by this, if there are r candidates and n voters cast their votes with identical probabilities (p1,..., pr), then the vector of votes for each candidate (n1,...,nr) has a multinomial distribution. Any good implementation of this will be able to simulate (n1,...,nr) in a time that is O(r), rather than O(n).

Ah, I think I messed up - by preference ballot, I meant a ranking of the candidates by preference, not "tick the candidates you like". Wait, or do you mean there's an easy way to convert the latter into the former?

e: sorry. statistics is not a strength of mine, to say the least.

coffeetable fucked around with this message at 00:11 on Mar 19, 2010

Hillridge
Aug 3, 2004

WWheeeeeee!
I have a BAT file question, but if there's a better easier way to do this, I'm open to suggestions.

I want to make a bat file that scans a directory for files of a certain type (*.bin), then sends them one at a time to an ftp server with a delay of 10 seconds or so between each one. I can write it with hard coded file names, but I want it to allow me to just drop a new file into the directory and have it send it. I also want it to loop once it has run out of files and start over with the first one.

I know how to send via ftp in a bat file, but the rest is new to me.

Suggestions?

Thanks.

Edit:
I can get the list of files with a "dir *.bin /B" command, then for each file I'd want to do this:

ftp -s:info.txt
ping -n 15 127.0.0.1

where info.txt has:
open [FTP's IP]
user
pass
put myfile.bin
quit

so for each file, it transfers it to the ftp, then delays using a few pings to home, then does it for the next file.
After all the files have been sent, it rescans the directory to see if any new ones were added, then starts the process over.

Hillridge fucked around with this message at 17:50 on Mar 19, 2010

Anmitzcuaca
Nov 23, 2005

If I have a mIRC trigger like this

on *:TEXT:$me:#:/msg $chan yes, $nick $+ ?

is there any way to stop users from abusing it by barraging the bot with text so it gets booted off the server for flooding?

Also can I use the on text event to reply to text said by a certain nick?

Top Bunk Wanker
Jan 31, 2005

Top Trump Anger
I can't figure out a regular expression to match all caps words containing a certain number of characters, except for specific words. As near as I can figure, it's something like [A-Z]{min,max}(?!WORD|OTHERWORD), but that doesn't seem to match it.

DoctorTristan
Mar 11, 2006

I would look up into your lifeless eyes and wave, like this. Can you and your associates arrange that for me, Mr. Morden?

coffeetable posted:

Ah, I think I messed up - by preference ballot, I meant a ranking of the candidates by preference, not "tick the candidates you like".

Ah ok, I was thinking of a single vote system.

The proble isn't so much about programming as it is the model you put on the voter preferences. You model each voter's preference vote as a (multivariate) random variable; and within each batch each voter has the same (probabilistic) distribution on their preferences.

What distribution do you choose? In principle this is up to you. A simple way is to model each voter's 'liking' for each candidate as a univariate random variable (log-Gaussian, Gamma, Beta or whatever) and have them vote according to their liking rank.

Might be better to move this to the SPE thread if you've any further questions.

Adbot
ADBOT LOVES YOU

tef
May 30, 2004

-> some l-system crap ->

Anmitzcuaca posted:

If I have a mIRC trigger like this

on *:TEXT:$me:#:/msg $chan yes, $nick $+ ?

is there any way to stop users from abusing it by barraging the bot with text so it gets booted off the server for flooding?

use timers ?

quote:

Also can I use the on text event to reply to text said by a certain nick?

yes, but you'd have to check the manual for the syntax.

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