Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

06-02-2013 , 09:21 AM
Quote:
Originally Posted by well named
WPF is the devil's work
Interesting comment. I tend to agree with this sentiment btw but I'm sure you are more knowledgeable about this than I am. Could elaborate a little bit on this?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 10:27 AM
Quote:
Originally Posted by Gullanian
SO is pretty much the nuts
Thanks for your advice!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 12:02 PM
For starters what does WPF stand for...word perfect...hardly.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 12:13 PM
we can't tell you about the *real* programmer forums until you pass The Initiation.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 01:23 PM
Pretty sure the secret handshake involves syns and acks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 01:34 PM
Quote:
Originally Posted by clowntable
For starters what does WPF stand for...word perfect...hardly.
Windows Presentation Foundation
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 01:47 PM
Quote:
Originally Posted by clowntable
Pretty sure the secret handshake involves syns and acks.
FIN

Last edited by tyler_cracker; 06-02-2013 at 01:48 PM. Reason: note to uninitiates: this is the equivalent of me leaving a bloody horse head in clown's bed
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 03:26 PM
Quote:
Originally Posted by adios
Windows Presentation Foundation
they've got a real knack for turning out a catchy phrase, don't they, those windows devs?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 03:31 PM
g_m,

MVVM is my current favorite. because clearly MVC is for slackers and anarchists.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 03:55 PM
MVVM is 33% more efficient because it reuses two words instead of needing a whole third word for the third thing. ldo.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 04:01 PM
Quote:
Originally Posted by kerowo
MVVM is 33% more efficient because it reuses two words instead of needing a whole third word for the third thing. ldo.
Spoiler:
--einstein

Last edited by tyler_cracker; 06-02-2013 at 04:01 PM. Reason: wait which thread is this?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 06:39 PM
Quote:
Originally Posted by gaming_mouse
they've got a real knack for turning out a catchy phrase, don't they, those windows devs?
You're being kind
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 07:05 PM
So I have what should be a pretty easy problem that I can't seem to figure out and I'm too embarrassed to go to SO so here I am.

Previously I did/was doing a jQuery AJAX POST of an object to a php file and everything worked just fine. Code looks like:

Code:
$('#retrieve-button').on('click', function() {
		var filterdata = {
			filter: $('#type-filter').val() // this is "All"
		};

		$.ajax({
		  url: '../scripts/get-data.php',
		  type: 'POST',
		  dataType: 'json',
		  data: filterdata,
		  success: function(data) {
		   	// do stuff
		  },
		  error: function(xhr, textStatus, errorThrown) {
		    console.log('ajax error');
		  }
		});
	});
and on the PHP side it just took $_POST['filter'] and everything worked just fine.

Now I'm trying to rewrite this without jQuery (because I'm a masochist or something) and here's what I came up with:

Code:
document.getElementById('retrieve-button').addEventListener('click', function () {
		var filterdata = {
			filter: document.getElementById('type-filter').value
		};

		var retrieveResults = new XMLHttpRequest();
		retrieveResults.onreadystatechange = appendResults;
		retrieveResults.open('POST', '../scripts/get-data.php', true);
		retrieveResults.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		retrieveResults.send(JSON.stringify(filterdata));

		function appendResults () {
			if (retrieveResults.readyState === 4 && retrieveResults.status === 200) {
				// do stuff
			}
		}
	});
The problem is the non-jQuery thing being sent isn't the same as the jQuery one. jQuery turns that object into a string that is "filter=All" which obviously isn't the same as the JSON.stringified version. Where/what is jQuery doing? How do I replicate that without it? Is this a header issue or something? I'm pretty confused here and looking at a ton of SO questions didn't even come close to answering it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 07:13 PM
jquery isn't generating json to send to the server, it's using the format specified by x-www-form-urlencoded which is:

param1=value1&param2=value2&...

where all of the above should be URL encoded

That's the format that PHP expects in order to parse it out into $_POST['param1'] and $_POST['param2']

the JSON datatype on the jquery version is actually telling it to expect JSON in the response, rather than how to format the request
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 07:16 PM
re: WPF, I haven't actually done that much with it, but we started a big project to rewrite our entire client into it a year or two ago and I'm pretty sure microsoft has already moved on and it's a dead end and the only real value I can see in it to begin with is the possibility of making it easier for designers to do designer stuff without worrying too much about code, but of course we don't seem to manage to make that happen. So most of my gripes aren't really technical.

Although it seems like there have been a lot of super ugly hacks in codebehinds in our usage of it to deal with bizarre cases, and I'm not sure if that's an artifact of our mixing WPF and WinForms for the moment or just WPF being horrible.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 09:26 PM
hmm yeah but using encodeURIComponent is returning the whole JSON string encoded meaning %7B%22filter%22%3A%22All%22%7D. What I really need is $.param but obviously without jQuery. Which is harder than it seems apparently. I'll keep working on it.

edit: fk it, I just got rid of my original json object and just made a properly formatted string. Still confused why this was so hard though.

Last edited by Grue; 06-02-2013 at 09:48 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 09:38 PM
Quote:
Originally Posted by well named
re: WPF, I haven't actually done that much with it, but we started a big project to rewrite our entire client into it a year or two ago and I'm pretty sure microsoft has already moved on and it's a dead end and the only real value I can see in it to begin with is the possibility of making it easier for designers to do designer stuff without worrying too much about code, but of course we don't seem to manage to make that happen. So most of my gripes aren't really technical.

Although it seems like there have been a lot of super ugly hacks in codebehinds in our usage of it to deal with bizarre cases, and I'm not sure if that's an artifact of our mixing WPF and WinForms for the moment or just WPF being horrible.
I'm probably not understanding, but I don't consider designer view a minor non technical issue. It's a generally poorly executed idea, IMO, and I wouldn't let a designer touch design view with a ten foot pole.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-02-2013 , 10:21 PM
grue: it still wasn't working because urlencoding the JSON string { "filter": "all" } is still the wrong thing, because it's not in the param=value format

If you want to post a JSON string and have the server parse it you need to submit something like

data=%7B%22filter%22%3A%22All%22%7D

and then in PHP you would

$data = json_decode($_POST['data']);
$filter = $data->filter;

In other words, if you send a POST with content-type x-www-form-urlencoded then the content of the post MUST be in the form of name=value&name=value pairs, where the name corresponds to the index into the $_POST array and the value is whatever you want, and both name and value need to be urlencoded (but not the = and & that delineate the submitted form fields

edit: well, it must be if you want to access it via $_POST. You can actually get the raw POST data and then you can use whatever format you want. i.e if you submitted the JSON string as you originally did, then you could use:

$data = json_decode(file_get_contents("php://input"));
$filter = $data->filter;

daveT: perhaps you are right about design view in general. As it turns out, I've just never really used it the way they seem to intend.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-03-2013 , 12:41 AM
Yeah I get that its just kinda funny to me how much jQuery does now behind the scenes so to speak. I just expected there to be a good alternative to the ~50 line (extracted) jQuery.param method so that I wouldn't have to alter my PHP file at all. In the end I "learned" to either impart all that logic to jQuery or to just do it another way (without JSON).

When I finish up this project tomorrow (converting a ~200 line jQuery file into (modern browser) vanilla DOM stuff) it will be interesting to see what the performance improvement is.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-03-2013 , 06:30 AM
I enjoy pathfinding and have been doing it for a while now... was browsing youtube and re-stumbled upon http://www.youtube.com/watch?v=nGC_kBCoHYc a few min ago.
Has anyone itt ever done group pathfinding before? I never have but it looks like that is what I will dive into next.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-03-2013 , 07:30 AM
Quote:
Originally Posted by daveT
I'm probably not understanding, but I don't consider designer view a minor non technical issue. It's a generally poorly executed idea, IMO, and I wouldn't let a designer touch design view with a ten foot pole.
What is a better way to go including alternatives to dotnet?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-03-2013 , 05:53 PM
Quote:
Originally Posted by adios
What is a better way to go including alternatives to dotnet?
I wish I had a good answer to this.

I do agree that it would be great if there was some integration, but I think creating code behind from accidental double clicks is a real issue. I'd also be nervous letting a real designer use it because she is likely mentally tied to using Photoshop and her mind is likely too ingrained with those hot keys, which is bound to create something bad. I slam into this all the time once I start zoning, but the difference is that I am keenly aware of this issue and I know how to roll back or exit processes gracefully when it happens.

In simple terms, the designer will have to have considerable knowledge of the programming tool and some well informed notions of how programming is done in order to not create a mess.

I do agree with gaming_mouse on this general issue, but there is no good integration of programming and design that I am aware of at this point. As far as I can see, the general trend appears to be a wider separation between the two disciplines.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-03-2013 , 08:49 PM
A bit off-topic:

As CS major, is there any particular distribution of Linux I should be installing? I see a lot of job postings wanting Linux knowledge so now seems as good a time as any to switch to it for most things. Are these job postings referring more to command-line stuff or can I install linux as my primary OS, use it for a few years for CS needs, and get the knowledge required?

Any good linux software that is a must-have?

Just started looking into job postings and the qualifications they want/desire, so I'm sure I'll have more similar questions in the future. My school is recruited from heavily so internships/entry-level jobs won't be much of an issue, but that's no excuse not to be the best candidate you possibly can be.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-03-2013 , 08:53 PM
Job linux is going to be server administration more than user land stuff I'm pretty sure. Being familiar the command line can't hurt though, you can get that with any distro.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
06-03-2013 , 09:07 PM
Quote:
Originally Posted by kerowo
Job linux is going to be server administration more than user land stuff I'm pretty sure. Being familiar the command line can't hurt though, you can get that with any distro.
Makes sense. I used Ubuntu years ago, is that still a decent go-to?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m