• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 17:22
CEST 23:22
KST 06:22
  • 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
TL.net Map Contest #22 - Voting1Code S Season 2 (2026) - RO8 Preview4[ASL21] Finals Preview: Two Legacies21Code S Season 2 (2026) - RO12 Preview2herO wins GSL Code S Season 1 (2026)7
Community News
StarCraft II 5.0.16 PTR Patch Notes may 26th64Weekly Cups (May 18-25): MaxPax wins doubles0Crank Gathers Season 4: BW vs SC2 Team League4Weekly Cups (May 11-17): Classic wins double0Code S Season 1 (2026) - RO8 Results2
StarCraft 2
General
Changing from 12 to 8 is just asking for StarCraft StarCraft II 5.0.16 PTR Patch Notes may 26th TL.net Map Contest #22 - Voting herO wins GSL Code S Season 1 (2026) Code S Season 2 (2026) - RO8 Preview
Tourneys
GSL Code S Season 2 (2026) Sparkling Tuna Cup - Weekly Open Tournament Crank Gathers Season 4: BW vs SC2 Team League GSL Code S Season 1 (2026) Maestros of The Game 2 announcement and schedule !
Strategy
[G] Having the right mentality to improve
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players
External Content
Welcome to the External Content forum Mutation # 527 Hell Train The PondCast: SC2 News & Results Mutation # 526 Rubber and Glue
Brood War
General
Every Matchup's Top 5 Winrates (all ASLs & KSLs) Pros React To: ASL S21 Finals VPN experiences Quality of life changes in BW that you will like ? BW General Discussion
Tourneys
[ASL21] Grand Finals Escore Tournament StarCraft Season 2 [BSL22] WB Final & LB Semis - Saturday 21:00 CEST Small VOD Thread 2.0
Strategy
Any training maps people recommend? Muta micro map competition [G] Hydra ZvZ: An Introduction Fighting Spirit mining rates
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread Path of Exile Dawn of War IV
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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Trading/Investing Thread Dating: How's your luck?
Fan Clubs
The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books
Sports
McBoner: A hockey love story 2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Facing Challenges in Mobile App Development
TL Community
The Automated Ban List
Blogs
Customization Drives Loyalty…
TrAiDoS
Why RTS gamers make better f…
gosubay
ramps on octagon
StaticNine
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2159 users

The Big Programming Thread - Page 665

Forum Index > General Forum
Post a Reply
Prev 1 663 664 665 666 667 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.
3FFA
Profile Blog Joined February 2010
United States3931 Posts
September 20 2015 03:13 GMT
#13281
New Jersey here, would be interested too.
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
Last Edited: 2015-09-20 17:25:12
September 20 2015 17:20 GMT
#13282
java question:

edit: let me rephrase this


my program takes input with scanner.
I ask a question and I want the user to type an answer

but, the blinking cursor that shows that they can type something in does not move to the end of the question where they will type it in. it blinks at the start of the question. I want it to blink where they will type it in.

example

"_" <----this underscore is the blinking cursor that suggests you can input


in my program i say:

System.out.print("type a number:");
numbervariable = scannername.nextint;



And on my screen this looks like:

type a number:


but I want it to look like:

type a number: _
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
September 20 2015 17:29 GMT
#13283
If you run the program embedded in your IDE then the answer is likely to depend on the IDE. So I guess you should first tell us what IDE you use.

Afaik the cursor for text input is usually called a caret.
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-09-20 17:31:34
September 20 2015 17:30 GMT
#13284
It is eclipse

If I compiled the program would it behave differently?


It looks like there are methods that let you manipulate the "caret"
RoomOfMush
Profile Joined March 2015
1296 Posts
September 20 2015 18:46 GMT
#13285
@travis: This has nothing to do with your program but with the eclipse console, its standard behavior and I know of no way to change it. (Although there probably is a way since eclipse is super heavy on the plugins and user modifications)
You dont have to care about this though because in a regular terminal this will be different.
Manit0u
Profile Blog Joined August 2004
Poland17754 Posts
Last Edited: 2015-09-20 22:20:57
September 20 2015 22:11 GMT
#13286
On September 18 2015 14:49 Blisse wrote:
Show nested quote +
On September 18 2015 10:27 3FFA wrote:
I'm trying to program a series of for loops that will take an inputted series of text and output it in single lines 60 characters long with an asterisk on the left and ride side of each line. Leaving the text centered in the middle.

This feels like it should be really simple but I can't remember/figure out(took a long break from programming, this was a challenge to myself as a starter to get back into it) how to find a space character, cut off the string, and then add the necessary surrounding spaces and asterisks. This is to prevent the problem of an awkwardly cut off word.

edit: language is Java.

Also, if someone wants to actually do it and post a full solution, I would be happy to see one spoiler'd so I can go back when I finish and see how someone else would've done it.


https://gist.github.com/Blisse/e68b99719c8e035a31f1

could use comments and a couple places could be done better but it's supposed to be rough

[image loading]



Why so many loops in there?

All you really have to do is:

+ Show Spoiler +

1. Split your text into words.


String text = "Our very long text";
String[] words = text.split("\\s+");


2. Write a simple method to which you'll pass your words and a number, so you can do this:


static final int maxLength = 56;
int i = counter;
String currentLine = "";

while (currentLine.length() < maxLength) {
String tmpLine = currentLine + words[i] + " ";

if (tmpLine.length() <= maxLength) {
currentLine = tmpLine;

i += 1;
} else {
break;
}
}

String formattedLine = String.format("* %s *%n", StringUtils.center(currentLine, maxLength));


Of course, this needs some fleshing out, like running #2 recursively, incrementing the counter and building up your final string from formatted lines.

Another thing would be not necessarily always adding a space after a word (if it's the last word in a line).


Spoilered it, as requested. I hope you'll be able to find some useful methods that are already present in Java in the code I posted
Time is precious. Waste it wisely.
Chocolate
Profile Blog Joined December 2010
United States2350 Posts
September 21 2015 20:26 GMT
#13287
On September 21 2015 02:30 travis wrote:
It is eclipse

If I compiled the program would it behave differently?


It looks like there are methods that let you manipulate the "caret"

My friends run into this all the time when they take the intro CS class at my school

If you don't figure out an easy way to fix it, I would just give intellij IDEA a shot. In my opinion eclipse is just too sluggish anyway
Acrofales
Profile Joined August 2010
Spain18299 Posts
September 21 2015 20:39 GMT
#13288
I dunno. My first contact with Intelligence IDEA was Android Studio. I find it unwieldy and incredibly slow. Eclipse is supersonic in comparison.
Chocolate
Profile Blog Joined December 2010
United States2350 Posts
Last Edited: 2015-09-21 21:09:33
September 21 2015 21:09 GMT
#13289
I do some Android programming with and I find it to work fine. You may be right though. I haven't actually used eclipse on my new computer lol.

Regardless, it would at least get around the silly IDE console error
Manit0u
Profile Blog Joined August 2004
Poland17754 Posts
September 22 2015 09:24 GMT
#13290
The best thing that ever happened to me was migrating from NetBeans and Eclipse to PhpStorm. They're worlds apart and I don't know a single person who would like to go back after even a week of using storm and not even realizing its full potential (that's for PHP though, maybe NetBeans and Eclipse work better with Java but even simple things like unnecessary whitespace removal - or showing whitespace for that matter - are complete shit compared to JetBrains products).
Time is precious. Waste it wisely.
phar
Profile Joined August 2011
United States1080 Posts
September 23 2015 05:41 GMT
#13291
Eclipse is mostly for Java; it falls off really fast for other languages.
Who after all is today speaking about the destruction of the Armenians?
TMG26
Profile Joined July 2012
Portugal2017 Posts
September 23 2015 13:41 GMT
#13292
Jetbrains productd uses the disk a lot. Having an SSD is recommended.

Whenever I try some new tech, i always check if there are some jetbrains product that supports it.
Supporter of the situational Blink Dagger on Storm.
Acrofales
Profile Joined August 2010
Spain18299 Posts
September 23 2015 13:45 GMT
#13293
On September 23 2015 22:41 TMG26 wrote:
Jetbrains productd uses the disk a lot. Having an SSD is recommended.

Whenever I try some new tech, i always check if there are some jetbrains product that supports it.

Only used pycharm so far and it's great. If all their products are as good then definitely go with them.
Cyx.
Profile Joined November 2010
Canada806 Posts
Last Edited: 2015-09-24 02:01:09
September 24 2015 01:59 GMT
#13294
On September 22 2015 05:39 Acrofales wrote:Eclipse is supersonic in comparison.

You seem to have had a *very* different experience with Eclipse than I did.

e: now that I think about it, I've never tried IntelliJ so maybe the comparison is apt... but this is one of the reasons I hate IDEs :D emacs ftw (and when an emacs user is calling your IDE slow it might be time to reconsider your path in life )
Cynry
Profile Blog Joined August 2010
810 Posts
Last Edited: 2015-09-24 07:52:45
September 24 2015 07:40 GMT
#13295
Hey guys !
Sorry in advance, but I need to RANT !

A little bit of context:
Beginning of summer I started working as programmer on a web project carried by professionnals (I'm officially a student still). Stuff happenned, I ended up as the only one working on it, but at this point no code is written.
I decide (big mistake, I see that now) to bring 2 friends to the party, and all 3 of us start working, with me acting as a sort of team leader. For which I'm not trained or particularly skilled, but whatever.

We pick meteor, start working on some basic templates to get an idea of how big the project is. And it's big. And there's plan to extend it even way more after release, but being short on time (we have 1 month before a first release at this point) we just move forward and try to have something to show without thinking much about long term.

2 weeks ago, we meet someone working on a very similar project, except he has been for years now, and is of course quite knowledgeable and willing to share with us. Right after this meeting, we learn that we have 1 more month then we thought. So in light of all these new informations, I ask the team if they're ok with considering building something good right from the start, now that we have the time. They're ok with that, I come up with a nice solution the next day,on which we agree to work.
So I start this very task, and spend my week-end cleaning up what we've done and bringing it to the new standards.

In no particular order, what I did: unified all collections (yay mongo) with schema.org as a basis, added a type field which allow a unified code for all database interactions (instead of Users.find and Teams. find we now have Collections.find which will point to the right collection according to the type queried.). Factorised templates, declared a new namespace supposed to contain all logic cut in small reusable functions, and a caller for that logic that does all the "get documents, apply logic to them, update them" cleanly.

So we end up with what I would consider to be good code. Templates and collections have very little logic on their own, all they do is call a particular set of logic functions which are all in their own folder. It can handle security, owner rights, checks for if an action is possible or not, and it even message the user of what's going on.
It has one issue though. You can't work with it yet.
That's my big mistake, after all the moving around of files and functions, the main piece, the logic caller, is not quite tuned. And I miss that, and I'm already trying to add new stuff to the architecture, without communicating much of it with the team. Screwed up on that one, yeah.

But still, we spend the week on skype all day every day, aaaand it's pretty quiet. I'm exploring dead ends, one is working with something that I never saw, the other doing not much. Middle of the week, I declare my exploration time as over and tell the team we're now back on track on what we all agreed on. T suggests that we review all the code and comment it, we try that, but again apathy from them leads to not much. That was last friday.

I'm off for the week end, without being able to connect to skype. Come home on monday, start working, and when they finally get up (~4pm..), they announce that they have been working on the old architecture (or rather lack of) on their own for 4 days now, without telling me. Reason : "durr we didn't understand what was going on, urr at least now it's easy and clear"

WHAT. THE. FUCK.

So yeah, there I am, starting my day, looking at this fugly code and not motivated one bit. Since then I managed to convince them back that it was a good idea, but the harm is done and I have to clean all that shit again, while arguing againt logical fallacies for everything that I want to add.

Not gonna lie, kinda wish I had some real team leader powers here. Like fire these 2 fucking amateurs...
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
September 24 2015 08:54 GMT
#13296
Hate to bring the bad news, but anyways:
1) Code that the whole team understands is of higher priority than clean code. As much as it hurts to read bad code. You have to work with the team you have and you have to accept that nobody is perfect. Help your team improve with a positive attitude. Depending on the personalities in the team this can tough to pull off without pissing anyone off.
2) Don't do huge refactorings. Especially don't do them alone. It's good to have a goal to refactor towards, but you should work out a series of smaller refactorings that lead towards the final architecture. Don't break the software with any of these smaller refactorings. Space those refactorings out over couple weeks or months. This way everyone on the team has enough time to catch up on the new stuff.

If you're already done with the huge refactoring then you probably shouldn't go back and do the small refactorings anymore. That would just increase confusion. But you'll have to invest a bunch of time to make sure everyone understands the new code. Make it clear that you're willing to help. This again can be a problem with your team, of course, because many people don't want to admit they don't undestand something.

Them working on the old code behind your back is bad, but you should find out why they did that instead of asking you for help with the new code.
If you have a good reason to disagree with the above, please tell me. Thank you.
Cynry
Profile Blog Joined August 2010
810 Posts
September 24 2015 10:56 GMT
#13297
Nah, you're not a bringer of bad news, it sounds like common sense. I may have sounded very mad in my post because I was venting, but both your points are lessons I took from the mistakes I made already. We are now working with an architecture they are familiar with, and I'm slowly working toward refactoring everything and making sure we're all good with that as I progress.
As a team leader having a fully functional team is indeed the priority, but as a person, it still irritates me ^^

The infuriating thing is that the refactoring was done and agreed upon, and they scratched everything because they couldn't figure what was the point of a small part of it after a week of not asking what was the point of that part.

Not sure what you mean by "If you're already done with the huge refactoring then you probably shouldn't go back and do the small refactorings anymore".
Shouldn't I try to slowly bring back the better architecture ?
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2015-09-24 11:30:19
September 24 2015 11:30 GMT
#13298
On September 24 2015 19:56 Cynry wrote:
Not sure what you mean by "If you're already done with the huge refactoring then you probably shouldn't go back and do the small refactorings anymore".
Shouldn't I try to slowly bring back the better architecture ?

Of course you should. I just figured you already had worked on getting their new code refactored for the new architecture. But I really shouldn't give you any recommendations whether you should keep the big refactoring or scratch it and start with the small ones. You'll have to judge by yourself which way will be easier for you and your team.
If you have a good reason to disagree with the above, please tell me. Thank you.
Manit0u
Profile Blog Joined August 2004
Poland17754 Posts
Last Edited: 2015-09-24 11:55:04
September 24 2015 11:50 GMT
#13299
Cynry, just one question. Does Meteor allow for easy data transformation? (like an object to id transformer and vice versa)

I'm asking because I don't know much about pure JS apps myself and one of the most common problems you run into with bigger apps is having to work with large amounts of data which means you need to filter it somehow, use lazy fetching etc.

Most common things already have libraries for that (Java Hibernate, PHP Doctrine etc.) but I can't seem to find anything like that for JS.

It's easy to make a mistake of rendering a select form field and not realize it has 20k+ options in it, which slows down (if not outright kills) your app tremendeously and is a nightmare from UX perspective. That's where you should have searchers on all except most basic select fields that will fetch only required parts of the data.

Something to think about as you develop your app.

Edit:

Also, please do get/create some faker and fill up your db to the brim with entries and see how everything works then. Testing with 5-10 records isn't really the same as doing it with 5-10k records in each table.
Time is precious. Waste it wisely.
Cynry
Profile Blog Joined August 2010
810 Posts
Last Edited: 2015-09-24 12:12:16
September 24 2015 12:09 GMT
#13300
Well, Meteor isn't really pure JS. It even introduces ECMAscript 6 as its language with its last update.
I'm no expert on Meteor yet, only been working with it for a couple months now, so there's that too.

As I see it, this issue is pretty much solved by using intelligent queries when fetching data from the database, be it client or server.
Basically, the client gets a mirror of the server database, filtered by the following:
-Meteor.publish on the server, which allows you to set some names (a bit like routes) for access to specified data. Specification of what is returned uses the regular mongodb queries syntax, so you can limit (even dynamically) the fields you want to return, according or not to the user status (connected, admin etc);
-Meteor.subscribe on the client, which calls the previously defined published data by its name, and you can specifiy here too which data you want to receive.

These 2 combines forms the client side database (minimongo collections), but does not fetch any documents in it. It's just which data and fields of this data you can even see. You then need to fetch it with the usual mongo .find().fetch() or .findOne(), and here again, you can limit the field you're actually returning to your logic.
This is also valid on the server side, except it works with the whole database instead of the minimongo mirror.

So there's that, built-in Meteor, that could work.
There's also a schema package, that works a lot like Doctrine (except it's JSON), called SimpleSchema, which provides an customisable autoform option It can even turn mongo into a SQL-like database by attaching schema directly to collections (thus forcing checks on a user defined allowed set of fields for every insert/update)

Edit: I tried to ctrl + s this message way too many times ...
Prev 1 663 664 665 666 667 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 38m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ZombieGrub314
JuggernautJason138
SpeCial 82
ForJumy 33
EmSc Tv 28
StarCraft: Brood War
Dewaltoss 112
ajuk12(nOOB) 13
soO 10
Dota 2
capcasts85
League of Legends
KnowMe76
Other Games
summit1g8383
Grubby3824
Gorgc2972
qojqva530
uThermal248
C9.Mang0211
Liquid`Hasu138
UpATreeSC132
B2W.Neo120
ArmadaUGS79
Mew2King65
ViBE39
PPMD26
minikerr3
Organizations
Counter-Strike
PGL198
Other Games
BasetradeTV187
StarCraft 2
angryscii 36
EmSc Tv 28
EmSc2Tv 28
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 17 non-featured ]
StarCraft 2
• Hupsaiya 18
• musti20045 11
• mYiSmile18
• IndyKCrew
• sooper7s
• intothetv
• Kozan
• AfreecaTV YouTube
• LaughNgamezSOOP
• Migwel
StarCraft: Brood War
• blackmanpl 45
• FirePhoenix3
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• Stunt221
Other Games
• tFFMrPink 9
Upcoming Events
Replay Cast
2h 38m
RSL Revival
9h 38m
Lambo vs SHIN
Solar vs Rogue
herO vs Clem
Maestros of the Game
13h 38m
SKillous vs Ryung
Solar vs Percival
Maru vs sOs
Lambo vs Arrogfire
IPSL
18h 38m
ZZZero vs WorsT
Julia vs eOnzErG
BSL
21h 38m
TerrOr vs Dewalt
Bonyth vs eOnzErG
Replay Cast
1d 2h
RSL Revival
1d 9h
Maestros of the Game
1d 15h
SHIN vs Nicoract
Rogue vs Gerald
ByuN vs Shameless
Cure vs TriGGeR
OSC
1d 15h
IPSL
1d 18h
Dragon vs Artosis
dxtr13 vs Hawk
[ Show More ]
BSL
1d 21h
Wardi Open
2 days
Monday Night Weeklies
2 days
Replay Cast
3 days
Sparkling Tuna Cup
3 days
WardiTV Spring Champion…
3 days
Maestros of the Game
3 days
The PondCast
4 days
Kung Fu Cup
4 days
Maestros of the Game
4 days
Replay Cast
5 days
Replay Cast
5 days
WardiTV Spring Champion…
5 days
Maestros of the Game
5 days
Replay Cast
6 days
uThermal 2v2 Circuit
6 days
Maestros of the Game
6 days
Liquipedia Results

Completed

ASL Season 21
2026 GSL S1
Heroes Pulsing #1

Ongoing

2026 KK StarCraft Pro League
BSL Season 22
IPSL Spring 2026
KCM Race Survival 2026 Season 2
KK 2v2 League Season 1
Acropolis #4
CSCL: Masked Kings S4
Escore Tournament S2: King of Kings
SCTL 2026 Spring
WardiTV Spring 2026
2026 GSL S2
RSL Revival: Season 5
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026

Upcoming

YSL S3
BSL 22 Non-Korean Championship
CSLAN 4
Blizzard Classic Cup 2026
Kung Fu Cup 2026 Grand Finals
CranK Gathers Season 4: BW vs SC2 Team League
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
Heroes Pulsing #3
Heroes Pulsing #2
Bounty Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
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 © 2026 TLnet. All Rights Reserved.