I read two, iOS development and Cocoa development. Two of the best programming books I've ever read.
are they beginner friendly? probably going to order the ios one!
I read two, iOS development and Cocoa development. Two of the best programming books I've ever read.
are they beginner friendly? probably going to order the ios one!
Asking resident Haskell experts on GAF:
My problem is the following: I have a function "f" that generates sets of strings recursively which length grows exponentially. I have another function "g" that calls "f" and extracts subsets of its results according to the position of the requested elements.
My problem is the following: While calling "g" works very fast, I have been trying to calculate the lenght of "f" with lenght (f (x y) ) and it have yet to finish after 3 hours. Even if I ask "g" to compute a sublist of a "f" set with higher recursive level (which means that it needs f(x y) in order to compute its elements), "g" still yields result very fast...
Is lazy evaluation really that awezome? Because I'm getting worried that my program doesn't behaves like it should.
Yeah, they're pretty beginner friendly. While not as dense with material as some other programming books I've read, they do a fantastic job of picking worthy topics and explaining them well.
I'd also recommend this book too, as it's become one of the standards for learning Objective C. http://www.amazon.com/Programming-Objective-C-Edition-Developers-ebook/dp/B009YLIMCY/ref=sr_1_1?ie=UTF8&qid=1358194934&sr=8-1&keywords=programming+objective+c
This book is twice as long and (at least the 4th edition which I own) walks you through designing an app in the end. I still refer to it occasionally. Download a sample of each book and see which caters to you more, can't go wrong with either one.
I'm not a Haskell expert by any stretch of the imagination although I have some familiarity with the language. I'm not 100% certain on how you have your functions written but if g is extracting f(x) at some point then under the hood what should be happening is memoisation of results, which is a strength of functional languages in general. What you're describing sounds either like:
a) You call f before g in your test so g can access memoised results from f
b) The implementation of f is doing something weird that calling it via g is not triggering
c) Haskell is doing some sorcery under the hood related to tail recursion and/or lazy evaluation
Without seeing code I can't really offer any actual insight unfortunately!
Thanks for your answer. f(n,m) generates a list, I calculated it's order of growth and is about o((2^2^n)(m^2^n)) (yes, small 'o'). So, f isn't doing something that weird. I'm just amazed about the power of lazy evaluation. Sadly, I can't share the code.And 100% sure it isn't memoisation.
Are you sure? A big part of the appeal of referential transparency in general is that the compiler knows that your code is able to be memoised automatically. But yeah lazy evaluation in general is an awesome property. So many problems can be expressed so cleanly when you can just define a list of things as an infinite series. Haskell is one of those languages that I'd love to see start making some inroads into the mainstream but a lot of programmers are scared off by the differences without really giving it a chance.
When you look and operate worse than Eclipse, you know you screwed up.
thanks! i'll order that one as well.
You can PM me, if you still need someone.Okay this is kind of lame, but can I ask someone who has some kind of computer science / programming related job a few questions about written communication in the workplace? I just realized I had to do this for homework for a technical writing class, and I don't know anyone I can easily contact. They are lame/easy questions.
thanks! i'll order that one as well.
Looking to get into "real" game making for the first time, i.e. producing a product that works on most people's systems and could potentially be sold through Steam. (Not that I expect it, of course.) I've done smaller hobbyist stuff for a long time though I'm rusty.
Should I dive into MonoGame, or is that a bad idea?
I like everything about Unity except it is not built for 2D games at all. XNA is dead (though tutorials and help for it would apply to MonoGame). DirectX by itself looks like a nightmare. SDL seems like it'd be a lot of work by comparison to most other things, but I haven't looked into it much.
EDIT: On further review, MonoGame appears to have some dependency on XNA 4 (.xnb files), so does it stand to reason that I might as well learn that for the time being? Is that wise at this point?
I'm just concerned that it takes me ages to accomplish anything and I don't want to be stuck using libraries that are 10 years out of date...unless that's actually acceptable and normal.
Scanner barCode = new Scanner(System.in);
String mCode = barCode.nextLine();
int decodeBarCode = Integer.parseInt(mCode);
I want to create a program that counts how many digits are in an integer. For example, I enter: 256420
Output: 6 digits.
How would I do this?
I first converted the String into an Integer but don't know what to do next? Any help would be appreciated.![]()
Code:Scanner barCode = new Scanner(System.in); String mCode = barCode.nextLine(); int decodeBarCode = Integer.parseInt(mCode);
while (i < s.length()) {
i++;
etc.
..
digits = i;
Well the easiest way would be to count the length of the integer as a string.I want to create a program that counts how many digits are in an integer. For example, I enter: 256420
Output: 6 digits.
How would I do this?
I first converted the String into an Integer but don't know what to do next? Any help would be appreciated.![]()
Code:Scanner barCode = new Scanner(System.in); String mCode = barCode.nextLine(); int decodeBarCode = Integer.parseInt(mCode);
public int GetLength(int number) {
return number.toString().length();
}
public int GetLength(int number) {
int result = 0;
while(number > 0) {
number = number / 10;
result = result + 1;
}
}
Code:public int GetLength(int number) { int result = 0; while(number > 0) { number = number / 10; result = result + 1; } }
public int GetLength(int number) {
int result = 0;
while(number > 0) {
number /= 10;
result++;
}
}
Why not:
Code:public int GetLength(int number) { int result = 0; while(number > 0) { number /= 10; result++; } }
Looks and reads neater.
public int GetLength(int number) {
int result = 0;
while(number > 0) {
number /= 10;
++result;
}
}
100 10 2
public void input(String[] args) {
if(args[0] >= 0 && args[0] <= 2147483647){ // This right here is the problem
value = args[0];
}else{
System.out.println("Invalid input for the number you wish to convert.");
System.exit(0);
}
//do this for all 3 values
I wanted to be clear because I wasn't sure how much Labombadog knows about programming. I probably shouldn't have even used a method.Why not:
Code:public int GetLength(int number) { int result = 0; while(number > 0) { number /= 10; result++; } }
Looks and reads neater.
I'm writing a java program that converts bases and I'm having trouble getting user input from the command line. I'm supposed to take a line such as
Code:100 10 2
with the output being 1100100
Basically the first value is a given number(100), the second is the base of that number(10), and the third is the base of the value that I want it converted to(2). Specifically I'm having problems with the first value, because I have no idea how to pass it's conditions in the if statement (must be greater than 0 and less than 2^31 - 1 inclusive) given that the value is a string, and the conditions I'm trying to set on it are integers. (also unlike the two bases, parseInt is not allowed on the given number / value)
Code:stuff
public static void main(String[] args)
{
int value = 0;
try
{
value = Integer.parseInt(args[0]);
}
catch(NumberFormatException e)
{
System.out.println("Invalid input for the number you wish to convert.");
System.exit(0);
}
//rest of numbers here, and then code to convert base
}
Close.
Code:public int GetLength(int number) { int result = 0; while(number > 0) { number /= 10; ++result; } }
(also forgot to return result)
I wanted to be clear because I wasn't sure how much Labombadog knows about programming. I probably shouldn't have even used a method.
Poop. Always somehow mix ++variable and variable++ when needed.
What's the difference?
What's the difference?
int x;
int y;
x = 1;
y = ++x; // x = 2, y = 2
y = x++; // x = 3, y = 2
For practical purposes.
Why don't you just call the function 3 times with the 3 different strings?E̶d̶i̶t̶:̶ ̶t̶h̶i̶s̶ ̶i̶s̶ ̶e̶l̶u̶d̶i̶n̶g̶ ̶m̶e̶.̶ ̶A̶n̶y̶ ̶w̶a̶y̶ ̶I̶ ̶c̶a̶n̶ ̶r̶e̶t̶u̶r̶n̶ ̶3̶ ̶c̶+̶+̶ ̶s̶t̶r̶i̶n̶g̶s̶ ̶t̶h̶a̶t̶ ̶a̶r̶e̶ ̶c̶l̶a̶s̶s̶ ̶m̶e̶m̶b̶e̶r̶s̶ ̶i̶n̶ ̶o̶n̶e̶ ̶f̶u̶n̶c̶t̶i̶o̶n̶ ̶n̶e̶a̶t̶l̶y̶?̶ ̶o̶r̶ ̶a̶m̶ ̶I̶ ̶g̶o̶i̶n̶g̶ ̶t̶o̶ ̶h̶a̶v̶e̶ ̶t̶o̶ ̶b̶r̶e̶a̶k̶ ̶i̶t̶ ̶u̶p̶ ̶i̶n̶t̶o̶ ̶d̶i̶f̶f̶e̶r̶i̶n̶g̶ ̶f̶u̶n̶c̶t̶i̶o̶n̶s̶?̶
Unless I return it as one string... Hmm....
Edit 2: duh return as a single string since it doesn't do much besides let you know what a current class name, number, and key are.
Thank you, this explains a lot, but in the context of result++ vs ++result, is one way better than the other?
In the example posted with result, if result++ would be used, then the number of digits would be one off since it's already entering the while loop (since the digit length is > 0). ++result rectifies that.
What? result++ and ++result would return the same number...wouldn't it?
++result increments then returns the new value.
result++ increments then returns the old value.
In other words, post-fix has to make a copy of x, so it is slightly costlier.
The reason this is failing is because you can't compare Strings to ints directly. The common way to do this in Java is to use exceptions:
Code:public static void main(String[] args) { int value = 0; try { value = Integer.parseInt(args[0]); } catch(NumberFormatException e) { System.out.println("Invalid input for the number you wish to convert."); System.exit(0); } //rest of numbers here, and then code to convert base }
This also has the benefit of handling inputs that aren't numbers at all as well as anything else weird that comes up.
I'm taking a data structures class this semester, and I want to try and fully understand it beyond what they teach me. Can anyone recommend me some good data structure books/links. Also, if you could recommend me three programming books what would they be?I have heard great things about Code Complete 2 so I am purchasing that. I'm very excited because this is my last semester at my local community college. I will be transferring to a state school that has a solid reputation for computer science. I took a look at the classes I have to take and they all sound really awesome. I'm just trying to make sure that I am the best programmer I could be before transferring.
Introduction to Algorithms by Cormen et al. is definitely the best book for data structures and algorithms imo. Also check out wikipedia, most of what I learned I got from there. Their articles on the subject are pretty good.I'm taking a data structures class this semester, and I want to try and fully understand it beyond what they teach me. Can anyone recommend me some good data structure books/links. Also, if you could recommend me three programming books what would they be?I have heard great things about Code Complete 2 so I am purchasing that. I'm very excited because this is my last semester at my local community college. I will be transferring to a state school that has a solid reputation for computer science. I took a look at the classes I have to take and they all sound really awesome. I'm just trying to make sure that I am the best programmer I could be before transferring.
I'm taking a data structures class this semester, and I want to try and fully understand it beyond what they teach me. Can anyone recommend me some good data structure books/links. Also, if you could recommend me three programming books what would they be?I have heard great things about Code Complete 2 so I am purchasing that. I'm very excited because this is my last semester at my local community college. I will be transferring to a state school that has a solid reputation for computer science. I took a look at the classes I have to take and they all sound really awesome. I'm just trying to make sure that I am the best programmer I could be before transferring.
I'm going to be learning C#. Biggest annoyance is that C# is not cross-platform unlike Java. I'm a Mac user. There's no C# IDE for Mac users. So I have two options. 1. Install boot camp to run Windows. 2. Run virtualisation software. I'm more interested in option 2. Any recommendation for virtualisation apps? I've heard of Parallel, VMWare and Virtual Box. I'm don't know too much about these things. Which are the best, most reliable, run smoothly, etc etc?
I'm going to be learning C#. Biggest annoyance is that C# is not cross-platform unlike Java. I'm a Mac user. There's no C# IDE for Mac users. So I have two options. 1. Install boot camp to run Windows. 2. Run virtualisation software. I'm more interested in option 2. Any recommendation for virtualisation apps? I've heard of Parallel, VMWare and Virtual Box. I'm don't know too much about these things. Which are the best, most reliable, run smoothly, etc etc?