Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Volguus
Mar 3, 2009

tricksnake posted:

Best/popular coding practice websites/games/apps? OK I have learned C++. Next I get bombarded with "just go code stuff" from every person I ask.

Open up an IDE and write code. Why do you need a website for that?

Adbot
ADBOT LOVES YOU

Peristalsis
Apr 5, 2004
Move along.

tricksnake posted:

Best/popular coding practice websites/games/apps? OK I have learned C++. Next I get bombarded with "just go code stuff" from every person I ask.

You can take a stab at Project Euler. If you feel up to it, you could also try contributing to some open source project (GitLab, GitHub, etc.). I don't know how many are written in C++, but you can probably find something.

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

tricksnake posted:

Best/popular coding practice websites/games/apps? OK I have learned C++. Next I get bombarded with "just go code stuff" from every person I ask.

https://projecteuler.net/

https://code.google.com/codejam/

http://theaigames.com/competitions

But really just go code stuff. If you need ideas.... have you written networking code before? Write a simple chat client and server. Worked with graphics before? Make an image manipulation program like paint, or make a simple game like pong. Worked with public APIs before? Try pulling stock information or google maps data. Etc.

tricksnake
Nov 16, 2012

Dominoes posted:

Need to be more specific.

A friend of mine told me to learn C#. He said it is very relevant in today's marketplace. That's a tip for anyone willing to help me out here. I'm looking for C# practice, um... not sure what else to say.

tricksnake
Nov 16, 2012

Zaphod42 posted:

https://projecteuler.net/

https://code.google.com/codejam/

http://theaigames.com/competitions

But really just go code stuff. If you need ideas.... have you written networking code before? Write a simple chat client and server. Worked with graphics before? Make an image manipulation program like paint, or make a simple game like pong. Worked with public APIs before? Try pulling stock information or google maps data. Etc.

Ok dude.

Star War Sex Parrot
Oct 2, 2003

Dominoes posted:

Need to be more specific.
They asked this question in this thread like a year ago and got all of these responses already.

JawKnee
Mar 24, 2007





You'll take the ride to leave this town along that yellow line

tricksnake posted:

A friend of mine told me to learn C#. He said it is very relevant in today's marketplace. That's a tip for anyone willing to help me out here. I'm looking for C# practice, um... not sure what else to say.

why are you learning to program, aside from maybe trying to get a job? What kind of things do you want to write code for?

luchadornado
Oct 7, 2004

A boombox is not a toy!

tricksnake posted:

A friend of mine told me to learn C#. He said it is very relevant in today's marketplace. That's a tip for anyone willing to help me out here. I'm looking for C# practice, um... not sure what else to say.

What are you trying to do? Going through your post history in this thread, you sound like someone that doesn't give a poo poo about coding, but wants to make money coding. You're not anywhere near being an expert just from taking some online courses and reading some books, I wouldn't even classify that as "competent" by the following model:

https://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisition

This isn't to poo poo on you and the effort you put in, but it's a wake up call. If you want to make money, look at the companies in your local area and what they're hiring for. Look on Linked In, go to job fairs, go to conventions and see what is in demand and how much money you can make. I can tell you in my neck of the woods Kotlin and C# do very well - Android developers are hugely in demand, and even bad ones are treated like royalty. You can totally slot in as a 9-5 career developer with either. Some places just want cogs in a machine that will do the work. If you want to go beyond that, it's a different conversation.

You probably want to work someplace that has a product, or a website that is integral to selling that product. If it's a larger, enterprisey company, that means some flavor of Java or C# probably. If no companies in your area use C#, that's not a very good language to start with, so just keep that in mind. Smaller companies tend to lean towards Python or Node these days. Honestly, I'd pick Kotlin as a generic response to anyone looking to get into programming. It's probably the best flavor of Java, it's got great momentum, you can do enterprisey Java API/apps development with it, or you can do Android development with it - and both of those are in demand. You can also easily switch to Groovy or vanilla Java if you know Kotlin.

I didn't get a job coding until I had built something, and I don't think that was just coincidence. I like weather for example - so I built an app that grabbed and parsed a bunch of weather data and threw it into a database, then I built a REST API that exposed it, then I built a phone app and a website that consumed that API. Pick something that you can dogfood because its so much more interesting to work on. Also, if you've settled on C# as being what you want to do for example, keep up to date on a few C# related blogs, read Hacker News, and follow the current and future release notes for the language and the .NET framework so you can intelligently talk about features.

luchadornado fucked around with this message at 03:38 on Jun 29, 2018

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.

Peristalsis posted:

You can take a stab at Project Euler. If you feel up to it, you could also try contributing to some open source project (GitLab, GitHub, etc.). I don't know how many are written in C++, but you can probably find something.

Project Euler is great if you want some practice at numeric stuff. Many of the problems are best solved with clever math tricks rather than good coding though.

As much as I love the idea of more people contributing to open source projects, I don't think it's good advice for a novice looking to expand their skills. The best open source project to contribute to is one that you use every day, hit its limitations, and are inspired to solve the issues with your use cases. Just go contribute is likely to end in frustration. Starting your own open source project is a different matter though. If you think there's some piece of software missing from the world, by all means go write it and make it open source. But in general, if you're not invested in something, it's hard to make a meaningful contribution to it.

Dominoes
Sep 20, 2007

Speaking of asking repetating questions with a time lag, does anyone know how to configure a create-react-app dev server with a custom MIME type? It's something that seems like it would/should be straightforward, but it's perhaps the most elusive programming question I've had; asked multiple places on the internet, and have had 0 suggestions, and 0 relevant search results... this implies that this is a deceptively devilish task. I need this to use WASM:

quote:

Note: To run with instantiateStreaming and compileStreaming, you need your webserver to serve .wasm file with application/wasm MIME type. The https crate can be used to serve files from localhost, and includes the application/wasm MIME type out of the box.

Any thoughts on why this is so elusive?

Dominoes fucked around with this message at 04:46 on Jun 29, 2018

nielsm
Jun 1, 2009



I don't know about your application server, but in a regular web server like Apache or Nginx it's a single line of configuration.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Dominoes posted:

Any thoughts on why this is so elusive?

because the node.js culture is all about creating custom-built solutions to what should be solved problems.

from my recollection, create-react-app's server is webpack-dev-server. according to this bug, it should be solved, but you might have to update your webpack-dev-server and webpack-dev-middleware and mime packages. best of luck

Jewel
May 2, 2009

tricksnake posted:

Best/popular coding practice websites/games/apps? OK I have learned C++. Next I get bombarded with "just go code stuff" from every person I ask.

http://codingame.com I've recommended it time and time again

Pollyanna
Mar 5, 2005

Milk's on them.


We’ve got an epic to work on at work that is rapidly getting more complicated and I’m a little overwhelmed.

We have a project that is split into a Rails UI codebase and a Rails API codebase. The UI builds some stuff using its Postgres models and puts into a Mongo database, which the API then consumes and exposes. We want to stop using Mongo, but from my digging into the codebase, getting rid of our dependency on Mongo means that we will have to share a LOT of models and functionality between the API and the UI. We’ll have to break out those Postgres models into a gem or something, and share them between each codebase. And this is like, the backbone of the UI and API project, to the point where it’d just make more sense if they were the same codebase. I’m not sure this will be something we can do in two months.

Does anybody have advice on how to tackle a project like this? I’m really not sure where to even start making changes, or what would even be my best option.

Pollyanna
Mar 5, 2005

Milk's on them.


I’m digging in and it’s so much worse than that. I genuinely think trying to share models is a bad idea, and we should instead just put up some API endpoints on the UI side to expose the data the API needs. Am I just being lazy or giving up?

Peristalsis
Apr 5, 2004
Move along.

KernelSlanders posted:

Project Euler is great if you want some practice at numeric stuff. Many of the problems are best solved with clever math tricks rather than good coding though.

I'm sure there are other problem sets that can be worked through, this is just the one I'm familiar with, so I threw it up there. Other people suggested others, and the person who asked the question can peruse them to see which interests them the most.

KernelSlanders posted:

As much as I love the idea of more people contributing to open source projects, I don't think it's good advice for a novice looking to expand their skills. The best open source project to contribute to is one that you use every day, hit its limitations, and are inspired to solve the issues with your use cases. Just go contribute is likely to end in frustration. Starting your own open source project is a different matter though. If you think there's some piece of software missing from the world, by all means go write it and make it open source. But in general, if you're not invested in something, it's hard to make a meaningful contribution to it.

I understand your point, and that's why I included a qualification about the open source bit. However, I find your advice odd - someone who is too much of a novice to work on minor fixes in someone else's open source project without getting frustrated is likely to be overwhelmed very quickly with creating one of their own. It sounded to me like someone wanting to get some more experience with some coding, not design and manage a whole project, where they'd have to make architectural decisions as well as potentially having to evaluate others' submissions.

Dominoes
Sep 20, 2007

Suspicious Dish posted:

because the node.js culture is all about creating custom-built solutions to what should be solved problems.

from my recollection, create-react-app's server is webpack-dev-server. according to this bug, it should be solved, but you might have to update your webpack-dev-server and webpack-dev-middleware and mime packages. best of luck
I just deleted my frontend folder, reinstalled Create-React-App, and re-added my files; still get errors about MIME type. I'll dig more. Webpack and Node's deep reach into the JS infrastructure's a reason I look forward to WASM.

Dominoes fucked around with this message at 21:29 on Jun 29, 2018

tricksnake
Nov 16, 2012

Helicity posted:

What are you trying to do? Going through your post history in this thread, you sound like someone that doesn't give a poo poo about coding, but wants to make money coding. You're not anywhere near being an expert just from taking some online courses and reading some books, I wouldn't even classify that as "competent" by the following model:

https://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisition

This isn't to poo poo on you and the effort you put in, but it's a wake up call. If you want to make money, look at the companies in your local area and what they're hiring for. Look on Linked In, go to job fairs, go to conventions and see what is in demand and how much money you can make. I can tell you in my neck of the woods Kotlin and C# do very well - Android developers are hugely in demand, and even bad ones are treated like royalty. You can totally slot in as a 9-5 career developer with either. Some places just want cogs in a machine that will do the work. If you want to go beyond that, it's a different conversation.

You probably want to work someplace that has a product, or a website that is integral to selling that product. If it's a larger, enterprisey company, that means some flavor of Java or C# probably. If no companies in your area use C#, that's not a very good language to start with, so just keep that in mind. Smaller companies tend to lean towards Python or Node these days. Honestly, I'd pick Kotlin as a generic response to anyone looking to get into programming. It's probably the best flavor of Java, it's got great momentum, you can do enterprisey Java API/apps development with it, or you can do Android development with it - and both of those are in demand. You can also easily switch to Groovy or vanilla Java if you know Kotlin.

I didn't get a job coding until I had built something, and I don't think that was just coincidence. I like weather for example - so I built an app that grabbed and parsed a bunch of weather data and threw it into a database, then I built a REST API that exposed it, then I built a phone app and a website that consumed that API. Pick something that you can dogfood because its so much more interesting to work on. Also, if you've settled on C# as being what you want to do for example, keep up to date on a few C# related blogs, read Hacker News, and follow the current and future release notes for the language and the .NET framework so you can intelligently talk about features.

Duly noted my man... I was told C# is the way to go. I've never heard of Kotlin. I'll look it up. Doesn't seem like a good idea to learn two languages at once with these textbooks clocking in at 800+ pages... Thanks.

luchadornado
Oct 7, 2004

A boombox is not a toy!

C# is probably my favorite language, but most places pick either .NET or Java for enterprise type development. If there aren't a lot of places that use C# around you, there won't be as many opportunities to get work, etc. One of the two is bound to have opportunities in your area, just figure out which one (or both in some markets). Java is more ubiquitous.

Kotlin is made by JetBrains, makers of the only good Java IDE IntelliJ IDEA, and other cool things like ReSharper and PyCharm. They understand how languages work, and got annoyed building their IDEs in Java/Scala/Groovy (all Java Virtual Machine languages) due to various problems with each of the languages. So they made their own language that also runs on the JVM, but is heavily influenced by parts of Scala, parts of C#, etc. It's pretty good. If you know Kotlin, it isn't hard to switch to Java, Groovy, or even C# for that matter.

Definitely focus on getting one language down first. I know some devs with good careers focusing on a single language, but I would argue polyglot developers are more useful and usually have better careers.

mystes
May 31, 2006

Don't learn Kotlin for your first language. It only even exists because android doesn't support recent java language features and the number of people using it is fairly small. It's sort of hot right now but there's a very good chance it will become this embarrassing thing that nobody wants to admit to have ever liked in a few years like Groovy.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

tricksnake posted:

Duly noted my man... I was told C# is the way to go. I've never heard of Kotlin. I'll look it up. Doesn't seem like a good idea to learn two languages at once with these textbooks clocking in at 800+ pages... Thanks.

You haven't said what you want to do. "Games, websites and apps" is hella broad and even just picking one of those is gonna give you a ton of routes to go down, with different tools to learn depending on what you're aiming for

If you're just looking for A Job and you're happy with any of those areas you mentioned, and not particularly bothered which, then do what Hellcity said - look at what's in demand, pick one, and go do some tutorials until you know enough to a make a little project of your own. It's a learning process and it's something to show people

But if you want to do something in particular, you'll need to look at the technologies that get used in that area, and specialise a bit. If you want to do iOS apps, you'll need to learn Objective-C or Swift. If you want to do Android, you'll need Java (and Kotlin is becoming a new standard too). C# is very similar to Java in a lot of ways, but you won't actually use it in Android dev. Websites (frontend anyway) tends to mean Javascript and learning some frameworks. Games tend to be C++ and sometimes C# - and as far as I'm aware, it's a bit harder to break into that field without creating something to show you know what you're doing. I'm generalising but hopefully you get me

tracecomplete
Feb 26, 2017

People don't just use Kotlin because of Android. People use it because it's a strict improvement over Java without the complexity drawbacks of Scala. Unlike Groovy, Kotlin may not be Super Popular in five years but nobody is gong to be embarrassed for using it. It's a sane modern language which is reasonably representative of the mid-to-leading edge of popular software; the lessons it encourages and enforces are good ones to apply to other languages.

But TBH anyone learning to program just to get a job is going to be basically useless at their first job until the company spends six months getting them up to speed anyway so it's mostly an academic argument.

And, FWIW, mobile is a bad place to be. Write things people actually want. They don't want 95% (or more) of apps and the companies with apps people want are generally staffed by more senior people. Junior mobile development is body-shop work.

tracecomplete fucked around with this message at 16:54 on Jun 30, 2018

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
If you pick Kotlin you’re signing up to learn two languages. Do yourself a solid and just go for Java in that case.

luchadornado
Oct 7, 2004

A boombox is not a toy!

AFashionableHat posted:

People don't just use Kotlin because of Android. People use it because it's a strict improvement over Java without the complexity drawbacks of Scala. Unlike Groovy, Kotlin may not be Super Popular in five years but nobody is gong to be embarrassed for using it. It's a sane modern language which is reasonably representative of the mid-to-leading edge of popular software; the lessons it encourages and enforces are good ones to apply to other languages.

But TBH anyone learning to program just to get a job is going to be basically useless at their first job until the company spends six months getting them up to speed anyway so it's mostly an academic argument.

This is a much better way of saying what I was going to. I don't think learning any of C#, Java, Kotlin, Python, or Node would be an egregious mistake but there are pros and cons to each. I've seen a lot of new devs flourish with Kotlin and Python recently, although Python work is hard to come by (in my area). We have a really strong Kotlin community here, so I might be more accepting of it.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


I haven't paid that much attention to the entry-level job market, but it seems to me that it would be tough to get much traction without either Python or Java. Those are just such common languages that it seems like everyone is expected to know one of them.

mystes
May 31, 2006

AFashionableHat posted:

People don't just use Kotlin because of Android. People use it because it's a strict improvement over Java without the complexity drawbacks of Scala. Unlike Groovy, Kotlin may not be Super Popular in five years but nobody is gong to be embarrassed for using it. It's a sane modern language which is reasonably representative of the mid-to-leading edge of popular software; the lessons it encourages and enforces are good ones to apply to other languages.
OK, but it's just not even that much better than modern java. If you already know java and prefer kotlin and want to deal with using an alternative JVM language that's great, but for someone's first language it would make much more sense to just learn java.

Eela6
May 25, 2007
Shredded Hen
I would teach someone Go or Python for their first language I think. Relatively clean syntax and decent demand. If you just want to Get A Job dehumanize yourself and face to JavaScript, it's the one language that's absolutely unavoidable, but I kind of hate it.

Java and C#/.net are everywhere but it's also much more heavyweight and so harder to practice basic programming with.

Linear Zoetrope
Nov 28, 2011

A hero must cook

KernelSlanders posted:

As much as I love the idea of more people contributing to open source projects, I don't think it's good advice for a novice looking to expand their skills. The best open source project to contribute to is one that you use every day, hit its limitations, and are inspired to solve the issues with your use cases. Just go contribute is likely to end in frustration. Starting your own open source project is a different matter though. If you think there's some piece of software missing from the world, by all means go write it and make it open source. But in general, if you're not invested in something, it's hard to make a meaningful contribution to it.


Peristalsis posted:

I understand your point, and that's why I included a qualification about the open source bit. However, I find your advice odd - someone who is too much of a novice to work on minor fixes in someone else's open source project without getting frustrated is likely to be overwhelmed very quickly with creating one of their own. It sounded to me like someone wanting to get some more experience with some coding, not design and manage a whole project, where they'd have to make architectural decisions as well as potentially having to evaluate others' submissions.

Working on your own codebase is a lot easier than integrating into somebody else's. Hooking into somebody else's requires a lot of research and proficiency in figuring out where things are, general language conventions, stuff like that. It also requires much more formality with code cleanliness and documentation clarity, which can be a double edged sword (it's certainly not wholly a bad thing). Your own project may end up an unidiomatic nightmare, but as long as it compiles and does what's advertised it works and gets you some experience, at the risk of falling into bad habits.

I'd only recommend starting with open source contributions if you get pointed to a project that has mentorship or at least nice people who will calmly explain where you should put code or how to refactor/lint/whatever your contributions.

Now, your solo project more likely than not isn't going to get any users, especially if you made it just to write code and not to solve a problem you actually had (we don't need Basic Ray Tracing Library 299,754,210), but I think there's less pressure when you're the ruler of your own little code kingdom. KernelSlanders is right when they say it's difficult to make meaningful contributions if you haven't used the library and found its flaws or limitations yourself. You can ameliorate this if you're experienced enough. Once you have enough experience you can kiiind of jump into a codebase with nothing but an issue tracker and start trying to integrate things, but jumping into codebases just to contribute unless you have very specific goals ("I plan to use this eventually and want to become more familiar now", "I want to learn more about <X> and this is a library and contribution about <X>", etc) can be dicey at the best of times.

If you're a newbie and write an open source library that somehow explodes in popularity, then yeah, suddenly you've gotten yourself in hot water that's way worse than merely diving into a big project. But that's extremely unlikely to actually happen.

I do in general find "just go code" advice pretty bad, though. A lot of people don't have passion projects they just want to code, and often at a novice level you don't really have a sense of what's feasible or even available for you to do. Even as a more experiences programmer learning a new language I find it easier to learn by coding a task I already have in a new language than inventing a task "just to code" and learn it.

Star War Sex Parrot
Oct 2, 2003

Linear Zoetrope posted:

Hooking into somebody else's requires a lot of research and proficiency in figuring out where things are, general language conventions, stuff like that.
Which is exactly what employers value.

Linear Zoetrope
Nov 28, 2011

A hero must cook

Star War Sex Parrot posted:

Which is exactly what employers value.

Yes, but we're talking about newbies here. You have to work up to that stuff.

nielsm
Jun 1, 2009



If you pick up a larger, active open source project, chance is it also has a community of people who can help you get the build/test set up, and give you feedback on your changes both for logic and code quality. There will often be people with deep understanding of the problem domain, so they can give more qualified help.
If you start your own project, anyone you ask for help will need to learn a lot more about your structure, goals, and problem domain, and the problems might not even be any simpler.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Linear Zoetrope posted:

Yes, but we're talking about newbies here. You have to work up to that stuff.

Why? Because that was your path?

Eela6
May 25, 2007
Shredded Hen

pokeyman posted:

Why? Because that was your path?

It was mine.

spiritual bypass
Feb 19, 2008

Grimey Drawer
There's plenty of PHP jobs out there, but they all suck

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

Pollyanna posted:

I’m digging in and it’s so much worse than that. I genuinely think trying to share models is a bad idea, and we should instead just put up some API endpoints on the UI side to expose the data the API needs. Am I just being lazy or giving up?

IDK, I'm not very familiar with Rails stuff but if I was doing what you said I think that's how I'd do it. Generally a good thing to have separation between those worlds, that's basically the anti-corruption layer pattern right?

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

ultrafilter posted:

I haven't paid that much attention to the entry-level job market, but it seems to me that it would be tough to get much traction without either Python or Java. Those are just such common languages that it seems like everyone is expected to know one of them.

This, also if you know Java you know C#, and if you know Python you could pick up Lua or Perl or whatever pretty quick too.

Learn Java and Python.

CzarChasm
Mar 14, 2009

I don't like it when you're watching me eat.
Goat another one, but at least I recognize the language this time. It's a VB script that is meant to scrape the data from incoming emails, put the pieces into string variables and then feed those strings into a pick database. This is working fairly well, but I'm running into an issue with separating a combined City/State value.

The original email message will come through to us and look like the following:
From: Jimmy Vivino
Email: jgvivino@gmail.com

Phone: 666-524-8751
Location: San Diego, CA

Inventory Location: Newport Beach, CA
Stock #: 6660434


The Process reads down the email, line by line, does a CASE lookup against the field name (sFirstArgument) to the left of the ":" and returns the value (sSecondArgument) past that point. it then takes that string value and adds it to the corresponding variable so the name, or From in this case, goes into sName, email to sEmail and so on. And by and large, this has been working for most of our email submissions. But when we get down to a city and state on the same line, that's where I'm running into problems. Most of our other emails come in formatted with those items on separate lines and those process fine. This was thought of by my predecessor, who built this whole system, but it seems a bit broken here. Case Statement below with comments:

code:
Case "City,State,Country", "Location"
Dim CSZ() As String
sSecondArgument = Replace(sSecondArgument, ".", "")
CSZ() = Split(sSecondArgument, " ") **Split variable sSecondArgument where a space is located**
     If InStr(1, sSecondArgument, ",") Then **If there is a "," in the string, then break the string into pieces for each "," in the string**
          Dim sPieces() As String
          sPieces = Split(CSZ(0), ",")
          Select Case UBound(sPieces) **Count the number of pieces based on the above split**
          Case 2
               sCity = sPieces(0)
               sState = UCase(sPieces(1))
               sCountry = sPieces(2)
         Case 1
               sCity = sPieces(0)
               sState = UCase(sPieces(1))
         Case Else
               sCity = sPieces(0)
          End Select   
     Else **If there is not "," in the string**
          Select Case UBound(CSZ)
          Case 2
               sCity = CSZ(0)
               sState = UCase(CSZ(1))
               sCountry = CSZ(2)
          Case 1
               sCity = CSZ(0)
               sState = UCase(CSZ(1))
          Case Else
               sCountry = CSZ(0)
          End Select
     End If
But with these, the issue is that for half of the submissions coming in this format, the city name is two names separated by a space. So the location in this case is breaking into SAN(0) DIEGO(1) and (CA), because it is breaking on both the space and the comma. Or at least that's what I would have thought, but all I am getting is sCity = sPieces(0) so my sCity = "SAN" and then my state is blank. According to my debugging, in this case it is indicating that there is only the one value when it breaks the string into pieces, which makes a little sense due to the line sPieces = Split(CSZ(0), ",")

So I have some idea as to what the problem is, but I'm unclear as to how to fix it. I know that all the messages I'm tweaking this for will have "Location" as the field name, and all the results will be in City, State format. Can I just split that string on the comma and feed sPiece(0) into sCity and sPiece(1) into sState? It kind of dawned on me as I'm typing, but I think that should work. Thoughts?

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

I don't know the syntax but it looks like that's going
  • split the original input on spaces, store those pieces (words, if you like) in an array called CSZ
  • check if the original has a comma in there anywhere
  • if so, completely ignore everything in CSZ except the first piece, assume everything is in there separated only by commas, like City,State,Country - no spaces
  • otherwise, assume each piece (word) in CSZ is a single element of data

So something like San Diego, CA will be real broken because first it splits on spaces, "San"; "Diego,"; "CA", then it sees there's a comma in there somewhere and throws out everything but "San", and expects all the data to be in there. It's expecting the whole thing to be formatted like City,State,Country with no spaces anywhere. I'm assuming the initial split on spaces is meant to catch multi-line cases or something?

If you know all your stuff is gonna be City, State then yeah just split on the commas (and look for some kind of trim command to remove the extra whitespace, or just split on ", " or something). But if some of it is on separate lines, you'll need to spot that and handle it differently. If those are the only two situations, it's probably fine to handle them separately instead of having one parsing thing that does everything. Also, I'm guessing the multiline stuff doesn't work for something like
San Diego
CA
either, since it's splitting on spaces (probably get Diego as the state)

So yeah it would be something like
  • got a comma? Assume a single line, split on commas, each element in the result is a piece of data
  • no comma? Assume multiple lines, each line is a piece of data
splitting on spaces can't work because you have spaces in your units of data (like "San Diego"), so you'll need to find another way to grab each line. Can you split on \n (line break character) or something?

baka kaba fucked around with this message at 23:04 on Jul 3, 2018

Carecat
Apr 27, 2004

Buglord
As someone who has an intermediate understanding of C# , which textbook would be good for web development? I'm going through the W3 schools material at the moment.

"Learning PHP, MySQL & JavaScript" sounded like what I'm after but the reviews are about 3/5 for some bad practices and hit or miss on what it focuses on or doesn't cover enough.

Adbot
ADBOT LOVES YOU

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Carecat posted:

As someone who has an intermediate understanding of C# , which textbook would be good for web development? I'm going through the W3 schools material at the moment.

"Learning PHP, MySQL & JavaScript" sounded like what I'm after but the reviews are about 3/5 for some bad practices and hit or miss on what it focuses on or doesn't cover enough.

Php, mysql and w3 schools are all trash and javascript is a necessary evil. You want to pick up something about asp.net mvc .net core, something about typescript, and something about react.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply