FORUMS
Remove All Ads from XDA

[GUIDE]**Beginners guide to programming-C,C++,Bash,Python,java**[GUIDE]

250 posts
Thanks Meter: 1,002
 
By Dark Wraith, Senior Member on 26th December 2013, 10:59 AM
Post Reply Email Thread
29th December 2013, 03:57 AM |#11  
broodplank1337's Avatar
Inactive Recognized Developer
Flag Nijmegen
Thanks Meter: 10,205
 
Donate to Me
More
Hey awesome tutorial, I see you used my xda university tut, regarding to that I want to say something, because the layout of wordpress is kinda screwed up there are some small mistakes in the code.

You copied this:

Quote:
Originally Posted by Dark Wraith


Code:
static struct clkctl_acpu_speed acpu_freq_tbl[] = {
    { 0, 24576,  LPXO, 0, 0,  30720000,  900, VDD_RAW(900) },
    { 0, 61440,  PLL_3,    5, 11, 61440000,  900, VDD_RAW(900) },
    { 1, 122880, PLL_3,    5, 5,  61440000,  900, VDD_RAW(900) },
    { 0, 184320, PLL_3,    5, 4,  61440000,  900, VDD_RAW(900) },
    { 0, MAX_AXI_KHZ, AXI, 1, 0, 61440000, 900, VDD_RAW(900) },
    { 1, 245760, PLL_3,    5, 2,  61440000,  900, VDD_RAW(900) },
    { 1, 368640, PLL_3,    5, 1,  122800000, 900, VDD_RAW(900) },
    /* AXI has MSMC1 implications. See above. */
    { 1, 768000, PLL_1,    2, 0,  153600000, 1050, VDD_RAW(1050) },
    /*
     * AXI has MSMC1 implications. See above.
     */
    { 1, 806400,  PLL_2, 3, 0, UINT_MAX, 1100, VDD_RAW(1100), &pll2_tbl[0]},
    { 1, 1024000, PLL_2, 3, 0, UINT_MAX, 1200, VDD_RAW(1200), &pll2_tbl[1]},
    { 1, 1200000, PLL_2, 3, 0, UINT_MAX, 1200, VDD_RAW(1200), &pll2_tbl[2]},
    { 1, 1401600, PLL_2, 3, 0, UINT_MAX, 1250, VDD_RAW(1250), &pll2_tbl[3]},
    { 0 }
};
Now what if you add the following lines to the first structure
Code:
{78, 1, 3, 0 },        /* 1516 MHz */
{83, 1, 3, 0 },        /* 1612 MHz */
{88, 1, 3, 0 },        /* 1708 MHz */

and 

{ 1, 1516800, PLL_2, 3, 0, UINT_MAX, 1250, VDD_RAW(1250), &pll2_tbl[6]},
{ 1, 1612800, PLL_2, 3, 0, UINT_MAX, 1275, VDD_RAW(1275), &pll2_tbl[7]},
{ 1, 1708800, PLL_2, 3, 0, UINT_MAX, 1300, VDD_RAW(1300), &pll2_tbl[8]},
{ 1, 1804800, PLL_2, 3, 0, UINT_MAX, 1325, VDD_RAW(1325), &pll2_tbl[9]},
{ 0 }
};


but it actually should be this:


Quote:
Originally Posted by Dark Wraith


Code:
static struct clkctl_acpu_speed acpu_freq_tbl[] = {
    { 0, 24576,  LPXO, 0, 0,  30720000,  900, VDD_RAW(900) },
    { 0, 61440,  PLL_3,    5, 11, 61440000,  900, VDD_RAW(900) },
    { 1, 122880, PLL_3,    5, 5,  61440000,  900, VDD_RAW(900) },
    { 0, 184320, PLL_3,    5, 4,  61440000,  900, VDD_RAW(900) },
    { 0, MAX_AXI_KHZ, AXI, 1, 0, 61440000, 900, VDD_RAW(900) },
    { 1, 245760, PLL_3,    5, 2,  61440000,  900, VDD_RAW(900) },
    { 1, 368640, PLL_3,    5, 1,  122800000, 900, VDD_RAW(900) },
    /* AXI has MSMC1 implications. See above. */
    { 1, 768000, PLL_1,    2, 0,  153600000, 1050, VDD_RAW(1050) },
    /*
     * AXI has MSMC1 implications. See above.
     */
    { 1, 806400,  PLL_2, 3, 0, UINT_MAX, 1100, VDD_RAW(1100), &pll2_tbl[0]},
    { 1, 1024000, PLL_2, 3, 0, UINT_MAX, 1200, VDD_RAW(1200), &pll2_tbl[1]},
    { 1, 1200000, PLL_2, 3, 0, UINT_MAX, 1200, VDD_RAW(1200), &pll2_tbl[2]},
    { 1, 1401600, PLL_2, 3, 0, UINT_MAX, 1250, VDD_RAW(1250), &pll2_tbl[3]},
    { 0 }
};
Now what if you add the following lines to the first structure
Code:
{78, 1, 3, 0 },        /* 1516 MHz */
{83, 1, 3, 0 },        /* 1612 MHz */
{88, 1, 3, 0 },        /* 1708 MHz */

and 

{ 1, 1516800, PLL_2, 3, 0, UINT_MAX, 1250, VDD_RAW(1250), &pll2_tbl[6]},
{ 1, 1612800, PLL_2, 3, 0, UINT_MAX, 1275, VDD_RAW(1275), &pll2_tbl[7]},
{ 1, 1708800, PLL_2, 3, 0, UINT_MAX, 1300, VDD_RAW(1300), &pll2_tbl[8]},
{ 1, 1804800, PLL_2, 3, 0, UINT_MAX, 1325, VDD_RAW(1325), &pll2_tbl[9]},
{ 0 }
};


so the "&" is actually just "&". just saying so that same mistake is not taken over because of the wordpress layout that screws it up

Good job on this tut
The Following 4 Users Say Thank You to broodplank1337 For This Useful Post: [ View ] Gift broodplank1337 Ad-Free
29th December 2013, 04:53 AM |#12  
N00B_IN_N33D's Avatar
Senior Member
Flag Pompano Beach
Thanks Meter: 999
 
More
Good job, @Dark Wraith! Awesome tutorial!

On a side note, in your guide you wrote the following Java code to print:
Code:
system.out.println("Hello");
However, it should be:
Code:
System.out.println("Hello");
The 'S' in "System" must be capital for the code to properly compile and/or run, otherwise you'll be like...



Keep in mind that in Java it is--according to convention--proper to start class names with capital letters. As Java is case sensitive and the System class is defined with a capital 'S', it is mandatory that we call it with its proper name.

Reference Link: http://docs.oracle.com/javase/6/docs...ng/System.html

Again, you did an awesome job on this tutorial. Keep up the good work. (Note: I liked all dah posts + rated the thread 5 stars)
The Following 2 Users Say Thank You to N00B_IN_N33D For This Useful Post: [ View ] Gift N00B_IN_N33D Ad-Free
29th December 2013, 05:06 AM |#13  
premsagar_rs1's Avatar
Senior Member
Flag Hyderabad
Thanks Meter: 64
 
More
JAVA
great helpful guide indeed!!!:vict ory:

CAN YOU ALSO POST TUTORIAL FOR JAVA?...
The Following User Says Thank You to premsagar_rs1 For This Useful Post: [ View ] Gift premsagar_rs1 Ad-Free
29th December 2013, 05:22 AM |#14  
Senior Member
Flag Mumbai
Thanks Meter: 54
 
More
Nice tutorial !!
Nice tutorial bro but are u sure if..else is a loop ??
as far as i know "if.. else" is to check if the condition satisfies or not .. it only iterates if written under a body of a loop !!
I might be wrong though
still it's a good tutorial
The Following User Says Thank You to karan5chaos For This Useful Post: [ View ] Gift karan5chaos Ad-Free
29th December 2013, 05:23 AM |#15  
amey_gangal's Avatar
Senior Member
Thanks Meter: 51
 
More
Great tutorial my friend..brilliant!!

Sent from my Xperia S using Tapatalk
The Following User Says Thank You to amey_gangal For This Useful Post: [ View ] Gift amey_gangal Ad-Free
29th December 2013, 05:27 AM |#16  
N00B_IN_N33D's Avatar
Senior Member
Flag Pompano Beach
Thanks Meter: 999
 
More
Quote:
Originally Posted by premsagar_rs1

great helpful guide indeed!!!:vict ory:

CAN YOU ALSO POST TUTORIAL FOR JAVA?...

If you're interested in self-teaching yourself Java I highly recommend checking out Derek Banas's tutorials on YouTube: http://www.youtube.com/playlist?list=PLE7E8B7F4856C9B19.

It may not hurt to also check out this book: http://portal.aauj.edu/e_books/teach...in_21_days.pdf

Lastly, if you ever need any Java project/assignment ideas I can certainly send some your way. I'm currently enrolled in an AP Computer Science class so I've got tons of practice material you could use, if you want it.
The Following 4 Users Say Thank You to N00B_IN_N33D For This Useful Post: [ View ] Gift N00B_IN_N33D Ad-Free
29th December 2013, 05:37 AM |#17  
premsagar_rs1's Avatar
Senior Member
Flag Hyderabad
Thanks Meter: 64
 
More
Quote:
Originally Posted by N00B_IN_N33D

If you're interested in self-teaching yourself Java I highly recommend checking out Derek Banas's tutorials on YouTube: http://www.youtube.com/playlist?list=PLE7E8B7F4856C9B19.

It may not hurt to also check out this book: http://portal.aauj.edu/e_books/teach...in_21_days.pdf

Lastly, if you ever need any Java project/assignment ideas I can certainly send some your way. I'm currently enrolled in an AP Computer Science class so I've got tons of practice material you could use, if you want it.

yes!...i want them i have inboxed u my mail id
29th December 2013, 05:45 AM |#18  
N00B_IN_N33D's Avatar
Senior Member
Flag Pompano Beach
Thanks Meter: 999
 
More
Quote:
Originally Posted by karan5chaos

Nice tutorial bro but are u sure if..else is a loop ??
as far as i know "if.. else" is to check if the condition satisfies or not .. it only iterates if written under a body of a loop !!
I might be wrong though
still it's a good tutorial

Correct. If I wrote the following sample code (in Java):

Code:
//initialize variables
boolean isHappy = true;

while(isHappy)
{
     System.out.println("N00B_IN_N33D is feeling happy!");
}

System.out.println("N00B_IN_N33D is not feeling happy...");
You would have the following infinite output:
Code:
N00B_IN_N33D is feeling happy!
N00B_IN_N33D is feeling happy!
N00B_IN_N33D is feeling happy!
N00B_IN_N33D is feeling happy!
N00B_IN_N33D is feeling happy!
N00B_IN_N33D is feeling happy!
N00B_IN_N33D is feeling happy!
N00B_IN_N33D is feeling happy!
However, if I put:
Code:
//initialize variables
boolean isHappy = false;

while(isHappy)
{
     System.out.println("N00B_IN_N33D is feeling happy!");
}

System.out.println("N00B_IN_N33D is not feeling happy...");
You would have the following output:
Code:
N00B_IN_N33D is not feeling happy...
Now, if I were to write this sample code:
Code:
//initialize variables
boolean isHappy = true;

if(isHappy)
{
     System.out.println("N00B_IN_N33D is feeling happy!");
}
else
{
     System.out.println("N00B_IN_N33D is not feeling happy...");
}
You would get the following output:
Code:
N00B_IN_N33D is feeling happy!
As you said an if statement will check for a condition(s) that yields true once, unless it has been placed within a loop.
The Following User Says Thank You to N00B_IN_N33D For This Useful Post: [ View ] Gift N00B_IN_N33D Ad-Free
29th December 2013, 06:29 AM |#19  
Senior Member
Flag Mumbai
Thanks Meter: 54
 
More
"if .. else" conditions is usually taught with "switch" conditions.

switch conditions are better then nested "if..else" and "else.. if" conditions as it doesn't needs to perform all the conditions check like if..else .
u should consider including "switch" in tutorial if u can
The Following User Says Thank You to karan5chaos For This Useful Post: [ View ] Gift karan5chaos Ad-Free
29th December 2013, 07:07 AM |#20  
Dark Wraith's Avatar
OP Senior Member
Flag Bangalore
Thanks Meter: 1,002
 
Donate to Me
More
Quote:
Originally Posted by broodplank1337

Hey awesome tutorial, I see you used my xda university tut, regarding to that I want to say something, because the layout of wordpress is kinda screwed up there are some small mistakes in the code.

You copied this:




but it actually should be this:





so the "&" is actually just "&". just saying so that same mistake is not taken over because of the wordpress layout that screws it up

Good job on this tut

Thanks for pointing it out......Will edit this in the op...and also thanks for the tut in xda university...

Quote:
Originally Posted by N00B_IN_N33D

Good job, @Dark Wraith! Awesome tutorial!

On a side note, in your guide you wrote the following Java code to print:

Code:
system.out.println("Hello");
However, it should be:
Code:
System.out.println("Hello");
The 'S' in "System" must be capital for the code to properly compile and/or run, otherwise you'll be like...



Keep in mind that in Java it is--according to convention--proper to start class names with capital letters. As Java is case sensitive and the System class is defined with a capital 'S', it is mandatory that we call it with its proper name.

Reference Link: http://docs.oracle.com/javase/6/docs...ng/System.html

Again, you did an awesome job on this tutorial. Keep up the good work. (Note: I liked all dah posts + rated the thread 5 stars)

Nice Catch...Thanks for pointing it out bro...you are correct..class names in Java start with Capitals and when you make an object..you need to be careful with the naming ...

Thanks for the rating and compilments....

Quote:
Originally Posted by premsagar_rs1

great helpful guide indeed!!!:vict ory:

CAN YOU ALSO POST TUTORIAL FOR JAVA?...

Tutorial in Java would probably take loads of posts and a beginner's guide wont be enuff...Follow the links NOOB_IN_N33D posted and a personal tip is to get the concept of classes and objects clear in JAVA. Once that is done..your base in Java would be very clear

Quote:
Originally Posted by karan5chaos

Nice tutorial bro but are u sure if..else is a loop ??
as far as i know "if.. else" is to check if the condition satisfies or not .. it only iterates if written under a body of a loop !!
I might be wrong though
still it's a good tutorial

Yes..you are correct..If....else is a conditional statement...and a conditional statement can be used as a loop...

Code:
int i=0;

if( i <= 50)
{

printf("Hello");

i++;

}
would print hello 50 times....
The Following User Says Thank You to Dark Wraith For This Useful Post: [ View ] Gift Dark Wraith Ad-Free
29th December 2013, 07:13 AM |#21  
Dark Wraith's Avatar
OP Senior Member
Flag Bangalore
Thanks Meter: 1,002
 
Donate to Me
More
Quote:
Originally Posted by karan5chaos

"if .. else" conditions is usually taught with "switch" conditions.

switch conditions are better then nested "if..else" and "else.. if" conditions as it doesn't needs to perform all the conditions check like if..else .
u should consider including "switch" in tutorial if u can

ummm....sure...will add switch statement as well......
Post Reply Subscribe to Thread

Tags
c++, java, programming guide, python, tutorial

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes