Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 380 381 [382] 383 384 ... 796

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

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5715 on: April 23, 2014, 08:00:27 am »

So... For my web page I have to replace all http://localhost:8080/ with http://skycoders.no-ip.org:60001... Should I use a utility like sed?
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5716 on: April 23, 2014, 09:07:56 am »

Well the ideal is you use relative paths for your links, or can configure it somehow. It does depend on if this is just a HTML website, or if it's using a server-side scripting language like PHP.

A tool like sed may work as a brute-force solution, or you could even define your own macro that you replace with the URL via sed (for example, you could replace all instances of with #{HOST}# with  http://localhost:8080/ when testing locally, and http://skycoders.no-ip.org:60001 when deploying to the live server). It does mean you need to script a local deploy for testing too.
« Last Edit: April 23, 2014, 09:17:47 am by MorleyDev »
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5717 on: April 23, 2014, 09:14:20 am »

All of the links have to be absolute: one of them is for configuring my backend (CherryPy), and the rest are embedded in HTML/JS to request CSS/JS/JSON from the server.
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5718 on: April 23, 2014, 09:17:53 am »

It's hard to suggest without knowing the system.

In code terms, configuration is really a dependency as much as a class or third party library is and should be treated as such whenever possible (injection and what-not). For example, the Javascript could load a config.json to a json object, then you use that json object whenever you need to specify.

And in the end, these things must be driven by pragmatism. It's often better to implement the best solution you can realistically do now and aim to work towards a better one. For example, you could sed away localhost for now, and consciously move towards relative paths or configuration or #{HOST}# or whatever as you work on areas of the code that need fixing.

In the long term, these things also help maintainability and expansion. Being able to move the backend onto a different machine from the front-end without having to touch every part of the code that talks to the backend is nice for growth.
« Last Edit: April 23, 2014, 09:21:19 am by MorleyDev »
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #5719 on: April 24, 2014, 05:52:46 pm »

Ackh going back to Javascript/Typescript after writing the client-side code in Scala is soooo....not as fun as moving from Javascript to Scala :(
Logged

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #5720 on: April 24, 2014, 07:55:33 pm »

Visual basic thingie and making macros in Excel is fun. I've never played with this stuff before. I know I'm still a nub at coding but I still feel like a god right now making shortcuts for formatting and stuff. :3
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5721 on: April 24, 2014, 09:01:01 pm »

Visual basic thingie and making macros in Excel is fun. I've never played with this stuff before. I know I'm still a nub at coding but I still feel like a god right now making shortcuts for formatting and stuff. :3

Just wait until the first time you Python.

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #5722 on: April 24, 2014, 09:28:41 pm »

Code: [Select]
import godhood

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #5723 on: April 24, 2014, 09:38:18 pm »

Visual basic thingie and making macros in Excel is fun. I've never played with this stuff before. I know I'm still a nub at coding but I still feel like a god right now making shortcuts for formatting and stuff. :3

Just wait until the first time you Python.
Whatcha talkin bout.
Logged

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #5725 on: April 24, 2014, 09:44:56 pm »

I know what it is, was more wondering if he meant that python is cool or really annoying or..?

Money's on cool.
Logged

Skyrunner

  • Bay Watcher
  • ?!?!
    • View Profile
    • Portfolio
Re: if self.isCoder(): post() #Programming Thread
« Reply #5726 on: April 24, 2014, 10:02:59 pm »

PYTHON IS SUPER COOL
Logged

bay12 lower boards IRC:irc.darkmyst.org @ #bay12lb
"Oh, they never lie. They dissemble, evade, prevaricate, confoud, confuse, distract, obscure, subtly misrepresent and willfully misunderstand with what often appears to be a positively gleeful relish ... but they never lie" -- Look To Windward

Parsely

  • Bay Watcher
    • View Profile
    • My games!
Re: if self.isCoder(): post() #Programming Thread
« Reply #5727 on: April 24, 2014, 10:05:13 pm »

PYTHON IS SUPER COOL
Now you have to explain, for the babby nublet that is me.
Logged

ECrownofFire

  • Bay Watcher
  • Resident Dragoness
    • View Profile
    • ECrownofFire
Re: if self.isCoder(): post() #Programming Thread
« Reply #5729 on: April 24, 2014, 11:51:26 pm »

PYTHON IS SUPER COOL
Now you have to explain, for the babby nublet that is me.
This should explain all there is to know about Python.

Basically it's a really good introduction to programming and has a lot of really cool features that "just make sense". Like indexing an array, you want the first element you do array[0], but to get the last element it's just array[-1]. In many other languages, you'd have to get the size of the array and then use that to find where the last element is.
Logged
Pages: 1 ... 380 381 [382] 383 384 ... 796