• Ever wanted an RSS feed of all your favorite gaming news sites? Go check out our new Gaming Headlines feed! Read more about it here.

Zoe

Member
Oct 25, 2017
14,228
We run a Windows shop, so I don't see us moving away from SQL Server any time in the future. I would basically have to recreate everything I've done, and there isn't enough manpower (count = 1) to maintain many different systems.

And like I said, the example I gave is a third party product that we use. It's actually supposed to be PostgreSQL, but our SysAdmin made them change it which has caused issues on the software side from time to time when they forget to change syntax.
 

MikeRahl

Member
Oct 27, 2017
419
Have either of you just considered using a NoSQL database? That's literally exactly what it's for.

I definitely need a relational database. It's just 17 years of tech debt since it's been set up where everyone has access to CRUD actions on everything as under the dbo role. Including such fun things as connecting to the MSSQLSERVER as the sa account.
 

metaprogram

Member
Oct 28, 2017
1,174
We run a Windows shop, so I don't see us moving away from SQL Server any time in the future. I would basically have to recreate everything I've done, and there isn't enough manpower (count = 1) to maintain many different systems.

And like I said, the example I gave is a third party product that we use. It's actually supposed to be PostgreSQL, but our SysAdmin made them change it which has caused issues on the software side from time to time when they forget to change syntax.

You don't have to delete sql server, you can have multiple systems working together. I mean, having 1 headcount is obviously a problem, but it's possible to make the relational stuff be in sql server and the dynamic column-store stuff be in Cassandra or something with the relational table having a key into the column store. Then have it be up to the application to go look somewhere else for column-store data. Certainly takes some effort to set that up, but sounds like the right high-level design
 

Nachos

Member
Oct 26, 2017
798
I've been bouncing around a lot of temp jobs over the past few years, and I'm starting to crave consistent employment. After giving it a lot of thought, I think I want to get into UI and UX, but I want to start out as a front-end developer to get my foot in the door. Right now, I'm working through FreeCodeCamp, so I have a few questions.
  • Is this a stupid idea? I know the deck's stacked against those without a CS (or any) degree, but would plugging the gaps in what the site teaches, having a strong portfolio, and actively networking be enough to compensate?

    The site promises non-profit work upon finishing its three tracks, but the wait list lasts for months, and the whole site is in the middle of restructuring how it'll approach non-profit work going forward. I'm not counting on it being able to give me work experience, but I don't know how far personal projects and open source would be able to take me, assuming I'm even any good.

  • How important is it to go for the most optimal solution possible? I get the idea behind big O, but since I'm just getting into basic algorithms, I don't know how important it is. I'm already noticing multiple ways of tackling some of the prompts.
 

mugurumakensei

Elizabeth, I’m coming to join you!
Member
Oct 25, 2017
11,320
Nachos

1) I'll be honest for your first job or two it's going to be hard to get in the door. However, once you've got some work under your belt, your experience not your degree will matter.

2) efficiency is important or not important based on the individual project. as a front end developer, all your work is going to tax the client machine. Therefore, efficiency depends on how up to date most of your client machines are expected to be. With front end, especially web stuff, it's more important you don't stall the event queue more than anything. As long you avoid that, in most cases, you're going to be fine. Most web apps are not going to do tons of processing on the client.
 

culexknight

Member
Oct 25, 2017
16
I've been bouncing around a lot of temp jobs over the past few years, and I'm starting to crave consistent employment. After giving it a lot of thought, I think I want to get into UI and UX, but I want to start out as a front-end developer to get my foot in the door. Right now, I'm working through FreeCodeCamp, so I have a few questions.
  • Is this a stupid idea? I know the deck's stacked against those without a CS (or any) degree, but would plugging the gaps in what the site teaches, having a strong portfolio, and actively networking be enough to compensate?

    The site promises non-profit work upon finishing its three tracks, but the wait list lasts for months, and the whole site is in the middle of restructuring how it'll approach non-profit work going forward. I'm not counting on it being able to give me work experience, but I don't know how far personal projects and open source would be able to take me, assuming I'm even any good.

  • How important is it to go for the most optimal solution possible? I get the idea behind big O, but since I'm just getting into basic algorithms, I don't know how important it is. I'm already noticing multiple ways of tackling some of the prompts.

1. Deck isn't quite as stacked as you make it seem. Develop a portfolio.

2. "Most optimal" is a loaded phrase. In what context: with what constraints, time limits, requirements, technical limitations? If you're in embedded world, maybe up to cpp, I'd probably want to see much more understanding of what you might be considering "optimal" than, say, if you were constructing something in Java. Show completion and understanding.
 
OP
OP
Moosichu

Moosichu

Member
Oct 25, 2017
898
Discord Link

Hidden content
You need to reply to this thread in order to see this content.
 
Last edited:
OP
OP
Moosichu

Moosichu

Member
Oct 25, 2017
898
Now for real, looking through all the OP suggestions and updating it accordingly!

I'm also going to throw this thread in the community spotlights, all ok with everyone? :)

Moosichu one suggestion would be to convince the forum administrators to install additional language plugins. Right now there's just HTML, PHP, and Generic. I suggested this in the suggestions thread but I don't know if it will get any traction. It would be nice to have real syntax highlighting for code snippets

See, for example: https://xenforo.com/community/resources/geshi-syntax-highlighter.89/

Something like that would be AMAZING

Done :)

https://www.resetera.com/posts/462942/
 

Deleted member 8166

Account closed at user request
Banned
Oct 26, 2017
4,075
How did it go?

I actually never had a database course in college and I sort of wish it was mandatory. It seems like its necessary to have a basic understanding of DBs in almost any job. Everything I've learned so far about SQL has been on the job.
crazy enough I got my grade today 1.15 (best grade possible is 1.0) she even told me only one other student was able to measure himself with myself. I honestly don't know how to feel about this. I made one mistake in an ERD (I forgot the relationships).
 

DarkDetective

Banned
Oct 25, 2017
4,906
The Netherlands
crazy enough I got my grade today 1.15 (best grade possible is 1.0) she even told me only one other student was able to measure himself with myself. I honestly don't know how to feel about this. I made one mistake in an ERD (I forgot the relationships).
Great, congrats dude!
The German grading system is weird tho... It was part of the introduction to German language class in middle school and it's confusing af to someone who's used to { 1=worst, 2, 3, 4, 5, 6=average, 7, 8, 9, 10=best }.
 

firehawk12

Member
Oct 25, 2017
24,158
One thing I haven't really thought about... what is Python's role in the grand scheme of things? It seems to be a lot easier to use than things like C/C++/Java, but I assume there are things that you can't do in Python or otherwise everyone would have moved over already.
 
OP
OP
Moosichu

Moosichu

Member
Oct 25, 2017
898
One thing I haven't really thought about... what is Python's role in the grand scheme of things? It seems to be a lot easier to use than things like C/C++/Java, but I assume there are things that you can't do in Python or otherwise everyone would have moved over already.

It's all a matter of trade-offs. So yes, whilst you can do a lot of stuff very easily in Python, it still doesn't make it the best choice for everything. It's also worth pointing out, that you can perform any possible computation you want in any programming language that is Turing complete, so anything you can do in Python, you can do in C, you can do in C++, you can do in Java, etc.

So, a bit more about the tradeoffs. Python has been designed to be a language that is incredibly easy to use, to learn, and is incredibly low-friction, but these benefits come with costs:
  • Maintainability is a big one. Python is designed to be incredibly low friction, so you can very easily hack something together which does what you want extremely fast. The problem with this though, is the fact that friction that other languages provide, in lets say their type systems, make it much easier to write more maintainable code, even if it takes more time to write that code in the first place.
  • Performance is the second big one. Python, again, in order to be low friction, manages a lot of things for the programmer (such as memory) that they otherwise would have to manage themselves. This makes writing programs incredibly easy, but comes at a performance cost.
  • Multithreading. This is very Python-Specific, but the GIL (global interpreter lock) is a pain to work with I've heard.
  • Libraries are also important. If you work in a particular field, if everyone in that field is using C++, then all the tools you are going to want to use are going to be written in C++ as well, and the libraries that help you do things in that field won't be as mature in other languages such as Python. This means that even in cases where you might prefer one language over another, the tools available may just nudge you in the other direction.
I hope my post makes sense, discussing the tradeoffs between different languages is a huge field in and of itself, but I hope this gets across the idea that there isn't "one ideal language", and that programming languages are just tools, and different tools are better for different jobs.
 

firehawk12

Member
Oct 25, 2017
24,158
It's all a matter of trade-offs. So yes, whilst you can do a lot of stuff very easily in Python, it still doesn't make it the best choice for everything. It's also worth pointing out, that you can perform any possible computation you want in any programming language that is Turing complete, so anything you can do in Python, you can do in C, you can do in C++, you can do in Java, etc.

So, a bit more about the tradeoffs. Python has been designed to be a language that is incredibly easy to use, to learn, and is incredibly low-friction, but these benefits come with costs:
  • Maintainability is a big one. Python is designed to be incredibly low friction, so you can very easily hack something together which does what you want extremely fast. The problem with this though, is the fact that friction that other languages provide, in lets say their type systems, make it much easier to write more maintainable code, even if it takes more time to write that code in the first place.
  • Performance is the second big one. Python, again, in order to be low friction, manages a lot of things for the programmer (such as memory) that they otherwise would have to manage themselves. This makes writing programs incredibly easy, but comes at a performance cost.
  • Multithreading. This is very Python-Specific, but the GIL (global interpreter lock) is a pain to work with I've heard.
  • Libraries are also important. If you work in a particular field, if everyone in that field is using C++, then all the tools you are going to want to use are going to be written in C++ as well, and the libraries that help you do things in that field won't be as mature in other languages such as Python. This means that even in cases where you might prefer one language over another, the tools available may just nudge you in the other direction.
I hope my post makes sense, discussing the tradeoffs between different languages is a huge field in and of itself, but I hope this gets across the idea that there isn't "one ideal language", and that programming languages are just tools, and different tools are better for different jobs.

Yeah, it does. Is there a reason why Python ended up being the defacto language of big data analysis (in addition to R) then? Because the people doing data analysis don't really have the same performance and maintainability concerns as other programmers doing other work?
 
OP
OP
Moosichu

Moosichu

Member
Oct 25, 2017
898
Yeah, it does. Is there a reason why Python ended up being the defacto language of big data analysis (in addition to R) then? Because the people doing data analysis don't really have the same performance and maintainability concerns as other programmers doing other work?

The thing with data analysis right, is that you want to quickly analyse your data in a load of different ways. Its essentially a search for insights into the data, so it is a lot of iteration. Also, a lot of the hard work and calculations can be farmed out to libraries written in C fort example, so you don't really have that performance cost.
 

erd

Self-Requested Temporary Ban
Banned
Oct 25, 2017
1,181
Python just does everything you'd want for data analysis and machine learning really. And not just for that, but for scientific programming in general, which is something Python's incredible at.
  • It's easy to use, and it's easy to produce good code.
  • It allows for quick prototyping.
  • It has a ton of libraries for whatever you need, and they tend to be very easy to install.
  • If you want to implement something maths heavy yourself, Numpy makes it as easy as it gets.
And the main drawbacks are irrelevant. Slow speed? Python is definitely not slow when your deep learning library has cuDNN support. It's hard to get much faster than that. The same applies for Scipy and Numpy, which use a lot of c and Fortran code to make things as optimized as possible. Unless you're a really good programmer you're not going to be able to write something faster without spending a lot of time and effort on it, no matter the language. Maintainability also isn't a big problem, since your code probably isn't going to grow too large to become unmaintainable.
 

The Wizard

Member
Oct 25, 2017
2,052
Low barrier of entry is also a good argument for the heavy usage of Python in data science. For people who come from a less programming heavy background e.g stats, data and maths it can be inviting to take some desired data analysis and be able to quickly put something together that gets the job done in an intuitive manner. You can produce some very nice looking clean code that's readable and non-daunting. At least that's the impression I'm getting after starting to play around with Pandas and NumPy.
 

Nachos

Member
Oct 26, 2017
798
Sorry for the late replies.
Nachos

1) I'll be honest for your first job or two it's going to be hard to get in the door. However, once you've got some work under your belt, your experience not your degree will matter.

2) efficiency is important or not important based on the individual project. as a front end developer, all your work is going to tax the client machine. Therefore, efficiency depends on how up to date most of your client machines are expected to be. With front end, especially web stuff, it's more important you don't stall the event queue more than anything. As long you avoid that, in most cases, you're going to be fine. Most web apps are not going to do tons of processing on the client.
Yeah, I figured that in the end, experience and ability trump all, but I didn't know how hard it would be to prove my skills, once I have them. I've been reading stories of people becoming much more alluring to recruiters after they get their first job, but they never went what the job hunt was like.

1. Deck isn't quite as stacked as you make it seem. Develop a portfolio.

2. "Most optimal" is a loaded phrase. In what context: with what constraints, time limits, requirements, technical limitations? If you're in embedded world, maybe up to cpp, I'd probably want to see much more understanding of what you might be considering "optimal" than, say, if you were constructing something in Java. Show completion and understanding.
Yeah, I agree that developing a portfolio (without all the cookie-cutter projects that most of the sites that teach how to do web development have you make) is the most important thing I should be focusing on. I guess I wasn't sure if I would have to meet higher standards compared to a university graduate, because I'd be more of an unknown. I've been looking at job listings to see what's relevant around my city, and I've seen a few that require a bachelor's degree no matter what, regardless of experience.

But I'm finding that I'm not liking FreeCodeCamp that much. It does force you to research things on your own, which I like, but I feel like the lessons aren't good enough or long enough to give a good foundation for the material. And with how often I've had to look at other resources, I might as well drop FCC and just rush all the projects if I need to later on.

I did find this alternative from someone who was one of the most active users on the forums but seemed like he grew increasingly displeased with the direction the site was going in. It's much heavier on computer science and gets you working with things like Git (which FCC doesn't cover until 800 hours in) from the start. I actually want more rigor, so I think I'm just going to use that as my blueprint instead.
 
Oct 28, 2017
751
I have a question that "involves" programming, but it's more career focused, so I hope it's ok if I post it here. Earlier this year, I got my Associate's degree in application programming and development at my local community college. During that time, I worked for two years as a part-time student worker at their technical help desk, and I enjoyed my time there. After getting my degree, I've been applying to entry level positions in the help desk field, but I haven't had any luck, so I'm kind of at a crossroad, wondering if I should keep going for a help desk job, or try to focus on programming again.

If I go back to programming, I feel like I'm rusty and could use some resources to help me get up to speed to a certain level. In college, I worked with Visual Basic, C#, Java, JavaScript, Objective-C, and HTML. My Java 2 class involved working with Android applications. I've been asked "What's your favorite language?", but I don't really have one. I guess I haven't gotten too deep into one yet to prefer it over the others. I also realize there's the issue of going for a Bachelor's degree, but it took me long enough to get my Associate's (I'm 26 now) and I feel like I want to move on from school to the next part of my life, if possible.

So I guess what I'm trying to ask is what would I need to do and work on in order to become competent enough in application programming to get an entry level job in the field? I'm sorry if this question is too open ended, but I would really appreciate any advice on what I should do next. I'll provide more information if needed.
 
Oct 28, 2017
10,000
I have a question that "involves" programming, but it's more career focused, so I hope it's ok if I post it here. Earlier this year, I got my Associate's degree in application programming and development at my local community college. During that time, I worked for two years as a part-time student worker at their technical help desk, and I enjoyed my time there. After getting my degree, I've been applying to entry level positions in the help desk field, but I haven't had any luck, so I'm kind of at a crossroad, wondering if I should keep going for a help desk job, or try to focus on programming again.

If I go back to programming, I feel like I'm rusty and could use some resources to help me get up to speed to a certain level. In college, I worked with Visual Basic, C#, Java, JavaScript, Objective-C, and HTML. My Java 2 class involved working with Android applications. I've been asked "What's your favorite language?", but I don't really have one. I guess I haven't gotten too deep into one yet to prefer it over the others. I also realize there's the issue of going for a Bachelor's degree, but it took me long enough to get my Associate's (I'm 26 now) and I feel like I want to move on from school to the next part of my life, if possible.

So I guess what I'm trying to ask is what would I need to do and work on in order to become competent enough in application programming to get an entry level job in the field? I'm sorry if this question is too open ended, but I would really appreciate any advice on what I should do next. I'll provide more information if needed.

Too be honest it really depends on what you want to do? Do you want a career in help desk/IT or do you want to program/develop software. As for why you aren't getting hired, well where are you applying what are their expectations and demands? What could be happening is people with Bachelors' (and experience) in Computer Science/Software Engineering/IT are applying so they are less of a risk.

My favorite language is C/C++ but that's because I prefer efficiency over everything, but a good engineer will choose the best tool for the job and that includes programming languages since they have a lot of differences. As for sources, try MIT/Other Schools free online courses, but if you want to be a good programmer you're going to need to practice, practice, practice. Do a project you want to do, you want to make an app that is simple list keeper do that, a game do that, an operating system do that. The greatest motivator to learn is to do something fun while you learn.

Too answer your final question again of "competent", it's simple practice makes better.
 

Pokemaniac

Member
Oct 25, 2017
4,944
They're forcing me to do some access stuff at work. Does anyone even use access here?

I used Access a lot at one point.

It's not a bad program in theory, but the problem is that it tends to get used in place of a real database or even a real programming language in a lot of places. Allowing VBA and especially UI building inside of Access is one of the worst mistakes Microsoft has ever made.

It's entirely possible that what you'll be working with will actually be a reasonable use of Access, it's just pretty unlikely.
 
Last edited:

Zoe

Member
Oct 25, 2017
14,228
A lot of our work is still stuck in Access. I've been trying to force everyone over to SQL Server and Reporting Services.
 

MarkRJR

Member
Oct 25, 2017
355
Anyone have any good resources for learning how to program online? I'm currently on my University's Computer Science program (2nd year) and it's almost been entirely theory and concepts. I haven't really done any actual projects or much coding for that matter.

I figured since midterm exams are over I might as try making something basic to get my feet wet. I just literally have no idea.
 

lasthope106

Member
Oct 25, 2017
920
Iowa USA
I'm going to try to get back into doing projects at home. Have been slacking for the past 3 years and work is not advancing my skills enough. I'm playing with the idea of doing a few apps for my iPhone. This will require me learning Swift. I have downloaded a few free books offered by Apple, and going to watch the Standford class about iOS development. Haven't really kept track of all the resources available to get started. Are there any others that you guys recommend?
 

erd

Self-Requested Temporary Ban
Banned
Oct 25, 2017
1,181
Anyone have any good resources for learning how to program online? I'm currently on my University's Computer Science program (2nd year) and it's almost been entirely theory and concepts. I haven't really done any actual projects or much coding for that matter.

I figured since midterm exams are over I might as try making something basic to get my feet wet. I just literally have no idea.

Well, the first step is definitely deciding what you want to do. I can think of several project oriented online resources, but they focus on specific things like, for example, web programming in ruby on rails. In general, you can look at some coursera/udacity courses and see if there's anything you like.

The second thing to consider is that, since you're in the 2nd year of a university program, you likely already know enough to make basic things. The concepts thought in CS courses might seem purely theoretical, but if you've got those concepts down there's a lot you can do. For example, simple games like Snake or Tetris can be implemented pretty easily with some basic knowledge of algorithms and data structures. This doesn't apply to all fields - things like machine learning require specific knowledge - but if you want to make something like videogames just experimenting and trying to do it on your own (and, of course, researching things when you run into trouble) can be really interesting.
 

MarkRJR

Member
Oct 25, 2017
355
Well, the first step is definitely deciding what you want to do. I can think of several project oriented online resources, but they focus on specific things like, for example, web programming in ruby on rails. In general, you can look at some coursera/udacity courses and see if there's anything you like.

The second thing to consider is that, since you're in the 2nd year of a university program, you likely already know enough to make basic things. The concepts thought in CS courses might seem purely theoretical, but if you've got those concepts down there's a lot you can do. For example, simple games like Snake or Tetris can be implemented pretty easily with some basic knowledge of algorithms and data structures. This doesn't apply to all fields - things like machine learning require specific knowledge - but if you want to make something like videogames just experimenting and trying to do it on your own (and, of course, researching things when you run into trouble) can be really interesting.
Creating something like Snake or Tetris seems insane to me. Not sure how you would manage the visual aspects of it all. I'm honestly looking for ways to apply what I know to actual code that does something. If Tetris or Snake are examples of those, I'd love to learn how. I'd love to get into games as a career choice, but every time I look into it I just hear horror stories. I'd probably lean towards Web design if only because of how relevant it seems.

All I really know atm is basic Java and C, with basic algorithm stuff. I think I may have purchased some Udemy courses back when they were on sale for really cheap. Might look into those too.
 

erd

Self-Requested Temporary Ban
Banned
Oct 25, 2017
1,181
Creating something like Snake or Tetris seems insane to me. Not sure how you would manage the visual aspects of it all. I'm honestly looking for ways to apply what I know to actual code that does something. If Tetris or Snake are examples of those, I'd love to learn how. I'd love to get into games as a career choice, but every time I look into it I just hear horror stories. I'd probably lean towards Web design if only because of how relevant it seems.

All I really know atm is basic Java and C, with basic algorithm stuff. I think I may have purchased some Udemy courses back when they were on sale for really cheap. Might look into those too.
The visual aspect isn't much of a problem - there's a variety of simple libraries that do the hard work for you. You can also disregard those completely and write it as a text based terminal application (plenty of libraries for that, with ncurses being the most well known, or something like libtcod, which is specifically made for roguelikes and has a pretty nice tutorial). Or you can just a full blown engine like Unity. For simple games, most graphics will just be drawing a square (or a character for text based games), which is pretty simple. I thought it was going to be hard at first too, but it quickly became apparent that visuals are not much of a problem for simple, 2D games.

If you want to apply something like a list, Snake is a pretty good example, since that's how you represent the snake itself. And Tetris makes good use of 2d arrays, as do most grid based games. Games actually apply a lot of things that are thought in CS courses. Data structures for keeping information about various objects, algorithms like A* for path finding, loops and branching for the actual gameplay - things like that. I can say that a lot things I personally thought were useless had a use in game programming. I don't necessarily know if they are the best way to apply those concepts, but they are at least a fun way. Something like web design is much less about algorithms and data structures, but you can get something up and running really quickly by following online tutorials.

If you already bought Udemy courses then this seems like the perfect time to use them. Can't really speak about the quality of the specific courses you have, but if they are highly rated then they should be perfectly fine - probably better than anything I can recommend tbh. For web development specifically I've also heard good things about The Odin Project, although it uses Ruby on Rails which is no longer the "hot new thing" (it is great for beginners though, imo - very approachable framework).
 

metaprogram

Member
Oct 28, 2017
1,174
Slightly more complicated than snake / tetris, a good "next step" would be a Sokoban-style game. That's the puzzle game where you have to push blocks around so that they all end up in some pre-determined final configuration.

The nice thing about it is that you can practice multiple things. First just getting it working so the user can play it and interact with it. But if you want to test your algorithms and stuff you can try to write a solver.
 

Deleted member 8166

Account closed at user request
Banned
Oct 26, 2017
4,075
good god this week we have ITIL and I've to make a test for an ITIL foundation certification.
It's more than just sleep inducing. help.
 

INST

Member
Nov 2, 2017
2,640
ITIL always bored me to tears, I simply didn't give a shit.

Also my first time posting in programming. Been an IT-Engineer for about two years now. My job requires me to be a jack of all trades: Linux (mostly CentOS), Windows Servers/Clients, networking (Cisco or bust), virtualization (VMWare of course), building monitoring and logging appliances (Zabbix/rsyslog) etc.

But in my free time I like to program simple stuff for my own personal use. Wrote my first program in Python which based on user input calculates what Windows license you'd need for your virtual environment, how much it would cost etc. Really loved doing that.

Started C++ course on Pluralsight, can't say if it's much different than Python but that is because I just started. Looking forward to developing my own tools instead of asking others.
 

Benz On Dubz

Member
Oct 27, 2017
763
Massachusetts
Hi all,

I've been working on an Oculus Rift project in my personal time. It's an fps which attempts to solve the problems associated with first person locomotion in VR. It's developed with C++, DirectX 11, XAudio2, and (of course) the Oculus SDK.

There are a lot of stock assets atm, but the current look is the direction I'm taking:



Gifs:

J1G8vZj.gif


7tdcoMI.gif


e6AU7hU.gif


1IvOT8w.gif

Feel free to critique or suggest improvements. For example, someone on another forum noted that the stereoscopic images were slightly off in a screenshot I posted there.


Thanks!

edit:
Added more media
 
Last edited:

SnakeyHips

Member
Oct 31, 2017
2,700
Wales
Anyone have any good resources for learning how to program online? I'm currently on my University's Computer Science program (2nd year) and it's almost been entirely theory and concepts. I haven't really done any actual projects or much coding for that matter.

I figured since midterm exams are over I might as try making something basic to get my feet wet. I just literally have no idea.
Codeacademy is a good site: https://www.codecademy.com/. If you want to get experience for actual projects, I'd say Java is a good place to start: https://www.codecademy.com/learn/learn-java
 
Oct 27, 2017
16,544
Hey guys, I'm doing my java hw and have gotten stuck would anyone be able to help? I'm trying to write a program that'll read in a street name and zip code (this part works fine) then call a boolean method to determine whether the zip code begins with 112 and print the address to the appropriate file. I'm stumped on boolean method, I'm not sure how to test the zip code to see if it starts with 112.

Code:
  public static void main(String[] args) throws IOException{
    File myfile = new File("addresses.txt");
    Scanner infile = new Scanner(myfile);
    int counter = 0,houseNum,zip;
    String street;
    while (infile.hasNext()) {
      //counts amount of times ran
      counter++;
      //reads data
      houseNum = infile.nextInt();
      street = infile.nextLine();
      zip = infile.nextInt();
      //prints read data and counter
      System.out.println(houseNum + street);
      System.out.println(zip); 
      System.out.println("Ran " + counter + " times.");
    }
  }
  zip();
  public staic boolean zip(zip){
    if(zip==112){
      PrintWriter ofile = new PrintWriter("All112.txt")
      ofile.println(zip);
    }
    else{
      PrintWriter ofile = new PrintWriter("allElse.txt")
      ofile.println(zip);
    }   
  }
 

MikeRahl

Member
Oct 27, 2017
419
Hey guys, I'm doing my java hw and have gotten stuck would anyone be able to help? I'm trying to write a program that'll read in a street name and zip code (this part works fine) then call a boolean method to determine whether the zip code begins with 112 and print the address to the appropriate file. I'm stumped on boolean method, I'm not sure how to test the zip code to see if it starts with 112.

The [==] (double equals) is an equality operator. So what you are asking is, does the zip I passed in EQUALS 112.

You need to figure out a way to only look at the first 3 characters; of which there are a number of ways. If you are feeling especially masochistic you could use Regular Expressions (there is a funny saying I heard once that when you use Regular Expressions to solve a problem, now you have 2 problems!)
 

Zevenberge

Member
Oct 27, 2017
570
Hey guys, I'm doing my java hw and have gotten stuck would anyone be able to help? I'm trying to write a program that'll read in a street name and zip code (this part works fine) then call a boolean method to determine whether the zip code begins with 112 and print the address to the appropriate file. I'm stumped on boolean method, I'm not sure how to test the zip code to see if it starts with 112.
A "starts with" (or any wildcard comparison) is typically a text operation. Your zip is a number. What utilities does Java offer to convert it?

If you are feeling especially masochistic you could use Regular Expressions (there is a funny saying I heard once that when you use Regular Expressions to solve a problem, now you have 2 problems!)

If my regex is not on StackOverflow, it doesn't exist.
 
Last edited:
Oct 27, 2017
16,544
The [==] (double equals) is an equality operator. So what you are asking is, does the zip I passed in EQUALS 112.

You need to figure out a way to only look at the first 3 characters; of which there are a number of ways. If you are feeling especially masochistic you could use Regular Expressions (there is a funny saying I heard once that when you use Regular Expressions to solve a problem, now you have 2 problems!)

A "starts with" (or any wildcard comparison) is typically a text operation. Your zip is a number. What utilities does Java offer to convert it?



If my regex is not on StackOverflow, it doesn't exist.
I'll change my zip from an int to string and try startsWith, thanks guys. Hopefully I can get this to return what I need.
 

erd

Self-Requested Temporary Ban
Banned
Oct 25, 2017
1,181
You don't need to use strings to extract the first x digits of an integer by the way. Plain old division works just fine.
 

DarkDetective

Banned
Oct 25, 2017
4,906
The Netherlands
I'm not very familiar with Java, but doesn't Java have a String.contains function?
Something like this:
Code:
string str1 = "string";
string str2 = "in";

bool doesContain
{
   return str1.contains(str2);
}

Also,
Code:
public staic boolean zip(zip){
Here's also a small typo (staic). Not sure if it's in your program or just a copy-paste mistake, but I think it doesn't hurt to let you know anyway. :)
 

vypek

Member
Oct 25, 2017
12,531
If you are doing division you would (might) need to account for 5 vs 9 digit zip codes though... are 9 digit zip codes a thing?

Yes, the 4 at the end represent a specific segment of a certain zip code as far as I can remember (might be mistaken). You're right that division would need to take into consideration handling zip and 4 codes that appear like "10020-7890"
 

erd

Self-Requested Temporary Ban
Banned
Oct 25, 2017
1,181
If you are doing division you would (might) need to account for 5 vs 9 digit zip codes though... are 9 digit zip codes a thing?
It depends on the length yeah, but I think it's more interesting to figure out how to do it with division than just jumping to startsWith right away (even if startsWith is an easier way).
Yes, the 4 at the end represent a specific segment of a certain zip code as far as I can remember (might be mistaken). You're right that division would need to take into consideration handling zip and 4 codes that appear like "12345-7890"
If you're storing zipcodes as an integer, you're going to have a lot of problems with different formats. Things like UK zipcodes, which are alphanumeric are not going to work, for example. There's also a variety of formats that will work just fine. That's a different problem, and I'm assuming The Last Wizard checked that it's not a problem in his case (since he said the reading part works fine). As long as the integer is actually parsed properly, division works just fine. If that's not the case, then you're going to have to use strings anyway.
 

vypek

Member
Oct 25, 2017
12,531
If you're storing zipcodes as an integer, you're going to have a lot of problems with different formats. Things like UK zipcodes, which are alphanumeric are not going to work, for example. There's also a variety of formats that will work just fine. That's a different problem, and I'm assuming The Last Wizard checked that it's not a problem in his case (since he said the reading part works fine). As long as the integer is actually parsed properly, division works just fine. If that's not the case, then you're going to have to use strings anyway.

Yeah, you're right. I hadn't even considered alphanumeric zip codes. I didn't know that was what the had in the UK. Division would be a pretty interesting way to go assuming that those kinds of zip codes aren't the kind that would be presented.
 

Zevenberge

Member
Oct 27, 2017
570
It depends on the length yeah, but I think it's more interesting to figure out how to do it with division than just jumping to startsWith right away (even if startsWith is an easier way).

It's a good exercise, certainly, but (for clarity) just for the sake of exercise. I wouldn't recommend it for any project.
 

metaprogram

Member
Oct 28, 2017
1,174
Eh, on the other hand converting to a string just for the purposes of getting a specific number of digits, and then converting it back to an integer is pretty bad too. I mean it depends on what you're going to do with those first n digits. If you need access to the individual digits, then sure convert it to a string first. If you want to treat it as a single number (e.g. to check what range it falls in), use division.
 

Zevenberge

Member
Oct 27, 2017
570
If you want to check for range, just use range checks :) lower < x && x < upper
Numbers have a value (x == 12) and an ordering (x < 13). Strings have a value (x == "12"), an ordering (x < "13") and a pattern (x.startsWith("1"), a visual representation). Please also note the subtle difference in definition of the range check and the starts with check.

I value good and pragmatic coding style over program efficiency (but I don't come from a C++ background). The first priority of a programmer should be to have a readable, working and extensible solution. If performance is a concern in the end, start optimizing then.
 
Oct 27, 2017
16,544
You don't need to use strings to extract the first x digits of an integer by the way. Plain old division works just fine.
I'm assuming something like %112==0 would do the trick right? But if not I'm unsure how to grab those first 3 digits. Math has never been my strong suit:/
I'm not very familiar with Java, but doesn't Java have a String.contains function?
Something like this:
Code:
string str1 = "string";
string str2 = "in";

bool doesContain
{
   return str1.contains(str2);
}

Also,
Code:
public staic boolean zip(zip){
Here's also a small typo (staic). Not sure if it's in your program or just a copy-paste mistake, but I think it doesn't hurt to let you know anyway. :)
I caught that typo, thanks though.

Man, this is annoying me. I'll solve one problem and something else will pop up. But when the code works, that feeling is great.

Code:
  zipC = zipcode(zip);
  }
  public static boolean zipcode(String zip){
    if(str.startsWith(112)){
      PrintWriter ofile = new PrintWriter("All112.txt");
      ofile.println(zip);
      return true;
    }
    else{
      PrintWriter ofile = new PrintWriter("allElse.txt");
      ofile.println(zip);
      return false;
    }   
  }

Now it's saying incompatible types: boolean cannot be converted to java.lang.String
 
Last edited: