00:00
00:00
Newgrounds Background Image Theme

boonsketi just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Programming Regs Lounge

714,961 Views | 15,737 Replies
New Topic Respond to this Topic

Response to Programming Regs Lounge 2013-03-18 11:48:57


At 3/17/13 07:40 PM, Dean wrote: One downside to my plan right now is that I'm storing the names and addresses in a HashMap, which doesn't allow a key to be used multiple times, in this case the name. So if two devices were to be broadcasting the same name, it's going to cause some problems. Even if I was storing them in some other data structure, name conflicts are still a problem right now.

I guess you could always do some sort of blackberry pin idea, where everyone has a unique id that they use for reference and then they can give themselves a screen name too (that doesn't have to be unique).


BBS Signature

Response to Programming Regs Lounge 2013-03-18 12:20:28


At 3/18/13 11:48 AM, smulse wrote: I guess you could always do some sort of blackberry pin idea, where everyone has a unique id that they use for reference and then they can give themselves a screen name too (that doesn't have to be unique).

Although I assume that's going to require some kind of central server or something to deal with the unique pin allocation and to store info on which pin belongs to which device? The original idea behind this project was that it was to be audio communication over ad-hoc WiFi, but due to Android's lack of support for ad-hoc WiFi, I've sort of abandoned that idea and given the time constraint of this project (I only have a few weeks left to work on it) I don't want to make it any more complex than I have to.

I don't want the devices interacting with a server or anything. I'd still like it in a sort of ad-hoc fashion where the devices just sort of talk amongst themselves. At present, I think I'm just going to ignore the name conflict issue and work out a fix if I have enough time. While I've already achieved audio streaming, I still need to implement some kind of call request system, where one device can request to call another and the user on the other device can choose whether or not to start the audio conversation. Once I get that sorted, my app should have the basic functionality. If I have time left over to work on it, I'll try and polish it up a little.

This is my final year university project by the way. It's a little less exciting than I thought it would be and honestly, I don't think it's a particularly impressive project. Mostly just because when I think about what I'm working on, it's a phone call system. Most non-technically minded people who don't understand what's involved in making a system like this probably wont be impressed by it at all. Hell, I'm sure there will even be technically minded people who don't think it's a particularly impressive project. If it were to be operating over ad-hoc WiFi, that'd probably be more impressive but I think it would also have required a lot more work. Still, it'll probably be the most impressive piece of software I've produced if I actually get it working.


BBS Moderator - Feel free to send me a PM if you have a problem!

BBS Signature

Response to Programming Regs Lounge 2013-03-23 21:59:01


Since HTML5 games are here, I think there should be a :main for HTML5, CSS3 and JS. I know Afro-Ninja has locked previous attempts at (X)HTML, CSS and JS mains, but you can't just go to w3schools to learn how to make HTML5 games. (I am aware that HTML5 and CSS3 are not programming languages, but how the DOM interacts with JS is a programming topic.)

I apologise if I'm not the first to suggest this...

Response to Programming Regs Lounge 2013-03-25 15:07:02


I started a new Python project which uses non-blocking sockets. Since I'm mostly making this project for my portfolio I'm not using Twisted; under any other circumstances I absolutely wouldn't be rolling out my own framework for this.

Either way I found a handy use for function decorators specifically for handling non-blocking operations. Normally to do this you need to wrap everything you do with the sockets in a try/catch that looks for the blocking exception:

def handle_conn():
  try:
    return mysocket.accept()
  catch socket.error as err:
    if err.errno != errno.EWOULDBLOCK:
      raise Exception(err)

def handle_recv():
  try:
    return mysocket.recv(1024)
  catch socket.error as err:
    if err.errno != errno.EWOULDBLOCK:
      raise Exception(err)

As you can imagine this gets ugly pretty damn fast, and is pretty damn repetitive.
Function decorators to the rescue:

def no_block(function):
  def wrapper():
    try:
      return function()
    except socket.error as err:
      if err.errno != errno.EWOULDBLOCK:
        raise Exception(err)
  return wrapper

@no_block
def handle_conn():
  return mysocket.accept()

@no_block
def handle_recv():
  return mysocket.recv(1024)

Now isn't that much prettier?
This is why I love Python so very, very much.

Response to Programming Regs Lounge 2013-03-30 14:57:44


At 3/30/13 01:50 PM, mandog wrote: print "hello"

right?

That's valid Python 2.x code, but in Python 3.x print is a function and not a keyword, so you need to do it like this:

print("hello")

You could do it that way in Python 2.x as well, but it's not very conventional.

Response to Programming Regs Lounge 2013-04-11 14:27:46


I was writing some shaders on a mac mini today and after a painful reminder that GLSL shaders also need a #version directive, I added a #version 400 to a standard phong shader -> Compile error, version 400 not supported. I was like well, ok I don't really need fancy stuff, vertex lookup and all that, so I made that to #version 200. The glsl compiler told me again that version 200 is not supported, again disappointing, but still, I only needed version 140 for what I had in mind, so I made the version to 140 and still compile error.
Now of course GLSL version 1.4 is a pretty old standard that you would expect to be supported on a new computer, so I started to look into the version of opengl and glsl the drivers supported and found out that it came with OpenGL 2.1 and GLSL 1.2, WTF?!?! those are standards that came out in 2006, it's 2013 !!!!

Response to Programming Regs Lounge 2013-04-12 02:59:33


At 3/10/13 08:06 PM, Dean wrote: Productive afternoon using C++.

Would love to play that game!

Response to Programming Regs Lounge 2013-04-29 14:11:20


No posts in over 2 weeks. What gives?

I'm about to be done with my computer science degree. Network Applications exam on Thursday and I have to make a poster for my project and display it on Friday. Project was "finished" a week or two back and my dissertation was submitted to. Was so revealed to get it out the way, although I don't really think I achieved as much as I'd have liked. I got a bit lazy with it. Still, I created an application capable of audio chat over UDP.

Still not sure where I'll be going from here though. I'll probably start applying for jobs soon, which is something I probably should have started doing a long time ago but I guess there's some comfort knowing that I'm not the only one who's left it late. Hopefully I work something out. It's sort of my goal to be living and working in Edinburgh by the end of the year. We'll see though.

In the mean time, I kinda want to try and spend some of my free time more productively, although so far that hasn't been going too well. Right now I'm thinking that I'll try to create an HTML5 to upload to Newgrounds. Been occasionally taking interest in the HTML canvas and Javascript recently, and it's project that will produce an end result that I can hopefully put to use. Just hope I can keep the motivation to do this for a while. Before that though, I need to think up a game concept...

What're you guys up to these days?


BBS Moderator - Feel free to send me a PM if you have a problem!

BBS Signature

Response to Programming Regs Lounge 2013-04-29 21:59:49


At 4/29/13 02:11 PM, Dean wrote: I'll probably start applying for jobs soon, which is something I probably should have started doing a long time ago but I guess there's some comfort knowing that I'm not the only one who's left it late.

Start doing this right now. Employers assume that students apply before they graduate, so if you apply after graduating it will look like you've been denied from a bunch of places, which isn't good.
The computer science industry is on fire right now so you shouldn't have too much trouble either way but the longer you wait the more difficult it will be.

At 4/29/13 02:11 PM, Dean wrote: Right now I'm thinking that I'll try to create an HTML5 to upload to Newgrounds.

I've been trying to start this kind of project; I even recently bought the ImpactJS game engine (which is awesome).
Too bad I can't think of any ideas whatsoever.

At 4/29/13 02:11 PM, Dean wrote: What're you guys up to these days?

Not working as hard or often as I should be. :(

Response to Programming Regs Lounge 2013-04-30 05:37:29


At 4/29/13 09:59 PM, Diki wrote: Start doing this right now. Employers assume that students apply before they graduate, so if you apply after graduating it will look like you've been denied from a bunch of places, which isn't good.

I never thought of it like that. Although my actual graduation isn't until August or something. This coming Friday is just the last day I need to be at uni. But yea, I should have started job hunting a while ago. Ideally I'd have been looking for internships over the course of previous years but with me not living in the city it made it a bit of a pain when it came to travelling. It's still a little bit of an issue because getting too and from any interviews that I receive will be costly.

At 4/29/13 09:59 PM, Diki wrote: I've been trying to start this kind of project; I even recently bought the ImpactJS game engine (which is awesome).
Too bad I can't think of any ideas whatsoever.

My aim was just to begin developing something really simple, to familiarise myself better with using JavaScript in this way. From there, just try to improve it until I'm at the point where I think it's worthy of submitting to Newgrounds. My current "plan" is to try and make another horizontal shooter, only this time put a lot more effort into it that the one I wrote in C++. Ideally I'd also try to hunt down people on NG to do some art and audio for it, but that wont be happening any time soon.

At 4/29/13 09:59 PM, Diki wrote: Not working as hard or often as I should be. :(

I was hoping to have been more productive recently myself. I was hoping to have more completed projects on GitHub to use as a sort of portfolio. So far I only have three projects on there. My Audio Chat application, the C++ game I wrote (which is a bit of a mess) and the PHP/MySQL forums I was working on which are also probably a bit of a mess.


BBS Moderator - Feel free to send me a PM if you have a problem!

BBS Signature

Response to Programming Regs Lounge 2013-05-03 09:18:59


Well, that's it. It's all over. I'm now finished with my four years at university. Today was my last day. Had to design a poster about my application and talk about it to anyone who took interest. My project supervisor and the second reader for my dissertation seemed generally impressed with it, claiming that it was quite a challenging project. Hopefully that's a good sign that I've done well in my overall degree. Hoping to come out of this with a 2:1 or whatever the equivalent is in various countries. Basically means that I graduated with an overall B.

Also, to my surprise there was quite a lot of free food on offer afterwards. Usually at these kinds of things there's a small platter of stuff for people to eat away at but today they were rolling in trolley after trolley of the stuff. It gets better though, there was free booze. Warm booze, but free none the less. I took advantage of that although I was drinking on an empty stomach so it's a little weird to be sitting in the department's Linux lab feeling a little... tipsy?

I do feel a little encouraged though. I hope my supervisor and second reader weren't just calling my project impressive to be nice. Hoping I can find a job relatively quick but I don't know how easy that will actually be. In the mean time, I actually want to try and spend my free time being productive. It's odd to think that I have no uni work to be getting on with. Procrastination will no longer be procrastination. Regardless, I want to try and add more to my GitHub account so that I have a better "portfolio" of work to show.


BBS Moderator - Feel free to send me a PM if you have a problem!

BBS Signature

Response to Programming Regs Lounge 2013-05-15 21:51:53


http://tical.co/

Opinions?

Response to Programming Regs Lounge 2013-05-16 16:14:42


At 5/15/13 09:51 PM, NinoGrounds wrote: http://tical.co/

Opinions?

Beautiful. Very minimalistic and nice. A clear and straightforward design.

Response to Programming Regs Lounge 2013-05-16 19:21:21


At 5/16/13 04:14 PM, Rawnern wrote: Beautiful. Very minimalistic and nice. A clear and straightforward design.

Minimalistic is my middle name

THANK YOU

Response to Programming Regs Lounge 2013-05-28 14:37:39


I don't know who thought of this joke but it's pretty funny.

Response to Programming Regs Lounge 2013-06-05 03:35:34


At 5/28/13 02:37 PM, Diki wrote: I don't know who thought of this joke but it's pretty funny.

i lolled

on the inside

Response to Programming Regs Lounge 2013-07-02 00:35:53


I've been busy with other shit lately so I haven't been programming very much, but a few days ago I started a new project. Basically it's going to be an IRC-esque server/client program that I'm making for fun but mostly to learn PyGTK. This post isn't about that though; this post is about a module that I wrote to handle the backend socket management.

Rather than learn one of the tried-and-true frameworks out there like Twisted I just decided to bang out a lightweight module to do what I need because A) it's fun and B) Twisted has shitty documentation that I don't like reading.

As you probably guessed the module that I wrote is written in Python, and it is used to handle all incoming and outgoing socket connections and messages for both the client and server. Here's an example of a basic echo server and client:

client.py

import pynetty

class MyProtocol(pynetty.client.ClientProtocol):
    def on_receive(self, base, data):
        print "Server sent '{}'".format(data)
        base.sock.send("Hello, server!")

pynetty.working_client = pynetty.client.ClientBase()
pynetty.working_client.protocol = MyProtocol()

pynetty.connect("127.0.0.1", 8000)

server.py

import pynetty

class MyProtocol(pynetty.client.ServerProtocol):
    def on_connect(self, base, sock, addr):
        print "{}:{} connected".format(*addr)
        sock.send("Hello, client!")

    def on_disconnect(self, base, sock, addr):
        print "{}:{} dropped".format(*addr)

    def on_receive(self, base, sock, addr, data):
        print "Client sent '{}'".format(data)

pynetty.working_server = pynetty.server.ServerBase("127.0.0.1", 8000)
pynetty.working_server.protocol = MyProtocol()z

pynetty.listen()

It's not finished yet so it doesn't function perfectly. For example if you run that example code the application will never exit; it will just loop forever doing nothing, and the only way to close it will be through the OS.

You can grab the most recent source code from my GitHub repo.

That's about it for now. I'll make another post about my IRC-type program that I'm working on when I make further progress.

Response to Programming Regs Lounge 2013-07-07 11:26:50


Keyword in this entire post: MAC. Their support for OpenGL makes me want to cry. Like, if you don't support 4, that's one thing, but 3!

My God I've missed Newgrounds. Hallo!

At 4/11/13 02:27 PM, kiwi-kiwi wrote: I was writing some shaders on a mac mini today and after a painful reminder that GLSL shaders also need a #version directive, I added a #version 400 to a standard phong shader -> Compile error, version 400 not supported.
Now of course GLSL version 1.4 is a pretty old standard that you would expect to be supported on a new computer, so I started to look into the version of opengl and glsl the drivers supported and found out that it came with OpenGL 2.1 and GLSL 1.2, WTF?!?! those are standards that came out in 2006, it's 2013 !!!!

MY E-PENIS IS BIGGER THAN YOURS

8=================================>

...and this is my fag...

BBS Signature

Response to Programming Regs Lounge 2013-07-12 22:26:15


What's going on guys. I used to be somewhat of a regular here 7-8 years ago. Unfortunately, don't remember any of my old account information. Though, it's a shame to see this forum is almost dead, but at least I still see a few familiar faces around here.

Anyway, I've been working on an "AI Battle Arena" type engine and wanted to see if anyone here was interested in getting a small competition going. Basically the idea is you code your own AI for bots and let them battle (I've already written the entire back-end code, you just code your bot according to the rules).

To get an idea of what I'm talking about, we used to have AS Wars on the Flash forum back in the day. Pretty much the exact same concept, except this will be in Python, not Actionscript. Screenshot from my engine:

Programming Regs Lounge

Response to Programming Regs Lounge 2013-07-13 02:18:23


At 7/12/13 10:26 PM, Daedalu5 wrote: stuff

AI battle sounds like fun, count me in XD

Response to Programming Regs Lounge 2013-07-13 02:39:56


At 7/13/13 02:18 AM, kiwi-kiwi wrote:
At 7/12/13 10:26 PM, Daedalu5 wrote: stuff
AI battle sounds like fun, count me in XD

Cool man, if a few more people are interested we can get this going!

On an unrelated note, I'm currently working on a program that writes its own brainfuck programs using genetic algorithms. You specify an output you want it to produce, and it generates a program capable of displaying that output. Right now I've only tested to see how well it can produce a single character of output. It will probably take a considerable more amount of tweaking to output longer strings.

But it is still quite cool. As seen in the image below, it goes from a random syntactically incorrect program to a program that almost flawlessly outputs the letter 'A' (which was the output I told it to generate). And it does this in less than 60 seconds! Note that I did not specifically tell the software how to organize a program. As in it has no initial concept that adding to a byte repeatedly and then outputting that final byte will print a character on the screen. It doesn't even know what correct syntax is at first, or what any instruction means. It learns that all on its own!

As of right now, due to the way I implemented the mutation method, it can't really make efficient use of the looping construct in brainfuck to generate more complex code. That should be fixed soon though.

Programming Regs Lounge

Response to Programming Regs Lounge 2013-07-14 05:15:31


Program now to the point where it can write programs that output complete sentences. It took less than five minutes for it to write a program that produced the output "I am aware."

Next step: See if it can evolve programs that use actual logic and user input to do things like add and multiply, reverse a string, etc.

Programming Regs Lounge

Response to Programming Regs Lounge 2013-07-25 08:51:16


At 7/14/13 05:15 AM, Daedalu5 wrote: Program now to the point where it can write programs that output complete sentences. It took less than five minutes for it to write a program that produced the output "I am aware."

Next step: See if it can evolve programs that use actual logic and user input to do things like add and multiply, reverse a string, etc.

I'd love to see the source code for this.

How high level is the fitness function. Are there syntactically invalid iterations in between valid ones?


∀x (∃e (e ∈ x ∧ ∀x ¬(x ∈ e)) ∨ ∃y ¬∃e (e ∈ x ∧ ¬∃z (z ∈ y ∧ z ∈ e ∧ ∀x ¬((x ∈ y ∧ x ∈ e) ∧ ¬(x = z)))))

Response to Programming Regs Lounge 2013-07-25 08:54:59


(actually I see that there isn't really such a thing as invalid syntax in this language)

Reminds me of a language I made that was nothing but a dereference operator and NAND.


∀x (∃e (e ∈ x ∧ ∀x ¬(x ∈ e)) ∨ ∃y ¬∃e (e ∈ x ∧ ¬∃z (z ∈ y ∧ z ∈ e ∧ ∀x ¬((x ∈ y ∧ x ∈ e) ∧ ¬(x = z)))))

Response to Programming Regs Lounge 2013-07-26 19:12:33


At 7/25/13 08:54 AM, sharpnova wrote: (actually I see that there isn't really such a thing as invalid syntax in this language)

Reminds me of a language I made that was nothing but a dereference operator and NAND.

It is possible to write a syntactically incorrect program in brainfuck, though only by mismatched loop brackets:

-++++]----[>>+ is incorrect
>--<[++>]] is incorrect

The program does generate a lot of syntactically incorrect programs at first but the incorrect programs receive score penalties and are eventually evolved away. I don't completely discard them because there can be useful genetic information in them.

Here's the source for the actual program: http://pastebin.com/mhULNwzN

And here's a zip containing the brainfuck interpreter I wrote if you want to actually run it: http://www.newgrounds.com/dump/item/88a00cf53f4efbe9cc7161fc bc87dcd3

Response to Programming Regs Lounge 2013-07-26 19:21:28


At 7/26/13 07:12 PM, Daedalu5 wrote: Here's the source for the actual program: http://pastebin.com/mhULNwzN

Also ignore the long message at the top about input, it just describes my final goal of having the program take input but I haven't gotten to that yet.

Response to Programming Regs Lounge 2013-07-27 00:13:14


At 7/26/13 07:12 PM, Daedalu5 wrote: Here's the source for the actual program: http://pastebin.com/mhULNwzN

I can now feel at peace knowing that I am not the only person in the world that prefers to write C++ in his spare time :D.
In any case you can speed up the program generation by quite a bit if you replace program += get_random_instruction(); with a string stream so the compiler doesn't have to create a copy for each iteration.
You might also want to make the std::strings in program_exists and replace_program const references just for the sake of it.
Otherwise very nice and clean, it looks pretty cool.

Response to Programming Regs Lounge 2013-07-27 15:01:21


At 7/27/13 12:13 AM, kiwi-kiwi wrote:
At 7/26/13 07:12 PM, Daedalu5 wrote: Here's the source for the actual program: http://pastebin.com/mhULNwzN
I can now feel at peace knowing that I am not the only person in the world that prefers to write C++ in his spare time :D.
In any case you can speed up the program generation by quite a bit if you replace program += get_random_instruction(); with a string stream so the compiler doesn't have to create a copy for each iteration.
You might also want to make the std::strings in program_exists and replace_program const references just for the sake of it.
Otherwise very nice and clean, it looks pretty cool.

Haha I try to use C++ as often as I can, but Python is my guilty pleasure due to how quickly you can throw a working program together. Anyway thanks for the tips though. I don't know too much about string streams yet, but that's a good idea.

Also I'm still looking for people to participate in A.I. Arena! Like I said, I've already got the whole engine complete, everyone else just needs to code a bot in Python using my engine. If you don't know Python, you can easily pick up what you'd need to know in about an hour to get started.

Response to Programming Regs Lounge 2013-07-30 11:09:35


Had my first ever software development related interview today. I went into it not really knowing what to expect but I think I did okay. Unfortunately it appears more people applied than I imagined though. Seeing as I'm in a fairly rural area and this was a job aimed more at recent computer science graduates, I didn't think there'd be much competition. I saw a guy come out of the interview before me and the two guys who were interviewing me mentioned that they had more interviews for the rest of today and tomorrow. I'd say there are a maximum of 8 people I have to compete with. I guess it's common to come out of an interview and start thinking about how you could have performed better but what's done is done I guess.

I did go in with things in my head that I planned to talk about, but I can't help but feel I wasn't specific enough in some areas and a little too specific in others. I found myself waffling on about my dissertation project at one point and wasn't sure whether to keep going at it or look for a way to talk about something else because the interviewers didn't seem to be responding too much, which left me wondering if they were actually interested in what I was talking about. There were also a couple cases of awkward silence when I was done speaking. I wasn't sure if the pause indicated that they wanted me to say more or if they were just making sure I was done talking.

I think they seemed impressed with some of the stuff I bought up. Since it appears to mostly be a web development job I mentioned a project site that I occasionally work on in my spare time, a dynamic website that I've been working on from scratch. I seem to recall one of the interviewers then repeating "you did that from scratch?" which I assume was a good sign. I spent most of my time just talking about university projects and tried to think of examples of things I've worked on as personal projects. I wish I'd remembered that I was working on that HTML5 game. I don't know how it slipped my mind, especially seeing as it's one of the more recent things I was doing.

Two other areas they questioned me on were planning and testing. I really don't think university put enough emphasis on either, but I tend to plan things with class diagram type things. I take the problem and try to split it into small parts that function separately. As for testing, that's definitely something I'll need to look into. I mentioned that I've been introduced to unit testing in Java with JUnit but we didn't spend a whole lot of time on that. Most of the testing I carry out is sort of informal. I just play around with the software for a while and try to ensure it does what I expect it will do. I did also mentioned that I've previously used the SPARK subset of Ada, which is for safety critical software and gave me a little insight to how that works. Seemed relevant because testing is quite a significant part of writing programs in SPARK. Test cases are pretty much built into the language from what I recall.

For the last 15 minutes of the interview they gave me a written test. When they said "written test" I perked up a bit, because I thought it was going to be question and answer type stuff which would have been great. Turned out to be a scenario and I had to write functions in pseudocode to solve some simple problems. I've never liked writing code on paper but I just got straight into it. Two of them involved calculating percentages, which after the interview it struck me that I'd messed up the formula for calculating percentages. I think I did something like (count / 100)*total when it should have been (count / total)*100. I'm hoping they won't laugh at my math error, but I guess the test was more about showing that you can actually produce some simple code. Why couldn't it just have been FizzBuzz haha. Overall, I think I did okay in that test.

Anyway, just thought I'd share the experience of my first interview for anyone that's interested. I think I did okay, but I can't stop thinking that another candidate will have done a better job. I know I could do well at that job, but in hindsight I'm wondering if I did a good enough job of conveying that to them. They said that I'll probably hear back by the end of the week or early next week. Fingers crossed that I do actually get this job because if I don't, I'm more than likely going to have to look for work that is outside of my region, which adds an extra level of hassle to the whole thing. Not to mention this job actually does sound pretty great and the two guys who interviewed me would be people I'd be working with on a daily basis and they both seemed like really nice guys.

You guys had many software development related interviews? How'd they go? Got any tips?


BBS Moderator - Feel free to send me a PM if you have a problem!

BBS Signature

Response to Programming Regs Lounge 2013-07-31 06:45:08


At 7/31/13 06:08 AM, deckheadtottie wrote: Don't suppose anyone knows the formula for calculating a percentage?

I'm smart. I swear!


BBS Moderator - Feel free to send me a PM if you have a problem!

BBS Signature