Hi devs! I'm pretty noob in programming. While working on a simple Java program in Eclipse, related to formatting strings, I came around a problem where I'm not getting an output which is expected from the lines of code.
Here's the code:
{
"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"
}
But I got this as output:
But from the code, the expected output is this, right??
Where did I go wrong??
Hi, you could try using the following. I think it should work but I also have limited knowledge of Java.
Set these variables inside for loop
int square = i*i
int cube = i*i*i
Replace the f.format line and the print output with the following.
System.out.format("%10d%10d%10d", i, square, cube)
Sent from my Nexus 7 using Tapatalk HD
veeman said:
Hi, you could try using the following. I think it should work but I also have limited knowledge of Java.
Set these variables inside for loop
int square = i*i
int cube = i*i*i
Replace the f.format line and the print output with the following.
System.out.format("%10d%10d%10d", i, square, cube)
Sent from my Nexus 7 using Tapatalk HD
Click to expand...
Click to collapse
That worked Veeman! :good: :victory: But I had to add a \n to get a new line. Thanks a ton! cheers!
Btw, can you give a detail about that?? about, why it happened?? Thanks again..
chandujram said:
That worked Veeman! :good: :victory: But I had to add a \n to get a new line. Thanks a ton! cheers!
Btw, can you give a detail about that?? about, why it happened?? Thanks again..
Click to expand...
Click to collapse
I think your problem was just using the format wrong.
Sent from my Nexus 7 using Tapatalk HD
Here's why your original code produces the results it does. 'veeman' is correct in that is not the way you would normally use a formatter. Instead you would use the format() method of System.out to present the output how you want it, as shown in post #2 above.
Your original code has created a Formatter with the default constructor. i.e. nothing passed as parameters in the call to create the 'new' object.
From the documentation in: -
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html
we have: -
public Formatter()
Constructs a new formatter.
The destination of the formatted output is a StringBuilder which may be retrieved by invoking out() and whose current content may be converted into a string by invoking toString(). The locale used is the default locale for this instance of the Java virtual machine.
Click to expand...
Click to collapse
Therefore, the destination of this object, (i.e. where its output is going to), is the Formatter's own internal appendable Stringbuilder object.
By using f.format(....) you are writing to the end of this stringbuilder object.
This explains why you are printing out a string that increases by the next term each time.
To make your code use the formatter correctly, you need to do something like this:
Code:
import java.util.*;
public class FormatDemo {
public static void main(String[] args) {
Formatter f=new Formatter();
for (int i=0;i<10;i++) {
f.format("%d\n",i*i*i);
}
f.out();
}
}
Code:
C:\PROGRA~1\Java\JDK17~1.0_0\bin>javac FormatDemo.java
C:\PROGRA~1\Java\JDK17~1.0_0\bin>java FormatDemo
0
1
8
27
64
125
216
343
512
729
C:\PROGRA~1\Java\JDK17~1.0_0\bin>
P.S. This isn't really OT, if a mod wants to shift it over to Q&A.
stephj said:
P.S. This isn't really OT, if a mod wants to shift it over to Q&A.
Click to expand...
Click to collapse
It's fine here - it's not related to phones so doesn't belong in any of the other Q&A or app development forums.
I'm a little surprised by this though. I can see what it's doing, but have no idea why it would. Admittedly I'm not au-fait with Java yet, but I know enough about C based languages to say, "eh?"
Edit: I take that back - just read your post properly
Yeah okey. I got it.. Thanx everyone for the reply. Actually there is another careless mistake in the program I pasted above. But anyway good for me that you guys knew what I was trying to ask. Thanx again! :highfive:
Related
Hi all! Thought I'd share my theme I designed and created today.
It's inspired by Cityscape by drmidnight.
The iconset, I can't remember where I got it from [it's on my other PC, will update with appropriate credit when I have it ]. The background was found in my My Pictures folder, so I've *no* idea where it came from, heh!
It's linked to PocketCM, so feel free to change that in the XML if you wish.
Skyline for rlToday
{
"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"
}
Installation
(1) Ensure rlToday is installed
(2) Make rlToday the only plugin on the Today Screen
(3) Copy the two programs in the Windows folder to Windows on your mobile
(4) Copy the Skyline folder to \Program Files\rlToday\
(5) Choose the Skyline theme in rlToday's options
(6) Set the Wallpaper image as your background, with a transperancy of 0%
(7) Enjoy!
Included Files
o Theme files
o folderview.exe
o ShowCalls.exe [both from the rlToday Dev Kit]
Bugs
o Won't like double-digit SMS/Missed call counts very well!
o Only for QVGA so far!
o Report bugs in this thread
Future
o If there is any demand for it, I may code up a VGA verson.
o Post feature requests in this thread
Download
http://www.touch-innovation.com/skindetails-47/
This skin is kindly hosted by Touch-Innovation.
Thanks!
Girvo
this is pretty cool, the only problem is, that it's the 1st of september
nir36 said:
this is pretty cool, the only problem is, that it's the 1st of september
Click to expand...
Click to collapse
Not in Australia
I've updated the first post with some more information
It requires PocketCM, so if you don't have it feel free to change the XML to whatever you like. I'm thinking about possibly making the contacts button respect rlToday's Applications list, so that it's up to you to change in via rlToday, without messing about with XML files.
Thoughts?
I only wish rlToday had guestures and transitions. Then it'd be perfect.
*sighs
Girvo said:
Not in Australia
Click to expand...
Click to collapse
lol oops. i should be beaten on the head with a sharp stick.
Girvo said:
I've updated the first post with some more information
It requires PocketCM, so if you don't have it feel free to change the XML to whatever you like. I'm thinking about possibly making the contacts button respect rlToday's Applications list, so that it's up to you to change in via rlToday, without messing about with XML files.
Thoughts?
I only wish rlToday had guestures and transitions. Then it'd be perfect.
*sighs
Click to expand...
Click to collapse
thats what i was gunna ask
i just changed it to icontact because i didnt know how to change it to the original windows contacts.
nir36 said:
lol oops. i should be beaten on the head with a sharp stick.
Click to expand...
Click to collapse
Caution: The mods may see to this happening!
Now that would be funny to watch
Updated the OP, it's now a Touch-Innovation.com exclusive
Girvo said:
Now that would be funny to watch
Updated the OP, it's now a Touch-Innovation.com exclusive
Click to expand...
Click to collapse
Woooohoooo !
what a simple theme..looks nice
I really like seeing more and more themes pop up.
Looks really great! I am going to try it out.
I love the iconset, any chance you have the whole set? I would enjoy messing around with it on some more ideas I have.
I actually do have the whole set. There's some brilliant stuff in here. As soon as I get home I'll post up the link
Hello,
A friend has sent me a set of very nice folder icons. He doesn't remember wher they came from but he thinks he found them somewhere on xda. I spent a few hours searching for them but I can't find a clue...
{
"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"
}
I want to find the original thread or the Author of these icons because I need additional icons for 2 further folders. So I would like to ask the author for preparing additional icons or at least for an empty folder icon to put my symbols on them. And of course I want to ask him if I can use these icons in my mod.
Can you point me to their source?
Thanks in advance
Skrobel
hi skrobel ... thx
Hi,
Havent your post been a bit different at the beginning?
Try this link
http://rapidshare.com/files/407268397/ikony.zip
These are the only icons I have. But to make a whole set I need also icons for Settings subfolders: Personal and System
I'm not familiar with graphics editing, so perhaps somebody could help me to prepare these two additional icons out of the ones in the archive (without having empty folder icon I mean)?
It is very esay. Had you done a XDA search with: glass folder icons
Then you had found this:
http://forum.xda-developers.com/showthread.php?t=662569
http://forum.xda-developers.com/showthread.php?t=647379
Glass Folder Icons (Thanks to dJcedric). And here you have the download:
http://forum.xda-developers.com/showthread.php?t=604469
It costs me 1 minute for search and open the link . By me a redbull
Man, you are great!
It appears that to search is also an art I really searched over the xda and google general, but I didn't put "Glas folder", but I tried Glossy, Shining, transparent, semi transparent and others. I'm just a Polish guy and I still learn (either English and the WinMo "slang").
I can't see any "Donate" button or a PayPal link And I guess we won't have the opportunity to drink the redbull in person I travel to Germany 2-3 times per year but I've never been to the Netherlands.
Skrobel said:
Man, you are great!
It appears that to search is also an art I really searched over the xda and google general, but I didn't put "Glas folder", but I tried Glossy, Shining, transparent, semi transparent and others. I'm just a Polish guy and I still learn (either English and the WinMo "slang").
I can't see any "Donate" button or a PayPal link And I guess we won't have the opportunity to drink the redbull in person I travel to Germany 2-3 times per year but I've never been to the Netherlands.
Click to expand...
Click to collapse
Hi Skrobel,
the redbull was a joke... i help where i can. Yes for the netherlands you have to go a little bit further. Sometimes is the good thing so near. Do and hold it simple.. glass folder icons
Thanks again!
Skrobel said:
Thanks again!
Click to expand...
Click to collapse
Good old times... was searching and came here . You are still alive Skrobel?
Hello Mike,
Yes, in fact I'm still alive. Not active in the WinMo business anymore though... same as you I see.
Skrobel said:
Hello Mike,
Yes, in fact I'm still alive. Not active in the WinMo business anymore though... same as you I see.
Click to expand...
Click to collapse
You are right . it is a long time ago and so as normal we/i go further to the next item.
Anyone not using dropbox? Ive been using it for a while and just wanted to remind newbs of it. go to https://www.dropbox.com/referrals/NTYwNzM2ODk and sign up, install the software, and you haev the easiest wireless way to share files back and forth between your phone and your desktop. Great Backup Solution. Help me out by signing up from the link above, and we both get extra space in the dropbox for doing so!
True, I mean when not at home. Its very helpful, especially for sending large things like videos. I have collaboration folders setup with my wife, and brother, and I can just drop the files in there, and then they get them too. Great way to share big stuff.
Bump
Sent from my PC36100 using XDA App
Dropbox is great but make sure you keep a separate backup. DB literally ate the English Essay I had worked on for days. Here's what happened: I typed up the rough draft on my PC at home. I then went to the writing lab at school and downloaded it to my phone. I plugged my phone into the tutor's PC and we revised it together and printed it out. I submitted it to my professor and a couple days later she e-mailed me saying she wanted me to make some changes. I went back to Dropbox on my PC to open the file and got the rough draft again. Downloaded again, same thing. I went on my phone and found out that it too had the rough draft. Somehow when I uploaded the final draft it did not actually upload so I wound up having to rewrite it again (as best as I could from memory).
Moral of the story: When you make changes to a file, make sure you back it up elsewhere!
You do know that drophox supports versioning right? You can go the website and see the last several save states. So if your more fully written essay was overwritten, so long as it was saved at some point, you can still retrieve it from the website.
Sent from my PC36100 using XDA App
gtkansan said:
You do know that drophox supports versioning right? You can go the website and see the last several save states. So if your more fully written essay was overwritten, so long as it was saved at some point, you can still retrieve it from the website.
Sent from my PC36100 using XDA App
Click to expand...
Click to collapse
{
"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"
}
I was wondering why this was being bumped so much, and then I saw the referral code at the end of the link.
Shame shame OP. lol.
TJDuckett said:
I was wondering why this was being bumped so much, and then I saw the referral code at the end of the link.
Shame shame OP. lol.
Click to expand...
Click to collapse
Same here. I'm not that shameless myself; mine is cleverly hidden in my sig.
Haha I added it to my Sig too. Just running out of room and hoping to get some more space in a hurry
As a side note, how do I make a url in my Sig clickable?
This thread should be deleted since it's not anything for help with Dropbox but rather a plug to get more space... shame shame OP..
gtkansan said:
Haha I added it to my Sig too. Just running out of room and hoping to get some more space in a hurry
As a side note, how do I make a url in my Sig clickable?
Click to expand...
Click to collapse
Firstly, I advise against adding a "dropbox" link to your sig ... unless of course, you feel it necessary to have your account suspended.
The purpose of services such as dropbox, rapidshare, megaupload, 4shared, etc. is to provide a space for folks to download/upload content that can be legitimately used on a mobile device. In other words, shameless promotion to bump space or increase points is not appropriate.
Thread closed and moved to Off-Topic.
I know it's not a lot, but hey, I'll take what little news I can get...
https://github.com/CyanogenMod/android_build/commit/ba34e7ecbaff949e4bd3a946ce92642ec4b0f742
Saw fattire's work on github yesterday. I know the CM team doesn't do anything half-ass so this should be a decent build.
I saw that commit this morning! Very excited.
Here is Kmobs tweet a few hours ago:
Nook color #cm7. Yes for the love of God yes. http://twitpic.com/40yxcu Great job Fattire and company.
phiremod's rom has me really close to buying an NC, but this would cause me to leave work early and grab one
I see dedicated back and menu buttons on the top. Yes. No search though. Can't wait. 8 )
Nook Color via Xda App
Looks like the NookColor might also be getting a name change to Encore. Its in the screen shot and also in the github commits.
Go look over in the Recovery EXT4 thread http://forum.xda-developers.com/showthread.php?t=959240, there's links to download it, but I haventy tried anything, as I'm at work, and dammit, my uSD reader is sitting on the counter @ home.
computercarl said:
I know it's not a lot, but hey, I'll take what little news I can get...
https://github.com/CyanogenMod/android_build/commit/ba34e7ecbaff949e4bd3a946ce92642ec4b0f742
Click to expand...
Click to collapse
It's already here: http://forum.xda-developers.com/showthread.php?t=959240 .
yes!!
10 chars
hopefully they can get the status bar + permanent back and menu buttons to the bottom somehow... or make it optional. Nice to have the buttons at the bottom.
bt1980 said:
hopefully they can get the status bar + permanent back and menu buttons to the bottom somehow... or make it optional. Nice to have the buttons at the bottom.
Click to expand...
Click to collapse
+1 for buttons on the bottom option
**** YEAH!!! One week after getting my NC I get CM7
My sister chose the perfect week to come visit from USA
Installed and working great
schnem said:
+1 for buttons on the bottom option
Click to expand...
Click to collapse
I will probably just remap my volume keys again. Tactile feedback ftmfw.
Man I love the CM guys
Running smooth for me as well soooo stoked about this...now if we can just get an oc kernel I'm not used to 800mhz anymore...can't wait to see how cm7 runs at 1.1ghz
Swyped from a CM7 EVO using the Xda app
how do i actually install this?! :/ i'm on rooted 1.1 stock atm...
My Win7 machine stopped recognizing the NC, so I lost ADB access. Do I need a separate set of drivers, or should the hacked ones from here still work?
[Edit:] Nevermind. Somehow the PID of NC has changed from 002 to 003. Just had to change the relevant lines in android_winusb.inf of the driver installation package, and I'm back in business.
j.a said:
Here is Kmobs tweet a few hours ago:
Nook color #cm7. Yes for the love of God yes. http://twitpic.com/40yxcu Great job Fattire and company.
Click to expand...
Click to collapse
Here's the image for easy viewing:
{
"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"
}
AWESOME!!!
> For Instructions Click Here <
Any bt action with this?
1. Will there be just one flashable .zip soon?
2. Does flash work?
Firstly, thank you very much, @topjohnwu
It's just a suggestion.
Why not a way to enable/disable Hide Magisk to all package processes?
Today, if I want to use the CLI, I have to dump the APK, collect all the package processes, and then enable/disable the magisk hide for each by one.
It would be very good if I could replace the name of the process by an asterisk to represent "all processes", like:
Code:
magiskhide add name.of.package *
magiskhide rm name.of.package *
And then enable/disable magisk hide for all processes of name.of.package
If you really want John's attention, a Github pull request would be the best way to go about that...
Didgeridoohan said:
If you really want John's attention, a Github pull request would be the best way to go about that...
Click to expand...
Click to collapse
I created my account on github.
Thank you for suggestion.
I'm sorry for my newbie question: do I have to write the code of my proposal or can I just write a suggestion like I did here?
VD171 said:
I created my account on github.
Thank you for suggestion.
I'm sorry for my newbie question: do I have to write the code of my proposal or can I just write a suggestion like I did here?
Click to expand...
Click to collapse
The optimal would be a pull request, but if you can't make one an issue ticket with the described proposal would be the second best thing.
Didgeridoohan said:
The optimal would be a pull request, but if you can't make one an issue ticket with the described proposal would be the second best thing.
Click to expand...
Click to collapse
Thank you very much, my friend.
I created my account: https://github.com/VD171
and I created the issue: https://github.com/topjohnwu/Magisk/issues/4019
Hope it can help other people too.
LOL.
The issue was closed with the tag "wontfix".
And somebody replied with a recommendation that does NOT work.
That can be solved with just some lines of code.
Apparentely that is not an interessting thing for the public !
This is a very strange attitude for developers from an open source tool.
No matter, I will keep dumping the APK using aapt, as I always did:
Android aapt - eLinux.org
elinux.org
Thank you very much for attention, @Didgeridoohan
VD171 said:
LOL.
The issue was closed with the tag "wontfix".
And somebody replied with a recommendation that does NOT work.
That can be solved with just some lines of code.
Apparentely that is not an interessting thing for the public !
This is a very strange attitude for developers from an open source tool.
No matter, I will keep dumping the apk, as I always did.
Thank you very much for attention, @Didgeridoohan
Click to expand...
Click to collapse
Exaclty that. Sad...
[Suggestion] Enable/Disable Magisk Hide to all proccesses of the package using CLI · Issue #4019 · topjohnwu/Magisk
Android Version: 10 QP1A.190711.020 Magisk Version Code: 22004 (This issue was posted to XDA-Developers: https://forum.xda-developers.com/t/suggestion-enable-disable-magisk-hide-to-all-proccesses-o...
github.com
Blinking was killed off in html code for a reason, a long time ago now.....
Unmistakeable hint: Change the gif, no one wants to see that or anything animated when theyre trying to read a thread, please, and thank you
73sydney said:
Blinking was killed off in html code for a reason, a long time ago now.....
Unmistakeable hint: Change the gif, no one wants to see that or anything animated when theyre trying to read a thread, please, and thank you
Click to expand...
Click to collapse
Really, really (and really) off-topic.
That's callled as gif, my friend.
The first gif released was at 1987.
I don't like coca-cola too, but I see it everywhere.
{
"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"
}
VD171 said:
Really, really (and really) off-topic.
That's callled as gif, my friend.
The first gif released was at 1987.
I don't like coca-cola too, but I see it everywhere.
View attachment 5248833
Click to expand...
Click to collapse
There are limits on suignatures to try and stop people posting annoying matter because it ruins the readability of the forums....
Please think of others and knock the gifs off please
73sydney said:
There are limits on suignatures to try and stop people posting annoying matter because it ruins the readability of the forums....
Please think of others and knock the gifs off please
Click to expand...
Click to collapse
The gif on my signature keeps hide and you need to "toggle signature" to see that.
But, I will think about that.
VD171 said:
The gif on my signature keeps hide and you need to "toggle signature" to see that.
But, I will think about that.
View attachment 5248859
Click to expand...
Click to collapse
not hidden, still blinding people