ProgrammingGAF, what are some good resources to teach yourself how to program?
What are you looking to focus on?
ProgrammingGAF, what are some good resources to teach yourself how to program?
Check this stackoverflow question. I think for what you want, the StringBuilder solution is the most suitable one, as the binary string may vary its length (it's not always 7 digit).
Use IntelliJ, best IDE around not named Visual Studio.I have a Laptop with 4k display, I want to do some java development in Eclipse or NetBeans and none of them scale properly. Like wtf?
in 2016, how is it that these popular IDE does not support 4k display? I thought by now 4K displays will be common. Fucking shame.
What should I use? Any suggestions?
What are you looking to focus on?
Use IntelliJ, best IDE around not named Visual Studio.
https://www.codecademy.com/learn/pythonI'd like to start with the basic stuff.
I'd like to start with the basic stuff.
I'd like to start with the basic stuff.
"Coding the matrix"Definitely a smorgasbord of stuff, and maybe not exactly what you're looking for, but this has plenty of links to CS lectures. From 101 level stuff up to some advanced topics. Great if you just want exposure to CS.
"Coding the matrix"
Misleading!
Others have replied about adding padding zeroes, but ASCII technically *is* a 7 bits code, not eight.1001 1100 also all my binaries are 7 digit, which I just realized. Any helpful hints?
Well this got me almost there.
String bin = String.format("%8s", Integer.toBinaryString(ch1)).replace(' ', '0');
Now I am getting 8 numerals with padded zero. I probably won't get the split into 2 sets of 4 though. I probably will lose 2 points out of 100 for it.
Thanks for the link.
https://www.codecademy.com/learn/python
Have fun. When you're done, see if you can make a small console (command prompt) game like a text adventure.
Honestly, that's like the most vague of an answer possible. As for what you should do to start, I personally suggest udacity's intro to programming.
Definitely a smorgasbord of stuff, and maybe not exactly what you're looking for, but this has plenty of links to CS lectures. From 101 level stuff up to some advanced topics. Great if you just want exposure to CS.
I'm building a search engine with Java for a class. We started with the crawler, in which we use the Wikipedia API to get the pages and it's categories, and we also get the external links and send them to Crawler4J. It uses kinda of a pipeline design; a thread uses the API to get the page and it sends the page info to another thread which writes on the DB and the external links to another thread with Crawler4J (which too sends to the DB thread), and finally it also sends the text striped out of the HTML tags to another thread which puts it into a Solr instance. However, after ~30min or so, an OutOfMemory Exception is raised on the "Solr thread", I imagine due to the long texts in the ConcurrentLinkedQueue. The program don't stop running, I have to do that manually, BUT, no thread does any work. So my question is, is there a way to pause all other threads when that happen, except the Solr thread, which I want to keep running, processing whatever is on the queue until it's empty, so that I can un-pause the other threads?
I'm having some trouble helping students understand object-oriented design. I tutor CS at my university, and this is one of the areas where it has been hard to get students to understand. They often want to just make super classes or make their main method do work for them. What often happens is that I'll illustrate a good OOP model to use for their classes. Essentially, I'm giving them an informal UML diagram. They'll buy into it, then have trouble implementing what I've described to them, and regress to making Franken-classes. So, I either have to let them do that or instruct them on how to implement it. But at that point, I'd be essentially doing their project for them. Any suggestions on how to tutor students on how to implement good OO design without actually doing the implementation for them?
I tried using this analogy, but I think it didn't stick with them. Do you think this is a sound analogy? Imagine your program is a cube. Let's just say it's volume is its complexity and its surface area is the amount of code. Let's say we just make a monolithic class. So this one class will be very complex since it contains all of the volume of the cube. Now, let's make this program into multiple classes. So now our program cube will be divided up into something that looks like rubics cube. The total sum of the volume of each cube will be the same as the monolithic cube. This is because the end result of both programs essentially do an equivalent amount of complex tasks as a whole. However, each individual sub-cube has much smaller volume, and hence less complexity. The sum of the surface area of each subcube will be greater than the surface area of the monolithic cube. Hence, the multi-class program will require a lot more code. Or at least, it will require a lot more "prep code". And it's this part that students seem to want to run away from like the plague without realizing how much of a mess the alternative is.
Does this analogy seem to illustrate the point well?
All this is just IMHO but to be really honest, I think that analogy is quite terrible and no wonder your students are running away from it. It's not about even it being sound or wrong or right, but it's rather complex, long but doesn't really answer the biggest question of "why".
Same with "informal UML diagrams". Even if it's "informal", it's still a UML diagram, a thing that's notoriously hard thing to grasp or use effectively even if the concept behind it should be really simple, right?
How about you try to show them instead: Show them why their mega god classes suck, show cases where their classes will become un-usable or hard to refactor, show them how to improve them. You cannot just except that the magical UMLs "click" at some point and hope that they are then writing class after class of perfect OO code.
static boolean[][] lights = new boolean[1000][1000];
for (int i=0;i<=lights[0].length;i++){
for(int j=0;i<=lights[1].length;j++){
System.out.println(lights[i][j]);
}
}
From your description, it sounds like the Solr thread is taking too long to process each element from the queue, making it too big to fit into memory. The simplest approach would be to just increase the heap size of the JVM. The default size is usually fairly conservative.
If that's not an option, you could have a check in each thread that looks at how much stuff is in the queue for the Solr thread and if it's too much, it waits for a while. One way of doing this would be to have a counter (AtomicLong) shared across all the threads where the thread that fetches the data from the API adds the number of characters the article has and the Solr thread subtracts the number of characters it just processed once it's finished a given workload. That way, the counter should reflect, approximately, how much stuff is in the queue at any given point in time. In the other threads, you check that counter before you start a new workload and if that counter is over some value, you wait until it gets lower. This is not something I've ever had to implement myself and I'm far from an expert on concurrency, but this might help.
Btw, another entry for the "I evidently suck at making loops" series: I'm working on a 2D array of booleans:
Code:static boolean[][] lights = new boolean[1000][1000]; for (int i=0;i<=lights[0].length;i++){ for(int j=0;i<=lights[1].length;j++){ System.out.println(lights[i][j]); } }
anytime I try to iterate on it in any way (even just printing the values), I automatically get an ArrayIndexOutOfBoundsException. I don't understand where I'm going out of bounds and how. Reading around it might have to do about how 2D arrays are handled in Java.
Hmm, didn't think of that. It kinda defeat the purpose of separating them, but if it's only once in a while itmight do. Thanks.
Change the "<=" to "<". Since arrays start at 0, an array with 1000 elements go from position 0 to position 999. Your for is going from 0 to 1000 however.
I also think I see another problem (unless I misinterpreted what you're trying to do), but I'll let you find that out
Hint:make a non square matrix (like 5x2), and print the lengths you're using on the for.
I did explain why their mega-classes would be bad. I was trying to show them with an informal UML diagram how they can make each class take care of themselves and whenever they need to do something more complex, they have a lot of tools to make objects do work on themselves and whatnot.
All this is just IMHO but to be really honest, I think that analogy is quite terrible and no wonder your students are running away from it. It's not about even it being sound or wrong or right, but it's rather complex, long but doesn't really answer the biggest question of "why".
Same with "informal UML diagrams". Even if it's "informal", it's still a UML diagram, a thing that's notoriously hard thing to grasp or use effectively even if the concept behind it should be really simple, right?
How about you try to show them instead: Show them why their mega god classes suck, show cases where their classes will become un-usable or hard to refactor, show them how to improve them. You cannot just except that the magical UMLs "click" at some point and hope that they are then writing class after class of perfect OO code.
To give you some context. It's making a board game called Reversi. I'm basically saying to have a game class that has a board object, and 2 player objects. The board class has a 2D array of position objects. The position class has a disc object. And player objects have a reference to the same board object. A lot of students just want to make a 2D character array to represent the board and whatnot even though the assignment is an OOD project with OOD requirements.Design skills like not using big classes is something you need to experience, you can tell people all day it's bad but it doesn't sink in until someone hands you a thousand line monstrosity and asks you to fix a small bug and you waste a couple 8 hours days doing it. Toy problems aren't going to cut it and realistically what they are doing isn't necessarily bad, a typical approach should be naive and refactored as more is added. The skill comes in anticipation of changes but if the shipping product is known upfront and you'll never work on it again (as it is with programming assignments) you can safely not bother cleaning things up. You probably just want to accept it's nothing you can teach in a limited setting, but you can warn.
To give you some context. It's making a board game called Reversi. I'm basically saying to have a game class that has a board object, and 2 player objects. The board class has a 2D array of position objects. The position class has a disc object. And player connects have a reference to the same board object. A lot of students just want to make a 2D character array to represent the board and whatnot even though the assignment is an OOD project with OOD requirements.
{1, 2}
{2, 3}
{3}
{}
I made a new avatar to commemorate my former identity, so that it may not be forever lost in the annals of the internet.
I made a new avatar to commemorate my former identity, so that it may not be forever lost in the annals of the internet.
3.4. Environment variables
For running Gradle, firstly add the environment variable GRADLE_HOME. This should point to the unpacked files from the Gradle website. Next add GRADLE_HOME/bin to your PATH environment variable. Usually, this is sufficient to run Gradle.
Restart your command prompt.
FUCK
That worked.
Thank you.
I feel like I'm making this a lot harder than it needs to be..
I'm trying to read a file that looks like this:
Code:{1, 2} {2, 3} {3} {}
to fill a double int array (int[][] lines, for example). What is the simplest method to do so? I'm working in Java if it makes any difference.
The mods should have changed you to java_is_king.
Or...The mods should have changed you to java_is_king.
Wait, Ironically Supporting Fascism... Whatever was cpp_is_King with a name change? When did this happen?
RE: CPP_is_king's name change. Dumb stuff on the mods' part. Political views aside, if what someone posts is really unacceptable the thing to do is ban them, not do a stupid name change.
I've been having a problem with something.
Is anyone here familiar with Dropwizard?
I'm using it with an H2 Database, and based on all the documentation I've read, I need the class "DataSourceFactory". I've got the io.dropwizard.db in my build, but then if I try to import or use DataSourceFactory, it's not recognized. Why is this?
Nope, that isn't working. They aren't recognized.No clue what any of the stuffed you're talking about is, but my guess is you need to add an #include, import, using, or some other kind of similar statement to your file.
Anyone here familiar with Visual Studio 2015 and Code Blocks? As well as linux?
My C code compiles on Visual Studio 2015 and my school's linux server (Flip). But won't compile on code blocks. It seems like there's some syntax error. But I can't find any.
I can't post the code here directly. Would anyone be willing to PM me?