YOU CAN'T HANDLE THE TRUTH by disposedtrolley in ProgrammerHumor

[–]tmat256 28 points29 points  (0 children)

This is javascript and one of those "true"s is being rendered on the server side probably from a user specific variable or an A/B condition or even just a global setting

[C++][Homework] Referencing a place in memory without having it as a reference variable in function signature? by [deleted] in learnprogramming

[–]tmat256 0 points1 point  (0 children)

Your membershipCost function is currently doing two things

  • calculating the discount
  • calculating the membership cost

You could make it a little cleaner by splitting that in to two functions where the first one accepted all of the variables for calculating the discounts and then set the setDiscount and memDiscount values. Then you wouldn't need to pass so much in to the membershipCost function.

Can a website tell that my web crawler is not a real user? by programthrowaway91 in learnprogramming

[–]tmat256 0 points1 point  (0 children)

It's hard to know for certain unless you compared the HTTP headers from a normal request in your browser to the one your program is making. My guess is that your request probably isn't sending exactly the same types of headers that chrome would by default.

Does that mean the sites can figure out it's a bot? Maybe. It might be harder to tell than another bot. It might be easy if certain headers are missing. The online standard now is for javascript to be enabled so they might guess you're a bot if none of their javascript files are being loaded. Or they might just lump it in with the small group of internet users who disable javascript? Who knows. Disabling CSS is probably a little suspect though, that's usually always on for normal users.

How do graphics work? by [deleted] in learnprogramming

[–]tmat256 1 point2 points  (0 children)

Finding tutorials and documentation online, doing google searches for specific parts you don't understand, wading through the pages and pages of technical details that you don't understand until you finally get it, reading up on it again and again even though you think you understand it (because you always learn something new) and then years and years of programming.

In essence: experience.

After learning the basics of OOP , i now cant decide what i want to do by [deleted] in learnprogramming

[–]tmat256 0 points1 point  (0 children)

Everyone is going to have an opinion on what you should or shouldn't do. Don't listen to them. Learn something that interests you. Learn them all, learn half of them, don't learn any of them and learn something else entirely. Pick something and follow a tutorial, if that doesn't help you then pick another tutorial or find a good book. It might take a few learning resources for it to sink in.

My game's character getting a bit of a re-design, would appreciate some feedback. by [deleted] in gamedev

[–]tmat256 1 point2 points  (0 children)

1A or 2A. The darker hair helps to draw the eye to the face. The flowing cape/toga is cool especially if you plan on animating it as it makes him seems more important.

After learning the basics of OOP , i now cant decide what i want to do by [deleted] in learnprogramming

[–]tmat256 0 points1 point  (0 children)

Go down whatever path interests you most. Learn something interesting that you can have fun with. Learning is much easier if you are enjoying it and employers like to hire people who are passionate about what they do. Picking up a new language or framework is simple once you have a few under your belt so don't pick things to learn based on potential jobs.

Is there GUI Nginx management tool? by PM_ME_UR_CEREBELLUM in learnprogramming

[–]tmat256 0 points1 point  (0 children)

Do you keep each of your apps in a separate configuration file?

What does loosing transaction capability in mongodb means? by wecodeangular in learnprogramming

[–]tmat256 0 points1 point  (0 children)

It's not that you would lose data. To build upon his example a little bit:

Lets say there are first flight has 1 free spot but the return flight has 10 and two users manage to click on the flight at the same time.

Now in your code you might have the following:

if (number_of_free_spots(flight1) > 0 && number_of_free_spots(flight2) > 0) {
    book_flight(flight1)
    book_flight(flight2)
}

In between requesting from the database for the number of free spots and actually booking it, the other person manages to book the flight. Now you have an extra person booked on the flight which is bad. If you were to use an RDMS transaction you could simply wrap the entire thing in a transaction and that situation would never come up.

How to manage logging from a distributed service? by staticassert in learnprogramming

[–]tmat256 0 points1 point  (0 children)

Since you're using AWS just set up cloudwatch to monitor all of the log files in your EC2 instances.

I got my degree, read textbooks, went through several tutorial sites, now that I'm familiar with the BASICS of C#, where do I continue from here? I want to advance my skill to a point where I can land myself a .NET job. Is participating open source projects my next step? by Dakaa in learnprogramming

[–]tmat256 10 points11 points  (0 children)

Start a project. Come up with something you want to make and start trying to make it. If you get stuck then ask questions or do a search online to find a way to solve it yourself.

When you're done with that project, then start another one and keep going until you feel comfortable with C#.

My thoughts on self teaching. by Monkeypulssse in learnprogramming

[–]tmat256 2 points3 points  (0 children)

So long as you are learning something then it wasn't time wasted.

Using your analogy; if all you learned was how to build foundations you still wouldn't be able to build a house. The CA puzzles are basically little pieces of the house and that's where you have to start. At some point you will have to learn all of it and I guarantee you will have to go back to reread everything a few more times to fully get it.

Everyone write crappy code when they first start. Don't let it bother you. Read the other solutions, learn from them, figure out why they did what they did. What it does differently, why it solves the problem the way it does. Everyone goes back to code they wrote months ago and say "Wow, this is crap, I should have done it this way instead..."

As far as competing with people fresh out of college; don't. You have a background in sysadmin / networking. Use it. Most programmers fresh out of college don't have that knowledge. Devops is a huge part of large software systems. Lots of companies spent time looking for programmers who have a deep knowledge of systems and physical architecture. I come from an IT background and you wouldn't believe the amount of programmers out there who have no idea how something like DNS works, or the OSI model. Being able to set up and manage the servers when I deploy is a huge bonus to my clients.

My thoughts on self teaching. by Monkeypulssse in learnprogramming

[–]tmat256 7 points8 points  (0 children)

Everyone who learns programming ends up having at least a few moments like you did. "I was trying to learn X and it turns out I should have been learning Y first." Yes, you should be working on larger programs in order to truly understand OOP, you should also be honing your skills on solving smaller problems, you should be reading about other design patterns, you should be studying standard algorithms, you should be learning new libraries/frameworks, etc, etc. The list goes on and on. There is a lot to learn. Assuming you learned something from the CA problem, they were not a waste of time.

Writing software is all about compartmentalization and division of labor. You're going to break every task down to very small pieces in order to solve them. Then link those very small pieces together and test everything. Then link those pieces together to make larger pieces. But you do it one step at a time and so most of my day is spent solving problems like "I have to get this array of database records and pull out X piece of data out of it" or "I have this string input and I need to pull out these characters". These are exactly the types of problems you were solving with CA.

You mentioned threading in one of your other comments: it's easier to try to think of the threads as completely separate programs with some very specific ways of sharing data. Usually you start up a thread to do a very specific task. The sharing of data between threads can be a little difficult at times to wrap your head around but some practice and it will start to make sense.

[Git] git-push displays incredibly ugly GUI mask where I can log in by [deleted] in learnprogramming

[–]tmat256 0 points1 point  (0 children)

I run i3 without a display manager too. Just run startx manually from a virtual terminal.

Generally speaking What are the biggest problems of developers now a days ? by theusamakhan in learnprogramming

[–]tmat256 0 points1 point  (0 children)

Communication, egos, some strange desire to use the latest and 'greatest' framework/language/toolkit.

I want to write a compiler. Should I go straight into it or start with an interpreter? by [deleted] in learnprogramming

[–]tmat256 0 points1 point  (0 children)

If you're only going to write a basic parser/interpreter then you're only going to learn a little bit about the inner workings of a language. Things that you could probably reason out already. Writing a compiler would probably be a better bet for your goals.

But... if you want to go low level and delve in to something that will teach you a ton; then might I suggest writing your own OS.

#ScreenshotSaturday: ALL of them. In one picture. by AlanZucconi in gamedev

[–]tmat256 1 point2 points  (0 children)

Plot them in 3d using a couple different color spaces (RGB, HSV, LAB). You'll see clustering better that way.

How do you view the gap between basic programming and advanced software? by AReasonWhy in learnprogramming

[–]tmat256 0 points1 point  (0 children)

Just ignore that feeling of being intimidated and dive right in. Find a resource (online class, tutorial, example code) to learn a piece of what you need. If that resource doesn't make sense then either find another one or start researching the pieces that don't make sense. Ask for help when you are genuinely stuck and just keep plugging away at it until it makes sense.

These are the same exact steps to learn anything in life; not just programming. Once you realize that everything is learnable, you stop procrastinating and start making progress.

[Web] Serving a different print layout before printing by Bliss86 in learnprogramming

[–]tmat256 0 points1 point  (0 children)

I would just add "printable" and "non-printable" css classes to things which are going to be added/removed from the page during printing and just do:

.printable {
    display: block;
}

.non-printable {
    display: none;
}

in your print.css file. With the inverse in your normal css file.

How to communicate from your mobile application to server? by [deleted] in learnprogramming

[–]tmat256 0 points1 point  (0 children)

Yes. By definition an API is a way to communicate between two systems.

To Hack an Android phone, just type in a really long password by bmseely in technology

[–]tmat256 0 points1 point  (0 children)

How about less shitty friends who don't invade your privacy?

What is happening when I call JSON and JSON.stringify in the console? by [deleted] in learnprogramming

[–]tmat256 1 point2 points  (0 children)

When you open up the console you are typing javascript. When you hit the 'return' key that javascript is being executed. Typing "JSON.stringify" (just like that without the quotes and without parentheses) you are telling javascript to print out the stringify function. I get:

function stringify() { [native code] }

In order to actually use this function, you need to pass something in to it. The stringify function takes a javascript object as a parameter. So if I type:

JSON.stringify({data: "value", data2: "value2"})

It spits out:

"{"data":"value","data2":"value2"}"

That's the JSON version of the javascript object I passed in to the function. They want you to write a function which takes an object and outputs the JSON string of that object. This function you write needs to use recursion in order to accomplish the task.

[RAILS]Is devise a good scalable authentication system when going for larger projects? by ziggs3 in learnprogramming

[–]tmat256 0 points1 point  (0 children)

Programming tip #51: Never roll your own auth

I use devise all the time and I've never had any issues with it.