Be a Supporter!

Programming Regs Lounge

  • 419,557 Views
  • 17,911 Replies
New Topic Respond to this Topic
preffertobedead
preffertobedead
  • Member since: Oct. 21, 2006
  • Offline.
Forum Stats
Member
Level 10
Blank Slate
Response to Programming Regs Lounge 2012-04-22 16:38:21 Reply

At 4/21/12 03:50 PM, Diki wrote:
At 4/21/12 03:10 PM, Jon-86 wrote:

Sorry i will have to stand up with Diki here, i've been programming in .NET, PHP, games in Actionscript 3 and over the last year Python and Javascript (NodeJS, meteor blabla)...

I've worked a lot with PHP and i'm amazed of how this language got so far being on so low performance and making hard a lot of things that are solved within other languages long time ago, the fact of having a php.ini handling massive amounts of server configuration makes me want to die (if you run 2 applications you have to pare them with ini_get)

NO FREAKING ROUTING, your app looks exactly like your file system folder, mod_rewrite and .htaccess IS NOT an acceptable subsitute.

No decent deploy, just copy this files here to the server and on and on.....

here you have the mother of PHP rants, please take it from me i also loved developing PHP, is easy but if you are slightly experienced move away from it.

Go through this post, and link people to it, you cannot deny the flaws that PHP has, if you've been developing only in PHP you have no idea in which sucky world you are living.

Then be happy with CherryPy or with Flask, if you're on Windows i know it's not as setting up WAMP, or on MAC OSX as setting up MAMP or setting Apache within Linux, but setting up the server running the app by running a command is the normal thing with NodeJS and with Python and with Meteor aswell, and man... developing is so much nicer and ordered.. and faster...


Speed Beast 2 ! <-- If you have a listen..leave a review.
PFTBD's AUDIO

BBS Signature
nakedxbabe
nakedxbabe
  • Member since: Feb. 22, 2010
  • Offline.
Forum Stats
Member
Level 07
Musician
Response to Programming Regs Lounge 2012-04-23 13:59:57 Reply

At 4/21/12 02:21 PM, Diki wrote: For anyone who doesn't know: those are real quotes by Rasmus Lerdof, the creator of PHP.

ha ha i didn't know that.
I'm surprised that there is just one person who created php, are you sure on your facts?

PHP language is very dynamic.

Not even english was created by a single person.
The average person you may see outside your window may not even know what php is.


Myspace
Website Coming SoonPurevolume
<BR>Perfection Confection Sugar, you can use it on babies.

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-04-23 14:45:36 Reply

At 4/23/12 01:59 PM, nakedxbabe wrote: ha ha i didn't know that.
I'm surprised that there is just one person who created php, are you sure on your facts?

I didn't mean to say PHP had a single creator, just that PHP is the brain-child of Rasmus Lerdof. He designed it and wrote the original CGI implementation.
It's like how Brendan Eich created JavaScript, Guido van Rossum created Python, Dennis Ritchie created C and Bjarne Stroustrup created C++. They aren't the only person responsible for its creation, but it was their idea, they designed it, and they were the first person to start working on it (or were a part of the group of people to first start working on it).

But yes, he really did say those things.
Source: http://en.wikiquote.org/wiki/Rasmus_Lerdorf.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-04-23 22:31:19 Reply

I decided to improve my vanilla-JavaScript ability, so I took this tutorial on AJAX and this section of a tutorial on OOP and managed to put together a lightweight AJAX tool.

Used a lot like Prototype/jQuery:

Ajax({
	method: 'GET',
	url: 'foo.php',
	data: {name:'Foo Bar',age:42},
	timeout: '1000', /* set timeout to 1000 milliseconds */
	onError: function(err){
		console.log('Something Happened! Error Code: '+err);
	},
	onSuccess: function(response){
		console.log(response);
	},
	onTimeout: function(){
		console.log('Request timed out');
	}
});

Source: http://pastebin.com/FqmG9J1w

And it's only 3kb! :)

Momo-the-Monkey
Momo-the-Monkey
  • Member since: Oct. 15, 2005
  • Offline.
Forum Stats
Member
Level 45
Musician
Response to Programming Regs Lounge 2012-04-23 23:38:43 Reply

Just a curious question (since I know almost every AJAX application has it), why are you use a switch statement with one case? Wouldn't it be easier to use an if-statement? I know that would bring it to four levels of if's. You could probably combine the single 4th-level if-statement with the one above it. Hmmmm....

It would make that line long, but you have longer lines than that.


Hello, from the past!
[ PHP: Main ]

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-04-24 09:14:31 Reply

At 4/23/12 11:38 PM, Momo-the-Monkey wrote: Just a curious question (since I know almost every AJAX application has it), why are you use a switch statement with one case? Wouldn't it be easier to use an if-statement?

Because I figured I might want to have functionality for the other states, specifically the "connect" and "processing" states.
That and I find it looks cleaner than doing:

if (ajaxRequest.http.readyState == 4) {
    // . . .
}

Although I did pretty much do that with the if (ajaxRequest.http.status == 200) statement.

So looks like I should fix up some of this.

Momo-the-Monkey
Momo-the-Monkey
  • Member since: Oct. 15, 2005
  • Offline.
Forum Stats
Member
Level 45
Musician
Response to Programming Regs Lounge 2012-04-24 23:05:00 Reply

At 4/24/12 09:14 AM, Diki wrote: So looks like I should fix up some of this.

Nitpicky stuff, haha. Thanks for answering. It looks good though; very small and simple.


Hello, from the past!
[ PHP: Main ]

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-04-25 16:45:18 Reply

I refactored a bunch of the code, and added comments; even gave it a name: "Simple AJAX".
I think it's a big improvement: http://ideone.com/UZxTq.

Added functionality for detecting a "404 Not Found" error:

Ajax({
	url: '/path/to/file/that/doesnt/exist.html',
	onNotFound: function() {
		console.log('Not found! Oh no!!');
	}
});

Also added functionality for detecting latency:

Ajax({
	url: '/path/to/file.html',
	onSuccess: function(response, ms) {
		console.log('Received: '+response);
		console.log('Took: '+ms+' milliseconds');
	}
});

Tested and working on IE6, 7, 8, 9 and the most recent versions of Firefox and Chrome.

Any comments and/or suggestions are welcome.

citricsquid
citricsquid
  • Member since: Jun. 25, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to Programming Regs Lounge 2012-04-28 14:34:48 Reply

because some fucking dolt decided to spam the ng chat my bot is no longer allowed on the irc network because of rate limits and I cba to start my own irc network, so this is completely worthless but I'm sharing it anyway:

chat.newgrounds.com via irc: http://www.youtube.com/watch?v=b4O6hpLC-vU&hd=1

smulse
smulse
  • Member since: Mar. 24, 2005
  • Offline.
Forum Stats
Member
Level 31
Blank Slate
Response to Programming Regs Lounge 2012-04-28 16:11:00 Reply

At 4/28/12 02:34 PM, citricsquid wrote: chat.newgrounds.com via irc: http://www.youtube.com/watch?v=b4O6hpLC-vU&hd=1

"Also, my food is done. I can hear it beeping.... shit."

Hahaha


BBS Signature
Jon-86
Jon-86
  • Member since: Jan. 30, 2007
  • Offline.
Forum Stats
Member
Level 14
Blank Slate
Response to Programming Regs Lounge 2012-04-29 09:25:26 Reply

At 4/21/12 03:50 PM, Diki wrote: Here is an example of the code I have to work with: http://codepad.org/2QSerXvD.

I feel sorry for you now, but I'd argue thats less PHPs fault than the fault of someone who hasn't bothered to learn about computer systems and making that many disk accesses will make things grind to a halt. But the sad thing is the person who wrote it probably thinks its really neat because it dose what they want with a few loops and the code is compact / easy to read.

I've not been condescending. I've been blunt, and possibly rude, but not condescending.
If my posts have come of as me talking down to people that's not what my intention was.

You remind me of thoughtpolice who used to post on here years ago, he would get into arguments all the time because he was blunt with people, he was almost always right and like you done a good job of actually explaining things to people. But if your arguing with someone or somebody reads something the wrong way (which is easy to do) then they will probably just ignore anything you have to say.

Which is a shame if your making quality posts :P


PHP Main :: C++ Main :: Java Main :: Vorsprung durch Technik
irc.freenode.net #ngprogramming

BBS Signature
ZiggyZack99
ZiggyZack99
  • Member since: Apr. 15, 2007
  • Offline.
Forum Stats
Member
Level 15
Melancholy
Response to Programming Regs Lounge 2012-05-01 17:58:23 Reply

At 4/21/12 01:31 PM, Diki wrote: The problem is that the PHP programmer will never learn why what they are doing is flawed.

Is it flawed if the programmer in question never encounters an issue? Sure, PHP is flawed (and frequently, outright broken) in many areas. Sure, it's not pretty to look at most of the time. Sure, it's easy to fall in to bad coding habits while using it if you aren't careful, especially if it's a new coder's first language. However, it's just as possible to write poor PHP as it is to write good PHP. What matters is how the end product looks and behaves to the end user, and to the consumer, PHP works just as well as Ruby or Python. Combine that with the ease of deployment that PHP offers, and you're looking at the reason companies still use PHP. Don't hate, appreciate.

Anyways, the reason why I came here in the first place:
@CitricSquid: I saw your WhatPulse profile up there on the rankings. Thought it was crazy that somebody who I recognize exists elsewhere on the Internet, for some reason. Small world, huh?


n/a

citricsquid
citricsquid
  • Member since: Jun. 25, 2005
  • Offline.
Forum Stats
Member
Level 23
Blank Slate
Response to Programming Regs Lounge 2012-05-01 18:24:44 Reply

At 5/1/12 05:58 PM, ZiggyZack99 wrote: Anyways, the reason why I came here in the first place:
@CitricSquid: I saw your WhatPulse profile up there on the rankings. Thought it was crazy that somebody who I recognize exists elsewhere on the Internet, for some reason. Small world, huh?

if my whatpulse ranking is the most recognisable thing I've done I'll be sorely disappointed.

ZiggyZack99
ZiggyZack99
  • Member since: Apr. 15, 2007
  • Offline.
Forum Stats
Member
Level 15
Melancholy
Response to Programming Regs Lounge 2012-05-01 21:45:40 Reply

At 5/1/12 06:24 PM, citricsquid wrote: if my whatpulse ranking is the most recognisable thing I've done I'll be sorely disappointed.

You haven't really typed that much, either. You're #3 or so for referrals.


n/a

deckheadtottie
deckheadtottie
  • Member since: Oct. 21, 2003
  • Offline.
Forum Stats
Supporter
Level 59
Programmer
Response to Programming Regs Lounge 2012-05-04 08:52:48 Reply

I'm revising for an exam and I'm annoyed at myself for not being to find any clear notes for this question, perhaps one of you fine chaps can clarify this for me. (Google and books can't seem to find a concise, solid answer).

Explain what is meant by the following types of <ins>object visibility</ins>:

i) attribute visibility
ii) parameter visibility

#coys

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-05-04 10:27:04 Reply

If anyone out there is running a server with PHP in CGI mode then you may want to remedy that.
PHP running in CGI is susceptible to command line operations passed as query strings.

On the plus side I can now look at, and laugh at, Sony's very poorly written PHP code: http://help.station.sony.com/app/answers/list?-s

Zendra
Zendra
  • Member since: Sep. 7, 2003
  • Offline.
Forum Stats
Moderator
Level 51
Blank Slate
Response to Programming Regs Lounge 2012-05-07 08:27:54 Reply

I live in a weird system. The weather is currently getting to a beautiful spring where I live. Normally, people love to do outdoor activities. Yet, I get the weird feeling today of getting into programming again. I've not been active for a long time, due to my thesis and other (social) obligations.
It's weird though, it's the total opposite: Nice weather, I wish to do things that require me to be inside (or at least avoid the sun, else the screen isn't view able anymore).

Perhaps, but that's what the best explanation: I just miss it a bit. The last projects I finished as a freelance programmer originate from somewhere in November 2011. Although I made a decision to put all that on a lower priority, I can't deny that I still read a lot about it and sometimes think out concepts of how it might work that way.
For me it's a fact: Programming is addictive.

kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2012-05-13 12:57:44 Reply

Just wanted to say that Directory Servers are awesome.
/random

Other than that how's everybody doing ?

NinoGrounds
NinoGrounds
  • Member since: Nov. 28, 2005
  • Offline.
Forum Stats
Member
Level 19
Programmer
Response to Programming Regs Lounge 2012-05-13 16:42:05 Reply

At 5/13/12 12:57 PM, kiwi-kiwi wrote: Other than that how's everybody doing ?

I'm having heart relates issues. Nice, eh. Apart from that, I'm still working on a link shortener site.

smulse
smulse
  • Member since: Mar. 24, 2005
  • Offline.
Forum Stats
Member
Level 31
Blank Slate
Response to Programming Regs Lounge 2012-05-13 17:12:34 Reply

At 5/13/12 12:57 PM, kiwi-kiwi wrote: Other than that how's everybody doing ?

Good, but I find free time these days is pretty much none existent. Still visit NG forums every now and again, but tend to lurk more than post.

Did manage to catch the F1 today though. Best sport evaaaaar.


BBS Signature
Momo-the-Monkey
Momo-the-Monkey
  • Member since: Oct. 15, 2005
  • Offline.
Forum Stats
Member
Level 45
Musician
Response to Programming Regs Lounge 2012-05-16 10:38:08 Reply

Just thought I'd post my frustration. Spent a day figuring out how to auto-sort a set of points into a convex polygon, then it turns out I had to use a different method entirely.

Just goes to show you how important system design is.


Hello, from the past!
[ PHP: Main ]

BBS Signature
kiwi-kiwi
kiwi-kiwi
  • Member since: Mar. 6, 2009
  • Offline.
Forum Stats
Member
Level 09
Programmer
Response to Programming Regs Lounge 2012-05-22 17:37:48 Reply

I'm just gonna leave this here: http://wtpl.heroku.com/ be warned though, it gets addictive quick.
As a side note, I got 30%, I feel ashamed.

Trunks
Trunks
  • Member since: Jul. 31, 2005
  • Offline.
Forum Stats
Member
Level 22
Musician
Response to Programming Regs Lounge 2012-05-26 18:18:52 Reply

I haven't posted on this forum in a long time, let alone this thread, but I figure this is a good place to ask the following question: what's a logical path for me to take in regards to what languages should be learned to be considered useful? I've learned a lot about C and I would like to say I'm pretty well-versed in most widely used data structures (logically and their implementations in C), but I'm not sure where to go next. I've started teaching myself Java with some really good books I've found, but after I feel comfortable with Java I'm not sure what language would be good to learn next.

Any help would be super totally awesome and stuff. :)


Web developer, software engineer, musician, all-around nerd.

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-05-26 20:19:05 Reply

At 5/26/12 06:18 PM, Trunks wrote: what's a logical path for me to take in regards to what languages should be learned to be considered useful?

Depends on what you're doing.
Here are some common things and some languages that are useful for them:

Websites: Python, Ruby or PHP. PHP will be the most readily available, but it's a very wonky language.
Game Development: C++, C#, Java, ActionScript 3, or JavaScript (with HTML5).
GUI-Based Applications: C# or Java.
Custom Servers (e.g. a basic socket server): C++, Java or Python.

Note: I've probably forgot some languages.

But if you're just looking for a new language to learn I would recommend Python. I love that language; it's awesome.
It's a little cumbersome to develop GUI applications with it, but that's almost always true regardless of the language.

Trunks
Trunks
  • Member since: Jul. 31, 2005
  • Offline.
Forum Stats
Member
Level 22
Musician
Response to Programming Regs Lounge 2012-05-26 21:44:34 Reply

At 5/26/12 08:19 PM, Diki wrote: But if you're just looking for a new language to learn I would recommend Python. I love that language; it's awesome.
It's a little cumbersome to develop GUI applications with it, but that's almost always true regardless of the language.

I think I'm going to stay away from Python for a while, I've heard kids in my old high school claiming to be programmers and using Python so I'm going to just assume it's a very high-level, away from the machine language and I want to build some proper roots before I get up there. I think I'm gonna look into C# next after Java, thanks for the tips!


Web developer, software engineer, musician, all-around nerd.

Thegluestickman
Thegluestickman
  • Member since: Mar. 16, 2007
  • Offline.
Forum Stats
Member
Level 13
Game Developer
Response to Programming Regs Lounge 2012-05-27 10:04:09 Reply

At 5/26/12 09:44 PM, Trunks wrote: I think I'm going to stay away from Python for a while, I've heard kids in my old high school claiming to be programmers and using Python so I'm going to just assume it's a very high-level, away from the machine language and I want to build some proper roots before I get up there. I think I'm gonna look into C# next after Java, thanks for the tips!

C# and Java are very similar languages, it wouldn't take long to get comfortable with C# if you know Java.


To protect the world from devastation.
kidd25 is the best Newgrounder ever.

BBS Signature
Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-05-27 14:31:33 Reply

At 5/27/12 10:04 AM, Thegluestickman wrote: C# and Java are very similar languages, it wouldn't take long to get comfortable with C# if you know Java.

Very true. C# is essentially Microsoft's version of Java.
They are both excellent choices for applications that require a GUI interface.

I've also heard good things about the .NET Framework, though I don't have any experience with it.

Wolfos
Wolfos
  • Member since: Jan. 19, 2008
  • Offline.
Forum Stats
Member
Level 25
Game Developer
Response to Programming Regs Lounge 2012-05-27 19:51:32 Reply

.NET is well documented, fast and cross-platform (through Mono/Xamarin).

Seriously, this shit is awesome:
http://www.mono-project.com/Main_Page

Diki
Diki
  • Member since: Jan. 31, 2004
  • Offline.
Forum Stats
Moderator
Level 13
Programmer
Response to Programming Regs Lounge 2012-05-31 20:31:48 Reply

https://github.com/TylerOBrien/SimpleJS

My JavaScript library has gotten to the point that it can actually be used.
And not long ago this was nothing but a tiny AJAX wrapper. :)

iryw
iryw
  • Member since: Mar. 31, 2012
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to Programming Regs Lounge 2012-06-04 00:48:55 Reply

At 5/31/12 08:31 PM, Diki wrote: https://github.com/TylerOBrien/SimpleJS

My JavaScript library has gotten to the point that it can actually be used.
And not long ago this was nothing but a tiny AJAX wrapper. :)

Really nice, watching the repo, I'll fork in a couple days to play with