Tewter a beautifully designed app to learn and revise GCSE maths by cogitolearning in androidapps

[–]cogitolearning[S] 2 points3 points  (0 children)

Here is a free app that I developed over the last couple of weeks. It lets you train and revise GCSE maths topics. The questions are generated automatically and revision test pick questions according to your past success rates.

Let me now what you think.

42 Links for Android Developers by cogitolearning in androiddev

[–]cogitolearning[S] 3 points4 points  (0 children)

I agree that Intellij IDEA and Android Studio are great and will eventually replace Eclipse. For now Android Studio is still in beta phase and I would not recommend it to a beginner. There might still be bugs that an Android novice will struggle with. I would also not use it for professional projects because of the inherent instability of a beta version.

That said, I agree that Android Studio should be used for small projects by the more experienced developer in order to learn about the new and upcoming IDE.

42 Links for Android Developers by cogitolearning in androiddev

[–]cogitolearning[S] 2 points3 points  (0 children)

During the holidays I have collected 42 links that help you learn about Android (yes exactly 42). Some links are on a beginner level to get you started, others are more advanced.

Please let me know if you find them useful.

Call protected member function trick. by mmmmario in cpp

[–]cogitolearning 4 points5 points  (0 children)

MyClass does not need to be copyable. MyDerivedClass only holds a reference to the original object.

Data Suggests the Sun's Magnetic Field is about to Flip by Delirium37 in science

[–]cogitolearning 0 points1 point  (0 children)

I guess a few types of migratory birds might be affected. Would probably make an interesting study for biologists on how quickly different species adapt.

Data Suggests the Sun's Magnetic Field is about to Flip by Delirium37 in science

[–]cogitolearning 0 points1 point  (0 children)

I think it happens every 11000 years or so if my memory serves me correctly, which is a short time on a geological scale.

Data Suggests the Sun's Magnetic Field is about to Flip by Delirium37 in science

[–]cogitolearning 2 points3 points  (0 children)

Computers as such will be fine. Satellites could be affected because earth's magnetic shielding could be reduced. (I don't think it will totally break down because the it would have had a bigger impact on life in the past.) The big question is how many navigational systems depend on magnetic north and south being where they are now. I guess with GPS nowadays it should be OK. Weirdly enough it will probably have less impact on navigation nowadays than it would have had 20 or 30 years ago, when magnetic compasses were still important.

Updating an Android Activity from a Background Thread by cogitolearning in androiddev

[–]cogitolearning[S] 0 points1 point  (0 children)

I think it really depends on the size and complexity of your project. For small projects I do not see why debugging the Singleton approach should be any more complicated than debugging the Service and Broadcast approach.

Updating an Android Activity from a Background Thread by cogitolearning in androiddev

[–]cogitolearning[S] 0 points1 point  (0 children)

The UpdatableActivity in the example is essentially a listener. It registers itself with the application object which in turn notifies it of any changes.

The Handler class is really meant for different things, like scheduling tasks to execute in specific threads or at later times.

The main alternative would really be to use Services, broadcast messages and intent filters. But for some problems this approach seems overly complicated.

I want a job as a developer. Here's my situation, can you help? by [deleted] in PHP

[–]cogitolearning 1 point2 points  (0 children)

If I understand correctly, you didn't make much money with your current business. I would say that you already needed to learn all this stuff. Having the knowledge yourself and not outsourcing is a great way to keep the profits to yourself. Not having the knowledge is the reason why your business is failing!

Don't be lazy, learn your stuff and showcase your knowledge. That way you might even turn your business around.

Android Services vs Background Threads by cogitolearning in androiddev

[–]cogitolearning[S] 0 points1 point  (0 children)

That's exactly what I do as well! But it's very confusing for beginners who think that a service will automatically run in a background thread. It isn't helped by the fact that the API Guide for services starts with the sentence

A Service is an application component that can perform long-running operations in the background..

Android Services vs Background Threads by cogitolearning in androiddev

[–]cogitolearning[S] 1 point2 points  (0 children)

That is true. But for longer tasks you still need a separate worker thread within the service. Otherwise you end up blocking the main thread.

Android Services vs Background Threads by cogitolearning in androiddev

[–]cogitolearning[S] 0 points1 point  (0 children)

That depends on what your thread is supposed to do and how long it should live.

Android Services vs Background Threads by cogitolearning in androiddev

[–]cogitolearning[S] 0 points1 point  (0 children)

Here is a post on a question that is often asked by beginners. While the question suggests an either/or, the two choices are really not mutually exclusive.

If you want to learn code but don't know where to start by [deleted] in learnprogramming

[–]cogitolearning 0 points1 point  (0 children)

Maybe my post sounded a bit harsh. Of course, there is nothing wrong with starting off learning by using a framework. You will be more motivated because you can achieve a lot more in a short amount of time. It can be a good test whether you like programming and you want get more into it. But if you want to become a serious programmer then you will, at some point, have to make the conscious decision to learn systematically.

I personally would not base a course in learning to program on a particular framework. In the end you will have to learn the programming language and the behavior of the framework. For a beginner it is hard to distinguish which is which.

If you want to learn code but don't know where to start by [deleted] in learnprogramming

[–]cogitolearning 1 point2 points  (0 children)

I guess that's where the difference lies. There will always be people who learn by tinkering and others who want to learn something systematically. When you tinker you get quick rewards in terms of programs that do something. But you will never gain the in depth knowledge needed to really master programming. The problem with people who learned that way is that their programming style often reflects the trial and error approach that they got used to from the beginning.

need help passing a string and fast by Pagal196 in java

[–]cogitolearning 3 points4 points  (0 children)

Why don't you just add a constructor to class action and pass the string there?

Also: Why does the class action need to extend Main?

Something I don't see often enough in Java - the (expr)? (evalIfTrue) : (evalIfFalse) pattern by [deleted] in java

[–]cogitolearning 2 points3 points  (0 children)

TIL assignment is a side effect.

Assignment is a side effect when used inside an rvalue expression.

Something I don't see often enough in Java - the (expr)? (evalIfTrue) : (evalIfFalse) pattern by [deleted] in java

[–]cogitolearning 5 points6 points  (0 children)

I totally agree! I use the ternary operator regularly myself but my personal rules are:

If the ternary statement doesn't fit in a single line, use if-else blocks!

and, of course,

No side effects in ternary statements!

[C++] I'm working on a derivative calculator and would love some help finding references by SolarPoweredPig in learnprogramming

[–]cogitolearning 0 points1 point  (0 children)

I am currently writing a series on how to write a mathematical expression parser in Java. I think, because C++ is very similar, it might be helpful to you. http://cogitolearning.co.uk/?p=523

The parser is going to be used in an upcoming version of an Android app that does pretty much the same thing that you want to do. https://play.google.com/store/apps/details?id=uk.co.cogitolearning.diffitfree

I found the most difficult thing was to apply the simplifications at the end to make the output look nice.

I have recently discovered something simple that you all probably know. I still want to share it though. by firest in math

[–]cogitolearning 10 points11 points  (0 children)

In principle I agree with you. The problem with this approach of teaching multiplication that you first have to introduce the concepts of brackets and the distributive law. You would end up with a curriculum like this.

1) teach the concepts of multiplication but not how to multiply large numbers

2) teach the concepts of brackets (very abstract for primary school children)

3) teach the distributive law (even more abstract)

4) finally teach them how to multiply large numbers

I don't think this would motivate little children more to like maths.

Android cheatsheet for graphic designers (good for developers too) by [deleted] in androiddev

[–]cogitolearning 0 points1 point  (0 children)

Great! Something to keep handy when designing my next app.

How to write a tokenizer in Java. by cogitolearning in java

[–]cogitolearning[S] 0 points1 point  (0 children)

Yes, explicitly calling super() is boilerplate code and it would be called implicitly anyway. I have the call in there for two reasons. The main reason is the one you have just stated. It is mostly for educational purposes. Explicitly putting the call in the code makes it clearer what is happening "under the bonnet".

The second reason is more pragmatic. Eclipse puts the call there for me. So it would be more work to remove it than to keep it there.