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
mister_gosh
May 24, 2002

Coconut Pete posted:

This is not exactly a programming question, but it is related to programming:

If you are contracted to build a web application, say a CMS or whatever, how do you feel about building it with a framework, such as CodeIgniter for PHP or Django or whatever, not counting if the client specifically requests it?

I've always kind of wondered, do you use CodeIgniter, or since you are selling the application as your own to the client, should you write all of the code by hand? Is using a framework "cheating" when selling an application?

I would think using a framework as a starting point would lessen the bill on their end, wouldn't it? Why reinvent? There will still be customizations and general work you can bill for, I don't see why they would have a problem with it. I don't think you can profit from reselling open source, so I would be careful how you implement and charge (and read the small print of any source package you use).

What I would have a problem with, as a client, is not being presented with a functional specification outlining what you are going to build the framework on (frameworks, languages, etc) prior to you starting your work.

Adbot
ADBOT LOVES YOU

mister_gosh
May 24, 2002

I have a general MVC framework question.

I have a HTML/JSP/Javascript page which renders a page and provides some basic interface, interaction and control.

I then have a servlet which is executed from a button on the page described above.

The servlet sends all information to the core model and service code.

The core stuff executes and sends the response back to the servlet which sends it back to the HTML/JSP/Javascript page.

So my question is, do I have this right?:

HTML/JSP/Javascript page = view
Servlet = controller
Model/Service = model

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

Coconut Pete posted:

This is not exactly a programming question, but it is related to programming:

If you are contracted to build a web application, say a CMS or whatever, how do you feel about building it with a framework, such as CodeIgniter for PHP or Django or whatever, not counting if the client specifically requests it?

I've always kind of wondered, do you use CodeIgniter, or since you are selling the application as your own to the client, should you write all of the code by hand? Is using a framework "cheating" when selling an application?

Hell no - the client's paying you for the end result, anything you can do to lessen the work on your end is 100% ok. (Where the "end result" includes maintainability, so don't think I'm advocating taking stupid shortcuts and hardcoding things.)

You're not selling every bit of code as being your own, you're selling the entire package. You do have to make sure the license terms on all the components you assemble allow you to resell them, but frameworks should all be ok with that, because that's what they're for.

Alan Greenspan
Jun 17, 2001

Triple Tech posted:

Why again is emulation for video games slow? Is it because the programmers lack the EXACT documentation for the original architecture? Basically is it a matter of accuracy or is it really processing power?

I guess it couldn't be processing power if today's systems are magnitudes more powerful than consoles... Also, just how powerful are the specialized components in consoles that couldn't be emulated away (quickly) in a modern desktop? (graphics, sound, "emotion", etc)

What emus are you talking about? I've only tried emus up to Playstation 1 and they all worked well. Emus of modern consoles are most likely limited by processing power. In the past, emulators were simple interpreters of the game code (fetch instruction, simulate it on x86 hardware, loop forever). Unless the modern console emus try to get some JIT compilation going I don't see a lot of hope to get them to emulate games properly on current systems.

Skychrono
May 11, 2007

I'll make you cry like I did when my daddy died!

Triple Tech posted:

Why again is emulation for video games slow? Is it because the programmers lack the EXACT documentation for the original architecture? Basically is it a matter of accuracy or is it really processing power?

I guess it couldn't be processing power if today's systems are magnitudes more powerful than consoles... Also, just how powerful are the specialized components in consoles that couldn't be emulated away (quickly) in a modern desktop? (graphics, sound, "emotion", etc)

I believe your guesses are right - we pretty much just react to the game instructions instead of really understanding them. I know there are some systems we "understand," like the NES, that we can perfectly emulate. Other than that things like the Emotion Engine and Mode 7 chips provide specialized speed for games that utilize it in the same way that a PhysX card does for computer games - we can emulate it, but it uses up speed on something else.

more falafel please
Feb 26, 2005

forums poster

Skychrono posted:

I believe your guesses are right - we pretty much just react to the game instructions instead of really understanding them. I know there are some systems we "understand," like the NES, that we can perfectly emulate. Other than that things like the Emotion Engine and Mode 7 chips provide specialized speed for games that utilize it in the same way that a PhysX card does for computer games - we can emulate it, but it uses up speed on something else.

It's really more because game console hardware is a hell of a lot more complex than it was 20 years ago. Also, the operating systems and libraries on the consoles (those exist now) have to be duplicated almost exactly, and the only documentation for them (that you can get legally, at least) is how games use them. And, you don't have the source. It'd be like handing someone a copy of Office and the x86 spec and saying "emulate Windows running on a PC, but make it run on MIPS." It's theoretically possible, but it'd be a monumental effort.

Entheogen
Aug 30, 2004

by Fragmaster

more falafel please posted:

It's really more because game console hardware is a hell of a lot more complex than it was 20 years ago. Also, the operating systems and libraries on the consoles (those exist now) have to be duplicated almost exactly, and the only documentation for them (that you can get legally, at least) is how games use them. And, you don't have the source. It'd be like handing someone a copy of Office and the x86 spec and saying "emulate Windows running on a PC, but make it run on MIPS." It's theoretically possible, but it'd be a monumental effort.

why can't some brave soul bust into the xbox labs and take off with the specs? A boy could only dream, i guess.

Triple Tech
Jul 28, 2006

So what, are you quitting to join Homo Explosion?

Entheogen posted:

why can't some brave soul bust into the xbox labs and take off with the specs? A boy could only dream, i guess.

Probably because they can tell which people have access to that level of specs and it wouldn't be worth jeopardizing their awesome careers so some kids on the Internet can play games for free.

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





Coconut Pete posted:

This is not exactly a programming question, but it is related to programming:

If you are contracted to build a web application, say a CMS or whatever, how do you feel about building it with a framework, such as CodeIgniter for PHP or Django or whatever, not counting if the client specifically requests it?

I've always kind of wondered, do you use CodeIgniter, or since you are selling the application as your own to the client, should you write all of the code by hand? Is using a framework "cheating" when selling an application?

Do you write your own language and libraries when you contract? Of course it's not cheating.

Super Mario Shoeshine
Jan 24, 2005

such improper posting...
I have a small problem right now, I want to capture the data of a field on a .dbf but i dont know how to capture chars by chars on a string. Its kinda difficult to explain but i want for example, change this field (i kid you not, this is how its formatted) "NAME/NAME2/MORE NAMES" to 3 different fields where everything is separated. :)

Sorry for the bad english

I guess i should be doing a SQL script to change all the data, and i am not really a pro at Visual FoxPro :I

Super Mario Shoeshine
Jan 24, 2005

such improper posting...
BAD DOUBLE POSTING BAD!

ashgromnies
Jun 19, 2004
Why does the command line version of md5 on my OS X laptop give me different results than the Javascript implementation at http://pajhome.org.uk/crypt/md5/ ? Since there's an RFC for md5, shouldn't they be the same?

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

ashgromnies posted:

Why does the command line version of md5 on my OS X laptop give me different results than the Javascript implementation at http://pajhome.org.uk/crypt/md5/ ? Since there's an RFC for md5, shouldn't they be the same?

Is one including the newline at the end of the line and one isn't?

ashgromnies
Jun 19, 2004

JoeNotCharles posted:

Is one including the newline at the end of the line and one isn't?

Durrrr. `echo -n` fixed it. Thanks!

ColdSnickersBar
Apr 7, 2005

A book I'm reading has all its examples in C++, and in all its examples, every class function is implemented outside the class declaration instead of inside it. Why do they do this? My best guess is to keep their focus on class relationships instead of the implementation.

Example:

code:
class MazeGame
{
 Public:
  Maze* CreateMaze();
}

Maze* MazeGame::CreateMaze () {
        Maze* aMaze = new Maze;
        Room* r1 = new Room(1);
        Room* r2 = new Room(2);
        Door* theDoor = new Door(r1, r2);
    
        aMaze->AddRoom(r1);
        aMaze->AddRoom(r2);
    
        r1->SetSide(North, new Wall);
        r1->SetSide(East, theDoor);
        r1->SetSide(South, new Wall);
        r1->SetSide(West, new Wall);
    
        r2->SetSide(North, new Wall);
        r2->SetSide(East, new Wall);
        r2->SetSide(South, new Wall);
        r2->SetSide(West, theDoor);
    
        return aMaze;
    }

I just don't see any reason why the function implementation isn't inside the class declaration. Is this for functional reasons that I'm missing, or is it just stylistic?

POKEMAN SAM
Jul 8, 2004

ColdSnickersBar posted:

A book I'm reading has all its examples in C++, and in all its examples, every class function is implemented outside the class declaration instead of inside it. Why do they do this? My best guess is to keep their focus on class relationships instead of the implementation.


Normally you'd put the declarations in a header file (maze.h) and the defintions/implementation in the .cpp/.c file. Then, when something else wants to use your class, it can #include your maze.h and, by only looking at what's exposed there, knows exactly what it can use the class for, without requiring any knowledge of implementation.

ColdSnickersBar
Apr 7, 2005

Ugg boots posted:

Normally you'd put the declarations in a header file (maze.h) and the defintions/implementation in the .cpp/.c file. Then, when something else wants to use your class, it can #include your maze.h and, by only looking at what's exposed there, knows exactly what it can use the class for, without requiring any knowledge of implementation.

Oh that's awesome. I wonder why it didn't just say that? Especially since re-usability and separating design from implementation is the main theme of the book.

Thanks!

EDIT: So, then, wouldn't declaring arguments in the function assume too much about the implementation?

EDIT2: Nevermind. I get it.

ColdSnickersBar fucked around with this message at 18:37 on Jul 9, 2008

That Turkey Story
Mar 30, 2003

ColdSnickersBar posted:

A book I'm reading has all its examples in C++, and in all its examples, every class function is implemented outside the class declaration instead of inside it. Why do they do this? My best guess is to keep their focus on class relationships instead of the implementation.

That's one of the reasons, along with it being much easier for a programmer to comprehend since they most-often just needs to know how to interface with a type rather than know its implementation, but there's also a lot more to it.

If you put the function definitions in the class definition it means that every translation unit that simply needs the class definition, for instance, just to interface with an instance of the class, now has to go through all of the function definitions as well. This can increase compile times, especially if you have a lot of units, and now whenever you change the implementation, you are going to have to recompile all the units that simply interface with your class because you put the implementation in the headers that they all include. If you had the implementation in its own unit, then changing the implementation would not imply a recompile for everything else as long as the interface stayed the same.

As well, by putting the implementation in the header that people need to include in order to interface with your class, you are pulling in any dependencies that the implementation has which the interface may not. Again, this can increase your compile times by a very large amount, especially if you are doing something like including <windows.h>, heh.

Putting the function definition inside of the class definition also implicitly makes your functions as though you used the keyword "inline," though I wouldn't worry about that since most compilers are smart enough when considering the inline hint to disregard it if you have a complex function definition anyway.

Finally a more subtle issue is that it's not always possible to put the function definition inside of the class definition because of conflicting dependencies which can only be resolved by putting includes between the class definition and the function definitions.

ColdSnickersBar
Apr 7, 2005

I don't code in C++ often. Is this something that is usually only done by C++ developers? I never see this practice on the web in, for example, C#.

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh
That's because you're not able to do it in C#.

That Turkey Story
Mar 30, 2003

Yes, a lot of this is because of the way that C and C++ code is compiled, which is very different from the systems that C#, Java, and many other languages use.

ColdSnickersBar
Apr 7, 2005

Avenging Dentist posted:

That's because you're not able to do it in C#.



That Turkey Story posted:

Yes, a lot of this is because of the way that C and C++ code is compiled, which is very different from the systems that C#, Java, and many other languages use.

Oh. :(

It's alright, I guess, since the book is really about concepts and not the code itself. Thanks for the help.

Pinkied_Brain
Aug 4, 2004

I have a regular expression question - I need to split a string on spaces, except spaces between quotes. Basically what passing arguments into a program does. Couldn't find how to do it anywhere...

So
input: Hello Mr "potato head"
output: [ Hello, Mr, potato head ]

Also would be best if unclosed quotes would be ignored:

Input: Hello "mr potato head
Output: [ Hello, "mr, potato, head ]

So, what regex do I pass into java String.split to get this?

Thanks

Counter Punch
Nov 5, 2004
I'm working on a way to transfer data from an excel spreadsheet into an old NetTerm interface.

If the data is in 27 cells across a row, I should be able to copy the entire row and then hit paste in NetTerm to transfer it all. Sometimes NetTerm takes all the data... other times it hiccups midway through and stops.

I think the problem is that copying and pasting the data passes it through too quickly for the NetTerm system to respond properly.

Is there a way to slow down the speed at which data is copied and pasted?

Lexical Unit
Sep 16, 2003

Pinkied_Brain posted:

I need to split a string on spaces, except spaces between quotes.
I don't think you'll be able to use String.split() in this case since it takes a regex for a delimiter and in your case the delimiter is " ", except when it's not. So that's not the kind definition of a delimiter that String.split() can utilize.

You should take a look at java.util.regex.Matcher as it sounds like more of what you want. Basically, you just want to find matches that are either "characters separated by spaces" or "characters separated by quotes", so this is a regex which matches that:

" ?([^ ]+|\".+\") ?".

So your code would be similar to:
code:
Pattern exp = Pattern.compile (" ?([^ ]+|\".+?\") ?");
String input = grabInput ();
Matcher matcher = exp.matcher (input);
while (matcher.find ())
{
	System.out.println (matcher.group (1));
}
However I'm pretty unfamiliar with Java in general so I don't know if the above code really compiles or if there's some trick to using String.split() to do this that I'm unaware of. Also my regex might need some tweaking depending on what you need it to do, but it should at least point you in the right direction (maybe).

Emo.fm
Jan 2, 2007
Quick, probably embarrassing, only tangentially programming related question. I'm using X11 on a Mac to ssh to a server for work, and I need to get a .zip file from said server. I can find the file on that server just fine, but how can I copy it from there to my computer? I've tried using the cp command with a destination path on my computer, but that doesn't work and I didn't really expect it to... Any ideas?

6174
Dec 4, 2004

Emo.fm posted:

Quick, probably embarrassing, only tangentially programming related question. I'm using X11 on a Mac to ssh to a server for work, and I need to get a .zip file from said server. I can find the file on that server just fine, but how can I copy it from there to my computer? I've tried using the cp command with a destination path on my computer, but that doesn't work and I didn't really expect it to... Any ideas?

Have you tried using scp or sftp on your local machine? ie

scp user@remote:/path/to/file localfilename

Night Chaos
Jun 8, 2003

Emo.fm posted:

Quick, probably embarrassing, only tangentially programming related question. I'm using X11 on a Mac to ssh to a server for work, and I need to get a .zip file from said server. I can find the file on that server just fine, but how can I copy it from there to my computer? I've tried using the cp command with a destination path on my computer, but that doesn't work and I didn't really expect it to... Any ideas?

I) This goes in SH/SC
II) Why are you using X11 to ssh, OS X has a perfectly function ssh client built in
III) To grab files from a remote server, use a normal FTP client like Transmit or Cyberduck and just use your ssh credentials to log in and browse like a normal ftp. This is called sftp and it is very useful.

Emo.fm
Jan 2, 2007

6174 posted:

Have you tried using scp or sftp on your local machine? ie

scp user@remote:/path/to/file localfilename
Thanks! This worked perfectly.

Night Chaos posted:

I) This goes in SH/SC
II) Why are you using X11 to ssh, OS X has a perfectly function ssh client built in
III) To grab files from a remote server, use a normal FTP client like Transmit or Cyberduck and just use your ssh credentials to log in and browse like a normal ftp. This is called sftp and it is very useful.
1) Yeah, I screwed up. Good thing it's all over now.
2) I am pretty inexperienced, just took a few comp sci classes in college, and my professor was very adamant that X11 is superior to OS X's Terminal. I don't know what his reasoning is, but I've always just used X11 as a result.
3) Interesting, thanks.

bitprophet
Jul 22, 2004
Taco Defender
Your compsci professor was either misinformed or just out of date -- the Terminal.app that ships with OS X has been quite decent compared to average xterm since around 10.3/10.4, and is even better now in 10.5. Given that the X11 terminal looks and behaves like complete rear end, there's no reason to use it unless you're just using it to launch a GTK app like e.g. Wireshark.

Plastic Jesus
Aug 26, 2006

I'm cranky most of the time.

bitprophet posted:

Given that the X11 terminal looks and behaves like complete rear end, there's no reason to use it unless you're just using it to launch a GTK app like e.g. Wireshark.

alias wireshark='open -a /Applications/Wireshark.app'

There is no reason to use xterm/iterm/anydamnedterm on OS X.

defmacro
Sep 27, 2005
cacio e ping pong

Plastic Jesus posted:

alias wireshark='open -a /Applications/Wireshark.app'

There is no reason to use xterm/iterm/anydamnedterm on OS X.

Except for, you know, using terminal applications.

bitprophet
Jul 22, 2004
Taco Defender

Plastic Jesus posted:

alias wireshark='open -a /Applications/Wireshark.app'

There is no reason to use xterm/iterm/anydamnedterm on OS X.

Sorry, I meant the wireshark that installs via MacPorts :v: I forget why I installed it that way and not via whatever gives you a nice shiny .app, but that's how it's set up v:shobon:v it's a GTK app and has to be launched in X11.

And, yea, it's rather difficult to avoid the terminal entirely, at least if you're a non-Cocoa developer or sysadmin.

Plastic Jesus
Aug 26, 2006

I'm cranky most of the time.

GT_Onizuka posted:

Except for, you know, using terminal applications.

I meant that there's no reason to use anything other than Terminal.app

Allie
Jan 17, 2004

Plastic Jesus posted:

I meant that there's no reason to use anything other than Terminal.app

Terminal.app doesn't do mouse reporting, which is definitely a huge reason not to use it. It's also pretty spartan feature-wise. The only thing it has going over the only other native terminal emulator, iTerm, is that it's much faster and less buggy. It really is a matter of preference. Terminal.app isn't leagues ahead of everything else or anything like that.

Scaevolus
Apr 16, 2007

How is rxtv-unicode on OS X?

more falafel please
Feb 26, 2005

forums poster

Plastic Jesus posted:

alias wireshark='open -a /Applications/Wireshark.app'

There is no reason to use xterm/iterm/anydamnedterm on OS X.

iTerm is perfectly acceptable, if that's what you're into. The only reason I used to like it was tabs, and Leopard's Terminal.app has tabs now. But it's certainly not inferior to Terminal.app.

Filburt Shellbach
Nov 6, 2007

Apni tackat say tujay aaj mitta juu gaa!
Terminal.app seems to screw up the basic 16 colors. Turning off bold and using "Use bright colors for bold text" is still not good enough. It also doesn't let you tweak the exact colors you use (except for foreground and background).

I can't seem to get rid of the scrollbar. This is totally a nitpick but it's annoying. Even tuning scrollback lines down to zero doesn't hide it. I use screen so I never actually scroll up in the terminal itself. The scrollbar is ugly wasted space.

The block cursor does not draw whatever character is under it. Playing with its color's opacity does help, but I shouldn't have to do that. I don't like the other cursor displays because it's harder to find the cursor.

iTerm gets these all of these right, so I use it. Unfortunately, it crashes practically every day. But I always run everything in screen, so it's no more than a few seconds of annoyance.

Filburt Shellbach fucked around with this message at 13:14 on Jul 10, 2008

Allie
Jan 17, 2004

You can use TerminalColours to customize the color scheme.

If you want mouse reporting, I'm working on MouseTerm which implements it for Terminal.app. So far it only does mouse wheel scrolling, but it does simulated scrolling in fullscreen applications as well (like gnome-terminal).

Adbot
ADBOT LOVES YOU

Counter Punch
Nov 5, 2004

Counter Punch posted:

I think the problem is that copying and pasting the data passes it through too quickly for the NetTerm system to respond properly.

Is there a way to slow down the speed at which data is copied and pasted?

Any ideas?

Am I asking this in the wrong place?

Thanks...

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