• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 10:44
CEST 16:44
KST 23:44
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL50Weekly Cups (June 23-29): Reynor in world title form?12FEL Cracov 2025 (July 27) - $8000 live event16Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
The SCII GOAT: A statistical Evaluation The GOAT ranking of GOAT rankings How does the number of casters affect your enjoyment of esports? Statistics for vetoed/disliked maps Esports World Cup 2025 - Final Player Roster
Tourneys
RSL: Revival, a new crowdfunded tournament series [GSL 2025] Code S: Season 2 - Semi Finals & Finals $5,100+ SEL Season 2 Championship (SC: Evo) FEL Cracov 2025 (July 27) - $8000 live event HomeStory Cup 27 (June 27-29)
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Player “Jedi” cheat on CSL BGH Auto Balance -> http://bghmmr.eu/ Unit and Spell Similarities Help: rep cant save Flash Announces Hiatus From ASL
Tourneys
[BSL20] Grand Finals - Sunday 20:00 CET [Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile What do you want from future RTS games? 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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Trading/Investing Thread The Games Industry And ATVI
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread NBA General Discussion Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 753 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
Poland17243 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
Spain17969 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
Poland17243 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
Spain17969 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
Poland17243 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
OSC
13:00
King of the Hill #216
davetesta87
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko584
Hui .252
Vindicta 28
StarCraft: Brood War
Britney 57495
Calm 6793
Rain 3544
Shuttle 1426
Horang2 1401
EffOrt 1305
Hyuk 847
Larva 600
Light 294
BeSt 266
[ Show more ]
hero 201
Mini 166
Leta 164
ToSsGirL 113
Mind 87
Mong 75
Pusan 73
Snow 71
Hyun 62
Rush 49
Shinee 47
Barracks 45
JYJ39
Movie 26
soO 24
PianO 18
HiyA 13
Nal_rA 12
Backho 11
Shine 9
yabsab 8
IntoTheRainbow 8
SilentControl 7
zelot 3
Dota 2
Gorgc10538
qojqva2694
League of Legends
singsing2653
Other Games
Grubby2727
B2W.Neo1534
hiko948
DeMusliM571
Fuzer 292
XaKoH 261
ArmadaUGS126
QueenE25
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• IndyKCrew
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• LaughNgamezSOOP
• Kozan
StarCraft: Brood War
• Michael_bg 9
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 2657
• WagamamaTV410
League of Legends
• Nemesis6783
• Jankos1184
• TFBlade818
Upcoming Events
WardiTV European League
1h 16m
Scarlett vs Percival
Jumy vs ArT
YoungYakov vs Shameless
uThermal vs Fjant
Nicoract vs goblin
Harstem vs Gerald
FEL
1h 16m
Big Brain Bouts
1h 16m
Korean StarCraft League
12h 16m
CranKy Ducklings
19h 16m
RSL Revival
19h 16m
FEL
1d 1h
RSL Revival
1d 19h
FEL
1d 21h
BSL: ProLeague
2 days
Dewalt vs Bonyth
[ Show More ]
Replay Cast
3 days
Sparkling Tuna Cup
3 days
The PondCast
4 days
Replay Cast
5 days
RSL Revival
5 days
Replay Cast
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Proleague 2025-06-28
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
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
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.