• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

My SQL is atrocious and this isn't tested and probably won't work and be just as bad but something like:

Code:
SELECT A.TransDate 
FROM pricevolume as A 
INNER JOIN pricevolume as B 
    ON A.ClosePrice = B.OpenPrice * 2 
    AND DATEDIFF(B.transdate, A.transdate) = 1 
    AND A.ticker = 't' AND B.ticker = 't'

I think comma separating like you had originally is the same as doing CROSS JOIN, which results in a table that has n * n rows, whereas an INNER JOIN should result in a table that has only the entries that match on the join points. I could be completely 100% wrong.
 

Zoe

Member
My SQL is atrocious and this isn't tested and probably won't work and be just as bad but something like:



I think comma separating like you had originally is the same as doing CROSS JOIN, which results in a table that has n * n rows, whereas an INNER JOIN should result in a table that has only the entries that match on the join points. I could be completely 100% wrong.

Here's some discussion on implicit joins:
http://stackoverflow.com/questions/1981601/queries-that-implicit-sql-joins-cant-do

As long as the syntax is completely correct, it will be the same as an explicit join, but there is a risk of a cross join if you miss a filter.
 

Chris R

Member
Thanks for the tips everyone, I really need to understand joins and nested queries better.

Me too! If the posted suggestions don't improve things let us know, always willing to help (granted I'm on vacation so I can't actually test anything that isn't Obj-C based... I really should look into making my next MBA bootcamped with my favorite programming tools :p)
 

jokkir

Member
Can someone help me with my PHP?

Code:
<?php
		//DETERMINES IF THE FORM IS VALID
		$validForm = false;

		//HOLDS ALL ERROR MESSAGES FOR THE FORM. DEFAULT VALUE BLANK.
		$errorMessage = array(
			"",
			"",
			"",
			"",
			"",
			"",
			"",
			"",
			);

		$matchCheck = array(
			'!preg_match("/^[ ]*[a-zA-Z]$/", $_POST[\'Name\'])',
			'!preg_match("/^[ ]*[ a-zA-Z\-]$/", $_POST[\'Manufacturer\'])',
			'!preg_match("/^[ ]*[ a-zA-Z0-9\-]$/", $_POST[\'Model\'])',
			'!preg_match("/^[ ]*[ a-zA-Z\-\.\,]$/", $_POST[\'Description\'])',
			'!preg_match("/^[ ]*[0-9]$/", $_POST[\'Quantity\'])',
			'!preg_match("/^[ ]*[0-9]$/", $_POST[\'Reorder\'])',
			'!preg_match("/^[ ]*[ a-zA-Z\-]$/", $_POST[\'Cost\'])',
			'!preg_match("/^[ ]*[0-9]$/", $_POST[\'Price\'])'
			);

		$matchCheckErrorMessage = array(
			'You may only input letters and spaces only',
			'You may only input letters, spaces and dashes only',
			'You may only input letters, digits, dashes and spaces only',
			'You may only input letters, dashes, commas, periods and spaces only',
			'You may only input digits only',
			'You may only input digits only',
			'You may only input letters and spaces only',
			'Price error'
			);

		//HOLDS ALL FIELD NAMES IN THE FORM
		$fieldNames = array(
			'Name',
			'Manufacturer',
			'Model',
			'Description',
			'Quantity',
			'Reorder',
			'Cost',
			'Price'
			);

		//HOLDS ALL THE VALUES FOR THE FORM
		$Name = $_POST['Name'];
		$Manufacturer = $_POST['Manufacturer'];
		$Model = $_POST['Model'];
		$Description = $_POST['Description'];
		$Quantity = $_POST['Quantity'];
		$Reorder = $_POST['Reorder'];
		$Cost = $_POST['Cost'];
		$Price = $_POST['Price'];
		$OnSale = $_POST['OnSale'];
		$Discontinued = $_POST['Discontinued'];

		//ERROR CHECKING FOR THE FORM
		if($_POST){
			//foreach($fieldNames as $value){

			//Loops through all the fields
			for($i = 0; $i < 9; $i++){
				if($_POST["$fieldNames[$i]"] == ""){ // Checks to see if fields are empty, if true, return an error
					$errorMessage[$i] = 'The field cannot be blank';
				}
				if($_POST["$fieldNames[$i]"] != ""){
					if($matchCheck[$i]/*, $_POST['$fieldNames[$i]'*/){
						$errorMessage[$i] = $matchCheckErrorMessage[$i];
					}
					else{
						$validForm = True;
					}
				}
			}
		}
?>

What I'm trying to do is I'm trying to make it so that it runs through each of the fields to do error checks on them. However, the preg_match doesn't seem to be working (or maybe something else). The "field cannot be blank" part seems to work but that's it. Am I going about this wrong?
 

Roquentin

Member
Can someone help me with my PHP?

What I'm trying to do is I'm trying to make it so that it runs through each of the fields to do error checks on them. However, the preg_match doesn't seem to be working (or maybe something else). The "field cannot be blank" part seems to work but that's it. Am I going about this wrong?
First of all, remove quotes from $matchCheck.
Code:
$matchCheck = array(
	!preg_match("/^[ ]*[a-zA-Z]$/", $_POST['Name']),
	/* ... */
And use foreach (which you commented out).
Code:
foreach ($fieldNames as $i => $fieldName){
	if ($_POST[$fieldName] == "") { // Checks to see if fields are empty, if true, return an error
		$errorMessage[$i] = 'The field cannot be blank';
	} else {
		if ($matchCheck[$i]){
			$errorMessage[$i] = $matchCheckErrorMessage[$i];
		} else {
			$validForm = True;
		}
	}
}
Also $validForm is incorrect. You should set it to true and then set it to false if any error occurred. Alternatively you could set $errorMessage to an empty array at the beginning and if it's not empty after validation that means there's an error.
 

Kinitari

Black Canada Mafia
Ugh.

So a friend of mine had a website made for her a while back for free, but she hated it so she asked for my help making it nicer. I said sure (figured since I'm just starting up, doing some pro bono work would at least be portfolio material).

So far it's been a mild nightmare for me, and now I turn to GAF for help. What I found out is this site was made in Wordpress and hosted on Godaddy. This combination seems to be breaking me. Or rather, the fact that I have no experience with either, and that the hosting process is completely unknown to me is causing me to flounder far too often. I've put aside my Godaddy issues for now, and I just want to focus on the website.

I'm completely new to wordpress, but after a few days playing around with it - I 'get' it. I've found a good theme, made a ton of modification in a provided stylesheet and I did a lot of good that way. But it's not enough, I want to really get in there and create some scripts (jQuery specifically) to make the site actually look and function as intended.

Figuring out how to do it (because I think it is possible) has been quite the struggle so far, and rather than spending a few more hours floundering until I get it, I figured I can ask GAF - how do I create/add a script to my theme in Wordpress?

edit: already figured some of it out... I enabled jQuery in my theme, now I just need to figure out how to get FTP access of this goddamn host. I can't figure it out, I thought I was being dumb - then I looked up the official method and the button that should be in her GoDaddy account doesn't exist ("Web Host") - so now I am just trying to figure out the IP so I can access it via FileZilla.

edit2: sigh.... Figured out what my overarching problem was. The site isn't hosted by GoDaddy - I guess taking someones word for it who doesn't really 'get' what hosting is was a bad idea, I should have just actually checked for myself instead of assuming something was up. The host was HostGator, and I am assuming it's the dude who originally made the site's private account, I doubt he'll have client access as an option. Bah. Aw well, no jQuery for this site - just maddddddddd CSS.
 

jokkir

Member
First of all, remove quotes from $matchCheck.
Code:
$matchCheck = array(
	!preg_match("/^[ ]*[a-zA-Z]$/", $_POST['Name']),
	/* ... */
And use foreach (which you commented out).
Code:
foreach ($fieldNames as $i => $fieldName){
	if ($_POST[$fieldName] == "") { // Checks to see if fields are empty, if true, return an error
		$errorMessage[$i] = 'The field cannot be blank';
	} else {
		if ($matchCheck[$i]){
			$errorMessage[$i] = $matchCheckErrorMessage[$i];
		} else {
			$validForm = True;
		}
	}
}
Also $validForm is incorrect. You should set it to true and then set it to false if any error occurred. Alternatively you could set $errorMessage to an empty array at the beginning and if it's not empty after validation that means there's an error.

Ah, alright. I'll try it and see if that works.

I'll probably be asking a lot more PHP questions the next few days. I'm not too great with this ><
 

squidyj

Member
So, I'm writing a raytracer in c++ and I have an array of pointers to scene objects wherein the objects of my scene all inherit from the scene object. I have a virtual method in SceneObject in order for each of my scene objects (simple polygons, complex models, geometric shapes etc) to be able to define how best to determine their intersection.

This function takes a pointer to a ray, updates data within the ray if there is an intersection, and returns a boolean regarding whether or not there was an intersection. One of the fields in ray is a double that describes it's distance which is updated in the intersection.

The problem is when I call the method, the value of distance is always -1 (default) inside the method until it gets updated. I can see all the changes that have been made after the method has been called, but when I pass my ray pointer it's like it resets some of the data it pointed to.

I don't have access to my code right now but when I get home I'll post some. I'm not particularly good with c++. Is there something I'm missing about virtual functions?
 

Slavik81

Member
You are almost certainly making a copy by accident somehow. Passing pointers around won't do it, but perhaps you're doing a cast wrong, or passing it into a function that takes parameters by value. It's hard to say without seeing code.

Edit: have you marked all your 1 argument constructors as explicit? You may be accidentally be creating a new ray somewhere by mistake.
 
Ok expert programming GAF, I need your wisdom. What the minimum amount I need to know about databases? In the past I've used Access, and simple SQL queries to open, update, sort records, etc. This however, is not something I do often. And usually I have to re-learn how to do everything.

What's a good database to learn more in depth, and maybe to use on personal projects?
 

Spoo

Member
You are almost certainly making a copy by accident somehow. Passing pointers around won't do it, but perhaps you're doing a cast wrong, or passing it into a function that takes parameters by value. It's hard to say without seeing code.

Edit: have you marked all your 1 argument constructors as explicit? You may be accidentally be creating a new ray somewhere by mistake.

This. Either mark the constructor explicit as noted or, if you can, disallow use of the copy constructor by marking it private or something (assuming you don't ever need to make copies). For future reference, this kind of thing is related to a problem called slicing that is worth looking up for when it eventually happens to you (and it will happen).
 

Spoo

Member
Ok expert programming GAF, I need your wisdom. What the minimum amount I need to know about databases? In the past I've used Access, and simple SQL queries to open, update, sort records, etc. This however, is not something I do often. And usually I have to re-learn how to do everything.

What's a good database to learn more in depth, and maybe to use on personal projects?

MySQL I guess, for smaller projects. It's all I've used, honestly. Remember your set theory and you can be allowed forgetting some specific database technology until you need it. :) Probably not great advice, but we're all lazy, right?

edit: sorry for double post.
 

squidyj

Member
This. Either mark the constructor explicit as noted or, if you can, disallow use of the copy constructor by marking it private or something (assuming you don't ever need to make copies). For future reference, this kind of thing is related to a problem called slicing that is worth looking up for when it eventually happens to you (and it will happen).

You are almost certainly making a copy by accident somehow. Passing pointers around won't do it, but perhaps you're doing a cast wrong, or passing it into a function that takes parameters by value. It's hard to say without seeing code.

Edit: have you marked all your 1 argument constructors as explicit? You may be accidentally be creating a new ray somewhere by mistake.

Thanks for the help and reading about slicing right now but that actually wasn't it. I've got it fixed now.
 

squidyj

Member
What was it?

Ahhh, I might as well embarrass myself. I edited but it was something like


Code:
bool found = false;
castRay(Ray* ray)
{
.... some code here....
for loop blah blah blah
{
[B]found = found || modelList[i]->testIntersection(ray);[/B]
}
}

which got changed to.
Code:
castRay(Ray* ray)
{
bool found = false;
bool temp = false;
.... some code here....
for loop blah blah blah
{
temp = modelList[i]->testIntersection(ray);
found = found || temp;
}
}
 

hateradio

The Most Dangerous Yes Man
What exactly does testIntersection return?

If it's a boolean, you could shrink it down a bit.

Code:
for . . .
  if (nodeList[i]->testIntersection(ray)) // of course, i guess test it to see if you get the same problem
    found = true;
    break;

So that you break out of the loop, too.
 

squidyj

Member
What exactly does testIntersection return?

If it's a boolean, you could shrink it down a bit.

Code:
for . . .
  if (nodeList[i]->testIntersection(ray)) // of course, i guess test it to see if you get the same problem
    found = true;
    break;

So that you break out of the loop, too.

Yeah, it returns a bool.

the point is that I don't want to break out of the loop but I want to remember that I found an intersection. I won't know if it's the closest until I test all the objects in the list. The if statement will do the job, I know that.
 

FerranMG

Member
I think your plan of representing state is ok but you might want to consider a state representation of (pacmanLocation, edgesVisited). We can take advantage of a property of pacman boards related to dots which is that from a square containing a dot, the move to an adjacent dot will always be optimal. i.e. there's no point in stopping halfway down a hallway and coming around to it from the other side later, you'll still use the same number of steps or more (I think this holds but I'm not bothered proving it).

Counterexample?
Dots are +, walls are *, PacMan is P, empty spaces are _.

Code:
*******
*---+P*
*+***-*
*----+*
*-***+*
*+++++*
*******

I hope that makes sense, it's pretty difficult to draw. :p
The idea is that PacMan starts by moving left entering a hallway, but then the best route is to get out of the hallway by moving right, then all the way down, then all the way left, and then up until he reaches the final state.


My problem right now is as follows:
- PacMan board with n dots, 1 PacMan, no ghosts.
- Want to find the best path that PacMan can take to eat all the dots.
- I represent each state with the position of PacMan and the position of the remaining dots.

I run an A* algorithm that starts in one state, and stops when it reaches a state when there's no dots left to eat.
I use as a heuristic the minimum of the sum of all the Manhattan distances between two dots, which is admissible.

The problem now is that it expands too many nodes, and it's taking too long.
For just 10 dots, it takes an average of 300 seconds.

I was looking into representing the board somehow like lorebringer mentioned, but can't find a good representation.
I was thinking when does actually PacMan need to decide if he needs to change direction.
In a hallway, it seems clear the he won't change direction as long as there's a dot adjacent to his current position. But if there's an empty space, then (as the counterexample before showed) he should recalculate what's the best direction to take next.

I'll appreciate any suggestions you guys have.
 

Tomat

Wanna hear a good joke? Waste your time helping me! LOL!
Man, some of the stuff that gets asked in here scares me sometimes. It's a very firm reminder of how much I have yet to learn about programming.
 

FerranMG

Member
Well, I've been programming quite a bit for the last 3 years, and there's days I think that I've come such a long way, and there's days I see some code that I have the feeling I won't understand even in a hundred years.

Of course, this happens with everything, but I don't know why with programming feels particularly bad. :p
 

SephriJ

Member
IMG_20121120_083046.jpg



Friend sent me this, best preface ever.
 

FerranMG

Member
If you're going to brute force it, maybe you should go with breadth-first search.

I *have* to use A*.

You implying that I'm using a brute force approach made me realize I might not be sure what exactly is a brute force approach.
I mean, I'm trying to find a clever solution to the problem. To me, brute force would be what I tried to do first: check all possible movements PacMan could do, and choose the ones that lead to the most efficient path.
Now I'm trying to find an algorithm that avoids this, so I represented each state differently, I avoid expanding a node if it wouldn't lead me to a better solution, etc. Plus, I'm looking into how to represent differently the game board so that it's more efficient. What would you say I'm using a brute force approach?
 

TheExodu5

Banned
I *have* to use A*.

You implying that I'm using a brute force approach made me realize I might not be sure what exactly is a brute force approach.
I mean, I'm trying to find a clever solution to the problem. To me, brute force would be what I tried to do first: check all possible movements PacMan could do, and choose the ones that lead to the most efficient path.
Now I'm trying to find an algorithm that avoids this, so I represented each state differently, I avoid expanding a node if it wouldn't lead me to a better solution, etc. Plus, I'm looking into how to represent differently the game board so that it's more efficient. What would you say I'm using a brute force approach?

That doesn't sound like brute force to me. Is there a term for this approach? I remember using it when programming a rudimentary board game in my AI class.
 

Mondriaan

Member
I *have* to use A*.

You implying that I'm using a brute force approach made me realize I might not be sure what exactly is a brute force approach.
I mean, I'm trying to find a clever solution to the problem. To me, brute force would be what I tried to do first: check all possible movements PacMan could do, and choose the ones that lead to the most efficient path.
Now I'm trying to find an algorithm that avoids this, so I represented each state differently, I avoid expanding a node if it wouldn't lead me to a better solution, etc. Plus, I'm looking into how to represent differently the game board so that it's more efficient. What would you say I'm using a brute force approach?
A* is very similar to BFS, but the main difference is that it prioritizes paths that look cheaper distance-wise while BFS explores every path of a given length before going on to paths of length plus one. You'd still have to modify BFS if your pacman board contains dead-ends (or other path things), though, since vanilla BFS doesn't permit revisiting nodes.

Other than dead-ends where it's obvious you have to retrace your steps, I'm not sure it's that easy to tell when you're better off not revisiting nodes, though.
 
I'm a traditional C/C++ programmer looking to add a new general language to my skillset. Does it make sense professionally to learn Java at this point?

edit:
My motivation is to have a backup skill that is marketable in a wide range of industries.
 

Pachimari

Member
I don't know where to ask this but do you guys know how Disqus comment system works?

I have implemented it on my website for all of the threads have the same headline, I can't seem to make them unique like say, on toucharcade.com.

www.disqus.com
 

iapetus

Scary Euro Man
I'm a traditional C/C++ programmer looking to add a new general language to my skillset. Does it make sense professionally to learn Java at this point?

edit:
My motivation is to have a backup skill that is marketable in a wide range of industries.

Java isn't a bad thing to have combined with C/C++. Make sure you learn how to program in Java idiomatically, though. Few things are uglier than C++ programmers trying to write C++ in Java. :p

You might also want to look at cooler languages with relatively widespread use. Ruby is still flavour of the month in a lot of places, for example, and while there's less work out there for Ruby devs than Java, there are also far fewer of the devs to go around...
 
Counterexample?
Dots are +, walls are *, PacMan is P, empty spaces are _.

Code:
*******
*---+P*
*+***-*
*----+*
*-***+*
*+++++*
*******

I hope that makes sense, it's pretty difficult to draw. :p
The idea is that PacMan starts by moving left entering a hallway, but then the best route is to get out of the hallway by moving right, then all the way down, then all the way left, and then up until he reaches the final state.

I drew a picture:

(Edit: It occured to me after I uploaded that first image that a better way to draw the graph might be each branch in the maze is a node. You would end up with more nodes but it would be much easier to construct from the map)

This one is the graph representation of the physical space. Each vertex is an edge dot where a decision can be made as to where to go next. The weights on the edges are the distances. The sets of letters are the node pairs you need to visit to eat all the dots. Pairs of the same letter just indicate a single dot, that node must be visited from anywhere. Pairs of different letters require a route from one to the other.

A8Pkz.jpg


The second graph (tree) is the state space to search through. Each state is represented by a set of (DISTANCE_TRAVELLED, LOCATION, VISITED_EDGES). From each state you can generate the set of reachable states. For each state, g(x) == the distance travelled so far, f(x) is the only thing I'm not 100% sure of but the max of manhatton distances to each node pair is admissable so you could start with that.

e.g. From the starting state of (0, a, {}), g(x) = 0 and f(x) = 9

m2VYB.jpg


This search space is a tree rather than a graph as part of the state definition is distance travelled, so you can ignore cycling. The max distance heuristic should be enough to rule out bouncing between states until g(x) gets too high although you could consider storing vertices travelled through as part of the state to explicitly catch cycling if it turns out to be costing too much time. Once you reach a state where you have all the vertex pairs in the set of visited pairs you can call it a day. Reconstructing your route from that point is a different problem but not too hard.

Hope that helps explain what I was getting at more. I haven't implemented this so I can't guarantee it will work ofc but it should, even if there are better methods you could use. If this is still not working out I'll have a go at an implementation.
 
I'm trying to make an extension in chrome, but I seem to keep stumbling along the way. This is my first attempt to code anything so any help with getting this off the ground would be great.

manifest.json said:
{
"name": "Amazon Auto Affiliate",
"version": "1.0",
"manifest_version": 2,
"description": "Changes all Amazon.com pages to ones with the referral.",
"content_scripts": [
{
"css": ["mystyles.css"],
"js": ["jquery.js", "myscript.js"]
}
],
...
}

myscript.js said:
// myscript.js

var affiliateCode = 'affiliate code'

onload = function () {
for (var i = 0; i < document.links.length; i++)
if (document.links.href.contains("amazon.com")) {
document.links.href = document.links.href +'?tag=' + affiliate code
}
}


Chrome had it working for a bit then it started in on me about manifest version 2 and now it wont work at all. Thanks for any help
 
I'm a traditional C/C++ programmer looking to add a new general language to my skillset. Does it make sense professionally to learn Java at this point?

edit:
My motivation is to have a backup skill that is marketable in a wide range of industries.

ADA (DOD ...) or I heard (visual) Basic is quite popular in the US. Fortran won't die anytime soon either.
 
Few things are uglier than C++ ... [and] Java.

Fixed :p

Really though you'll find Java very easy to pick up coming from C++ once you get used to the new everywhere. Oh god so much new. But it's also really worthwhile to look into some higher level languages like the Pythons and the Rubys and even some functional languages like Scala or Haskell etc. There's a lot of value there that you can take back with you even if you stay doing imperative programming professionally.
 

SolKane

Member
I'm a traditional C/C++ programmer looking to add a new general language to my skillset. Does it make sense professionally to learn Java at this point?

edit:
My motivation is to have a backup skill that is marketable in a wide range of industries.

Python seems pretty useful if you're interested in web development at all.
 
Thanks for the answers. I'll go with Java and Python.

I thinking of writing a simple 2d browser game in Java. Low complexity and fun hopefully.

Maybe a ray tracer like squidjy in Python. Still undecided for this one.
 
Thanks for the answers. I'll go with Java and Python.

I thinking of writing a simple 2d browser game in Java. Low complexity and fun hopefully.

Maybe a ray tracer like squidjy in Python. Still undecided for this one.

If you're interested in doing a 2d game in Java, look into Slick2d. I used it for a couple of small personal projects and an entry into Ludum Dare earlier this year. Really well put together library and it's simple to build it as an applet.

Also Python is such an excellent language, good choice
 

mltplkxr

Member
I'm a traditional C/C++ programmer looking to add a new general language to my skillset. Does it make sense professionally to learn Java at this point?

edit:
My motivation is to have a backup skill that is marketable in a wide range of industries.
To quote Twisted Sisters : "What do you want to do with your life?" Base your choice on the area or field you want to work in. For example, iPhone, web, enterprise, etc.

For a general recommendation, I'd recommend javascript. Similar syntax to C, same freedom; you should be able to pick it up very quickly. Javascript is everywhere now, so you'll be able to use alot of the popular frameworks out there both for mobile and web.

I second iapetus' answer. It looks like there's still a lot of demand for Java devs. However, Java and C++ are both OO languages but they have very different mindsets and cultures. So if you go that route, be aware that you might hate the lack of control and find the APIs verbose.
 

squidyj

Member
Thanks for the answers. I'll go with Java and Python.

I thinking of writing a simple 2d browser game in Java. Low complexity and fun hopefully.

Maybe a ray tracer like squidjy in Python. Still undecided for this one.

Awwwwww yeahhhh ray tracin! you can make sweet looking images like this!
ibai3CJOqYErIH.png


....How do I refraction?
 
For a general recommendation, I'd recommend javascript. Similar syntax to C, same freedom; you should be able to pick it up very quickly. Javascript is everywhere now, so you'll be able to use alot of the popular frameworks out there both for mobile and web.

I think every C programmer should learn JavaScript and Ruby just to experience the stark existential horror of how modern languages have evolved both syntactically and in their execution environment. Or, as a friend puts it, "if you love string concatenation, you'll love JavaScript."

When I learned how the automatic dispatch system for Rails table lookups worked (override the missing method handler, perform heuristics on the method name, etc.), I was truly amazed and terrified.
 
If you're interested in doing a 2d game in Java, look into Slick2d. I used it for a couple of small personal projects and an entry into Ludum Dare earlier this year. Really well put together library and it's simple to build it as an applet.

Also Python is such an excellent language, good choice

Oh cool, thanks for the Slick2d link. Some of these games are pretty neat and are in line with what I had in mind.

To quote Twisted Sisters : "What do you want to do with your life?" Base your choice on the area or field you want to work in. For example, iPhone, web, enterprise, etc.

Well, I like my current career path. But if it ever collapsed, my limited skillset would leave me in a tough spot. For a backup language, anything with lots of available work is ideal. I think I'd be okay in any line of work...that isn't straight up databases.

I'll do some general reading on JavaScript. Thanks for the suggestion.
 

FerranMG

Member
Lorebringer, thanks for your reply, I'll look into it after I solve this issue I'm having with Java. I'll let you know how it works out. :)


I'm on a Mac with Mountain Lion.
I'm trying to install Java 7. I download it from here.
Open the dmg file, then double click on th pkg file. The wizard starts, and apparently finishes installing everything ok.
But then I can't find anything related to Java 7 anywhere on the computer.
The jdk is still v6.
If I open Library/Java/JavaVirtualMachines, there's absolutely nothing there.

I have no clue what to do. Any ideas?
 

Zoe

Member
Well, I like my current career path. But if it ever collapsed, my limited skillset would leave me in a tough spot. For a backup language, anything with lots of available work is ideal. I think I'd be okay in any line of work...that isn't straight up databases.

What's wrong with databases? I love databases!
 

butzopower

proud of his butz
I think every C programmer should learn JavaScript and Ruby just to experience the stark existential horror of how modern languages have evolved both syntactically and in their execution environment. Or, as a friend puts it, "if you love string concatenation, you'll love JavaScript."

When I learned how the automatic dispatch system for Rails table lookups worked (override the missing method handler, perform heuristics on the method name, etc.), I was truly amazed and terrified.

And yet it powers something like UrbanDictionary, so it really doesn't matter. I think C programmers should probably have the existential horror that they aren't paying by the byte on PDP-10s anymore.
 
I've been working on something all week, doing some really interesting things and I while I was doing a bit of further research today I came across a fully implemented, open source version of exactly what I was doing. :-(

What a waste of time. Sigh.
 
That doesn't sound like brute force to me. Is there a term for this approach? I remember using it when programming a rudimentary board game in my AI class.

It's a generalized version of Djikstra's graph path finding algorithm that finds the shortest path between 2 given points.
 
Awwwwww yeahhhh ray tracin! you can make sweet looking images like this!
ibai3CJOqYErIH.png


....How do I refraction?

Is it just me or are there no reflections yet? If so, I'd suggest you handle reflections before refraction. Also, you need to adjust your colour values there. It kinda looks like you just have ambient lighting in, but then you have a shade of specular in the center that makes me think otherwise.

Edit: NM, looks like that dim lighting IS your diffuse lighting and that you don't have any ambient (judging by your shadows).
Oh and my bad on the double post.
 
If you're interested in doing a 2d game in Java, look into Slick2d. I used it for a couple of small personal projects and an entry into Ludum Dare earlier this year. Really well put together library and it's simple to build it as an applet.

Also Python is such an excellent language, good choice

I'd actually suggest libgdx over slick2d.

gdx was created primarily for Android and desktop cross development (code once, run on both). As a result of targeting Android, gdx was made with speed in mind, and it performs tons of functions natively using jni. Using gdx, you can also run your game as an applet, under Web Start, under html5 using gwt, and soon under iOS using MonoTouch, all with little to no alterations of your code. It's under very active development, and it's very popular in the Android front.

slick2d is not as nicely optimized, not as fast (it's 100% Java), nor as actively developed, but it does have some convenient functions and tools to use. For example, you can draw 2D primitives, and using tile maps is easier.

Edit: slick2d was abandoned by its original developer and has moved from the link you were given to this new site.

Basically, slick2d may be easier to use in a couple of ways, but libgdx is definitely better overall. In fact, slick2d is borrowing a lot from libgdx nowadays...
 
Top Bottom