Snapdragon 800 a battery friendly beast? - Nexus 5 General
I've seen a lot of comments, about the possible battery size in the Nexus 5, which is only ~10% larger than a Nexus 4, which had OK, but not great battery life.
So the N5 is rumoured to have 2300 mAh 3.8v battery, the same size as the HTC One, a device with much better battery life than the N4. But what people are overlooking is the improvements in power efficiency from the Snapdragon 800, although it is a much faster SoC than the S4 Pro in the N4, it actually requires less voltage. This is possible due to TSMC's superior HPM 28nm process, which uses a technology called high-K metal gates, both the Snapdragon 600 & S4 Pro were manufactured on TSMC's 28nm LP process.
But, what if you don't believe me, well just look below. I compare the voltage tables for a S800 vs a S600, we must remember that S600 is an improved S4 Pro, these improvements included higher efficiency (battery life), so it's better than the S4 Pro in the Nexus 4.
28nm LP @ 1.7 GHz = 1075mv -- Snapdragon 600
28nm HPM @ 1.7 GHz = 900mv -- Snapdragon 800
So the S800 uses significantly less power, but achieves much greater performance. There is one outlier, the Adreno 330 GPU it of course is also built on the same superior HPM process, but contains more ALU (compute) units than any Adreno 320, so at max 100% usage may consume slightly more power. In the real world, the CPU/GPU do not sit at 100% all time, and the much faster S800 can complete a task eg load a webpage, faster than the Nexus 4, and then power down, whilst the N4 would still be rendering the webpage. This is a double win, faster ultimate performance means a task can be completed quicker, and the SoC put into low power mode, the fact that S800 needs less voltage in the first place magnifies the advantage.
Another possible power efficiency for the S800, is the on-die modem (baseband), unlike the S4 Pro / S600 which had a separate modem, we don't have hard data for this, but logic suggests that this a more efficient solution.
In conclusion using the 2300 mAh HTC One as a guide, which also has a 1080P display, older Snapdragon 600 and more software bloat than vanilla Android 4.4, I'd wager that the Nexus 5 will easily beat the Nexus 4 & HTC One for battery life. Of course we'd all love a a bigger battery, but given the incredible value of the Nexus phones, compromises have to be made, and I think battery life will be sufficient.
TSMC 28nm LP
static struct acpu_level tbl_PVS5_1700MHz[] __initdata = {
{ 1, { 384000, PLL_8, 0, 0x00 }, L2(0), 875000 },
{ 1, { 486000, HFPLL, 2, 0x24 }, L2(5), 875000 },
{ 1, { 594000, HFPLL, 1, 0x16 }, L2(5), 875000 },
{ 1, { 702000, HFPLL, 1, 0x1A }, L2(5), 875000 },
{ 1, { 810000, HFPLL, 1, 0x1E }, L2(5), 887500 },
{ 1, { 918000, HFPLL, 1, 0x22 }, L2(5), 900000 },
{ 1, { 1026000, HFPLL, 1, 0x26 }, L2(5), 925000 },
{ 1, { 1134000, HFPLL, 1, 0x2A }, L2(14), 937500 },
{ 1, { 1242000, HFPLL, 1, 0x2E }, L2(14), 950000 },
{ 1, { 1350000, HFPLL, 1, 0x32 }, L2(14), 962500 },
{ 1, { 1458000, HFPLL, 1, 0x36 }, L2(14), 987500 },
{ 1, { 1566000, HFPLL, 1, 0x3A }, L2(14), 1012500 },
{ 1, { 1674000, HFPLL, 1, 0x3E }, L2(14), 1050000 },
{ 1, { 1728000, HFPLL, 1, 0x40 }, L2(14), 1075000 },
{ 0, { 0 } }
TSMC 28nm HPM
static struct acpu_level acpu_freq_tbl_2p3g_pvs5[] __initdata = {
{ 1, { 300000, PLL_0, 0, 0 }, L2(0), 750000, 72 },
{ 0, { 345600, HFPLL, 2, 36 }, L2(1), 750000, 83 },
{ 1, { 422400, HFPLL, 2, 44 }, L2(2), 750000, 101 },
{ 0, { 499200, HFPLL, 2, 52 }, L2(2), 750000, 120 },
{ 0, { 576000, HFPLL, 1, 30 }, L2(3), 750000, 139 },
{ 1, { 652800, HFPLL, 1, 34 }, L2(3), 760000, 159 },
{ 1, { 729600, HFPLL, 1, 38 }, L2(4), 770000, 180 },
{ 0, { 806400, HFPLL, 1, 42 }, L2(4), 780000, 200 },
{ 1, { 883200, HFPLL, 1, 46 }, L2(4), 790000, 221 },
{ 1, { 960000, HFPLL, 1, 50 }, L2(9), 800000, 242 },
{ 1, { 1036800, HFPLL, 1, 54 }, L2(10), 810000, 264 },
{ 0, { 1113600, HFPLL, 1, 58 }, L2(10), 820000, 287 },
{ 1, { 1190400, HFPLL, 1, 62 }, L2(10), 830000, 308 },
{ 1, { 1267200, HFPLL, 1, 66 }, L2(13), 840000, 333 },
{ 0, { 1344000, HFPLL, 1, 70 }, L2(14), 850000, 356 },
{ 0, { 1420800, HFPLL, 1, 74 }, L2(15), 860000, 380 },
{ 1, { 1497600, HFPLL, 1, 78 }, L2(16), 870000, 404 },
{ 1, { 1574400, HFPLL, 1, 82 }, L2(17), 880000, 430 },
{ 0, { 1651200, HFPLL, 1, 86 }, L2(17), 890000, 456 },
{ 1, { 1728000, HFPLL, 1, 90 }, L2(18), 900000, 482 },
{ 0, { 1804800, HFPLL, 1, 94 }, L2(18), 910000, 510 },
{ 0, { 1881600, HFPLL, 1, 98 }, L2(18), 920000, 538 },
{ 1, { 1958400, HFPLL, 1, 102 }, L2(19), 930000, 565 },
{ 0, { 2035200, HFPLL, 1, 106 }, L2(19), 940000, 596 },
{ 0, { 2112000, HFPLL, 1, 110 }, L2(19), 955000, 627 },
{ 0, { 2188800, HFPLL, 1, 114 }, L2(19), 965000, 659 },
{ 1, { 2265600, HFPLL, 1, 118 }, L2(19), 975000, 691 },
{ 0, { 0 } }
};
Besides all these, I believe android 4.4 is more battery friendly than 4.3
Sent from my Nexus 4 using xda app-developers app
ashkan_mc said:
Besides all these, I believe android 4.4 is more battery friendly than 4.3
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
Can I borrow your crystal ball? I need to get tonights lotto numbers
Lewythefly said:
Can I borrow your crystal ball? I need to get tonights lotto numbers
Click to expand...
Click to collapse
ha
Nice thread, i can see that being true. Besides, like it was said above, based on the kitkat video; android 4.4 is said to be an improved project "butter". I expect the 2.300mh battery life to be enough for the phone.I can go as far as to say 3000mh is over doing it and pointless. :silly:
Does anyone know how much screen on time the HTC One gets? I can't find any screenshots in the One forums with the stock kernel and stock ROM.
Sent from my HTC Sensation using xda app-developers app
topgeardave said:
Does anyone know how much screen on time the HTC One gets? I can't find any screenshots in the One forums with the stock kernel and stock ROM.
Sent from my HTC Sensation using xda app-developers app
Click to expand...
Click to collapse
I was getting no more then 3.5 hours in a good day but far less on the regular.
Sent from my LG-D801 using xda app-developers app
Of course being a Nexus, we are guaranteed excellent dev support, a custom kernel that allows undervolting will boost battery life, even the Nexus 4 isn't bad with a moderate undervolt.
topgeardave said:
Does anyone know how much screen on time the HTC One gets? I can't find any screenshots in the One forums with the stock kernel and stock ROM.
Sent from my HTC Sensation using xda app-developers app
Click to expand...
Click to collapse
Personally for me on stock ROM and kernel I got no less than 4+ hours screen on time. Going up to 6 hours some days.
Sent from my HTC One using Tapatalk now Free
xXxG0dzRAgexXx said:
Personally for me on stock ROM and kernel I got no less than 4+ hours screen on time. Going up to 6 hours some days.
Sent from my HTC One using Tapatalk now Free
Click to expand...
Click to collapse
Wicked! Is that with a combination of 4G/wifi with medium brightness?
Sent from my HTC Sensation using xda app-developers app
Lewythefly said:
Can I borrow your crystal ball? I need to get tonights lotto numbers
Click to expand...
Click to collapse
4 8 15 16 23 42
Sent from my Nexus 4 using xda app-developers app
Wow.. To put that in perspective, the S800 uses the same voltage at 2.3ghz that my N4 uses at 810mhz!
Sent from my Nexus 4 using xda app-developers app
ashkan_mc said:
4 8 15 16 23 42
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
Wouldn't we all be devastated if these actually turn out to be the correct lotto numbers haha
Sent from my Nexus 4 using XDA Premium 4 mobile app
It looks like low power tasks and standby is best in class on the SD800. I'd image however that 100% load would brutalize the battery, although it's still nothing compared to the carpet bombing by the Adreno 330, which according to Erica, destroys the G2's 3000mAh playing NFS in 90 minutes. That's just crazy!
Does that mean by underclocking to around 1.5ghz we will get substantial battery savings?
Sent from my HTC Sensation using xda app-developers app
Well, we could downclock our N5s to 1.7 GHz, enjoy good battery and then when the time comes when we need more power we could revert it back to 2.3 GHz. After a few years maybe :cyclops:
That's quite an amusing thought under clocking to 1.7ghz for battery savings, my gnex runs at 1.2ghz which is fine, my 2012 n7 at 1.3 lol
Sent from my Galaxy Nexus using Tapatalk
The Gingerbread Man said:
That's quite an amusing thought under clocking to 1.7ghz for battery savings, my gnex runs at 1.2ghz which is fine, my 2012 n7 at 1.3 lol
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
Haha, same here. My sensation is on 1.2ghz at the moment and it's fine. Only bottleneck is 768mb of RAM which means I have to kill many apps. Once I get the phone I'm going to compare battery life on 1.5ghz (same as N4) and 2.3 and see the difference in battery life. I might try an extreme test and downclock them to 1ghz/1.2ghz for lolz to share with everyone. The main thing I've learnt which determines battery life is mpdecision. I'm going to mess about with it till I can get the best battery life
Interesting, one thing I want to mention you're assuming the 'race-to-idle' condition for the CPU. And in web browsing, may not apply since the bottleneck is likely the network that it has to wait for, so even though the CPU may finish local tasks faster, it may spend extra (wasted) cycles waiting for the network to fetch the data. Or even RAM which are slower than local CPU cache.
Also some brief googling for the N4's S4 Pro (8064) chip voltage tables came up with something like this, for more accurate comparison
Code:
static struct acpu_level acpu_freq_tbl_fast[] __initdata = {
{ 1, { 384000, PLL_8, 0, 2, 0x00 }, L2(0), 850000 },
{ 0, { 432000, HFPLL, 2, 0, 0x20 }, L2(6), 875000 },
{ 1, { 486000, HFPLL, 2, 0, 0x24 }, L2(6), 875000 },
{ 0, { 540000, HFPLL, 2, 0, 0x28 }, L2(6), 900000 },
{ 1, { 594000, HFPLL, 1, 0, 0x16 }, L2(6), 900000 },
{ 0, { 648000, HFPLL, 1, 0, 0x18 }, L2(6), 925000 },
{ 1, { 702000, HFPLL, 1, 0, 0x1A }, L2(6), 925000 },
{ 0, { 756000, HFPLL, 1, 0, 0x1C }, L2(6), 975000 },
{ 1, { 810000, HFPLL, 1, 0, 0x1E }, L2(6), 975000 },
{ 0, { 864000, HFPLL, 1, 0, 0x20 }, L2(6), 1000000 },
{ 1, { 918000, HFPLL, 1, 0, 0x22 }, L2(6), 1000000 },
{ 0, { 972000, HFPLL, 1, 0, 0x24 }, L2(6), 1025000 },
{ 1, { 1026000, HFPLL, 1, 0, 0x26 }, L2(6), 1025000 },
{ 0, { 1080000, HFPLL, 1, 0, 0x28 }, L2(15), 1075000 },
{ 1, { 1134000, HFPLL, 1, 0, 0x2A }, L2(15), 1075000 },
{ 0, { 1188000, HFPLL, 1, 0, 0x2C }, L2(15), 1100000 },
{ 1, { 1242000, HFPLL, 1, 0, 0x2E }, L2(15), 1100000 },
{ 0, { 1296000, HFPLL, 1, 0, 0x30 }, L2(15), 1125000 },
{ 1, { 1350000, HFPLL, 1, 0, 0x32 }, L2(15), 1125000 },
{ 0, { 1404000, HFPLL, 1, 0, 0x34 }, L2(15), 1137500 },
{ 1, { 1458000, HFPLL, 1, 0, 0x36 }, L2(15), 1137500 },
{ 1, { 1512000, HFPLL, 1, 0, 0x38 }, L2(15), 1150000 },
{ 0, { 0 } }
Turbotab said:
I've seen a lot of comments, about the possible battery size in the Nexus 5, which is only ~10% larger than a Nexus 4, which had OK, but not great battery life.
So the N5 is rumoured to have 2300 mAh 3.8v battery, the same size as the HTC One, a device with much better battery life than the N4. But what people are overlooking is the improvements in power efficiency from the Snapdragon 800, although it is a much faster SoC than the S4 Pro in the N4, it actually requires less voltage. This is possible due to TSMC's superior HPM 28nm process, which uses a technology called high-K metal gates, both the Snapdragon 600 & S4 Pro were manufactured on TSMC's 28nm LP process.
But, what if you don't believe me, well just look below. I compare the voltage tables for a S800 vs a S600, we must remember that S600 is an improved S4 Pro, these improvements included higher efficiency (battery life), so it's better than the S4 Pro in the Nexus 4.
28nm LP @ 1.7 GHz = 1075mv -- Snapdragon 600
28nm HPM @ 1.7 GHz = 900mv -- Snapdragon 800
So the S800 uses significantly less power, but achieves much greater performance. There is one outlier, the Adreno 330 GPU it of course is also built on the same superior HPM process, but contains more ALU (compute) units than any Adreno 320, so at max 100% usage may consume slightly more power. In the real world, the CPU/GPU do not sit at 100% all time, and the much faster S800 can complete a task eg load a webpage, faster than the Nexus 4, and then power down, whilst the N4 would still be rendering the webpage. This is a double win, faster ultimate performance means a task can be completed quicker, and the SoC put into low power mode, the fact that S800 needs less voltage in the first place magnifies the advantage.
Another possible power efficiency for the S800, is the on-die modem (baseband), unlike the S4 Pro / S600 which had a separate modem, we don't have hard data for this, but logic suggests that this a more efficient solution.
In conclusion using the 2300 mAh HTC One as a guide, which also has a 1080P display, older Snapdragon 600 and more software bloat than vanilla Android 4.4, I'd wager that the Nexus 5 will easily beat the Nexus 4 & HTC One for battery life. Of course we'd all love a a bigger battery, but given the incredible value of the Nexus phones, compromises have to be made, and I think battery life will be sufficient.
Click to expand...
Click to collapse
Also the much lower voltages will really help save the power to if you saw that earlier in the thread which also should help not make these things heat up so much.
Sent from my Galaxy Nexus using Tapatalk
Related
New kernel build issues
http://pastebin.com/Lb339PWz If anyone has any ideas, let me know.
It's really obvious so I'm guessing you already checked that, but: Code: arch/arm/mach-tegra/board-ventana.c:36:41: error: linux/usb/android_composite.h: No such file or directory
Yup thats where I am starting
http://pastebin.com/ciaXzHzY Got that file from a Xoom build and tried to recompile again.
What source kernel is this exactly? linux/usb/android_composite.h Its already a part of 50x, are your paths set properly? Check to see if your build path actually includes everything it should
this is the new tegra kernel from google, 2.6.39, working on dj steve server
And the new errors http://pastebin.com/Lec1F2vt
Solved and onto new issues http://pastebin.com/XGBr8rFn
Ripped the kernel from another Tegra2 device, and ran the defconfig and it compiled, just waiting to hear if it works or not.
Did it worked? If you want maybe I could help a bit Gesendet von meinem LG-P920 mit Tapatalk
We re-worked the kernel to add our stuff and came up with a bunch of errors, but after working at it, I'm down to just one error.
Ah, ok. If I could help, tell me Gesendet von meinem LG-P920 mit Tapatalk
This is where I am stuck at in my current build. Code: arch/arm/mach-tegra/common.c:123: error: array type has incomplete element type make[1]: *** [arch/arm/mach-tegra/common.o] Error 1 make: *** [arch/arm/mach-tegra] Error 2 The first line is the error static __initdata struct tegra_clk_init_table common_clk_init_table[] = { /* name parent rate enabled */ { "clk_m", NULL, 0, true }, //#ifdef CONFIG_TEGRA_SILICON_PLATFORM //#ifdef CONFIG_ARCH_TEGRA_2x_SOC { "pll_p", NULL, 216000000, true }, { "pll_p_out1", "pll_p", 28800000, true }, { "pll_p_out2", "pll_p", 48000000, true }, { "pll_p_out3", "pll_p", 72000000, true }, { "pll_p_out4", "pll_p", 108000000, true }, { "pll_m", "clk_m", 600000000, true }, { "pll_m_out1", "pll_m", 120000000, true }, { "sclk", "pll_m_out1", 40000000, true }, { "hclk", "sclk", 40000000, true }, { "pclk", "hclk", 40000000, true }, //#else { "pll_p", NULL, 408000000, true }, { "pll_p", NULL, 408000000, true }, { "pll_p_out1", "pll_p", 9600000, true }, { "pll_p_out2", "pll_p", 48000000, true }, { "pll_p_out3", "pll_p", 102000000, true }, { "pll_m_out1", "pll_m", 275000000, true }, { "pll_p_out4", "pll_p", 102000000, true }, { "sclk", "pll_p_out4", 102000000, true }, { "hclk", "sclk", 102000000, true }, { "pclk", "hclk", 51000000, true }, //#endif //#else { "pll_p", NULL, 216000000, true }, { "pll_p_out1", "pll_p", 28800000, true }, { "pll_p_out2", "pll_p", 48000000, true }, { "pll_p_out3", "pll_p", 72000000, true }, { "pll_m_out1", "pll_m", 275000000, true }, { "pll_c", NULL, ULONG_MAX, false }, { "pll_c_out1", "pll_c", 208000000, false }, { "pll_p_out4", "pll_p", 108000000, true }, { "sclk", "pll_p_out4", 108000000, true }, { "hclk", "sclk", 108000000, true }, { "pclk", "hclk", 54000000, true }, //#endif { "csite", NULL, 0, true }, { "emc", NULL, 0, true }, { "cpu", NULL, 0, true }, { "kfuse", NULL, 0, true }, { "fuse", NULL, 0, true }, { "pll_u", NULL, 480000000, false }, { "sdmmc1", "pll_p", 48000000, false }, { "sdmmc3", "pll_p", 48000000, false }, { "sdmmc4", "pll_p", 48000000, true }, //#ifndef CONFIG_ARCH_TEGRA_2x_SOC { "cbus", "pll_c", 416000000, false }, { "pll_c_out1", "pll_c", 208000000, false }, //#endif { NULL, NULL, 0, 0 }, }; Click to expand... Click to collapse
Have you the source code on github? I can help better if I can edit and try to build Gesendet von meinem LG-P920 mit Tapatalk
Gerrett said: Have you the source code on github? I can help better if I can edit and try to build Gesendet von meinem LG-P920 mit Tapatalk Click to expand... Click to collapse https://github.com/EnJens/android-tegra-nv-2.6.39 build for tegra_android_defconfig, but you will need to merge it with https://github.com/DJSteve/streak7-kernel/tree/ics
and when I merge this and build it I will get the same error? Or did you fixed something before? Gesendet von meinem LG-P920 mit Tapatalk
It doesn't build at all, thats kinda the point Thats why we are working on it.
Yeah, but will it get directly your error or did you fixed some errors before Gesendet von meinem LG-P920 mit Tapatalk
Okay, so I know a lot about nothing and a little about something, but curious why that has sections for definitions but they're commented out, therefore it's using the same definitions multiple times? Most of them are the same, not sure if that'd matter, but others, such as this one, are defined differently three times.. Not sure if that means the first or the last is used.. { "pclk", "hclk", 54000000, true }, What I would try, and you probably already have, is strip out all of the duplication leaving the correct/intended values, or fix the ifdef's so they aren't commented out and are being used. Code: static __initdata struct tegra_clk_init_table common_clk_init_table[] = { /* name parent rate enabled */ { "clk_m", NULL, 0, true }, { "pll_p", NULL, 216000000, true }, { "pll_p_out1", "pll_p", 28800000, true }, { "pll_p_out2", "pll_p", 48000000, true }, { "pll_p_out3", "pll_p", 72000000, true }, { "pll_p_out4", "pll_p", 108000000, true }, { "pll_m", "clk_m", 600000000, true }, { "pll_m_out1", "pll_m", 120000000, true }, { "sclk", "pll_m_out1", 40000000, true }, { "hclk", "sclk", 40000000, true }, { "pclk", "hclk", 40000000, true }, { "csite", NULL, 0, true }, { "emc", NULL, 0, true }, { "cpu", NULL, 0, true }, { "kfuse", NULL, 0, true }, { "fuse", NULL, 0, true }, { "pll_u", NULL, 480000000, false }, { "sdmmc1", "pll_p", 48000000, false }, { "sdmmc3", "pll_p", 48000000, false }, { "sdmmc4", "pll_p", 48000000, true }, { "cbus", "pll_c", 416000000, false }, { "pll_c_out1", "pll_c", 208000000, false }, { NULL, NULL, 0, 0 }, };
Beginning Java
Hi! If you're beginning Java like me, then share your code here! Simply use the code tags. Here's my latest application: Code: package name; import java.util.Scanner; public class Name { public static void main(String[] args) { Scanner user_input = new Scanner(System.in); String first_name; System.out.print("Enter your first name: "); first_name = user_input.next(); String surname; System.out.print("Enter your surname: "); surname = user_input.next(); String age; System.out.print("How old are you: "); age = user_input.next(); String full_name; full_name = first_name + " " + surname; System.out.println("You are " + full_name + "." + "You are also " + age + " " + "years old."); System.out.println("Note that some of this information may not be true, since it it the information you or someone/something else provided."); System.out.println("You got a problem with that?!?!"); System.out.println("Thank you for using my awesome Java application!"); } } So, post yours!!
Right. I see there aren't many people Beginning Java round here.
Bad-Wolf said: Right. I see there aren't many people Beginning Java round here. Click to expand... Click to collapse Nope. I had 1 semester of Java well over a year ago. I forgot most of it since I started c++, which I forgot also the day after the semester ended.
I was learning c#, but then i realized that it's a crap language and im not going to get anywhere using it, so i started learning Java, which i'm trying hard to remember, and as you have seen, i have.
Yea Java is the **** right now. C++ is good for windows only. I have to see if I can continue taking Java in college instead of C++. And it is so much easier than C++ or any C language for that matter.
I used to study Java but my college wants C++. I think Java is easier when it comes to GUI. Sent from my SGH-T959 using XDA App
Agreed. 10chars
Well, isn't anyone going to post anything? Even a hello world is good enough here! Sent from a Time Lord, using his TARDIS.
Get your grey matter round this one! Code: public class test { static String startstring; static int startlen; public static void main(String[] args) { startstring = args[0]; startlen=startstring.length(); genanag(args[0].substring(0,1),args[0].substring(1,2)); } public static void genanag(String oldstring, String insert) { String newstring; int i; int oldlen=oldstring.length();; for(i=0;i<=oldlen;i++) { newstring=oldstring.substring(0,i)+insert+oldstring.substring(i); if(newstring.length()==startlen) System.out.print(newstring+"\n"); else genanag(newstring,startstring.substring(oldlen+1,oldlen+2)); } } } When you run it you get this : Code: C:\PROGRA~1\Java\JDK16~1.0_2\bin>java test ABCD DCBA CDBA CBDA CBAD DBCA BDCA BCDA BCAD DBAC BDAC BADC BACD DCAB CDAB CADB CABD DACB ADCB ACDB ACBD DABC ADBC ABDC ABCD C:\PROGRA~1\Java\JDK16~1.0_2\bin>
stephj said: Get your grey matter round this one! Code: public class test { static String startstring; static int startlen; public static void main(String[] args) { startstring = args[0]; startlen=startstring.length(); genanag(args[0].substring(0,1),args[0].substring(1,2)); } public static void genanag(String oldstring, String insert) { String newstring; int i; int oldlen=oldstring.length();; for(i=0;i<=oldlen;i++) { newstring=oldstring.substring(0,i)+insert+oldstring.substring(i); if(newstring.length()==startlen) System.out.print(newstring+"\n"); else genanag(newstring,startstring.substring(oldlen+1,oldlen+2)); } } } When you run it you get this : Code: C:\PROGRA~1\Java\JDK16~1.0_2\bin>java test ABCD DCBA CDBA CBDA CBAD DBCA BDCA BCDA BCAD DBAC BDAC BADC BACD DCAB CDAB CADB CABD DACB ADCB ACDB ACBD DABC ADBC ABDC ABCD C:\PROGRA~1\Java\JDK16~1.0_2\bin> Click to expand... Click to collapse THAT! IS! COOL! Unfortunately I'm not uo to that stage yet. Moving onto Joptionpane next, whatever that is.LOl. Where'dya learn Java.
Allow me to do some experimental BB Code programming! { "lightbox_close": "Close", "lightbox_next": "Next", "lightbox_previous": "Previous", "lightbox_error": "The requested content cannot be loaded. Please try again later.", "lightbox_start_slideshow": "Start slideshow", "lightbox_stop_slideshow": "Stop slideshow", "lightbox_full_screen": "Full screen", "lightbox_thumbnails": "Thumbnails", "lightbox_download": "Download", "lightbox_share": "Share", "lightbox_zoom": "Zoom", "lightbox_new_window": "New window", "lightbox_toggle_sidebar": "Toggle sidebar" }
Bad-Wolf said: Where'dya learn Java. Click to expand... Click to collapse I have been programming for years, originally in COBOL. The ability to code in Java came from learning C#, from previously learning C++, itself from C. (Other languages include Fortran, 370 Assember, PC Assembler and RPG III/IV, but none of these have much in common with object orientated programming.) While the C# and Java communities seem to take great delight in throwing brickbats at each other from their respective trenches, there is not really a great deal of difference between the two languages, not any that are worth getting upset about! Right let's make it do something vaguely useful.......... This was originally coded in C# as a solution to the following post. http://forum.xda-developers.com/showthread.php?t=1435629 ISO6346 defines the layout of serial numbers and the checksum digit for intermodal containers. (The 20 and 40 ft metal containers used to ship almost everything these days.) :- http://en.wikipedia.org/wiki/ISO_6346 This code takes the first ten characters of the serial number and calculates the checksum digit. The argument must be of the form ABCD123456 or there is no response: Code: public class ISO6346 { public static void main(String[] args) { String Input = args[0].toUpperCase(); int i,j,k; if(Input.matches("[A-Z]{4}[0-9]{6}")) { k=0; for (i=0; i<10; i++) { j = Input.charAt(i); if (j > 64 && j < 91) k += ((j - 55) + (j - 56) / 10) << i; else k += (j - 48) << i; } k = ((k % 11) % 10); System.out.print(Input.substring(0,4)+" "+Input.substring(4)+" "+k); } } } Results in: Code: C:\Program Files\Java\jdk1.6.0_23\bin>JAVA ISO6346 TOLU473478 TOLU 473478 7 C:\Program Files\Java\jdk1.6.0_23\bin> Compare the result with the image in the top right of the Wikipedia page.......... and that concludes the case for the defense, Your Honour!
As my current Project is based on JSP, I'll share the crap I'm doing now : Function for Inserting datas into database (Anyways the database should be connected before doing this [includes code] + --> Connection con = null; PreparedStatement ps = null Code: public boolean FunctionName(String name, String address, String phoneno) { boolean flag = false; try { ps = con.prepareStatement("insert into TABLE_NAME(FIELD_1,FIELD2,FIELD_3) values(?,?,?)"); ps.setString(1,name); ps.setString(2,address); ps.setString(3,phoneno); ps.executeUpdate(); flag = true; } catch(Exception e) { System.out.println("Error in Insertion"+e); } return flag; } + HTML / JSP Design Page should be there to get values from user (Textbox) + JSP action page should be there to trigger action when user clicks the button on the design page.
Where would anyone here recommend starting to learn Java from? Online, books, classes? Just starting out and not sure which is the best place to go first? I have dl Java sdk and eclipse but that's about as far as I'm at. Sent from my GT-P7300 using Tapatalk
Database Connection code (Mysql is discussed) : Code: package com.db; //Package name optional import java.sql.*; public class DbConnection() { Connection con = null; PreparedStatement ps = null; ResultSet rs = null; //ResultSet is useful for Select queries public DbConnection() //Create a constructor { try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/DATABASE_NAME","root",""); //I guess root is default in Mysql } catch(Exception e) { System.out.println("Error in Connection"+e); } } } ---------- Post added at 08:09 PM ---------- Previous post was at 08:04 PM ---------- Aust S5 said: Where would anyone here recommend starting to learn Java from? Online, books, classes? Just starting out and not sure which is the best place to go first? I have dl Java sdk and eclipse but that's about as far as I'm at. Sent from my GT-P7300 using Tapatalk Click to expand... Click to collapse The best reference for Core Java (ie, Java SE) I'd recommend "The Complete Reference Java Seventh Edition (Or Fifth Edition) by Herbert Schildt" And don't start studying Java using IDE (like Eclipse or Netbeans) Start writing code using simple Notepad or Notepad++ and compile it in Command Prompt. This is the best way for freshers.
Aust S5 said: Where would anyone here recommend starting to learn Java from? Online, books, classes? Just starting out and not sure which is the best place to go first? I have dl Java sdk and eclipse but that's about as far as I'm at. Sent from my GT-P7300 using Tapatalk Click to expand... Click to collapse I love this book. http://www.amazon.com/Head-First-Ja...9208/ref=sr_1_1?ie=UTF8&qid=1331745451&sr=8-1
Thanks guys I'll look into both of these. I'm looking forwards to learning all i can. Fingers crossed sent from Grey Skull
As Java used to be owned by Sun, before they themselves were bought by Oracle, there is a whole load of documentation beginning here: http://docs.oracle.com/javase/ As well as here: http://www.oracle.com/technetwork/java/javase/overview/index.html The API documentation is useful when you need to find which method of which object you need to do the job.
Simple java code one of first for math (ax^2+bx+c) Code: int a=2; //example int b=3; int c=4; for (int i = 0; i<=100;i++){ if((a*(i*i)+b*i+c)==4) system.out.println(i); }
That is beyond me! If I had more time, I would be learning Java quicker. Sent from a Time Lord, using his TARDIS.
Another Math Problem
6 ÷ 2 (2 + 1) =x
1 2chars Edit after so many days: The answer doesn't matter. No matter what happens, I'll be proved right AND wrong, having been the point of countless arguments forthcoming in the thread you're about to read. Its so pointless/repetative/annoying, I don't even wanna argue.
If you use order of operation the answer is 9. Multiplication and*Division (left-to-right) Sent from the Galaxy beast note ll
85gallon said: 6 ÷ 2 (2 + 1) =x Click to expand... Click to collapse My answer is with respect to BODMAS, just to clear things up
Lol I know BIDMAS but whats BODMAS(Is it Brackets of divison Multipication Addition and Subtraction Sent from my GT-S5660 using xda app-developers app
batman38102 said: Lol I know BIDMAS but whats BODMAS(Is it Brackets of divison Multipication Addition and Subtraction Sent from my GT-S5660 using xda app-developers app Click to expand... Click to collapse Lol its the other way round for me Its that only... Will have to google bidmas in the morning
a.cid said: Lol its the other way round for me Its that only... Will have to google bidmas in the morning Click to expand... Click to collapse There's only bodmas! Sent from my HTC Explorer A310e using xda app-developers app
In the USofA they use PEMDAS. Parenthases, exponent, multiplication, division, addition and subtraction. Annd the result is x = 9;
I'm curious, why is there a thread dedicated to such a basic math formulae Smoking is one of the leading causes of statistics. - Fletcher Knebel
jugg1es said: I'm curious, why is there a thread dedicated to such a basic math formulae Smoking is one of the leading causes of statistics. - Fletcher Knebel Click to expand... Click to collapse It was started by a noob, not like he knows better
Since pemdas and bodmas as are used in various areas left to right for multiplication and division is used by default for mathematicians yielding 9 as the answer Sent from my Galaxy Nexus using xda app-developers app
{ "lightbox_close": "Close", "lightbox_next": "Next", "lightbox_previous": "Previous", "lightbox_error": "The requested content cannot be loaded. Please try again later.", "lightbox_start_slideshow": "Start slideshow", "lightbox_stop_slideshow": "Stop slideshow", "lightbox_full_screen": "Full screen", "lightbox_thumbnails": "Thumbnails", "lightbox_download": "Download", "lightbox_share": "Share", "lightbox_zoom": "Zoom", "lightbox_new_window": "New window", "lightbox_toggle_sidebar": "Toggle sidebar" } Problem solved. Spiderman time?
LoopDoGG79 said: Problem solved. Spiderman time? Click to expand... Click to collapse Sounds good to me Smoking is one of the leading causes of statistics. - Fletcher Knebel
PEMDAS, BIMDAS, whatever you want to use, the way it's written the answer is 1. You only get nine if you divide first, which is not how it works. Order of operations states that you take care of the parenthetical operators first, then multiplication, then division. Honestly, the problem is poorly written and would never appear in a text or problem set that way.
MissionImprobable said: PEMDAS, BIMDAS, whatever you want to use, the way it's written the answer is 1. You only get nine if you divide first, which is not how it works. Order of operations states that you take care of the parenthetical operators first, then multiplication, then division. Honestly, the problem is poorly written and would never appear in a text or problem set that way. Click to expand... Click to collapse Multiplication and division are on the same level and go from left to right.
MissionImprobable said: PEMDAS, BIMDAS, whatever you want to use, the way it's written the answer is 1. You only get nine if you divide first, which is not how it works. Order of operations states that you take care of the parenthetical operators first, then multiplication, then division. Honestly, the problem is poorly written and would never appear in a text or problem set that way. Click to expand... Click to collapse You dare question Google!?!?
85gallon said: 6 ÷ 2 (2 + 1) =x Click to expand... Click to collapse so...im ten yrs old...i moved from romania to uk...go to school and then i give that to the class...nobody did that! The teacher didnt know to do this xD funny...really...uk schools-low...can u do it?: a+b=522 a+c=303 c+b=425 Find a, b and c...
Obviously none of you people know the maths. Everyone who knows maths knows that: X = Purple.
raducu7890 said: so...im ten yrs old...i moved from romania to uk...go to school and then i give that to the class...nobody did that! The teacher didnt know to do this xD funny...really...uk schools-low...can u do it?: a+b=522 a+c=303 c+b=425 Find a, b and c... Click to expand... Click to collapse a + b = 522 a + c = 303 c + b = 425 a + b + a + c = 522 + 303 2a + b + c = 825 2a + b + c - (b + c) = 825 - 425 2a = 400 a = 200 200 + b = 522 b = 522 - 200 b = 322 200 + c = 303 c = 303 - 200 c = 103 I'm 40 - and I haven't forgotten my basic maths Schooling in Romania is actually better than in the UK, mainly because most of the kids actually WANT to learn there.
SimonTS said: a + b = 522 a + c = 303 c + b = 425 a + b + a + c = 522 + 303 2a + b + c = 825 2a + b + c - (b + c) = 825 - 425 2a = 400 a = 200 200 + b = 522 b = 522 - 200 b = 322 200 + c = 303 c = 303 - 200 c = 103 I'm 40 - and I haven't forgotten my basic maths Schooling in Romania is actually better than in the UK, mainly because most of the kids actually WANT to learn there. Click to expand... Click to collapse The things is, the teachers are putting maths in them...hard work...here(in UK, Year 6) nobody knows algebra...they know just : % / - + °
[Q] hookSystemWideLayout in layout-sw360dp-xhdpi
Hello, my code dont give me something back, no error, nothing. the "global_actions_view_cover.xml" is in "layout-sw360dp-xhdpi". whats wrong with my code? Code: @Override public void initZygote(StartupParam startupParam) throws Throwable { XResources.hookSystemWideLayout("android", "layout", "global_actions_view_cover", new XC_LayoutInflated() { @Override public void handleLayoutInflated(LayoutInflatedParam liparam) throws Throwable { XposedBridge.log(LOG_TAG + "global_actions_view_cover"); } }); } thanks for helping
That'll only be inflated if your device's width is higher than 360dp and it's an XHDPI device. Not sure what will happen if there are multiple matches. See this for more info.
Do I need to try/catch findAndHookMethod()'s?
As the title implies, if I do Code: findAndHookMethod() { //method 1 } findAndHookMethod() { //method 2 } do I have to try/catch each call in order for it to reach //method 2 in case //method 1 isn't found? Also what happens if I get an Exception inside: Code: afterHookedMethod(MethodHookParam param) throws Throwable ? Do I have to make sure no Exception escapes from that hook? Where is such an Exception caught? Will it break the program being manipulated, or will it just be disregarded?