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
ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

the talent deficit posted:

I have a messaging system that consumes arbitrary binary sequences from a number of producers. Assuming all producers can read all other producers output, is there a way to uniquely identify producers that makes it impossible for producers to masquerade as other producers that doesn't rely on shared keys?

If you want to uniquely identify a producer, you have to have some kind of information that is unique to that producer. What, specifically, can't you do that makes you think you can't use "shared keys"? If you can be more specific about what your problem is, then we can choose a MAC that will work for you.

Adbot
ADBOT LOVES YOU

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





ShoulderDaemon posted:

If you want to uniquely identify a producer, you have to have some kind of information that is unique to that producer. What, specifically, can't you do that makes you think you can't use "shared keys"? If you can be more specific about what your problem is, then we can choose a MAC that will work for you.

I can use shared keys, but I'd like to avoid the overhead. I've got a bunch of processes (that I have no control over) writing to a single file (via a proxy that sequences the writes). I want to prevent processes from forging writes from other processes. They all have unrestricted read rights to the file, so I can't just use a unique ID per process. Right now, I use HMAC, but I'm trying to saturate the disk i/o, and the crypto overhead is preventing that.

Additionally, I'd like to avoid altering the message in any way, apart from enclosing it in some sort of container.

the talent deficit fucked around with this message at 02:12 on Dec 6, 2010

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
If you can't do any sort of handshake, maybe you can do something time-sensitive? Like, hash the epoch with a unique identifier or something. Then you'd be a moving target and malicious processes couldn't simply replay a stream from a legitimate process. I suspect this is insecure on its own, but maybe it's a start.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

the talent deficit posted:

I can use shared keys, but I'd like to avoid the overhead. I've got a bunch of processes (that I have no control over) writing to a single file (via a proxy that sequences the writes). I want to prevent processes from forging writes from other processes. They all have unrestricted read rights to the file, so I can't just use a unique ID per process. Right now, I use HMAC, but I'm trying to saturate the disk i/o, and the crypto overhead is preventing that.

You're going to have a really hard time finding a solution that's less expensive than HMAC. What are you using as the underlying hash? How much data are you running the hash over? For speed you should probably be using HMAC-SHA1 (or HMAC-MD5, which is currently secure although it's deprecated for a good reason) and be hashing over a short unique record number (such as its initial byte offset in the file or something).

About the best I can think of that doesn't involve any crypto overhead would be having the scheduling proxy maintain a second file in parallel that the processes don't have read permission for, use that to track ownership of the writes, then have an attestation proxy that can answer queries about ownership.

the talent deficit
Dec 20, 2003

self-deprecation is a very british trait, and problems can arise when the british attempt to do so with a foreign culture





Yeah, I suspected as much. There's a few other ways to do it, but the all involve modifying the data written and adding padding. I think I'm going to have to stick with the HMAC.

mik
Oct 16, 2003
oh
I'm using a intermediate language based on Java.

Is there any reason why I should do this:
code:
xStudy1_a = sma(maperiod, sym(sym1));

var value1_a = xStudy1_a.getValue(0);
DDE1_a = new DDEOutput("MA_" + sym1);
DDE1_a.set(value1_a);
Instead of this:
code:
xStudy1_a = sma(maperiod, sym(sym1));

DDE1_a = new DDEOutput("MA_" + sym1);
DDE1_a.set(xStudy1_a.getValue(0));
i.e. using an intermediate variable instead of wrapping everything together?

The reason I ask is because the example documentation for this code does it the former way, but it seems I can just skip a step (and some lines of code) doing it the second way.

Orzo
Sep 3, 2004

IT! IT is confusing! Say your goddamn pronouns!
They're nearly identical. The only real difference is that if the getValue failed for some reason, the DDEOutput constructor would not be called. If, say, getValue was prone to error for some reason and the constructor to DDEOutput was expensive, you'd want to attempt to run getValue first.

raminasi
Jan 25, 2005

a last drink with no ice

mik posted:

I'm using a intermediate language based on Java.

Is there any reason why I should do this:
code:
xStudy1_a = sma(maperiod, sym(sym1));

var value1_a = xStudy1_a.getValue(0);
DDE1_a = new DDEOutput("MA_" + sym1);
DDE1_a.set(value1_a);
Instead of this:
code:
xStudy1_a = sma(maperiod, sym(sym1));

DDE1_a = new DDEOutput("MA_" + sym1);
DDE1_a.set(xStudy1_a.getValue(0));
i.e. using an intermediate variable instead of wrapping everything together?

The reason I ask is because the example documentation for this code does it the former way, but it seems I can just skip a step (and some lines of code) doing it the second way.

It's plausible that the example documentation is trying to be clear and explicit for ease of understanding.

Meganiuma
Aug 26, 2003

mik posted:

I'm using a intermediate language based on Java.

Is there any reason why I should do this:
code:
xStudy1_a = sma(maperiod, sym(sym1));

var value1_a = xStudy1_a.getValue(0);
DDE1_a = new DDEOutput("MA_" + sym1);
DDE1_a.set(value1_a);
Instead of this:
code:
xStudy1_a = sma(maperiod, sym(sym1));

DDE1_a = new DDEOutput("MA_" + sym1);
DDE1_a.set(xStudy1_a.getValue(0));
i.e. using an intermediate variable instead of wrapping everything together?

The reason I ask is because the example documentation for this code does it the former way, but it seems I can just skip a step (and some lines of code) doing it the second way.

It's slightly easier to see things clearly in a debugger with more intermediate variables, but that's about all I can think of.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Meganiuma posted:

It's slightly easier to see things clearly in a debugger with more intermediate variables, but that's about all I can think of.

Similarly, it lets you add/remove a log message without changing the surrounding lines.

hayden.
Sep 11, 2007

here's a goat on a pig or something
So I'm about to graduate with a boring business degree, but haven't realized until this semester how awesome programming is and how much I like it. The problem I'm seeing, though, is that for most programming jobs they want:

A) A CS Degree with some experience
B) A ton of experience if you have no CS Degree

The problem being that it seems like it'd be difficult to meet the experience requirement without the degree since no one hires non-CS majors for programming jobs.

What are my options? Get another degree? Teach myself and work on open-source or personal projects?

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
If you like coding and you want to get a job coding without a degree, build a portfolio of projects. It doesn't matter how long you take, it doesn't matter what license you apply (if any), it doesn't even matter what it does. Pick a project, build it, reflect on your successes and failures, repeat. Companies that only hire CS majors for software engineering jobs aren't (in general) companies you'd want to work for in the first place.

hayden.
Sep 11, 2007

here's a goat on a pig or something
edit: missed your last sentence. Thanks for the reply!

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
All other things being equal, the CS degree is useful because it demonstrates a breadth of understanding. I can expect someone with a CS degree to understand algorithmic complexity, the costs, benefits and implementation details of data structures and a wide range of elementary algorithms.

In practice, all things are not equal. I have interviewed many people with a CS degree who couldn't program their way out of a soaking wet paper bag. I worked with an incredibly competent build engineer who was hired out of college with a physics degree. If you have a good grasp of basic skills and you're interested enough in programming to do it in your free time, I don't think it should be a major stumbling block. I will qualify this by saying my experiences have been with relatively small companies.

Opinion Haver
Apr 9, 2007

So, I have a Cocoa/ObjC program that displays a little square on the screen for each key on the keyboard, and I want to make it so that whenever you press a key, the corresponding one flashes onscreen. I hacked together something using an NSAnimation, but when I type at about 80 WPM, it uses 15-20% of my CPU on my MacBook Pro, even if I'm not actually changing the color of anything. Is graphics really that expensive, or am I just doing something horribly wrong?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Profile it in Instruments.

G-Dub
Dec 28, 2004

The Gonz
UML has been covered in here before but not for a while. I'm really just wondering what the recommended UML "development environments" (is it really a D.E., I don't know) is, on Windows these days. I have a few diagrams to do for work and I've been using StarUML but it's been out of development for ages now and I don't know if there's anything nicer out there. Thanks.

raminasi
Jan 25, 2005

a last drink with no ice
Are there any AutoIT gurus here? I'm having a bunch of weird loving issues getting basic scripts to run. For example, using ControlCommand to check a checkbox alternately checks and unchecks it (like my script is saving state somehow), and UnCheck doesn't do anything. I also get this using ControlSetText, where it only sets the text every other time. This is weird!

Opinion Haver
Apr 9, 2007

pokeyman posted:

Profile it in Instruments.

I did, and it tells me that most of the samples were in kevent and mach_msg_trap. If I disable the setNeedsDisplay call in the animation, the CPU usage goes down to something like 6%, so I'm pretty sure that that's what's screwing me over here.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

GrumpyDoctor posted:

Are there any AutoIT gurus here? I'm having a bunch of weird loving issues getting basic scripts to run. For example, using ControlCommand to check a checkbox alternately checks and unchecks it (like my script is saving state somehow), and UnCheck doesn't do anything. I also get this using ControlSetText, where it only sets the text every other time. This is weird!

Does it happen for just a certain app you're trying to automate, or does it happen system wide? (I do lots of AutoIT stuff)

ufarn
May 30, 2009
I want to use git commit with the -v option, but, embarrassingly, I don't know how to save and commit the file, after I've entered some text to describe the changes. Do I need to use a keyboard shortcut (Windows git bash), or what do I do to send it along?

raminasi
Jan 25, 2005

a last drink with no ice

Thermopyle posted:

Does it happen for just a certain app you're trying to automate, or does it happen system wide? (I do lots of AutoIT stuff)

Two out of two apps I've tried. I figured out one cause: WaitWindowActive wasn't actually doing what it said it was doing, and if it returned before the window was actually active nothing would happen (apparently this happened exactly every other time). I don't know about the checkbox thing though - and I wrote that app, so I might have hosed up something with the form design. I'll post a more concrete question about this later I guess.

ToxicFrog
Apr 26, 2008


ufarn posted:

I want to use git commit with the -v option, but, embarrassingly, I don't know how to save and commit the file, after I've entered some text to describe the changes. Do I need to use a keyboard shortcut (Windows git bash), or what do I do to send it along?

Depends on what editor it's using. I don't recall which one wingit uses by default.

If it's vi, try hitting escape a few times and then typing :wq<enter>.
If it's pico or nano, try ctrl-O <enter> ctrl-X.

Alternately, configure it to use an editor that you know how to use - for example, git config --global core.editor nano

ufarn
May 30, 2009

ToxicFrog posted:

Depends on what editor it's using. I don't recall which one wingit uses by default.

If it's vi, try hitting escape a few times and then typing :wq<enter>.
If it's pico or nano, try ctrl-O <enter> ctrl-X.

Alternately, configure it to use an editor that you know how to use - for example, git config --global core.editor nano
No dice. It's the default terminal-esque client you get when you install the Windows git package.

The bottom line says ~\repo\.git\COMMIT_EDITMSG[+][RO] [unix], if that says anything.

fankey
Aug 31, 2001

Suggestions for a CMS for a technical blog for posting tips and tricks related to an application my company has developed? Nothing too special required - basic posting from multiple users with the ability to imbed images/movies. A comment system of some sort would be nice. It looks like WordPress and Moveable Type are the big ones so I'd be curious about those as well as any other options that might make sense.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

yaoi prophet posted:

I did, and it tells me that most of the samples were in kevent and mach_msg_trap. If I disable the setNeedsDisplay call in the animation, the CPU usage goes down to something like 6%, so I'm pretty sure that that's what's screwing me over here.

If you post the code somewhere I can take a look if you'd like, but NSAnimation is kind of generally lovely. You'll probably want to look into Core Animation if you can.

That said, it does sound like an inordinately high amount of CPU, so I'd be interested to poke around.

Queen Anneka
Feb 21, 2010
I'm getting a headache from trying to get through this review for my fundamentals of programing class. My teacher isn't specific enough in his questions for me to really understand what he's asking and I was hoping someone with more experience could help me translate what he's asking for. he doesn't provide any answers to his review, and I have the test tomorrow. I would have gone to his hours to get help with trying to decipher exactly what he meant, but my work schedule wasn't accommodating.

this a link to his review
http://www.austincc.edu/rblack/courses/COSC1315/lectures/ExamThreeReview/index.html

questions like these I'm having troubles understanding what he asking. I asked my boyfriend for help and he doesn't know he's got about 4 years for java under his belt. My teachers great he has wonderful lectures and labs it's his written stuff that gets me he's way to vague with questions.

these are the questions I'm having issues with I guess I'm confused with the questions:
# QUESTION: How does the computer actually find a chunk of data in memory?
# QUESTION: How do we tell a function where a chunk of data lives in memory?
# QUESTION: How would you write a loop that initializes every element of the array?
# QUESTION: How do we send an array to a function as a parameter? Be sure you understand what parameters are needed to make this work.
# QUESTION: What are the major processes that a compiler performs on your program code?

thank you

ToxicFrog
Apr 26, 2008


ufarn posted:

No dice. It's the default terminal-esque client you get when you install the Windows git package.

The bottom line says ~\repo\.git\COMMIT_EDITMSG[+][RO] [unix], if that says anything.

What's "no dice"? The key sequences I suggested didn't work? 'git config' didn't? Neither? Changing core.editor should definitely work in msysgit, I've done it before.

And that's the editor status line (telling you what file you're editing, what mode it has, what line ending convention it uses, etc), but I don't recognize which editor uses that format.

Trapick
Apr 17, 2006

Queen Anneka posted:

these are the questions I'm having issues with I guess I'm confused with the questions:
# QUESTION: How does the computer actually find a chunk of data in memory?
# QUESTION: How do we tell a function where a chunk of data lives in memory?
# QUESTION: How would you write a loop that initializes every element of the array?
# QUESTION: How do we send an array to a function as a parameter? Be sure you understand what parameters are needed to make this work.
# QUESTION: What are the major processes that a compiler performs on your program code?
I'm not guaranteeing these, but I'll give it a shot...

A1: It has an address - a (16/32/64 bit location in memory). As for how it gets one initially, I don't know.
A2: We pass it an address. This would mean giving it a pointer -> passing by reference in C++.
A3:
code:
for (i=0, i<arraySize, i++)
    array[i] = 0;
A4: Uhh...this would be pretty language dependent, I would say. In C++, you would need to declare it properly initially, like
code:
 void function(int arg[]) 
but then can call it just by going
code:
 function(array); 

A5: preprocessing, code generation, linking. maybe?

ufarn
May 30, 2009

ToxicFrog posted:

What's "no dice"? The key sequences I suggested didn't work? 'git config' didn't? Neither? Changing core.editor should definitely work in msysgit, I've done it before.

And that's the editor status line (telling you what file you're editing, what mode it has, what line ending convention it uses, etc), but I don't recognize which editor uses that format.
The shortcuts didn't seem to work. I like using the regular git bash, since it works fine aside from the whole not being able to commit thing.

The Mechanical Hand
May 21, 2007

as this blessed evening falls don't forget the alcohol
Need some help with an excel problem I've come across.

I have a drop down list with names of cities in it.

I want to set this up so when you pick a city from that list another field will populate with an address associated with that city. I know it has to do with formulas and all that but I am totally lost. Any help?

ufarn
May 30, 2009
There is also an Excel thread where you might get better, swifter help.

Geno
Apr 26, 2004
STUPID
DICK
Wasn’t really sure where to put this so I’ll just post here…

So I’m interviewing for a position as a Validation Engineer at a big chip company. I graduated with a Bachelor’s in CS in June. I’ve taken some courses in Computer Architecture but it’s not something I’m great at. I’m obviously going to brush up on some fundamentals but I have no idea how much detail the interview questions can be. Anybody have any advice?

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
Talk to jawnv6 on irc

ToxicFrog
Apr 26, 2008


ufarn posted:

The shortcuts didn't seem to work. I like using the regular git bash, since it works fine aside from the whole not being able to commit thing.

...what shortcuts? You haven't said anything about shortcuts - I thought we were talking about editing commit messages when you're making a commit from the command line?

Please try the stuff I suggested, both the key sequences and changing core.editor to something you're more comfortable with. (If you aren't familiar with any text-mode editors, try 'nano' or 'pico', they're pretty friendly.)

Opinion Haver
Apr 9, 2007

pokeyman posted:

If you post the code somewhere I can take a look if you'd like, but NSAnimation is kind of generally lovely. You'll probably want to look into Core Animation if you can.

That said, it does sound like an inordinately high amount of CPU, so I'd be interested to poke around.

Here's my code; keep in mind this is my first time doing any kind of GUI programming so I have no clue what I'm doing wrong.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

yaoi prophet posted:

Here's my code; keep in mind this is my first time doing any kind of GUI programming so I have no clue what I'm doing wrong.

I sent you a pull request with the changes I made; CPU usage is now a third of what it was.

I wouldn't say you were doing anything wrong. There are some common pitfalls in view drawing. The biggest one is:

Avoid implementing -drawRect: if at all possible. If you must implement it, make it as fast as you can and your views as simple as possible. I changed your view code to get rid of -drawRect: entirely, and your KeyView no longer has any subviews.

Also, you were sending way more -setNeedsDisplay:YES than you needed, so I added a little check in the -decay method to only update if the colour would actually change.

We can take this off-thread if you'd like (check my profile), but I wrote this post in case anyone was following along at home.

Opinion Haver
Apr 9, 2007

pokeyman posted:

I sent you a pull request with the changes I made; CPU usage is now a third of what it was.

I wouldn't say you were doing anything wrong. There are some common pitfalls in view drawing. The biggest one is:

Avoid implementing -drawRect: if at all possible. If you must implement it, make it as fast as you can and your views as simple as possible. I changed your view code to get rid of -drawRect: entirely, and your KeyView no longer has any subviews.

Also, you were sending way more -setNeedsDisplay:YES than you needed, so I added a little check in the -decay method to only update if the colour would actually change.

We can take this off-thread if you'd like (check my profile), but I wrote this post in case anyone was following along at home.

Thanks; I merged the changes in and it did decrease the CPU load while actually typing to about 15%, which I think is about as good as it's going to get.

Queen Anneka
Feb 21, 2010
I've got some tic tac toe code that i've been messing around with for a final and it works but I want it to pause after someone wins. any suggestions?

#include<iostream>
using namespace std;
char board[9] ={'1','2','3','4','5','6','7','8','9'};

void drawboard()
{cout << "\n " << board[0] << " | " << board[1] << " | " << board[2] << endl;
cout<< " ---------" << endl;
cout<< board[3] << " | " << board[4] << " | " << board[5] << endl;
cout<< " ---------" << endl;
cout<< board[6] << " | " << board[7] << " | " << board[8] << endl;}

int winning(char f[])
{if(board[0] == board[1] && board[2] == board[0] )
return 1;

else if(board[3] == board[4] && board[5] == board[3])
return 1;

else if(board[6] == board[7] && board[8] == board[6])
return 1;

else if(board[0] == board[3] && board[6] == board[0])
return 1;

else if(board[1] == board[4] && board[7] == board[1])
return 1;

else if(board[2] == board[5] && board[8] == board[2])
return 1;

else if(board[0] == board[4] && board[8] == board[0])
return 1;

else if(board[2] == board[4] && board[6] == board[2])
return 1;
else
return 0;}

int main()
{char c[2] ={'X','O'};
int move;
int player=2;
for(int i=0;i<=9;i++){
if(i<9 && winning(board)==0)
{drawboard();
if(player ==1) player =2;
else player =1;
cout<<"player "<<player<<" please move"<<endl;
cin>>move;
board[move-1]=c[player-1];
{if(winning(board) == 1)
{cout<<"player "<<player<<" wins."<<endl;
return 0;
}}}

else if(i==9&&winning(board)==0)
cout<<"CAT game"<<endl;


else
cin.get();
}

}

Adbot
ADBOT LOVES YOU

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
Step 1: Use the [code] tags.

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