• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:42
CEST 11:42
KST 18:42
  • 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
Team TLMC #5 - Finalists & Open Tournaments0[ASL20] Ro16 Preview Pt2: Turbulence10Classic Games #3: Rogue vs Serral at BlizzCon9[ASL20] Ro16 Preview Pt1: Ascent10Maestros of the Game: Week 1/Play-in Preview12
Community News
BSL 2025 Warsaw LAN + Legends Showmatch0Weekly Cups (Sept 8-14): herO & MaxPax split cups4WardiTV TL Team Map Contest #5 Tournaments1SC4ALL $6,000 Open LAN in Philadelphia8Weekly Cups (Sept 1-7): MaxPax rebounds & Clem saga continues29
StarCraft 2
General
#1: Maru - Greatest Players of All Time Weekly Cups (Sept 8-14): herO & MaxPax split cups Team Liquid Map Contest #21 - Presented by Monster Energy SpeCial on The Tasteless Podcast Team TLMC #5 - Finalists & Open Tournaments
Tourneys
Maestros of The Game—$20k event w/ live finals in Paris Sparkling Tuna Cup - Weekly Open Tournament SC4ALL $6,000 Open LAN in Philadelphia WardiTV TL Team Map Contest #5 Tournaments RSL: Revival, a new crowdfunded tournament series
Strategy
Custom Maps
External Content
Mutation # 491 Night Drive Mutation # 490 Masters of Midnight Mutation # 489 Bannable Offense Mutation # 488 What Goes Around
Brood War
General
Soulkey on ASL S20 ASL TICKET LIVE help! :D BW General Discussion NaDa's Body A cwal.gg Extension - Easily keep track of anyone
Tourneys
[ASL20] Ro16 Group D [ASL20] Ro16 Group C [Megathread] Daily Proleagues BSL 2025 Warsaw LAN + Legends Showmatch
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile Borderlands 3 General RTS Discussion Thread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Canadian Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread UK Politics Mega-thread
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s)
TL Community
BarCraft in Tokyo Japan for ASL Season5 Final The Automated Ban List
Blogs
I <=> 9
KrillinFromwales
The Personality of a Spender…
TrAiDoS
A very expensive lesson on ma…
Garnet
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1577 users

The Big Programming Thread - Page 665

Forum Index > General Forum
Post a Reply
Prev 1 663 664 665 666 667 1031 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
Poland17341 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
Spain18050 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
Poland17341 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
Spain18050 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
Poland17341 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 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 18m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Rex 1
StarCraft: Brood War
Calm 5699
Bisu 731
Hyuk 162
HiyA 96
Hyun 96
sorry 86
ToSsGirL 84
Dewaltoss 82
Pusan 77
Light 74
[ Show more ]
Soma 60
actioN 56
Mini 49
ZerO 32
BeSt 30
Liquid`Ret 29
Nal_rA 28
soO 27
Sharp 24
Rush 19
Free 16
SilentControl 10
Dota 2
singsing1260
XcaliburYe206
boxi98170
League of Legends
JimRising 381
Counter-Strike
olofmeister1583
shoxiejesuss598
allub166
Other Games
XaKoH 143
NeuroSwarm80
Trikslyr15
Organizations
StarCraft: Brood War
lovetv 593
Other Games
gamesdonequick587
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 1
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1421
• Stunt679
Other Games
• WagamamaTV81
Upcoming Events
RSL Revival
18m
Maru vs Reynor
Cure vs TriGGeR
Rex1
Map Test Tournament
1h 18m
The PondCast
3h 18m
RSL Revival
1d
Zoun vs Classic
Korean StarCraft League
1d 17h
BSL Open LAN 2025 - War…
1d 22h
RSL Revival
2 days
BSL Open LAN 2025 - War…
2 days
RSL Revival
3 days
Online Event
3 days
[ Show More ]
Wardi Open
4 days
Monday Night Weeklies
4 days
Sparkling Tuna Cup
5 days
LiuLi Cup
6 days
Liquipedia Results

Completed

Proleague 2025-09-10
Chzzk MurlocKing SC1 vs SC2 Cup #2
HCC Europe

Ongoing

BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
LASL Season 20
RSL Revival: Season 2
Maestros of the Game
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1

Upcoming

2025 Chongqing Offline CUP
BSL World Championship of Poland 2025
IPSL Winter 2025-26
BSL Season 21
SC4ALL: Brood War
BSL 21 Team A
Stellar Fest
SC4ALL: StarCraft II
EC S1
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
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.