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
Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.
This isn't code specific, but specific to other programmers. I'm working on a large project for another internal department, and they don't understand programming concepts at all so I want a way to show them a list of tasks, with subtasks and some sort of visual way to show the progress. I don't need a server or web based, I just want to be able to send them a screenshot or document that shows this.

Example of the "tasks":
To Do
permissions
configuration - admin configuration and quota configuration
validation
error handling
two reconciliations
build
reporting
data transfer

Completed
UI
Data Pull
Tech Unit Assignment
Category Unit Assignment

Working On
Timeframe Unit Assignment

Any ideas?

Adbot
ADBOT LOVES YOU

baquerd
Jul 2, 2007

by FactsAreUseless

Uziel posted:

This isn't code specific, but specific to other programmers. I'm working on a large project for another internal department, and they don't understand programming concepts at all so I want a way to show them a list of tasks, with subtasks and some sort of visual way to show the progress. I don't need a server or web based, I just want to be able to send them a screenshot or document that shows this.

Have you tried writing utensils and paper? Saving that, a "word processor" is known to format documents to your specification, or a "spreadsheet program" can sometimes generate graphs.

All snarkiness aside, what is preventing you from doing this manually? It doesn't seem like very many categories, and it's not like you could give a hard date for flawless product anyway, so estimates all the way!

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.

baquerd posted:

Have you tried writing utensils and paper? Saving that, a "word processor" is known to format documents to your specification, or a "spreadsheet program" can sometimes generate graphs.

All snarkiness aside, what is preventing you from doing this manually? It doesn't seem like very many categories, and it's not like you could give a hard date for flawless product anyway, so estimates all the way!
It's unfortunately one of those situations where upper upper management is involved (Fortune 50 company) and this is the first time they've seen work from our 3 person mickey mouse operation regional team. If this app works as well as we hope, it's likely to get CEO attention and be rolled out nation wide so I want to be able to give them something a bit fancier than what they are used to seeing. Since we can't show of the app itself just yet, I just want something that looks reallllly good to present to show the progress.

SniperWoreConverse
Mar 20, 2010



Gun Saliva
Anybody know if Monodevelop's assembly browser can do visual basic?

Pretty much the situation is this: due to incompetence I have to clean up someone else's mess, and on top of it the source code no longer exists (or no one can find it). I was able to use .net reflector to take a look at the code, and I just need to make minor changes that should be easy, but I don't have access to professional (read: pay) tools. I can't figure out a way to get the source into an editable form easily. I don't have much experience with monodevelop so could anyone point me in the right direction?

benitocereno
Apr 14, 2005


Doctor Rope

Uziel posted:

It's unfortunately one of those situations where upper upper management is involved (Fortune 50 company) and this is the first time they've seen work from our 3 person mickey mouse operation regional team. If this app works as well as we hope, it's likely to get CEO attention and be rolled out nation wide so I want to be able to give them something a bit fancier than what they are used to seeing. Since we can't show of the app itself just yet, I just want something that looks reallllly good to present to show the progress.

Urgh... I hate this product so much, but it may be what you want:

http://www.macromediastudio.com/products/captivate/

You can make interactive movies to be a "product simulation." You'll probably kill a bunch of time making the throw-away demo, but bigwigs love this poo poo. Good luck!

Amtiskaw
May 15, 2003

it was almost the longest

SniperWoreConverse posted:

Anybody know if Monodevelop's assembly browser can do visual basic?

Pretty much the situation is this: due to incompetence I have to clean up someone else's mess, and on top of it the source code no longer exists (or no one can find it). I was able to use .net reflector to take a look at the code, and I just need to make minor changes that should be easy, but I don't have access to professional (read: pay) tools. I can't figure out a way to get the source into an editable form easily. I don't have much experience with monodevelop so could anyone point me in the right direction?

Have you tried Reflexil: http://reflexil.net/

It's a free plugin for reflector that lets you change the code. Sounds like it might be what you need.

God Exists.
Sep 26, 2010

by Ozma
Is there an app that you can batch insert a list of files and ask it to detect if there are changes between them?

Standish
May 21, 2001

God Exists. posted:

Is there an app that you can batch insert a list of files and ask it to detect if there are changes between them?

diff?

tripwire
Nov 19, 2004

        ghost flow
Svn?

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
WinMerge
WinDiff

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
sha1sum

Sovi3t
Jan 11, 2005
purple monkey dishwasher
I need to store two versioned trees along with a temporal series of data for each of the nodes.

Does there exist a solution for this problem that:
1) Is elegant
2) Is simple
3) Can be stored in a fully-normalized relational database

If not, what is the best solution using the most-fitting tools?

SniperWoreConverse
Mar 20, 2010



Gun Saliva

Amtiskaw posted:

Have you tried Reflexil: http://reflexil.net/

It's a free plugin for reflector that lets you change the code. Sounds like it might be what you need.

Thanks, it looks pretty cool. This is pretty much exactly what I want, but I can't seem to get it to work, when I go to "replace all with code" it brings me to the namespace, main(), and then the part that I would like to edit is just
code:
Option Explicit On
Option Strict On

#Region " Imports "
Imports System
Imports System.Collections.Generic
Imports System.Text
#End Region 

#Region " Referenced assemblies "
' - Bla.Bla.Hurf.Durf 
#End Region 

Namespace VKManager

	Class Main
	
		' Limited support!
		' You can only reference methods or fields defined in the class (not in ancestors classes)
		' Fields and methods stubs are needed for compilation purposes only.
		' Reflexil will automaticaly map current type, fields or methods to original references.
		Sub ReadFile()
		End Sub 

#Region " Methods stubs "
#Region " Fields stubs "

	End Class 
End Namespace 
Obviously I need to edit ReadFile() itself.

Also it comes up with like 20 popup messages saying it can't find System.Data.DataSetExtensions.dll

I think I'm just gonna tell them to have someone rewrite it from scratch.

N.Z.'s Champion
Jun 8, 2003

Yam Slacker
I've got a database like this,
code:
id | date | amount | calculated_balance
1  | 2006 | 4      | 4
2  | 2006 | 4      | 8
3  | 2007 | 5      | 13
4  | 2008 | 10     | 23
5  | 2009 | -4     | 19
6  | 2010 | 7      | 26
But if I change the initial balance to 10 (which is stored in another table) then I'd like to recalculate it,
code:
id | date | amount | calculated_balance
1  | 2006 | 4      | 14
2  | 2006 | 4      | 18
3  | 2007 | 5      | 23
4  | 2008 | 10     | 33
5  | 2009 | -4     | 29
6  | 2010 | 7      | 36
So short of going through each row and manually totaling it with sum() is there a better way? Is there a way to sum it upon select? The database is MySQL.

(this is just a personal spending tracker, it's not an important app, so hacks are welcome)

Psychorider
May 15, 2009

N.Z.'s Champion posted:

I've got a database like this,
code:
id | date | amount | calculated_balance
1  | 2006 | 4      | 4
2  | 2006 | 4      | 8
3  | 2007 | 5      | 13
4  | 2008 | 10     | 23
5  | 2009 | -4     | 19
6  | 2010 | 7      | 26
But if I change the initial balance to 10 (which is stored in another table) then I'd like to recalculate it,
code:
id | date | amount | calculated_balance
1  | 2006 | 4      | 14
2  | 2006 | 4      | 18
3  | 2007 | 5      | 23
4  | 2008 | 10     | 33
5  | 2009 | -4     | 29
6  | 2010 | 7      | 36
So short of going through each row and manually totaling it with sum() is there a better way? Is there a way to sum it upon select? The database is MySQL.

(this is just a personal spending tracker, it's not an important app, so hacks are welcome)

Should have posted in the SQL thread but here's your answer anyway:

code:
SELECT t.id, t.date, t.amount, t.calculated_balance + (SELECT t2.initial_balance FROM table2 AS t2 WHERE t2.id = 1) FROM table AS t
The where in the sub-select is needed to ensure you only ever get 1 result from the query, replace by what criteria you want to use. This assumes that calculated_balance and initial_balance are both integers or floats of some kind.

It's not a good idea to store calculated data that can change unless you have all the data needed to recalculate it and it would be prohibitive to calculate it each time. If you want to do it you can update all the rows with an UPDATE query:

code:
UPDATE table SET calculated_balance = (amount + (SELECT blablabla))
You get the idea.

Btw sum() is used to add together several rows from the same column so it's probably not what you want in this case.

N.Z.'s Champion
Jun 8, 2003

Yam Slacker

Psychorider posted:

Should have posted in the SQL thread but here's your answer anyway:
Whoops, and thanks - that looks like a good approach :)

FamDav
Mar 29, 2008
SML Question:

I have a datatype:

pre:
(* BST type definition *)
datatype 'a bst = Empty
	| Node of 'a * 'a bst * 'a bst;
I also have plenty of other functions that work with it.

pre:
(* Generates a new leaf *)
fun leaf n = Node(n,Empty,Empty);


(* inserts inpt into our tree given rule opt *)
fun insert(inpt,Empty,opt) = Node(inpt,Empty,Empty)
|	insert(inpt,Node(n,left,right),opt) =
		(* if true, insert into the left *)
		if opt(inpt,n) then Node(n,insert(inpt,left,opt),right)
			(* otherwise insert into the right *)
			else Node(n,left,insert(inpt,right,opt));


(* Inserts a list into an empty tree *)
fun insertList([],opt) = Empty
|	insertList(x::y,opt) =
		(* Insert the head of the list into the tree containing the tail *)
		insert(x,insertList(y,opt),opt);

val t = insertList([0.6,~1.0,0.4],op <);
When I write a member function for it, however...

pre:
fun member(inpt,Empty,opt) = false
|	member (inpt,Node(n,left,right),opt) =
		(* If we have the element, return true *)
		if (inpt = n) then true
			(* Otherwise recursively search in the correct subtree *)
			else if opt(inpt,n) then member(inpt,left,opt)
				else member(inpt,right,opt);
It compiles, but when I run it with, say,
pre:
member(0.6,t,op <);
I get this error:

pre:
stdIn:4.1-4.19 Error: operator and operand don't agree [equality type required]
  operator domain: ''Z * ''Z bst * (''Z * ''Z -> bool)
  operand:         real * real bst * ('Y * 'Y -> bool)
  in expression:
    member (0.6,t,<)
- 
I realize this is because polyEquals does not work on real values. What is the best way to get around this issue?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

FamDav posted:

I realize this is because polyEquals does not work on real values. What is the best way to get around this issue?

Use a tri-valued ordering function instead of the combination of a boolean ordering function and the builtin equality operator. That gives you a more general data structure anyway, and it also makes a certain flaw in your insert function more obvious.

The standard environment defines datatype order = LESS | EQUAL | GREATER.

guenter
Dec 24, 2003
All I want out of life is to be a monkey of moderate intelligence who wears a suit. That's why I've decided to transfer to business school!
I have an application on windows that depends on a library that constantly loads and unloads a dll at a fixed address. If I happen to have allocated something at that address, calls to the library will start to fail.

I was hoping I might just be able to allocate a few hundred kb at that address and wrap all calls to the offending library functions with something that will free and then reallocate that memory. Is this possible, or is there some other way anyone can think of to mark an address range as "reserved?"

[edit] Nevermind, I see VirtualAlloc accepts an address. Open to other slightly less dirty solutions if any exist though!

guenter fucked around with this message at 23:36 on Nov 18, 2010

bruckner
Sep 11, 2010
I remember reading it was possible to d/l mp3s from websites where they are streaming, but it was tedius, and I forgot.

maybe this isn't a programming question, but i read about it in a hacker book, and you guys seem like the right crowd

bruckner fucked around with this message at 05:11 on Nov 20, 2010

tef
May 30, 2004

-> some l-system crap ->
Please try yospos or sh/sc or google

Argue
Sep 29, 2005

I represent the Philippines
I posted this horror in the coding horrors thread.

Now I'm faced with the task of making sure it's been fixed. What's a good way of doing an automated test to consistently reproduce the bug, and what's a good way of verifying that the bug's been fixed?

Additional relevant details: the request processing is a separate thread from the response sending, and due to a lack of mocks, etc, it can only be tested by uploading it and sending requests to the server, as it does a lot of stuff behind the scenes whose details we're not privy to.

tef
May 30, 2004

-> some l-system crap ->
Put an md5 of the input request into the output via some headers or similar (inject a trace paramter which is returned unchanged in the output - although make sure it can't be used to inject anything terrible)

You should be able to cheaply check if the result is for your request.

Next up, as it is a race conditon I don't imagine it will be easy to reproduce without lots of connections in parallel, (even then not so easy). You might find playing with the timing of the requests (and delaying internal requests) will help produce more errors.

You might want to add a proxy in production that verifies all user requests with the md5 option or similar.

BrianBoitano
Nov 15, 2006

this is fine



Can someone write a program to read the numbers on these pictures for me? There used to be a "small coding projects" crowdsourcing thread, but I can't find it. I have about 2000 (and counting) all in .png format in a folder in Windows, and I ultimately would like them in an Excel spreadsheet.





I learned how to use AutoIT yesterday to collect these photos, and I have an idea of how to do it in AutoIT using very basic pixel color analysis, though it's obviously challenging since you can see that the numbers are not fixed-width, fixed-placement, OR fixed number of digits. Since I'm an incredible newbie to AutoIT, and someone on here surely knows a better/easier to implement strategy or even better tool to use, I thought I'd ask before spending upwards of 2 hours on this part of the code too.

Background:
I'm on Thanksgiving break, and my friends and I have a bet about Kitten Cannon. Two of us think that the lowest angle will give a higher average distance and the other thinks that it will behave more or less like normal projectile motion, and thus 45 degrees would be best.

When I got to the room where they had started this bet, they were both dutifully playing the game and writing down the results each time while carrying on a conversation about what statistics would be most important (mean, mode, maximum, etc). I offered to join in, and decided it would ultimately be worth the time investment to try and automate it. They managed ~60 data points each in that first hour. In a couple of hours, I wrote a script that manages 240 per hour, but still requires additional human effort to look at the pictures and record the data.

Thanks for any advice you can give, and if you would like the .exe or the source to play around with, I can guarantee more immediate and guaranteed results than using your computer's down time for SETI@Home!

csammis
Aug 26, 2003

Mental Institution

BrianBoitano posted:

my friends and I have a bet

What's the developer's cut of the winnings?

Jam2
Jan 15, 2008

With Energy For Mayhem
Mathematica

I have a list (list #1) of True False values. I have another list (list #2) of equal length. Then I have two functions. If the value an element of list #1 is False, I want to run function 1 on the corresponding element of list #2. If the value of element in list #2 is True, I want to run function #2 on list #2.

I've been funking around with If, Map, and Extract statements. No luck so far.

(beginner with no programming experience. I'm teaching myself Mathematica.)

ToxicFrog
Apr 26, 2008


BrianBoitano posted:

automatic number recognition

Personally, my approach would be something like:
- use imagemagick to automatically crop out the section of the image containing the score (which is always the same part) and make it black-on-white
- use gocr to read the numbers (and discard "," and "ft"), training it as needed

However, this requires gocr and imagemagick, which - as you're on windows - you may not have. There are windows versions of both, though.

Opinion Haver
Apr 9, 2007

Jam2 posted:

Mathematica

I have a list (list #1) of True False values. I have another list (list #2) of equal length. Then I have two functions. If the value an element of list #1 is False, I want to run function 1 on the corresponding element of list #2. If the value of element in list #2 is True, I want to run function #2 on list #2.

I've been funking around with If, Map, and Extract statements. No luck so far.

(beginner with no programming experience. I'm teaching myself Mathematica.)


code:
In[14]:= switch[b_, x_] = If[b, f[x], g[x]]

Out[14]= If[b, f[x], g[x]]

In[15]:= MapThread[switch, {{True, False}, {1,3}}]

Out[15]= {f[1], g[3]}

nbv4
Aug 21, 2002

by Duchess Gummybuns
Can anyone recommend me a good postal address verification service? I want to be able to enter an address, and have it return True or False depending on whether the address is in the postal database. Bonus points if it will return a 'cleaned' version of the data passed in if it is slightly off. I've tried CDYNE, but it sucks. Google has a geocoder, but the terms disallow usage outside of a google maps applet.

MrMoo
Sep 14, 2000

I'm using Yahoo's service, but it's only good for the US.

Super Dude
Jan 23, 2005
Do the Jew
Ruby Question

I am trying to split up a string in Ruby into words using pattern matching. A word is:

1) surrounded by double quotes
or
2) surrounded by whitespace

My code is only detecting the double quote words, but not the words surrounded by whitespace. Any ideas?

code:
a=[]
line.scan(/"([^"]{1,})"|\s+(^\s+)\s+/) do |word|
      a << $1
end

litghost
May 26, 2004
Builder

Super Dude posted:

Ruby Question

I am trying to split up a string in Ruby into words using pattern matching. A word is:

1) surrounded by double quotes
or
2) surrounded by whitespace

My code is only detecting the double quote words, but not the words surrounded by whitespace. Any ideas?

code:
a=[]
line.scan(/"([^"]{1,})"|\s+(^\s+)\s+/) do |word|
      a << $1
end

code:
\"([^\"]+)\"|(\S+)

Super Dude
Jan 23, 2005
Do the Jew

litghost posted:

code:
\"([^\"]+)\"|(\S+)

When I try to print the array out to make sure the results are correct, I get some nil results. My input is ’ aaa "bbb ccc" ddd "eee"’. It is indicating that aaa and ddd are nil in the array. Why?

Super Dude fucked around with this message at 08:38 on Nov 25, 2010

RobotEmpire
Dec 8, 2007
I posted this to StackOverflow and gis.stackexchange, but I haven't managed to get a result.

http://stackoverflow.com/questions/4262411/segmentation-fault-segfault-when-using-ogr-createfield-in-python

Receiving a segfault when running this very short script in Ubuntu.

code:
from osgeo import ogr, osr

shpfile = 'Census_County_TIGER00_IN.shp'

def cust_field(field):
    '''cust_field(shpfile, field) creates a field definition, which, by calling cust_field(),
    can be used to create a field using the CreateField() function. cust_field() DOES NOT create 
    a field -- it simply creates a "model" for a field, what can then be called later. It's weird, 
    but that's GDAL/OGR, as far as I can tell.'''
    fieldDefn = ogr.FieldDefn(field, ogr.OFTInteger)
    fieldDefn.SetWidth(14)
    fieldDefn.SetPrecision(6)
    return fieldDefn

ds = ogr.Open(shpfile, 1)
lyr = ds.GetLayerByIndex(0)
field = cust_field("Test")
lyr.CreateField(field)
Everything runs smoothly until that last line, when iPython, normal shell Python and the IDLE command line all dump to a segmentation fault. Is this an error on my end or an issue with the underlying C that I'm not addressing properly?

The suggestion that has cropped up a couple of times is that I need to uninstall and reinstall the GDAL and python-gdal packages. I've done that. Still no love. The other issue here is that when other people try to run this script with any shapefile -- including the one I'm using as an example -- it works perfectly for them, as intended.

Here is the download link to the exact shapefile I'm using. In addition, here is a link to the debug info when I run the script with GDB. If it matters (I'm sure it doesn't) I'm running all this on Ubuntu in a virtual box.

If anyone has some specific ideas on how to fix this, I am all ears.

litghost
May 26, 2004
Builder

Super Dude posted:

When I try to print the array out to make sure the results are correct, I get some nil results. My input is ’ aaa "bbb ccc" ddd "eee"’. It is indicating that aaa and ddd are nil in the array. Why?

There are two separate capture groups. The quote group matches \1, the unquoted word matches \2. You need to check both \1 and \2.

I used http://www.rubular.com/ to test it out.

BrianBoitano
Nov 15, 2006

this is fine



csammis posted:

What's the developer's cut of the winnings?

Oral credit? It's a friendly bet, so no money is on the line, and I don't really have a side in the bet anyhow.

ToxicFrog posted:

Personally, my approach would be something like:
- use imagemagick to automatically crop out the section of the image containing the score (which is always the same part) and make it black-on-white
Done! I also had to have it convert the .png into .jpg for the ocr program I found.

ToxicFrog posted:

- use gocr to read the numbers (and discard "," and "ft"), training it as needed
I couldn't find a reasonable ocr program that didn't screw up the numbers. I either had ones that could learn but needed 300 sample words (which I don't have) or one that kept reading 3s as 2s or 9s as 2s. Any alternative ocr programs out there?

ToxicFrog
Apr 26, 2008


The reason I suggested gocr is that it has a fairly simple and effective learning mode. Do something like:

code:
mkdir font
gocr -d 0 -a 99 -f ASCII -m $((256+128+2)) -p font/
This causes it to start up "blank", with no idea what patterns map to what letters. It'll try to break the text into letters, then display each one and ask you what it means, and you can type in anything (including no text or multiple characters). It'll then save the database it builds in the font/ directory for future runs. In this way, provided you're scanning text with a very consistent font (which this is), you can very quickly teach it.

This won't work very well with handwriting - too much variation - but I've used it to automatically transcribe text from programs and video games with great success.

You will need some preprocessing with imagemagick; it expects black-on-white, PNM format - try experimenting with the -threshold command. And use the PNGs as input; compression artifacts from JPEG may confuse it.

EDIT: my automatic transcription command for Septerra Core screenshots:

code:
function ocr() {
    convert $ss -crop 640x96+0+384 -negate -level 60%,61% pnm:/tmp/ocr.pnm
    gocr -d 0 -a 99 -f ASCII -m $((256+128+2)) -p ocr/ /tmp/ocr.pnm | tee -a transcription.txt
}

ToxicFrog fucked around with this message at 21:42 on Nov 25, 2010

newsomnuke
Feb 25, 2007

What is the name of the language feature that lets type definitions be modified at runtime? eg
code:
class Foo {}

Foo f;
f.x = 10; // creates new member 'x' on this instance of Foo

mr_jim
Oct 30, 2006

OUT OF THE DARK

Ruby classes are "open", which means you can reopen the class definition and add more stuff. The syntax is different from what you posted though. I don't know of any other names for that feature.

Adbot
ADBOT LOVES YOU

Opinion Haver
Apr 9, 2007

ultra-inquisitor posted:

What is the name of the language feature that lets type definitions be modified at runtime? eg
code:
class Foo {}

Foo f;
f.x = 10; // creates new member 'x' on this instance of Foo

Monkey patching or duck punching. The former is a derivation from 'guerilla patching', and the latter is because if it walks like a duck, but it doesn't quack like a duck, you punch it until it makes the noise you want :haw:

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