• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 11:25
CET 17:25
KST 01:25
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation12Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA8StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7
StarCraft 2
General
Mech is the composition that needs teleportation t RotterdaM "Serral is the GOAT, and it's not close" RSL Season 3 - RO16 Groups C & D Preview [TLMC] Fall/Winter 2025 Ladder Map Rotation TL.net Map Contest #21: Winners
Tourneys
RSL Revival: Season 3 Sparkling Tuna Cup - Weekly Open Tournament Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
SnOw's ASL S20 Finals Review FlaSh on: Biggest Problem With SnOw's Playstyle BW General Discussion What happened to TvZ on Retro? Brood War web app to calculate unit interactions
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET
Strategy
PvZ map balance Current Meta Simple Questions, Simple Answers How to stay on top of macro?
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread Clair Obscur - Expedition 33 Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread Artificial Intelligence Thread Canadian Politics Mega-thread
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2114 users

The Big Programming Thread - Page 568

Forum Index > General Forum
Post a Reply
Prev 1 566 567 568 569 570 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
Days
Profile Joined February 2010
United States219 Posts
Last Edited: 2015-01-22 00:12:07
January 22 2015 00:05 GMT
#11341
Hey guys hopefully there's a few of you are who are familiar with OTP Authentication. Anyway, I am building an iOS app for my job that is using TOTP authentication. I have everything working, except that my boss has an app on Android that uses TOTP authentication as well and he swears that we should be getting the same pin number generated from the TOTP if we do it at the same time. Both of our pin numbers are returning an 8-digit integer, but they are not the same. I am using the open source code that Google Authenticator provides, I have not touched anything with the algorithm they provided.

He insists that we should be getting the same pin number since we are going to be connected to the same database.

I know a simpler solution would be to have seperate databases, but unfortunately he's one up in command so he calls the shots. Anyone that has worked with TOTP auth before, do you know if you're suppose to get the same pins generated from two different devices if running at same time?

The function parameters for the java are two strings and a time, the function parameters for the iOS are a NSString, NSData, and a NSDate..... considering that and considering the fact that java is using BigInteger datatypes that are not supported in iOS, I have no idea how he's expecting me to spit out the same 8-digit integer that he is getting from his java OTP auth.
We buy things we don't need, with money we don't have, to impress people we don't like.
Manit0u
Profile Blog Joined August 2004
Poland17432 Posts
January 22 2015 00:11 GMT
#11342
On January 22 2015 09:05 Days wrote: do you know if you're suppose to get the same pins generated from two different devices if running at same time?


You shouldn't.
Time is precious. Waste it wisely.
Days
Profile Joined February 2010
United States219 Posts
January 22 2015 00:13 GMT
#11343
On January 22 2015 09:11 Manit0u wrote:
Show nested quote +
On January 22 2015 09:05 Days wrote: do you know if you're suppose to get the same pins generated from two different devices if running at same time?


You shouldn't.


How sure are you? This is a brand new job for me, so I really don't want to look bad. Can you please elaborate on your response so I have a more clear picture why they wouldn't generate the same two pins.
We buy things we don't need, with money we don't have, to impress people we don't like.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
January 22 2015 00:18 GMT
#11344
On January 22 2015 09:13 Days wrote:
Show nested quote +
On January 22 2015 09:11 Manit0u wrote:
On January 22 2015 09:05 Days wrote: do you know if you're suppose to get the same pins generated from two different devices if running at same time?


You shouldn't.


How sure are you? This is a brand new job for me, so I really don't want to look bad. Can you please elaborate on your response so I have a more clear picture why they wouldn't generate the same two pins.


Just generate a nonce. Here is how: http://stackoverflow.com/questions/4145531/how-to-create-and-use-nonces
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
January 22 2015 00:43 GMT
#11345
On January 22 2015 06:26 travis wrote:
in the meantime I have another java question
Let's say I am using drawstring to draw strings to a jpanel
the strings that I am drawing are variables
how do I go about having these strings properly format within the frame? right now, if the variable is a long string, it will just keep writing and writing on one line right off the frame. but i want it to wrap to the next line of the frame when that is appropriate


ok, back to this, because I don't want to use a JTextPane

I read here

http://www.wyzant.com/resources/blogs/266636/embedding_line_breaks_in_java_literal_strings

that I can use:


String sep = System.line.separator;
String text = "This is line one." + sep + "This is line two.";


and it will separate string text into 2 lines

now, I have little idea about this, but it definitely doesn't work for me. when I try to declare "String sep = System.line.separator;", it says that it can't find variable "line".

I am using the latest JDK and netbeans
Toadesstern
Profile Blog Joined October 2008
Germany16350 Posts
Last Edited: 2015-01-22 00:52:50
January 22 2015 00:50 GMT
#11346
On January 22 2015 09:43 travis wrote:
Show nested quote +
On January 22 2015 06:26 travis wrote:
in the meantime I have another java question
Let's say I am using drawstring to draw strings to a jpanel
the strings that I am drawing are variables
how do I go about having these strings properly format within the frame? right now, if the variable is a long string, it will just keep writing and writing on one line right off the frame. but i want it to wrap to the next line of the frame when that is appropriate


ok, back to this, because I don't want to use a JTextPane

I read here

http://www.wyzant.com/resources/blogs/266636/embedding_line_breaks_in_java_literal_strings

that I can use:


String sep = System.line.separator;
String text = "This is line one." + sep + "This is line two.";


and it will separate string text into 2 lines

now, I have little idea about this, but it definitely doesn't work for me. when I try to declare "String sep = System.line.separator;", it says that it can't find variable "line".

I am using the latest JDK and netbeans

you don't have to bind system.line.separator to a variable at all, you should just be able to use
String text = "HERE IS MY TEXT" + system.line.separator() + "HERE IS MORE TEXT" iirc
I mean you can bind it to a variable if you need it a lot but you probably need the () at the end but I've honestly never done it like that lol

At least I'm fairly sure that you can use stringbuilder that way and just use
sb.append("Text 1").append(system.line.separator()).append("Text 2");
return sb.toString();

<Elem> >toad in charge of judging lewdness <Elem> how bad can it be <Elem> also wew, that is actually p lewd.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2015-01-22 02:14:30
January 22 2015 02:10 GMT
#11347
I don't understand and I am getting annoyed. It does not let me use system.line.separator. It says that it cannot find variable line.

I just want to declare a String that has a linebreak in it. Or I want to use drawstring to draw 2 Strings together with a line break between them.

why is this so difficult to do.

I have a workaround to make my program still function the same.. but this seems like it should be easier.
meatpudding
Profile Joined March 2011
Australia520 Posts
January 22 2015 02:38 GMT
#11348
On January 22 2015 11:10 travis wrote:
this seems like it should be easier

Welcome to programming!

You can try using the escape character for newline "\n" but I have no idea about specific Java stuff.
Be excellent to each other.
Toadesstern
Profile Blog Joined October 2008
Germany16350 Posts
Last Edited: 2015-01-22 03:04:34
January 22 2015 02:53 GMT
#11349
On January 22 2015 11:10 travis wrote:
I don't understand and I am getting annoyed. It does not let me use system.line.separator. It says that it cannot find variable line.

I just want to declare a String that has a linebreak in it. Or I want to use drawstring to draw 2 Strings together with a line break between them.

why is this so difficult to do.

I have a workaround to make my program still function the same.. but this seems like it should be easier.


pretty sure it's your spelling:
[image loading]

I'm getting a
line cannot be resolved or is not a field
for the first one as well, which I'd assume is just the same you as yours just different IDE?

Keep in mind that particularly the 2nd one can be out of scope depending on where you use it (and put it), which would also result in the same error message I think?
<Elem> >toad in charge of judging lewdness <Elem> how bad can it be <Elem> also wew, that is actually p lewd.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2015-01-22 03:35:49
January 22 2015 03:27 GMT
#11350
no errors in the 2nd one but

static String Intro2 = "stuff " + System.lineSeparator() + "more stuff.";


is still drawing all to one line, even though no errors.


looks like drawstring just can't handle new lines?
well that's kind of silly
Toadesstern
Profile Blog Joined October 2008
Germany16350 Posts
January 22 2015 03:53 GMT
#11351
could be, never really used that. Sorry if advice was useless

+ Show Spoiler [picture] +
[image loading]

I mean if that's not the issue and it works in console... yeah...
<Elem> >toad in charge of judging lewdness <Elem> how bad can it be <Elem> also wew, that is actually p lewd.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
January 22 2015 03:59 GMT
#11352
It will work in console, just not actually drawn with paint.

I found a method for drawstring that someone else made that makes it work, though
Prillan
Profile Joined August 2011
Sweden350 Posts
Last Edited: 2015-01-22 14:47:16
January 22 2015 14:38 GMT
#11353
On January 22 2015 09:13 Days wrote:
Show nested quote +
On January 22 2015 09:11 Manit0u wrote:
On January 22 2015 09:05 Days wrote: do you know if you're suppose to get the same pins generated from two different devices if running at same time?


You shouldn't.


How sure are you? This is a brand new job for me, so I really don't want to look bad. Can you please elaborate on your response so I have a more clear picture why they wouldn't generate the same two pins.

I assume that this is for testing purposes. In this case you should get the same result/pin/token, but only if you have the same secret key on both devices.

Oh, and don't listen to this:
On January 22 2015 09:18 darkness wrote:
Show nested quote +
On January 22 2015 09:13 Days wrote:
On January 22 2015 09:11 Manit0u wrote:
On January 22 2015 09:05 Days wrote: do you know if you're suppose to get the same pins generated from two different devices if running at same time?


You shouldn't.


How sure are you? This is a brand new job for me, so I really don't want to look bad. Can you please elaborate on your response so I have a more clear picture why they wouldn't generate the same two pins.


Just generate a nonce. Here is how: http://stackoverflow.com/questions/4145531/how-to-create-and-use-nonces

Nonces and OTP are two different things, with different uses.
TheBB's sidekick, aligulac.com | "Reality is frequently inaccurate." - Douglas Adams
Days
Profile Joined February 2010
United States219 Posts
January 22 2015 15:25 GMT
#11354
On January 22 2015 23:38 Prillan wrote:
Show nested quote +
On January 22 2015 09:13 Days wrote:
On January 22 2015 09:11 Manit0u wrote:
On January 22 2015 09:05 Days wrote: do you know if you're suppose to get the same pins generated from two different devices if running at same time?


You shouldn't.


How sure are you? This is a brand new job for me, so I really don't want to look bad. Can you please elaborate on your response so I have a more clear picture why they wouldn't generate the same two pins.

I assume that this is for testing purposes. In this case you should get the same result/pin/token, but only if you have the same secret key on both devices.

Oh, and don't listen to this:
Show nested quote +
On January 22 2015 09:18 darkness wrote:
On January 22 2015 09:13 Days wrote:
On January 22 2015 09:11 Manit0u wrote:
On January 22 2015 09:05 Days wrote: do you know if you're suppose to get the same pins generated from two different devices if running at same time?


You shouldn't.


How sure are you? This is a brand new job for me, so I really don't want to look bad. Can you please elaborate on your response so I have a more clear picture why they wouldn't generate the same two pins.


Just generate a nonce. Here is how: http://stackoverflow.com/questions/4145531/how-to-create-and-use-nonces

Nonces and OTP are two different things, with different uses.


That's the problem. We have the same secret key, but we are receiving different pin/tokens from the OTP. I want to know how accurate OTP is with time, because maybe generating the APP from 2 seconds different might affect the pin that will be generated. I don't know what i'm doing wrong. I could post some of my objective C code if that could help.
We buy things we don't need, with money we don't have, to impress people we don't like.
herokiller_
Profile Blog Joined March 2011
92 Posts
January 22 2015 16:16 GMT
#11355
any Haskel experts here?
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
January 22 2015 16:22 GMT
#11356
--- Nuked ---
Ropid
Profile Joined March 2009
Germany3557 Posts
Last Edited: 2015-01-22 16:31:16
January 22 2015 16:27 GMT
#11357
On January 23 2015 00:25 Days wrote:
Show nested quote +
On January 22 2015 23:38 Prillan wrote:
On January 22 2015 09:13 Days wrote:
On January 22 2015 09:11 Manit0u wrote:
On January 22 2015 09:05 Days wrote: do you know if you're suppose to get the same pins generated from two different devices if running at same time?


You shouldn't.


How sure are you? This is a brand new job for me, so I really don't want to look bad. Can you please elaborate on your response so I have a more clear picture why they wouldn't generate the same two pins.

I assume that this is for testing purposes. In this case you should get the same result/pin/token, but only if you have the same secret key on both devices.

Oh, and don't listen to this:
On January 22 2015 09:18 darkness wrote:
On January 22 2015 09:13 Days wrote:
On January 22 2015 09:11 Manit0u wrote:
On January 22 2015 09:05 Days wrote: do you know if you're suppose to get the same pins generated from two different devices if running at same time?


You shouldn't.


How sure are you? This is a brand new job for me, so I really don't want to look bad. Can you please elaborate on your response so I have a more clear picture why they wouldn't generate the same two pins.


Just generate a nonce. Here is how: http://stackoverflow.com/questions/4145531/how-to-create-and-use-nonces

Nonces and OTP are two different things, with different uses.


That's the problem. We have the same secret key, but we are receiving different pin/tokens from the OTP. I want to know how accurate OTP is with time, because maybe generating the APP from 2 seconds different might affect the pin that will be generated. I don't know what i'm doing wrong. I could post some of my objective C code if that could help.

I looked up that TOTP thingy and that standard seems to say one should work with "Unix time", which is the seconds since 1970-01-01 00:00h, so I'm thinking it's possible to get the same key if you ask in the same second.

Here's what the standard's document says: http://tools.ietf.org/html/rfc6238#section-4.2

EDIT: There's also that "time step" mentioned, and that means it can have a coarser granularity than just 1 second?
"My goal is to replace my soul with coffee and become immortal."
herokiller_
Profile Blog Joined March 2011
92 Posts
January 22 2015 16:32 GMT
#11358
On January 23 2015 01:22 Nesserev wrote:
Just post your question...


I'm having troubles understanding monads (statet for example) and monads transformation
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
January 22 2015 18:30 GMT
#11359
On January 22 2015 11:10 travis wrote:
this seems like it should be easier.

It is easier.
It'll just take a while for you to develop an intuitive understanding of all that stuff.
If you have a good reason to disagree with the above, please tell me. Thank you.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2015-01-22 23:06:40
January 22 2015 23:00 GMT
#11360
does swing have a menu thats like what you would see in a typical old school rpg?

like where it says like

'items'
'stats'
'equip'

and you can pick between them

what swing component would i want to use for that?
I guess i'll need to learn to make my own?


or would I use a "list" for this?
Prev 1 566 567 568 569 570 1032 Next
Please log in or register to reply.
Live Events Refresh
PSISTORM Gaming Misc
15:55
FSL teamleague CNvsASH, ASHvRR
Freeedom16
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SteadfastSC 306
LamboSC2 118
mcanning 69
MindelVK 15
EmSc Tv 11
StarCraft: Brood War
Britney 30168
Rain 2752
Horang2 1410
Jaedong 998
Shuttle 451
Stork 395
PianO 259
firebathero 221
Barracks 164
LaStScan 99
[ Show more ]
Shinee 98
ggaemo 82
Leta 80
Hyun 69
soO 39
Rock 32
Shine 29
Mong 28
JYJ25
ToSsGirL 23
HiyA 21
Movie 15
zelot 11
Dewaltoss 10
Oystein7
Dota 2
Gorgc6149
qojqva1841
Dendi1061
XcaliburYe123
LuMiX1
Counter-Strike
ScreaM961
Heroes of the Storm
Khaldor312
Liquid`Hasu172
Other Games
B2W.Neo1935
Mlord411
Beastyqt257
DeMusliM256
Lowko255
Hui .193
Fuzer 171
Trikslyr27
febbydoto6
Organizations
Dota 2
PGL Dota 2 - Main Stream7590
PGL Dota 2 - Secondary Stream4521
Other Games
EGCTV633
StarCraft 2
EmSc Tv 11
EmSc2Tv 11
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• StrangeGG 71
• HeavenSC 26
• OhrlRock 1
• IndyKCrew
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• Michael_bg 5
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 1840
• Ler52
League of Legends
• Nemesis2810
Other Games
• WagamamaTV345
• Shiphtur62
Upcoming Events
IPSL
35m
ZZZero vs rasowy
Napoleon vs KameZerg
OSC
2h 35m
BSL 21
3h 35m
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
17h 35m
RSL Revival
17h 35m
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
19h 35m
Cure vs herO
Reynor vs TBD
WardiTV Korean Royale
19h 35m
BSL 21
1d 3h
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
1d 3h
Dewalt vs WolFix
eOnzErG vs Bonyth
Replay Cast
1d 6h
[ Show More ]
Wardi Open
1d 19h
Monday Night Weeklies
2 days
WardiTV Korean Royale
2 days
BSL: GosuLeague
3 days
The PondCast
3 days
Replay Cast
4 days
RSL Revival
4 days
BSL: GosuLeague
5 days
RSL Revival
5 days
WardiTV Korean Royale
5 days
RSL Revival
6 days
WardiTV Korean Royale
6 days
Liquipedia Results

Completed

Proleague 2025-11-14
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
CSCL: Masked Kings S3
SLON Tour Season 2
RSL Revival: Season 3
META Madness #9
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.