• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 16:34
CEST 22:34
KST 05:34
  • 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
[ASL22] Ro24 Preview: Summer's End9Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 244ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7
Community News
Weekly Cups (August 10-16): SHIN doubles2GSTL Returns in 2026!45Weekly Cups (Aug 3-9): Protoss get shut out7RSL goes to London! 2026 Offline Finals Nov 21-2212Weekly Cups (July 27-Aug 2): SHIN's big week0
StarCraft 2
General
GSTL Returns in 2026! SC4ALL II: SC2 Player Announcement 6/8 - Maru Balance hotfix patch 5.0.16b (July 16) Serral wins Maestros of the Game 2 Weekly Cups (August 10-16): SHIN doubles
Tourneys
2026 GSTL Announcement Master Swan Open (Global Bronze-Master 2) PIG STY FESTIVAL 8.0! (13 - 23 August) WardiTV Mondays 2026 KungFu Cup Announcement
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
The PondCast: SC2 News & Results Mutation # 539 Thunder Dome Mutation # 538 Media Blackout Mutation # 537 Hostile Territory
Brood War
General
BW General Discussion [ASL22] Ro24 Preview: Summer's End BGH Auto Balance -> http://bghmmr.eu/ How Famous was FlaSh before his Debut? Are you ready for ASL 22? NEW HYPE VIDEO
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues KCM Race Survival 2026 Season 3 [ASL22] Ro24 Group C
Strategy
Odyssey Mineral Stack Saturation Fighting Spirit mining rates Any training maps people recommend? Simple Questions, Simple Answers
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Anyone here play Quakeworld back in the day? Stormgate/Frost Giant Megathread EVE Corporation
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Dating: How's your luck? Artificial Intelligence Thread The Letting Off Steam Thread
Fan Clubs
The Creator Fan Club MarineLorD Fan Club The ShoWTimE Fan Club
Media & Entertainment
Movie Discussion! Anime Discussion Thread Series you have seen recently...
Sports
Football (Soccer) Thread MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023 NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Young Players Exit Esports E…
TrAiDoS
LOCKPICKING NOOB
LUCKY_NOOB
Cathedral Of CS And NY pizza a…
FuDDx
Please support my new stand…
Peanutsc
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4560 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
Poland17831 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
Spain18415 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
Poland17831 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
Spain18415 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
Poland17831 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 3h 26m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
UpATreeSC 160
EmSc Tv 23
StarCraft: Brood War
Calm 3182
Mini 216
Dewaltoss 166
Soulkey 103
ajuk12(nOOB) 19
Dota 2
qojqva3327
Dendi1435
XBOCT1309
XaKoH 462
canceldota8
League of Legends
Doublelift2991
Trikslyr32
Counter-Strike
minikerr0
Super Smash Bros
Mew2King125
Heroes of the Storm
Liquid`Hasu509
Other Games
Grubby2981
Liquid`RaSZi2212
fl0m1796
ceh9644
Beastyqt610
Mlord460
C9.Mang0270
shahzam190
ArmadaUGS111
RotterdaM105
Livibee86
White-Ra65
Organizations
Other Games
angryscii32
StarCraft 2
EmSc Tv 23
EmSc2Tv 23
[ Show 12 non-featured ]
StarCraft 2
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV452
League of Legends
• TFBlade1088
Other Games
• imaqtpie1386
• Shiphtur316
Upcoming Events
Replay Cast
3h 26m
Escore
13h 26m
PiG Sty Festival
15h 26m
Serral vs Reynor
HeRoMaRinE vs herO
Big Brain Bouts
19h 26m
MaNa vs Kelazhur
Nicoract vs HeRoMaRinE
Serral vs Cure
CranKy Ducklings
1d 13h
PiG Sty Festival
1d 15h
Zoun vs Solar
SHIN vs Maru
Patches Events
1d 19h
Sparkling Tuna Cup
2 days
PiG Sty Festival
2 days
The Patches Monday
3 days
[ Show More ]
GSL
4 days
PiGosaur Cup
5 days
Replay Cast
5 days
Replay Cast
6 days
The PondCast
6 days
Liquipedia Results

Completed

Proleague 2026-08-19
CranK Gathers Season 4: BW vs SC2 Team League
Eternal Conflict S2 Finale

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
ASL Season 22
Super Anchor Qualifying S3
CSL Season 22: Qualifier 1
RSL Revival: Season 6
PiG Sty Festival 8.0
META DYMY #4
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026

Upcoming

Escore Tournament S3: W8
CSL Season 22: Qualifier 2
CSL 2026 AUTUMN (S22)
Acropolis #5
Acropolis #5 - TRS
Blizzard Classic Cup 2026
Acropolis #5 - GSA
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
Big Dog Cup 2026 Div 1
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
Thunderpick World Champ. '26
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 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.