Get Some

General => Technology & Hardware => Topic started by: swindle on May 14, 2013, 09:57:23 pm

Title: Programming Question?
Post by: swindle on May 14, 2013, 09:57:23 pm
Having a play with the Android SDK. Straight up don't know how to write code. Not even once.

But that aside, I wouldn't mind wasting a few hours figuring some things out. I'll learn what I need to right, but I have one question that I think would help fit some things together for me mentally.

Example: I want to build an app for www.reddit.com (http://www.reddit.com).

How do I go from an icon on the screen, to an app that is buttons showing all the current links etc?

I guess what I'm trying to get to in a stupid way here is - How do I import a website into an app that is interactive/current etc?

I have Eclipse/SDK and am finding tutorials on that. I just need a few simple explanations/breakdowns/directions to connect a few dots.
Title: Programming Question?
Post by: mattnz on May 15, 2013, 11:30:36 am
I certainly wouldn't start with an app like that. It's a non-trivial problem, and you're going to have to work with a HTML parsing library of some sort. That usually involves some basic data structures (loops etc.) that you should really know about before you try to code anything.

You could probably find some example code online, and maybe modify it slowly with trial and error into a Frankenstein monster program to do what you want, but chances are you'll need a reasonable amount of basic knowledge first.

Learning how to use the IDE (Integrated Development Environment, i.e. Eclipse) probably isn't as important as knowing the programming language, which I believe is Java-based in Android. Eclipse is pretty much at the top of the heap as far as IDEs go, and it's generally user-friendly.

So yeah, my recommendation would be to just find some Android programming tutorials, getting more specific towards HTML. To be fair, what you're wanting might be easier as a Firefox/Chrome addon, but that skill isn't as generalisable.
Title: Programming Question?
Post by: Apostrophe Spacemonkey on May 15, 2013, 11:34:20 am
Does the android SDK not have a web browser control which can just display html pages?
Title: Programming Question?
Post by: mattnz on May 15, 2013, 11:37:24 am
Probably I guess, but if that's all he's after he may as well just bookmark a page using a web browser, mayn't he not?
Title: Programming Question?
Post by: oefox on May 15, 2013, 01:27:59 pm
I would recommend that if you really want to know the basics you should start by learning the basic semantics of programming http://en.wikipedia.org/wiki/Semantics_%28computer_science%29

Once you get that you should progress to playing around with a basic language such as lua which is used in minecraft http://www.lua.org/docs.html

Once you understand the basic semantics of programming, all languages are inherently easier to understand, much like learning a foreign language makes learning more easier.

I would recommend installing an IDE to help develop, such as eclipse http://www.eclipse.org/downloads/
Title: Programming Question?
Post by: Apostrophe Spacemonkey on May 15, 2013, 02:59:09 pm
C# and Java look quite the same. It's easy to pick one up when you already know the other.


Programming a simple C# Console program is a good start.
Code: [Select]
using System;
 
class Program
{
    static void Main()
    {
        Console.WriteLine("Hello world!");
    }
}
http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express

Or a Java version of Ninja Attack.
Title: Programming Question?
Post by: swindle on May 15, 2013, 03:23:11 pm
Quote from: oefox;1525312
I would recommend installing an IDE to help develop, such as eclipse [url]http://www.eclipse.org/downloads/[/url]


Yeah am using that.

Thanks guys. Info is brilliant.

Need to learn Java and HTML.

So I kill 2 birds with one stone here also in the sense that the Java/HTML code leant to deal with Android can also be transposed and used to create a web page?
Title: Programming Question?
Post by: mattnz on May 15, 2013, 03:32:17 pm
Well Javascript and Java are different things, but you could use Java for an applet on a webpage I guess. Wouldn't work on most mobile platforms though.

Anyway, you might find it easier to go through some programming tutorials that are based on a particular language, it will be more concrete than reading abstract descriptions on wiki. Or maybe not.
Title: Programming Question?
Post by: Bell on May 15, 2013, 06:47:45 pm
As Matt said the way I would do the task set out wouldn't be that trivial for a beginner.
It would be comprised of 3 major steps.

Crawling the webpage to download and parse the relevant HTML pages.
Processing the parsed data and creating a collection of custom UI objects.
Creating the front-end to handle user input and determine which objects to display.

My current project is somewhat similar, i'm creating a new website from a massive amount of raw HTML data downloaded from a government website.
So if you give this a crack I may be able to help a bit.
Title: Programming Question?
Post by: Pyromanik on May 15, 2013, 07:48:59 pm
Quote from: mattnz;1525310
Probably I guess, but if that's all he's after he may as well just bookmark a page using a web browser, mayn't he not?


Over 90% of smartphone apps are just webpage portals.
Title: Programming Question?
Post by: Pyromanik on May 15, 2013, 07:55:52 pm
Quote from: oefox;1525312
I would recommend that if you really want to know the basics you should start by learning the basic semantics of programming [url]http://en.wikipedia.org/wiki/Semantics_%28computer_science%29[/url]

Once you get that you should progress to playing around with a basic language such as lua which is used in minecraft [url]http://www.lua.org/docs.html[/url]

Once you understand the basic semantics of programming, all languages are inherently easier to understand, much like learning a foreign language makes learning more easier.

I would recommend installing an IDE to help develop, such as eclipse [url]http://www.eclipse.org/downloads/[/url]


A language like lua is a bad idea. Going from nothing straight to prototypal inheritance... :/
Also has a syntax that is unfamilar to curly brace C influenced languages like the one he'll need to write an android app.

He's going to be writing Java, so should just start with Java.
Title: Programming Question?
Post by: Bell on May 15, 2013, 07:57:27 pm
Yea lua was mind fuck enough coming from C++, although they threw an Occam framework at me at the same time. I wonder what it would be like going the other way.
Title: Programming Question?
Post by: Pyromanik on May 15, 2013, 08:01:52 pm
Quote from: Bell;1525337
Yea lua was mind fuck enough coming from C++, although they threw an Occam framework at me at the same time. I wonder what it would be like going the other way.

I've often wondered what would happen if you taught someone to program in Javascript before going into class based paradigm. Would it be easier to switch over than it is to go the other way? I'm not sure. Prototypal inheritance is cool, but classes often bring strict typing with them, which could be a bit of a mind fuck to someone used to a much higher level. I think it would be easier, but I'm not too sure it'd be by much.

Lua is a mindfuck no matter where you're coming from I think.
Title: Programming Question?
Post by: swindle on May 15, 2013, 09:03:00 pm
Thanks again for the input guys.

Any reputable courses on coding one can take online? Beginners of beginners.
Title: Programming Question?
Post by: Bell on May 15, 2013, 09:16:24 pm
http://www.codecademy.com
http://www.youtube.com/user/thenewboston
http://www.lynda.com (Paysite but awesome)
Title: Programming Question?
Post by: toofast on May 15, 2013, 10:53:01 pm
Randomish question, but has anyone ever tried using c# via mono to develop for android vs. using java.  Because i find c# does have a good support base (especially for picking up the basics), and imo is a lot easier to just get going in. So i wonder if swindle will have better luck learning that/using that.
Title: Programming Question?
Post by: Apostrophe Spacemonkey on May 16, 2013, 08:10:14 am
Quote from: toofast;1525355
Randomish question, but has anyone ever tried using c# via mono to develop for android vs. using java.  Because i find c# does have a good support base (especially for picking up the basics), and imo is a lot easier to just get going in. So i wonder if swindle will have better luck learning that/using that.

A little bit. If I wanted to develop for android, mono would be the path I would take.
Title: Programming Question?
Post by: oefox on May 16, 2013, 02:38:45 pm
You guys missed my point about LUA. It was not about syntax but about semantics. Perhaps I should've mentioned basic, pascal, python, or any myriad of simple to learn and use languages.

Actually, something like ruby (on rails) would be handy with it's online interpreter training thingy.


EDIT: Here's the link http://railsforzombies.org/
Title: Programming Question?
Post by: Bell on May 16, 2013, 05:48:00 pm
I'm not sure we did the syntax is pretty straight forward, its the features of lua that can be confusing when coming from 'traditional' programming languages.
You generally need to learn how to deal with classes if you want to program anything and in lua classes don't really exist but you can still make them by prototype http://en.wikipedia.org/wiki/Prototype-based_programming.

Sure using lua to learn conditional statements, control statements and simple data structures would be useful but i'd put forward python as a better candidate since the syntax is simple and once you have learnt the basics moving on to OO programming would arguably be easier than it would if you were using lua.
Title: Programming Question?
Post by: Pyromanik on May 16, 2013, 06:38:39 pm
I think it is you who missed our point.
Lua isn't simple to learn.
Title: Programming Question?
Post by: Pyromanik on May 16, 2013, 06:41:36 pm
god wtf it took more than 50 mins between typing and pushing post.
Any language has a simple syntax & is easy to learn if all you're doing is if/else, while and for.

Learning Java? Start with Java.
Title: Programming Question?
Post by: Bell on May 16, 2013, 07:15:56 pm
Yea but learning python lists is a fuckload easier than learning to use vectors in C++.
Title: Programming Question?
Post by: Evil Guy on May 16, 2013, 07:43:30 pm
I love python, but I presume we're still on-topic, so wouldn't java be the first choice here?
Even though SL4A allow most pure python to be used on android, I was under the (possibly naive) impression that java is the first class citizen for android apps .
Title: Programming Question?
Post by: Bell on May 16, 2013, 07:48:36 pm
True I sorta forgot about the original point of this discussion heh
So in conclusion start learning Java swindle. Then once you get a basic grasp move onto the Andriod Framework.
Title: Programming Question?
Post by: Pyromanik on May 16, 2013, 11:32:12 pm
Quote from: Evil Guy;1525405
I love python, but I presume we're still on-topic, so wouldn't java be the first choice here?
Even though SL4A allow most pure python to be used on android, I was under the (possibly naive) impression that java is the first class citizen for android apps .

I was under same impression.
Although I know Qt works on Android (with limitations), so you could tippity tappity some C++ if you were really keen Bell :P
Title: Programming Question?
Post by: swindle on May 17, 2013, 07:18:47 pm
Quote from: Bell;1525406
True I sorta forgot about the original point of this discussion heh
So in conclusion start learning Java swindle. Then once you get a basic grasp move onto the Andriod Framework.

Cheers dude. Sounds like that is the place to start.
Title: Racehorses run faster than normal horses
Post by: Tiwaking! on February 27, 2014, 11:30:33 am
Quote from: Bell;1525337
Yea lua was mind fuck enough coming from C++, although they threw an Occam framework at me at the same time. I wonder what it would be like going the other way.

I've often wondered what would happen if you taught someone to program in Javascript before going into class based paradigm. Would it be easier to switch over than it is to go the other way?
I have a good analogy for Loosley Typed to Class Based/Strong Typed Systems:

Racehorses run faster than normal horses
Title: Re: Programming Question?
Post by: Pyromanik on February 27, 2014, 11:57:49 am
It's not so much about the typing though Tiwa, it's about the inheritance/instantiation!