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
Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
You need to answer csammis's questions but generally your assembler should have some way to store a string constant as a variable in memory. Now all you have to do is send that variable as an argument to whatever function you are using to print.

If your using 16 bit x86 DOS you can just call int 21h.

quote:

INT 21 - DOS 1+ - WRITE STRING TO STANDARD OUTPUT
AH = 09h
DS : DX -> '$'-terminated string
Return: AL = 24h (the '$' terminating the string, despite official docs which
state that nothing is returned) (at least DOS 2.1-7.0 and
NWDOS)
Notes: ^C/^Break are checked, and INT 23 is called if either pressed
standard output is always the screen under DOS 1.x, but may be
redirected under DOS 2+
under the FlashTek X-32 DOS extender, the pointer is in DS:EDX
SeeAlso: AH=02h,AH=06h"OUTPUT"

Here's a tiny example, but be advised that this isn't the best way to do it since it's old school DOS.
code:
message db 'Hello World!$'
print:
   mov dx, offset message
   mov ah, 09
   int 21h

Janitor Prime fucked around with this message at 10:36 on Mar 6, 2008

Adbot
ADBOT LOVES YOU

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Most *nix installs have Perl installed by default, so that might be your best choice.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
What about something like Dominoes and we each have to create a client that has to beat the rest.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

JoeNotCharles posted:

Python.

Some will say Perl, but Perl is terrible. Others will say Ruby, which is a better choice, but I think Python will fit your background better.

I don't it's fair to dismiss a language as terrible without any explanation. In fact you didn't even mention why ruby or python are any better than Perl at text processing which has always been Perl's forte.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Plastic Jesus posted:

Can't you just do strchr('\n') (or strstr("\r\n") on windows)?

No the problem is that when you use scanf it removes the endline characters from the string.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
WTF does the ^ character mean? Is it supposed to be a better *?

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Well most open source programs are written in Linux so you should familiarize yourself with the build environment and tools. The languages vary but I'd say that the majority are written in C/C++.

Other than that you can get started by just checking out the source code and looking at their data structures. A lot of OS projects have developer wikis which can steer you in the right direction.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
A regular expression can do this easily. You just need a text editor that lets you replace using a regular expression.

This will match the test and separate it into 3 tags.
code:
([A-Z]+)([0-9]+)([A-Z]*)
The [A-Z]+ will match at least the first letter and any subsequent letters and place them into the first tag. The [0-9]+ will match the first number after the letters and any additional numbers and place them into tag 2. The final part [A-Z]* will match the first letter after the last tag and anything else after that letter.

Then all you have to do is replace using the 3 tags. This is how you would do it in notepad++. Notice the spaces between the 3 classes.
code:
\1 \2 \3
I'm not sure if you can do this directly in Excel, but if you can copy that column in a text editor it should work.

Janitor Prime fucked around with this message at 08:12 on May 7, 2008

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Yes you need to switch to the replace tab and then you push the replace all button.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Interfaces allow you to have more freedom than simple inheritance while at the same time giving you all the benefits like polymorphism.

I'll give you a good example of one I did recently. I was writing a B+ tree data structure. If you've ever studied the B+ tree you know that it has 2 different kinds of nodes. It has index nodes which are really just 2 arrays with one being an array of pointers to other nodes and it has the leaf nodes which is where the data is actually stored. Now both these classes share a lot of methods like insert, search and delete but each one has to implement it differently since they have different internal structures. So I created a Node interface with the above methods which these two classes implement. Now I can pass around Node objects without having to worry if they are leaf nodes or index nodes*.

Now I could have used normal inheritance with abstract functions but then if I ever wanted to inherit from another class I couldn't.

e: csammis where those methods come from? You have to inherit them from some place and in languages that don't allow multiple inheritance you have to use interfaces so that you can have multiple even handlers for one object. I think Incoherence said it wrong, I'm sure he meant that one object can have multiple even't handlers like keyboard and mouse, not that many objects can share the keyboard event handler. Because in that case you are correct, interfaces have nothing to do with it.

Janitor Prime fucked around with this message at 20:43 on May 7, 2008

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

csammis posted:

I know what Incoherence meant about one event having multiple handlers, but I'm not sure where you're coming from. Inheriting a method? :psyduck: Where are you inheriting the method from when you use a delegate in C#? How about registering a method callback in C++? Event handling is a concept that has absolutely nothing to do with interfaces. Interfaces only come into it as an implementation detail of Java's Listener pattern.

Well that shows how much I know about either of those languages. :downs:

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Rather than worry about it, why don't you just give one of them precedence? Like if the user select both options just take the one in the text field.


If you really care about it, then what you want is the XOR operator. It returns true only when one of the options are selected.

So you could do:
code:
boolean var = (document.gameform.gameNo.value == "") XOR (document.gameform.level.value == "")
Then you could check if that variable is true or false, and in the case of false you alert the user that he either didn't enter a value or that he can only select one option. This is assuming that javascript has an XOR operator and boolean variables. I'm sorry but I don't know any JS but that idea is valid in most languages.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Tripwire what you want to do is divide your population into n parts where n is the number of processes you want to run in parallel. Each child process finds the worst and best member of their segment of the population and returns the results. Then the parent thread makes n comparisons from the results and finds the best/worst of the entire population and generates the new offspring. This is probably the easiest way to distribute the work.

I know jack poo poo about python, so your efficiency problems might be solved by the other recommendations.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Scaevolus posted:

Macs, because OS X is Unix-derived, which is a much better programming environment than Windows.

Unless your doing .Net

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Geno posted:

I've been programming for less than a year and am not really good at explaning things so bare with me.

I have no idea what the gently caress you're trying to do. Try telling us what you want to do in words rather than code.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Incoherence posted:

The XOR trick probably works in more languages than tuple-unpacking in Python, but it has a significant effect on code clarity (what the gently caress are all of these ^=s doing in my code), and as an optimization it's fairly negligible.

If everyone knows about the trick then how does that make it unreadable. I think a comment like this would do just fine.
code:
// Swapping variables using stupid XOR trick
x ^= y;
y ^= x;
x ^= y;

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Munkeymon posted:

I think teapot got permabanned from here, but that would have been further back than a few months.

Yeah I remember teapot getting banned, but that was a while ago.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Ari posted:

This works for some people and not for others. For me, it's crucial sometimes to see a code listing on paper, because that's how my head works. I therefore recommend this if you've never tried it, to see how it works for you.

I'm taking a PSP course right now and for each code review we have to print all the code.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Avenging Dentist posted:

Why would learning about how to code for the Playstation Portable necessitate printouts of code?

PSP

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Contero posted:

PSP is good, but have you tried the team-oriented synergy production process management using the fred brooks extreme software-driven data requirement metric analysis documentation for mythical man usability unit coverage tests in agile object oriented model-view-controller business logic development?

I run a seminar if you're interested.

Sounds just like what I need to get that promotion. Do you accept blank cheques?

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

ufarn posted:

I have an assignment in CS to make a concatenator that merges several text files into one (Java ClassName text1.txt text2.txt text3.txt compilation.txt), but we've received no useful reading resource for doing so.

Does anyone know some good guides on the subject online?

Check out the BufferedReader class in the API, it has a clear example on how to open a file.
code:
BufferedReader in = new BufferedReader(new FileReader("foo.in"));
Then you can use the readLine() method to get each line of text.

For writing a file check out the PrintWriter class.
code:
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
This class is useful because of all the different print methods that it has.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Here is some pseudo code to help you.
code:
Main:
  while true
    ask for input
    if isValid(input)
        break
    print error

  exit

boolean isValid (input)
  return checkLength(input) && checkNumber(input) && checkRepeat(input)

boolean checkLength(input)
...
etc
e: I hate your avatar so much.

Janitor Prime fucked around with this message at 01:52 on Nov 18, 2009

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Get everyone on the team to agree on a set of coding standards and then refactor the whole code base with some automated tool.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Avenging Dentist posted:

Python is strongly typed. The word you're looking for is "statically".

God I hate the strong and weak type terminology. It's pretty useless since most languages are strongly typed anyways.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Javascript is too I think, but I just don't like the term because like you said C and C++ could both be considered weakly typed.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

OverloadUT posted:

D&D poo poo

I actually did this for django project, I'll upload it later so that you can all laugh at how bad it is :)

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
TheGopher you don't seem to "get" SA, you should have lurked more in CoC before making your posts. You've seriously gotten a lot a help and attention from some of the most experienced software developers on this board. Why did you come here expecting everyone to play nice with you?

Here is another valid answer to your questions.
Teach Yourself Programming in Ten Years

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

notMordecai posted:

I drink lots of it but it's not really THAT kind of internship. It pays really well and am basically like one of the employees in both status and responsibility. I guess it's why I am worried about slowing things down a tad.

But that is inevitable even if you were going to be a full time employee, so stop worrying.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Well it is if he doesn't want to create a ton of sites that aren't full of SQL and XSS vulnerabilities, otherwise sure he can learn to code in 6 months.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
You realize that people can just clone your mac and still use your wifi?

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Magnum1371 posted:

The guy I'm trying to help out lives in a apartment that is 50/50 retired people and college kids.

E:

I probably should tell him to use the default encryption. -and I think I already have, but I believe he said something about one of his devices not being able to use it. Either way any guide for that type of setup would be nice since I'd like to do something similiar when I get back to the states and have my own wifi.
\/\/
If that's really the case then the best he can hope for is setting up a MAC filter.

In the router go to the wireless security setting and it should have an option to filter by MAC address. Enable it and only add the MACS that you want to connect to the network. To find the mac address on windows open the command prompt and type [code]ipconfig /all[code], that will tell you the MAC address of every network card on the computer and you just have to find the one that belongs to the wireless card.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
This post is full of spoilers, so don't read if you want to figure it out yourself.
A better solution to that problem is start at the row last-1, and last. You then compare the position below and the position below+1 and add the greater of them to the current one. I probably said that in a retarded way, so this example will help clear it up. Looking at the last two rows in the problem:

63 66 04 68 89 53 67 30 73 16 69 87 40 31
04 62 98 27 23 09 70 98 73 93 38 53 60 04 23

You add the greater of 04 and 62 to 63, which gives you 125. You repeat for everything number left in the row until your row last-1 equals the following:

125 164 102 95 112 123 165 128 166 109 122 147 100 54

You repeat this process all the way to the top and you'll know the answer.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
It depends on what you want people to do with it. If you don't give a poo poo then go for BSD. If you do want them to contribute any modifications back then use an lgpl.

If it's a library and you want people to use it, then you really shouldn't release it as GPL. lgpl, Apache or BSD are more appropriate and will help in convincing others to use it.

edit: This question has some good commentary. http://stackoverflow.com/questions/40100/apache-licence-vs-bsd-vs-mit

Janitor Prime fucked around with this message at 00:44 on Sep 25, 2010

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

mr_jim posted:

Well, you see, there isn't a need for an integer type because numbers are represented by the depth of the call stack.
      /
:smug:

:barf:

drat you all.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Take a look at this http://docs.python.org/library/string.html#formatspec and this http://docs.python.org/library/functions.html#format.

The line should look like this:
code:
 print "So, you're {0} old, {1} tall and {2} heavy.".format(age, height, weight)

Janitor Prime fucked around with this message at 18:39 on Dec 24, 2010

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

csammis posted:

Feelin' sorry for all you guys with computer science degrees that should have been labeled "software engineering" :riker:




e: I kid, I kid. Please let's not drive this thread over the "what is school for" cliff.

Haha I was about to respond before you edited it. But honestly that's the problem with most schools they either teach too much of one thing or the other. It's hard to find the right balance, but I feel it's what most schools should strive for if they want to create marketable graduates.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Bob Morales posted:

There's a lot to be said for people who program in the old 'BASIC interpreter' style. Write a few lines, run it, change some stuff, run it again...

I find myself doing this a lot when I don't know the API of some library I want to use.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Otto Skorzeny posted:

BigRedDot, half the poo poo you mentioned doesn't apply to mobile or console processors, none of it applies to embedded processors, as mentioned several items are designed to be tranparent to the programmer at any level above microcode (eg. instruction pipelining and out-of-order execution, the latter of which is ironic to mention as it transparently mitigates some of the penalties associated with branching and dependency hazards in light of the former and thus makes the abstraction less leaky) and just... ugh. You're straining at gnats and swallowing camels.

This is probably the biggest gap in my programming knowledge, but how the hell can I know if my high level (Python, Java, C#) code is provoking cache misses? Is there some profiling tool that can tell me?

Do I have to necessarily be programming in some kind of assembly code to get the most out of my embedded hardware, or is just following certain best practices? I've never done any kind of embedded/mobile coding so I'm quite curious to know more on the subject.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

cannibustacap posted:

Thanks, my only concern with just making a simple .JAR file and run it through a command line is that it won't return values.

I wish I could do a "static int main(String[] args)" type of thing and return output codes, but I can't...

Or can I?

I think that if you do a System.exit(#number) that the number is returned to the process that invokes the jar. Or else you could println the stuff you want and simply read the output stream from your C++ app.

Adbot
ADBOT LOVES YOU

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
System.exit can only affect the JVM.

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