HalibutPassion FishSwimming in obscurity.Registered Userregular
edited November 2007
Head First Design Patterns is probably the best book I've read on patterns. It's an easy read, and the material is presented really well. And you won't find anything completely obscure. It's all pretty useful for a professional (OO) software developer.
Head First Design Patterns is probably the best book I've read on patterns. It's an easy read, and the material is presented really well. And you won't find anything completely obscure. It's all pretty useful for a professional (OO) software developer.
Beginning developers never met a pattern or an object they didn't like. Encouraging them to experiment with patterns is like throwing gasoline on a fire. And yet that's exactly what this book does [...] Do you really want a junior developer using patterns everywhere? It's about as safe as encouraging them to "experiment" with a gas-powered chainsaw. The best way to learn to write simple code is to write simple code! Patterns, like all forms of compexity, should be avoided until they are absolutely necessary. That's the first thing beginners need to learn. Not the last thing.
I picked up a book on Actionscript 3 design patterns, and after 2 chapters on OOP principles in Actionscript, all I can think of was "I have no valid use for any of this". Because most of the work I do in Flash is small-scale.
And the two other AS3 books I picked up both basically tell you to completely OOP even the simplest things.
OOP is nice but if it causes you to take twice as long to do something, gotta ask yourself if that lost time will ever repay in the future. In Actionscript the answer is usually no because of the nature of the projects, in ASP.NET the answer is almost always yes because you're repeating similar operations on many pages.
He was specifically asking how to avoid compromising his password if his server was misconfigured to send PHP scipts as plain text, which your solution does not address. Get a better hosting provider.
.... why would I change my hosting provider? My server doesn't serve PHP as plain text. Never will.
And if your server was misconfigured to send PHP scripts as plain text instead of executing them, then nothing PHP would work ever. period. end of story. If you can't run PHP at all, then it's not likely you're going to start MySQL development on it.
First get PHP running. Then try to use it. Not the other way around.
He was specifically asking how to avoid compromising his password if his server was misconfigured to send PHP scipts as plain text, which your solution does not address. Get a better hosting provider.
.... why would I change my hosting provider? My server doesn't serve PHP as plain text. Never will.
And if your server was misconfigured to send PHP scripts as plain text instead of executing them, then nothing PHP would work ever. period. end of story. If you can't run PHP at all, then it's not likely you're going to start MySQL development on it.
First get PHP running. Then try to use it. Not the other way around.
Issues pop up from time to time where scripts are sent as plain text. It happens to good providers too.
Issues pop up from time to time where scripts are sent as plain text. It happens to good providers too.
I've never seen this happen to any provider, either good or bad. Is there an example of anything anywhere that causes this? The only way I could think of it happening is if you removed all of the PHP modules from apache's config and then restarted apache. It's something you'd have to do on purpose, not by a common (or even uncommon) error. Or you could blow away PHP by mistake but then I'm pretty sure you'd get a 500 internal server error.
"Issues pop up" that apparently I've never seen on any site I've ever visited at any time anywhere on the internet over the span of more than a decade? I have a hard time believing that something that rare can even be considered a legitimate problem.
Issues pop up from time to time where scripts are sent as plain text. It happens to good providers too.
I've never seen this happen to any provider, either good or bad. Is there an example of anything anywhere that causes this? The only way I could think of it happening is if you removed all of the PHP modules from apache's config and then restarted apache. It's something you'd have to do on purpose, not by a common (or even uncommon) error. Or you could blow away PHP by mistake but then I'm pretty sure you'd get a 500 internal server error.
"Issues pop up" that apparently I've never seen on any site I've ever visited at any time anywhere on the internet over the span of more than a decade? I have a hard time believing that something that rare can even be considered a legitimate problem.
This is all pretty irrelevant. A question was asked, a solution was offered (putting the config file above the web root). If it matters to you so much, make a thread or something.
I picked up a book on Actionscript 3 design patterns, and after 2 chapters on OOP principles in Actionscript, all I can think of was "I have no valid use for any of this". Because most of the work I do in Flash is small-scale.
And the two other AS3 books I picked up both basically tell you to completely OOP even the simplest things.
OOP is nice but if it causes you to take twice as long to do something, gotta ask yourself if that lost time will ever repay in the future. In Actionscript the answer is usually no because of the nature of the projects, in ASP.NET the answer is almost always yes because you're repeating similar operations on many pages.
Your mileage may vary.
Actionscript is basically the same as Javascript, so any book you pick up should have stressed functional and prototype-based programming. If it had objects anywhere in it (aside from "how to port OOP code to..."), it's not a good book.
He was specifically asking how to avoid compromising his password if his server was misconfigured to send PHP scipts as plain text, which your solution does not address. Get a better hosting provider.
.... why would I change my hosting provider? My server doesn't serve PHP as plain text. Never will.
Your hosting provider doesn't allow you to put files outside the webroot. That's idiotic.
And if your server was misconfigured to send PHP scripts as plain text instead of executing them, then nothing PHP would work ever. period. end of story. If you can't run PHP at all, then it's not likely you're going to start MySQL development on it.
First get PHP running. Then try to use it. Not the other way around.
And if you get PHP running, have it serving an important site, and then some intern at the hosting company fucks up a config file and whoooooops all your passwords are exposed? What then? If your company had allowed you to store files outside the webroot, the risk would be hugely reduced. For that matter, it doesn't even need to be the provider's fuck-up - maybe a developer working on your site put in one too many "?>"s and exposed half the page's source. If you had passwords sitting in that half, you've got trouble.
I picked up a book on Actionscript 3 design patterns, and after 2 chapters on OOP principles in Actionscript, all I can think of was "I have no valid use for any of this". Because most of the work I do in Flash is small-scale.
And the two other AS3 books I picked up both basically tell you to completely OOP even the simplest things.
OOP is nice but if it causes you to take twice as long to do something, gotta ask yourself if that lost time will ever repay in the future. In Actionscript the answer is usually no because of the nature of the projects, in ASP.NET the answer is almost always yes because you're repeating similar operations on many pages.
Your mileage may vary.
Actionscript is basically the same as Javascript, so any book you pick up should have stressed functional and prototype-based programming. If it had objects anywhere in it (aside from "how to port OOP code to..."), it's not a good book.
Well, not completely. With the approach of Adobe Air and Flex there is a much bigger emphasis with Actionscript 3 for large scale applications, so the OOP has some relevance. Unfortunately their editor tools are pretty crappy for OOP development in my opinion. When you create a new class you can't even get info on it in code assist like in Visual Studio. They are a whole major release away from anyone taking Actionscript 3 seriously, methinks.
I bought the books assuming that AS3 was some sort of replacement for 2, hahaha, not really.
If I have an Label that contains an Icon, part of which I want to change the color of... hm, shit... and the part that I want to change the color of is a Rectangle2D that is defined within the draw method of the shape that the Icon is representing... shit, I don't even know what to call.
Do I getGraphics() from the label so I have the graphics object? Then what?
If I have an Label that contains an Icon, part of which I want to change the color of... hm, shit... and the part that I want to change the color of is a Rectangle2D that is defined within the draw method of the shape that the Icon is representing... shit, I don't even know what to call.
Do I getGraphics() from the label so I have the graphics object? Then what?
And there's a repaint in there somewhere...
First you need to say which language you're using. :P
Head First Design Patterns is probably the best book I've read on patterns. It's an easy read, and the material is presented really well. And you won't find anything completely obscure. It's all pretty useful for a professional (OO) software developer.
Beginning developers never met a pattern or an object they didn't like. Encouraging them to experiment with patterns is like throwing gasoline on a fire. And yet that's exactly what this book does [...] Do you really want a junior developer using patterns everywhere? It's about as safe as encouraging them to "experiment" with a gas-powered chainsaw. The best way to learn to write simple code is to write simple code! Patterns, like all forms of compexity, should be avoided until they are absolutely necessary. That's the first thing beginners need to learn. Not the last thing.
I agree with part of this statement. There is a difference between knowing how a pattern can help improve your software, and knowing when your software really needs that improvement. For simple applications, you might not get a lot of use out of them, and you should always stop and think about why you might need to use one.
However, the poster was asking about different types of patterns, and I have not read a book that even remotely explains them as well as the Head First one. I didn't really read the link, but the part you quoted says that beginning developers shouldn't experiment with patterns. Experimenting is the best way to learn when to use them and when not to use them.
That said, until you can see a problem and can immediately say "pattern xyz would be a good fit here for a,b,c, and d reasons" you probably shouldn't be using them on any project with importance. If you are a junior developer at a software company, you normally won't be making that kind of decision without the aid of a more senior developer anyway. If you are a student, you obviously shouldn't be using an unfamiliar pattern on a project the night before it is due. If you have never programmed before you shouldn't start with patterns, and the book is not intended for people who do not have at least a basic understanding of OO concepts.
On top of that, the risks of experimentation in a "real" project can be greatly reduced with the help of things like version control, or asking a mentor/teacher for help. I don't think the goal of the book was to tell beginning programmers to go back and modify the source code of a project behind the backs of their peers or team leads. I would hope that no one is that stupid.
It's in Java. Blah. This seems like it should be very simple, but it would have helped if our teacher taught us anything.
Sometimes Java can be the devil language if you want to do something simple. And then for other more complicated things it can be a breeze. It's strange that way.
Anyhow, it would help if you copied & pasted the code you want to edit so that we can see what you're talking about.
Alright, well, I've made my own modifcations to the code for other purposes, because we were basically supposed to extend the functionality in various parts of it... I'll just post the unmodified code, because it'd be a mess, as I've added various sliders and buttons to do different things:
animation tester:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
This program implements an animation that moves
a car shape.
Original code by Cay Horstmann: www.horstmann.com
*/
public class AnimationTester
{
public static void main(String[] args)
{
JFrame frame = new JFrame();
final MoveableShape shape = new CarShape(0, 0, CAR_WIDTH);
ShapeIcon icon = new ShapeIcon(shape,
ICON_WIDTH, ICON_HEIGHT);
final JLabel label = new JLabel(icon);
frame.setLayout(new FlowLayout());
frame.add(label);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
final int DELAY = 100;
// Milliseconds between timer ticks
Timer t = new Timer(DELAY, new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
shape.translate(1, 0);
label.repaint();
}
});
t.start();
}
private static final int ICON_WIDTH = 400;
private static final int ICON_HEIGHT = 100;
private static final int CAR_WIDTH = 100;
}
carshape:
import java.awt.*;
import java.awt.geom.*;
import java.util.*;
/**
A car that can be moved around.
Original code by Cay Horstmann: www.horstmann.com
*/
public class CarShape implements MoveableShape
{
/**
Constructs a car item.
@param x the left of the bounding rectangle
@param y the top of the bounding rectangle
@param width the width of the bounding rectangle
*/
public CarShape(int x, int y, int width)
{
this.x = x;
this.y = y;
this.width = width;
}
public void translate(int dx, int dy)
{
x += dx;
y += dy;
}
public void draw(Graphics2D g2)
{
Rectangle2D.Double body
= new Rectangle2D.Double(x, y + width / 6,
width - 1, width / 6);
Ellipse2D.Double frontTire
= new Ellipse2D.Double(x + width / 6, y + width / 3,
width / 6, width / 6);
Ellipse2D.Double rearTire
= new Ellipse2D.Double(x + width * 2 / 3, y + width / 3,
width / 6, width / 6);
// The bottom of the front windshield
Point2D.Double r1 = new Point2D.Double(x + width / 6, y + width / 6);
// The front of the roof
Point2D.Double r2 = new Point2D.Double(x + width / 3, y);
// The rear of the roof
Point2D.Double r3 = new Point2D.Double(x + width * 2 / 3, y);
// The bottom of the rear windshield
Point2D.Double r4 = new Point2D.Double(x + width * 5 / 6, y + width / 6);
Line2D.Double frontWindshield = new Line2D.Double(r1, r2);
Line2D.Double roofTop = new Line2D.Double(r2, r3);
Line2D.Double rearWindshield = new Line2D.Double(r3, r4);
g2.draw(body);
g2.draw(frontTire);
g2.draw(rearTire);
g2.draw(frontWindshield);
g2.draw(roofTop);
g2.draw(rearWindshield);
}
private int x;
private int y;
private int width;
}
moveableshape
import java.awt.*;
/**
A shape that can be moved around.
Original code by Cay Horstmann: www.horstmann.com
*/
public interface MoveableShape
{
/**
Draws the shape.
@param g2 the graphics context
*/
void draw(Graphics2D g2);
/**
Moves the shape by a given amount.
@param dx the amount to translate in x-direction
@param dy the amount to translate in y-direction
*/
void translate(int dx, int dy);
}
ShapeIcon:
import java.awt.*;
import java.util.*;
import javax.swing.*;
/**
An icon that contains a moveable shape.
Original code by Cay Horstmann: www.horstmann.com
*/
public class ShapeIcon implements Icon
{
public ShapeIcon(MoveableShape shape,
int width, int height)
{
this.shape = shape;
this.width = width;
this.height = height;
}
public int getIconWidth()
{
return width;
}
public int getIconHeight()
{
return height;
}
public void paintIcon(Component c, Graphics g, int x, int y)
{
Graphics2D g2 = (Graphics2D) g;
shape.draw(g2);
}
private int width;
private int height;
private MoveableShape shape;
}
So basically I know how to add buttons and actionlisteners for those buttons to the animation tester class...
I made 3 seperate buttons in my code, one each for red, blue, and green. I'm trying to figure out how to make it so that each button fills in the body of the car to be the given color. Would it be smart of me to have the car be initially filled as one color? That I can do. It's just I'm not sure which object's methods I should be calling to change that color within the button... I know I need to set some graphics object to a color, and then repaint, I guess?
It's in Java. Blah. This seems like it should be very simple, but it would have helped if our teacher taught us anything.
Sometimes Java can be the devil language if you want to do something simple. And then for other more complicated things it can be a breeze. It's strange that way.
Anyhow, it would help if you copied & pasted the code you want to edit so that we can see what you're talking about.
From what I've seen, in a lot of cases if Java code appears simple it's because it actually is complicated but someone else already did most of the work for you.
Ah, a place for a lowly university programming undergrad to hang his hat at last. Janin, I salute you!
EDIT: In fact, I have a probably very elementary question for you all I've been unable to find an answer to. It's not actual programming but very related.
Basically, I have a Macbook Pro, bootcamped. On the windows side, I can program in java using a .jar called graphics.jar, simply by typing import graphics.*; at the top of my code. It works straight away.
However, I'd dearly like to be able to program my stuff in OSX, because it's a pain going back and forth for this (I intended the bootcamp just for games). I cannot get the terminal compiler to recognise graphics.jar whatever I do. I have tried the classpath method as well as another I can't recall right now (2 in the morning) but neither resulted in success. I've come to the conclusion that the MANIFEST.MF file doesn't have what's needed. Graphics.jar contains several classes such as circles, rectangles, points, lines, etc. So, where do I go from here? I assume I'm being very stupid and this is exceedingly simple, as I'm struggling to find anything very clear/relevant using Google... Any help would be much appreciated.
Basically, I have a Macbook Pro, bootcamped. On the windows side, I can program in java using a .jar called graphics.jar, simply by typing import graphics.*; at the top of my code. It works straight away.
It's a classpath issue, or it's a fucked up JAR file on your OS X partition. There is no reason why Windows is able to use a JAR file and Mac OS X doesn't.
You could try putting the JAR into /Library/Java/Extensions to see if it's recognised when you do that. That folder is on the OS X classpath by default.
See in your car's draw method where you draw the body?? to change the color you'd need to call g.setColor(Color); before it. You'll probably have to store the color inside the car so you can change it. You can call ShapeIcon.repaint() on your Icon control after so you see the modifications.
Another thing. I thought .draw() didn't fill the Shape... I'm curious what your icon looks like, could you post a small image of it? :P
I'm currently working with a friend of mine who owns a games-webshop on helping him run the community side of the site (news posts etc).
It would be a great advantage to both of us if I knew some PHP, but sadly I don't. I do however have a (very) basic knowledge of Pyhon and apprently that should help. Could anyone here recommend a book or on-line resource to help me learn PHP?
Apologies if this has been covered here before but PHP is one letter short of the required search length.
Basically, I have a Macbook Pro, bootcamped. On the windows side, I can program in java using a .jar called graphics.jar, simply by typing import graphics.*; at the top of my code. It works straight away.
It's a classpath issue, or it's a fucked up JAR file on your OS X partition. There is no reason why Windows is able to use a JAR file and Mac OS X doesn't.
You could try putting the JAR into /Library/Java/Extensions to see if it's recognised when you do that. That folder is on the OS X classpath by default.
You are a genius. I can't thank you enough! Finally I can program in my favourite OS 8-)
I'm a Computer Science major (well... Working on it) and I love programming in all aspects. But I'm curious, what language is everyone's favorite? I have only programmed in C++ and Java, and love them both.
I'm currently working with a friend of mine who owns a games-webshop on helping him run the community side of the site (news posts etc).
It would be a great advantage to both of us if I knew some PHP, but sadly I don't. I do however have a (very) basic knowledge of Pyhon and apprently that should help. Could anyone here recommend a book or on-line resource to help me learn PHP?
Apologies if this has been covered here before but PHP is one letter short of the required search length.
Thanks!
It's bare bones, and I can't judge it's usefulness for the total beginner but I found the W3 Schools to be functional and too the point. I went from knowing nothing about PHP to writing a custom, secure login/registration system with MySQL backend in a couple of days using it and the php.org docs.
I'm a Computer Science major (well... Working on it) and I love programming in all aspects. But I'm curious, what language is everyone's favorite? I have only programmed in C++ and Java, and love them both.
I like Lisp's syntax (or, lack of), but after using the Python standard library I can't get used to Lisp's comparatively anemic libs.
I'm currently working with a friend of mine who owns a games-webshop on helping him run the community side of the site (news posts etc).
It would be a great advantage to both of us if I knew some PHP, but sadly I don't. I do however have a (very) basic knowledge of Pyhon and apprently that should help. Could anyone here recommend a book or on-line resource to help me learn PHP?
Apologies if this has been covered here before but PHP is one letter short of the required search length.
Thanks!
Rather than writing your own site, you should probably just use a pre-built system like PostNuke.
I'm a Computer Science major (well... Working on it) and I love programming in all aspects. But I'm curious, what language is everyone's favorite? I have only programmed in C++ and Java, and love them both.
Depends what I'm trying to accomplish.
UNIX scripting - Perl
OOP (enterprise level) - Java
OOP (stuff for me) - Ruby or Python. I like Ruby more as a paradigm (everything is an object, yay!) but really appreciate Python's lack of syntax cruft.
Interweb sites - Rails
Mac OS X development - Objective-C. I really like Objective-C with the Cocoa libraries; it's the OOP version of C that we should all really be using rather than C++, but C++ is slightly faster. Now it has garbage collection on Mac OS X (memory management was utterly miserable), I should think it's pretty damn sweet.
I'm currently learning Haskell, which has the lack of syntax cruft ala Python, but makes you write more concise, mathematical code. I quite like it now I have the ability to understand it, when I tried it as a 2nd year I hated it, and wondered how it could ever be useful.
Lewisham on
0
Options
HalibutPassion FishSwimming in obscurity.Registered Userregular
I'm a Computer Science major (well... Working on it) and I love programming in all aspects. But I'm curious, what language is everyone's favorite? I have only programmed in C++ and Java, and love them both.
Depends what I'm trying to accomplish.
UNIX scripting - Perl
OOP (enterprise level) - Java
OOP (stuff for me) - Ruby or Python. I like Ruby more as a paradigm (everything is an object, yay!) but really appreciate Python's lack of syntax cruft.
Interweb sites - Rails
Mac OS X development - Objective-C. I really like Objective-C with the Cocoa libraries; it's the OOP version of C that we should all really be using rather than C++, but C++ is slightly faster. Now it has garbage collection on Mac OS X (memory management was utterly miserable), I should think it's pretty damn sweet.
I'm currently learning Haskell, which has the lack of syntax cruft ala Python, but makes you write more concise, mathematical code. I quite like it now I have the ability to understand it, when I tried it as a 2nd year I hated it, and wondered how it could ever be useful.
I'd add that Java has a huge selection of open source libraries at your disposal. Generally, if I want to do something complex, there is already a Java library that can do it for me.
C# as a language is pretty good, but it doesn't have the open source support that Java does (it probably will with time).
You can do a lot with scripting languages (Ruby, Python, Perl, etc...) and you can generally do it a lot faster than with a statically typed language. I use Ruby or Python for just about everything that I don't require a lot of speed for.
Most people hate C++, but I kind of like it. Most of its faults can be alleviated by making a point to not use every single feature it offers. Simplicity goes a long way. That said, you probably only need to use C++ if you are doing something complicated... or something where speed is a primary concern.
Okay one last question and I'll stop being a pest. I was wondering if you guys had any idea of where to start programming games? Like is there a kit or something I can buy to mess around with?
See in your car's draw method where you draw the body?? to change the color you'd need to call g.setColor(Color); before it. You'll probably have to store the color inside the car so you can change it. You can call ShapeIcon.repaint() on your Icon control after so you see the modifications.
Another thing. I thought .draw() didn't fill the Shape... I'm curious what your icon looks like, could you post a small image of it? :P
Yeah... you need to use .fill() instead of .draw()
Meh
I'll figure this out
Okay one last question and I'll stop being a pest. I was wondering if you guys had any idea of where to start programming games? Like is there a kit or something I can buy to mess around with?
Do you want to write a game with fancy graphics and lots of physics, or a simple game like what you might see on a Gameboy, or in-between?
For simple games, the easiest way to go is Flash. For mid-tier, try Python + OpenGL + SDL. For complex games, learn C and Assembly, and start reading heavy math textbooks for fun.
Rather than writing your own site, you should probably just use a pre-built system like PostNuke.
Luckily, there are some vastly more experienced people working on that. I think this would purely be for maintenance work and is very much a long-term thing.
It's bare bones, and I can't judge it's usefulness for the total beginner but I found the W3 Schools to be functional and too the point. I went from knowing nothing about PHP to writing a custom, secure login/registration system with MySQL backend in a couple of days using it and the php.org docs.
Thanks that should definitively be a nice starting base. Any other recommendations would still be appreciated.
I'm a Computer Science major (well... Working on it) and I love programming in all aspects. But I'm curious, what language is everyone's favorite? I have only programmed in C++ and Java, and love them both.
I work mostly in VB.NET and C#, and love both of them. I like the syntax of VB.NET a lot more than C#, but it is the red-headed step-child in terms of features. Unfortunately VB.NET still has the stigma of VB6 attached to it. I am working on learning F#. I know Java, but don't like working with it. I know C++, but I have no desire to manage my own memory.
I hate dynamic languages. I think the productivity gain that people see from them are from the functional programming elements that the languages tend to include (Ruby, I'm looking at you!), and not from being dynamic.
Posts
Jeff Atwood had a bit of advice about this book, which I agree with.
I picked up a book on Actionscript 3 design patterns, and after 2 chapters on OOP principles in Actionscript, all I can think of was "I have no valid use for any of this". Because most of the work I do in Flash is small-scale.
And the two other AS3 books I picked up both basically tell you to completely OOP even the simplest things.
OOP is nice but if it causes you to take twice as long to do something, gotta ask yourself if that lost time will ever repay in the future. In Actionscript the answer is usually no because of the nature of the projects, in ASP.NET the answer is almost always yes because you're repeating similar operations on many pages.
Your mileage may vary.
.... why would I change my hosting provider? My server doesn't serve PHP as plain text. Never will.
And if your server was misconfigured to send PHP scripts as plain text instead of executing them, then nothing PHP would work ever. period. end of story. If you can't run PHP at all, then it's not likely you're going to start MySQL development on it.
First get PHP running. Then try to use it. Not the other way around.
Issues pop up from time to time where scripts are sent as plain text. It happens to good providers too.
I've never seen this happen to any provider, either good or bad. Is there an example of anything anywhere that causes this? The only way I could think of it happening is if you removed all of the PHP modules from apache's config and then restarted apache. It's something you'd have to do on purpose, not by a common (or even uncommon) error. Or you could blow away PHP by mistake but then I'm pretty sure you'd get a 500 internal server error.
"Issues pop up" that apparently I've never seen on any site I've ever visited at any time anywhere on the internet over the span of more than a decade? I have a hard time believing that something that rare can even be considered a legitimate problem.
This is all pretty irrelevant. A question was asked, a solution was offered (putting the config file above the web root). If it matters to you so much, make a thread or something.
Actionscript is basically the same as Javascript, so any book you pick up should have stressed functional and prototype-based programming. If it had objects anywhere in it (aside from "how to port OOP code to..."), it's not a good book.
Your hosting provider doesn't allow you to put files outside the webroot. That's idiotic.
And if you get PHP running, have it serving an important site, and then some intern at the hosting company fucks up a config file and whoooooops all your passwords are exposed? What then? If your company had allowed you to store files outside the webroot, the risk would be hugely reduced. For that matter, it doesn't even need to be the provider's fuck-up - maybe a developer working on your site put in one too many "?>"s and exposed half the page's source. If you had passwords sitting in that half, you've got trouble.
Well, not completely. With the approach of Adobe Air and Flex there is a much bigger emphasis with Actionscript 3 for large scale applications, so the OOP has some relevance. Unfortunately their editor tools are pretty crappy for OOP development in my opinion. When you create a new class you can't even get info on it in code assist like in Visual Studio. They are a whole major release away from anyone taking Actionscript 3 seriously, methinks.
I bought the books assuming that AS3 was some sort of replacement for 2, hahaha, not really.
Do I getGraphics() from the label so I have the graphics object? Then what?
And there's a repaint in there somewhere...
First you need to say which language you're using. :P
I agree with part of this statement. There is a difference between knowing how a pattern can help improve your software, and knowing when your software really needs that improvement. For simple applications, you might not get a lot of use out of them, and you should always stop and think about why you might need to use one.
However, the poster was asking about different types of patterns, and I have not read a book that even remotely explains them as well as the Head First one. I didn't really read the link, but the part you quoted says that beginning developers shouldn't experiment with patterns. Experimenting is the best way to learn when to use them and when not to use them.
That said, until you can see a problem and can immediately say "pattern xyz would be a good fit here for a,b,c, and d reasons" you probably shouldn't be using them on any project with importance. If you are a junior developer at a software company, you normally won't be making that kind of decision without the aid of a more senior developer anyway. If you are a student, you obviously shouldn't be using an unfamiliar pattern on a project the night before it is due. If you have never programmed before you shouldn't start with patterns, and the book is not intended for people who do not have at least a basic understanding of OO concepts.
On top of that, the risks of experimentation in a "real" project can be greatly reduced with the help of things like version control, or asking a mentor/teacher for help. I don't think the goal of the book was to tell beginning programmers to go back and modify the source code of a project behind the backs of their peers or team leads. I would hope that no one is that stupid.
Sometimes Java can be the devil language if you want to do something simple. And then for other more complicated things it can be a breeze. It's strange that way.
Anyhow, it would help if you copied & pasted the code you want to edit so that we can see what you're talking about.
animation tester:
carshape:
moveableshape
ShapeIcon:
So basically I know how to add buttons and actionlisteners for those buttons to the animation tester class...
I made 3 seperate buttons in my code, one each for red, blue, and green. I'm trying to figure out how to make it so that each button fills in the body of the car to be the given color. Would it be smart of me to have the car be initially filled as one color? That I can do. It's just I'm not sure which object's methods I should be calling to change that color within the button... I know I need to set some graphics object to a color, and then repaint, I guess?
From what I've seen, in a lot of cases if Java code appears simple it's because it actually is complicated but someone else already did most of the work for you.
EDIT: In fact, I have a probably very elementary question for you all I've been unable to find an answer to. It's not actual programming but very related.
Basically, I have a Macbook Pro, bootcamped. On the windows side, I can program in java using a .jar called graphics.jar, simply by typing import graphics.*; at the top of my code. It works straight away.
However, I'd dearly like to be able to program my stuff in OSX, because it's a pain going back and forth for this (I intended the bootcamp just for games). I cannot get the terminal compiler to recognise graphics.jar whatever I do. I have tried the classpath method as well as another I can't recall right now (2 in the morning) but neither resulted in success. I've come to the conclusion that the MANIFEST.MF file doesn't have what's needed. Graphics.jar contains several classes such as circles, rectangles, points, lines, etc. So, where do I go from here? I assume I'm being very stupid and this is exceedingly simple, as I'm struggling to find anything very clear/relevant using Google... Any help would be much appreciated.
It's a classpath issue, or it's a fucked up JAR file on your OS X partition. There is no reason why Windows is able to use a JAR file and Mac OS X doesn't.
You could try putting the JAR into /Library/Java/Extensions to see if it's recognised when you do that. That folder is on the OS X classpath by default.
See in your car's draw method where you draw the body?? to change the color you'd need to call g.setColor(Color); before it. You'll probably have to store the color inside the car so you can change it. You can call ShapeIcon.repaint() on your Icon control after so you see the modifications.
Another thing. I thought .draw() didn't fill the Shape... I'm curious what your icon looks like, could you post a small image of it? :P
It would be a great advantage to both of us if I knew some PHP, but sadly I don't. I do however have a (very) basic knowledge of Pyhon and apprently that should help. Could anyone here recommend a book or on-line resource to help me learn PHP?
Apologies if this has been covered here before but PHP is one letter short of the required search length.
Thanks!
You are a genius. I can't thank you enough! Finally I can program in my favourite OS 8-)
It's bare bones, and I can't judge it's usefulness for the total beginner but I found the W3 Schools to be functional and too the point. I went from knowing nothing about PHP to writing a custom, secure login/registration system with MySQL backend in a couple of days using it and the php.org docs.
I made a game, it has penguins in it. It's pay what you like on Gumroad.
Currently Ebaying Nothing at all but I might do in the future.
I like Lisp's syntax (or, lack of), but after using the Python standard library I can't get used to Lisp's comparatively anemic libs.
Rather than writing your own site, you should probably just use a pre-built system like PostNuke.
Depends what I'm trying to accomplish.
UNIX scripting - Perl
OOP (enterprise level) - Java
OOP (stuff for me) - Ruby or Python. I like Ruby more as a paradigm (everything is an object, yay!) but really appreciate Python's lack of syntax cruft.
Interweb sites - Rails
Mac OS X development - Objective-C. I really like Objective-C with the Cocoa libraries; it's the OOP version of C that we should all really be using rather than C++, but C++ is slightly faster. Now it has garbage collection on Mac OS X (memory management was utterly miserable), I should think it's pretty damn sweet.
I'm currently learning Haskell, which has the lack of syntax cruft ala Python, but makes you write more concise, mathematical code. I quite like it now I have the ability to understand it, when I tried it as a 2nd year I hated it, and wondered how it could ever be useful.
I'd add that Java has a huge selection of open source libraries at your disposal. Generally, if I want to do something complex, there is already a Java library that can do it for me.
C# as a language is pretty good, but it doesn't have the open source support that Java does (it probably will with time).
You can do a lot with scripting languages (Ruby, Python, Perl, etc...) and you can generally do it a lot faster than with a statically typed language. I use Ruby or Python for just about everything that I don't require a lot of speed for.
Most people hate C++, but I kind of like it. Most of its faults can be alleviated by making a point to not use every single feature it offers. Simplicity goes a long way. That said, you probably only need to use C++ if you are doing something complicated... or something where speed is a primary concern.
Meh
I'll figure this out
Do you want to write a game with fancy graphics and lots of physics, or a simple game like what you might see on a Gameboy, or in-between?
For simple games, the easiest way to go is Flash. For mid-tier, try Python + OpenGL + SDL. For complex games, learn C and Assembly, and start reading heavy math textbooks for fun.
Luckily, there are some vastly more experienced people working on that. I think this would purely be for maintenance work and is very much a long-term thing.
Thanks that should definitively be a nice starting base. Any other recommendations would still be appreciated.
Well... if you ever want to do anything 3D, or even 2D with 3D models, you are wasting your time with Flash.
I think that XNA would be a much better place to start, or perhaps Torque 2D engines.
XNA is basically free I believe, and the Torque beginner engines price around $100-$200. Flash will at least run you a few hundred.
I work mostly in VB.NET and C#, and love both of them. I like the syntax of VB.NET a lot more than C#, but it is the red-headed step-child in terms of features. Unfortunately VB.NET still has the stigma of VB6 attached to it. I am working on learning F#. I know Java, but don't like working with it. I know C++, but I have no desire to manage my own memory.
I hate dynamic languages. I think the productivity gain that people see from them are from the functional programming elements that the languages tend to include (Ruby, I'm looking at you!), and not from being dynamic.