Author Topic: Programming Megathread  (Read 143597 times)

/^((1[0-9][0-9]|[1-9][0-9]|[1-9])|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$/
edit: it didn't work with php's preg_match, it does now

this absolute beast of regex will determine whether something is an ip address or not
it won't take in 0.0.0.0 as a valid one but anything from 1.0.0.0 to 255.255.255.255 it'll take

i absolutely hate regex because look at that its 100% unreadable but it is really good for doing a complex one-line thing like this which is neat
« Last Edit: April 12, 2016, 07:09:59 PM by Gytyyhgfffff »

^((1[0-9][0-9]|[1-9]?[0-9])|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])$

this absolute beast of regex will determine whether something is an ip address or not
it won't take in 0.0.0.0 as a valid one but anything from 1.0.0.0 to 255.255.255.255 it'll take

i absolutely hate regex because look at that its 100% unreadable but it is really good for doing a complex one-line thing like this which is neat
i do not understand regex at all *shrug

BTW,I really should get started on that document i promised about the Concepts that Honno posted.

([0-9]{1,3}\.){3}[0-9]{1,3}

i don't understand regex at all either but https://regex101.com/ helped when i was testing it
the site includes an auto generated explanation of the thing which is useful when telling what different parts of the regex thing are


([0-9]{1,3}\.){3}[0-9]{1,3}
ok you win (sort of)
it'll take 500.500.500.500 as a valid ip address which is definitely not a valid ip address


it'll take 500.500.500.500 as a valid ip address which is definitely not a valid ip address
Yeah youre correct, IP addresses (atleast IPv4 ones, not sure about IPv6) cannot have their 4 octet divisions go above 255 since theyre 32 bit

((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4}
« Last Edit: April 12, 2016, 07:20:47 PM by $trinick »

{4}
i completely forgot what that did until i saw this post
i want to die now

For a lot of simple tasks I've found libraries like Verbal Expressions to be easy to work with.

Of course there is value in learning how to craft a regex yourself, but there's also value in not spending 12 hours on it when there are other tasks at hand :P

verbal expressions make perfect sense to me even when i haven't looked at any of the documentation

thank you for linking this it's great

http://regexr.com can help you test things very quickly and make changes without needing to run code again



first attempt at Barnsley leaf

plots 1000 random points every 10 milliseconds

So, I was talking to my ex-game design teachers. Apparently my state is in a slump for Games Programming teachers, so they've suggested that I pick up a Cert4 in Training and Assessment while continuing to practice math and programming, and since they're basically heads of whole departments they'll do their best to get me some work.

Does this sound like a good deal?

if you think you'd like it and if it pays well i don't see why not

i'm now discovering the beauty of trying to do anything lua on windows instead of linux (ps: that is sarcasm)

god i'm absolutely incompetent when trying to build/make/install/whatever-you-linux-hipsters-call-it from the command line
windows has spolied me by only requiring to click the .exe and having a program installed without any hassle

i'm going to kill someone over luasql

if you know your ins and outs for this kind of stuff and wonder why tutorials exist for installing various stuff look no further because i am the sole reason why people write tutorials at all

oh my loving god why does this have to be so difficult


i'm going to murder someone
this is why stuff is precompiled and this is why compiling stuff yourself should just be burned in a pit of acid and forgotten about

is there some pre-compiled thing of luasql 2.2 out there because i'm absolutely loving tired of wasting time doing stuff workarounds and not progressing at all
« Last Edit: April 12, 2016, 11:16:18 PM by Gytyyhgfffff »

http://regexr.com can help you test things very quickly and make changes without needing to run code again
regex101 which gyt linked to is also nice, but I'm partial to regexr because it's the first one I used, lol

in other news recently I've expanded what I had in mind for that chat thing I mentioned
first off I've decided to make it a WHOLE THING including a regular HTTP server along with the chat server, because as I decided to include more and more complex features some of them were clearly not suited to websockets given that it lacks a request/response cycle. as opposed to before, where it was just going to be an HTML file, CSS file, and JS file, and that was it
furthermore I've decided to use Socket.IO instead of plain websockets, for better compatibility
I've also changed my mind about coffeescript, but I will be using Ember.js for the client side, and Express/Socket.IO for the server. with MongoDB for database stuff

also androfox will be contributing to it

-snip-
Looks like you forgot to download a required dependency beforehand