Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 662 663 [664] 665 666 ... 795

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 817523 times)

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9945 on: August 28, 2016, 09:59:20 pm »

Aside from the experience gained by doing it yourself, is there any benefit to constructing a blog or forum yourself as opposed to installing a canned solution (WordPress, SimpleMachines etc)?
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #9946 on: August 28, 2016, 10:43:05 pm »

Aside from the experience gained by doing it yourself, is there any benefit to constructing a blog or forum yourself as opposed to installing a canned solution (WordPress, SimpleMachines etc)?
I have some experience in this area. I developed my own website in HTML, JS, and CSS, and now I'm working on web design for a website that uses Wordpress. My first impression was that it was way less flexible than developing it in an IDE, but, while keeping in mind that I wasn't involved in setting up the website through Wordpress (the owner of the website did that), my opinion now is that it speeds up development tremendously. Making a new page and linking it in main navigation across all your other web pages, for instance, is as simple as dragging and dropping a thing. And you still have the option of writing your own HTML and CSS. There are also lots of useful plugins for Wordpress.
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9947 on: August 29, 2016, 03:39:37 pm »

As someone who has coded multiple forums for fun and private usage, I can say that there are some potential benefits but they are likely not worth it in the long run unless you really do want to do it as a learning experience.  It is a good learning experience though and can teach you every aspect of web development from database administration to sever side development to client development.  Using one in my portfolio helped me to get my current job.

The short answer: flexibility and immunity to canned exploits are pros, but the shocking amount of code to write is a big con, and what you write isn't likely to be very secure either.

Long answer:

The forums I run now are focused on play by post RPGs, so I used the opportunity to add code to help with that.  In particular, it has the ability to insert die rolls for the different systems my group uses as BBCode tags.  That's not a great example, since there are certainly ways you could find canned solutions that would work (or just use Roll20 or the like), but I liked the fact that it fit seamlessly with the rest of the forums and it was code that I could modify myself.

I was also able to add other features that we found useful over time, such as the ability to embed modal windows (largely just popup windows if you're not familiar with the term), which would compile down to a link in the post that when clicked would present the window containing BBCode markup content.  We used that to keep track of things like initiative order in combat.  We later realized that it was a pain to stick something like that in the GM's signature, so we then added info bar areas at the tops and bottoms of threads that the GMs could edit, which could in turn hold links to the initiative windows or any other information.

Other features I added that I stole from other websites were automatically updating threads and a dynamic "who's looking at this page" indicator.  So, you can tell that someone else is viewing a thread and if they post, edit or delete something on the page you're looking at it automatically loads it for you using AJAX.  It also flashes the tab title when that happens, so if you're looking at something else you have an indicator that someone posted in a thread you're watching.  Theoretically annoying, but it works for us.

So, it's nice to be able to add features like that directly to the website and to have an intimate understanding of how it works.  The downside is that it's quite a lot of code.  I'm a professional web developer who has done this kind of thing before, and to go from nothing to a functional forum took me about six weeks of working on it in my spare time, if I recall.  Numerous bugs were found that have been fixed over the ensuing months.  The BBCode parser is hundreds of lines of PHP and the compiler is much more.  The [dice] tag compiler alone is over a thousand lines long because of the game systems it has to support now.  The AngularJS (client portion) code is also gigantic and a mess since I didn't really know how to use Angular well.  I know much better now, but can't be bothered to gut and replace it for a second time.

Using WordPress or another canned solution is going to cut weeks and weeks or months of time out.

Now... I mentioned canned exploits above, and using custom code helps there, but it comes with caveats.

WordPress is an absolute exploit magnet.  I get hits against my public IP address (I don't even have a domain for it!) where bots are scanning for wp-admin so they can attempt to exploit bugs and either upload malicious content or spam me.  My code is all custom, so exploits like that don't work.  Any prebuilt forum or CMS is going to have this problem to some degree, but the free ones are worse because more people use them, and the more people that use them, the more valuable they are as hacking targets.

If you're very careful to stay up to date and secure these things as the authors instruct then they're usually not that bad, but it's still usually a constant hassle to deal with bot registrations and spam.

That said, the caveat is that unless you're a security expert anything you write is probably going to be riddled with security problems.  I know for an absolute fact that my code is exploitable.  The backend is written to be reasonably secure and should be immune to things like SQL injection, but the REST API it uses is only secured in the most basic manner.  The big issue is the client code, which intentionally breaks AngularJS's protection to keep you from dumping raw HTML into templates.  That means that people could in theory do all kinds of nasty things, like embed malicious image tags.  For my little RP group I don't really care, but for a public website it would be a problem that would require me to completely redo the way that BBCode is compiled and cached on the server side.
Logged
Through pain, I find wisdom.

Lightningfalcon

  • Bay Watcher
  • Target locked. Firing main cannon.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9948 on: September 07, 2016, 12:07:23 am »

So, quick question. Does anyone know any cool or useful things that you can do with git (Or Mercurial, I guess)? I've got a presentation I'm doing on it and would like to have some stuff for people who are already experianced with git, so it isn't a waste of their time. Also I need something to feel 40 minutes with. So far all I have is Git bisect.
Logged
Interdum feror cupidine partium magnarum circo vincendarum
W-we just... wanted our...
Actually most of the people here explicitly wanted chaos and tragedy. So. Uh.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9949 on: September 07, 2016, 02:18:15 am »

believe it or not, you can use it as a distributed version control platform with no central repository

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9950 on: September 07, 2016, 06:46:22 am »

believe it or not, you can use it as a distributed version control platform with no central repository

yep you can have multiple parents and push thing left and right. you can also clone from a cloned repo and have a tree of repository, so that everyone can push only to maintainers and maintainers only can push to the top level repo.

you can clone into a backup server and pull regularly to prevent losing stuff.

you cannot use dropbox filesystem to have a fully distributed system but there's a version built on top of the dropbox api that can, so everyone sharing the dropbox folder can work on top of it, for full madness.
Logged

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9951 on: September 07, 2016, 10:08:28 am »

Reminder to never program when you're half-asleep because you'll spend hours and hours making really dumb mistakes and never seeing them until you just give up and redo the whole thing.

I'm writing a line of sight check in Unity. I forgot how vectors work and tried to use the target's position as the direction vector. Because the target's collision shape is a capsule and the origin is slightly underneath the floor, the ray hits the floor before it reaches the player and I spent a good 20 minutes figuring that out. Then, when I wrote a function that offset the ray's target, I put the coordinates as x, z, y. I fixed it... and ended up putting it as x, y, y. And didn't notice that for entirely too long because I thought it was some thing with local and world space getting mixed up, when if I just read back what I'd typed I'd have fixed it instantly.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

Ghills

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9952 on: September 07, 2016, 12:29:40 pm »

Reminder to never program when you're half-asleep because you'll spend hours and hours making really dumb mistakes and never seeing them until you just give up and redo the whole thing.

Yeah, everyone learns that one eventually.

Also: programming while on painkillers or shortly after surgery.  That was a very unfun week, only saved by careful checking, because we didn't have any beta testers and I absolutely had to get stuff right the first time out.
Logged
I AM POINTY DEATH INCARNATE
Ye know, being an usurper overseer gone mad with power isn't too bad. It's honestly not that different from being a normal overseer.
To summarize:
They do an epic face. If that fails, they beat said object to death with their beard.

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9953 on: September 07, 2016, 12:31:29 pm »

I feel like I need to make a Ballmer peak joke here.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

Reelya

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9954 on: September 07, 2016, 12:45:04 pm »

Beer and programming do not mix. Pot however ...

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9955 on: September 07, 2016, 01:37:41 pm »

believe it or not, you can use it as a distributed version control platform with no central repository

yep you can have multiple parents and push thing left and right. you can also clone from a cloned repo and have a tree of repository, so that everyone can push only to maintainers and maintainers only can push to the top level repo.

you can clone into a backup server and pull regularly to prevent losing stuff.

you cannot use dropbox filesystem to have a fully distributed system but there's a version built on top of the dropbox api that can, so everyone sharing the dropbox folder can work on top of it, for full madness.

i find it completely incredible that my sardonic answer (git is designed entirely to be a distributed version control platform with no central repository) can be taken seriously

also i meant "with no top level repo", like, that's what i meant by "no central repository"

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #9956 on: September 07, 2016, 01:56:03 pm »

So, quick question. Does anyone know any cool or useful things that you can do with git (Or Mercurial, I guess)? I've got a presentation I'm doing on it and would like to have some stuff for people who are already experianced with git, so it isn't a waste of their time. Also I need something to feel 40 minutes with. So far all I have is Git bisect.
Git isn't the most exciting thing ever.
Logged

Telgin

  • Bay Watcher
  • Professional Programmer
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9957 on: September 07, 2016, 02:57:41 pm »

Probably the most unusual thing I've heard of anyone using Git for would be writers using it to keep track of revisions of whatever they were writing.  It's kind of outside of the intended use of Git and probably not at all what you were looking for, but it's something.

I'm also not sure how well it would work in practice.  Unless you were using plain text files, Git's not going to be able to give you meaningful diffs or anything and would just serve as a glorified checkpoint system.  Branches might be useful for keeping track of different story ideas or something though.

Something slightly more relevant, but pretty mundane still, is that at work we've also used it as a sort of hacked together deployment system.  Rather than use SCP or some kind of file transfer system to copy deployed software to our production web servers, we instead just have Git running on all of them and issue "git pull" commands remotely to copy down source changes.  You can combine that with more elaborate remote scripting systems to also handle pre and post pull actions, like rebuilding dependencies.
Logged
Through pain, I find wisdom.

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9958 on: September 07, 2016, 03:26:30 pm »

I've got my resume on BitBucket.

Then again it's written in LaTeX, so ¯\_(ツ)_/¯
Logged

DragonDePlatino

  • Bay Watcher
  • [HABIT:COLLECT_WEALTH]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9959 on: September 07, 2016, 08:50:20 pm »

So. Today I programmed in Java for the first time. And made my first recursive method. It sucked.

But first some backstory...

Basically, I had to switch to a new college to get these programming classes. Unfortunately, since I had all of my general education classes out of the way, the only class I could take for the entire semester was a single lecture in remedial Python. That wasn't going to fly with me, so I begged the scheduling counselor to let me take the Java class even though I didn't have the prerequisite (Python). I told him I had a few months of self-taught C++ experience so he begrudgingly agreed.

Fast forward to today, and I open Eclipse for the first time. The assignment is to print out some fibonacci numbers. "Easy!" I think to myself. "I'll tally everything up in an array and be done in five minutes." Nope! The professor said we had to use a recursive method so that's what I did. Que an hour of compiling and recompiling trying to get a measly 5-line method to work. Combine the fact that the IDE kept screaming about Java syntax and I felt like I was about to break down in frustration.

But hark! Maybe my Java textbook shall give me some insight! There's a simple example tallying up the area of a triangle! I read, but what do I find...?

The call pattern of a recursive method looks complicated, and the key to the successful design of a recursive method is not to think about it. Instead, look at the getArea method one more time and notice how utterly reasonable it is. If the width is 1, then, of course, the area is 1. The next part is just as reasonable. Compute the area of the smaller triangle and don't think about why that works.

...

I hate recursion.
« Last Edit: September 07, 2016, 08:51:52 pm by DragonDePlatino »
Logged
Pages: 1 ... 662 663 [664] 665 666 ... 795