• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 16:46
CET 21:46
KST 05:46
  • 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
ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book19Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool3Weekly Cups (March 9-15): herO, Clem, ByuN win22026 KungFu Cup Announcement6BGE Stara Zagora 2026 cancelled12Blizzard Classic Cup - Tastosis announced as captains18
StarCraft 2
General
Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool Weekly Cups (March 9-15): herO, Clem, ByuN win Weekly Cups (August 25-31): Clem's Last Straw? Blizzard Classic Cup - Tastosis announced as captains Potential Updates Coming to the SC2 CN Server
Tourneys
2026 KungFu Cup Announcement [GSL CK] #2: Team Classic vs. Team Solar [GSL CK] #1: Team Maru vs. Team herO RSL Season 4 announced for March-April PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar)
Strategy
Custom Maps
Publishing has been re-enabled! [Feb 24th 2026] Map Editor closed ?
External Content
The PondCast: SC2 News & Results Mutation # 517 Distant Threat Mutation # 516 Specter of Death Mutation # 515 Together Forever
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion Gypsy to Korea BW General Discussion BSL 22 Map Contest — Submissions OPEN to March 10
Tourneys
[Megathread] Daily Proleagues [BSL22] Open Qualifiers & Ladder Tours IPSL Spring 2026 is here! ASL Season 21 Qualifiers March 7-8
Strategy
Simple Questions, Simple Answers Soma's 9 hatch build from ASL Game 2 Fighting Spirit mining rates Zealot bombing is no longer popular?
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Stormgate/Frost Giant Megathread Dawn of War IV Path of Exile
Dota 2
Official 'what is Dota anymore' discussion The Story of Wings Gaming
League of Legends
FTM 2019 new update 24.2.2
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
Five o'clock TL Mafia Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Mexico's Drug War Canadian Politics Mega-thread Russo-Ukrainian War Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! [Req][Books] Good Fantasy/SciFi books
Sports
2024 - 2026 Football Thread Formula 1 Discussion Tokyo Olympics 2021 Thread General nutrition recommendations Cricket [SPORT]
World Cup 2022
Tech Support
Laptop capable of using Photoshop Lightroom?
TL Community
The Automated Ban List
Blogs
Funny Nicknames
LUCKY_NOOB
Money Laundering In Video Ga…
TrAiDoS
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
Shocked by a laser…
Spydermine0240
Unintentional protectionism…
Uldridge
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2297 users

The Big Programming Thread - Page 588

Forum Index > General Forum
Post a Reply
Prev 1 586 587 588 589 590 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.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2015-02-16 03:06:41
February 16 2015 03:04 GMT
#11741
On February 16 2015 11:58 travis wrote:
Show nested quote +
On February 16 2015 11:44 berated- wrote:
On February 16 2015 06:57 travis wrote:
nope, because myList saves a reference to the object, not the object's values.

So myList[0] would point to myObject, myList[1] would point to myObject, myList[3] would point to myObject, etc.

then if myObjects values change, it will say the new values regardless of which myList you call.



Blitzkrieg's solution was to just make myList[counter] = new myObject, which I am assuming makes the position in the arraylist the actual reference, instead of making the position in the arraylist hold a reference. that's what I think is happening there, at least.


That's actually false, and not how java works. You should listen to Ropid. While that way may be confusing, it would not set all the objects to the same thing.


that's not what I've read. what I've read is that if you create 2 instances and they have the same reference name, then every reference with that name will point to the newest instance. so, i really don't understand why this wouldn't do that.


It does work like they're saying.

Basically you have a reference to an object. You create a new object and set the reference to that object. Then you copy that reference into the array. Then when you loop you're creating a new object and placing a reference to it in the same place. The new object has a different address so when you add it to the array it will be a unique object.

There is no point doing this copy action though. You should just save the object into the array when you make it.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
February 16 2015 03:09 GMT
#11742
I really should have understood that faster to be honest. Makes me feel dumb lol
berated-
Profile Blog Joined February 2007
United States1134 Posts
Last Edited: 2015-02-16 03:14:48
February 16 2015 03:14 GMT
#11743
On February 16 2015 12:09 travis wrote:
I really should have understood that faster to be honest. Makes me feel dumb lol


I've been doing this for 11 years and still had to write a main method to prove it to myself before posting... as long as you get it figured out keep learning I wouldn't feel too bad about it.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2015-02-16 07:40:23
February 16 2015 07:39 GMT
#11744


LOL


and yeah you really need to work a lot with C for a while before some things about references start clicking faster, sometimes i find myself wondering wtf is going on with & and then * and then *(*(&spp_var)) and then i meet a new operator && which is something about RHS or something

summoning nunez, what is &&variable in the parameter pls :d (http://stackoverflow.com/questions/4549151/c-double-address-operator)
There is no one like you in the universe.
Manit0u
Profile Blog Joined August 2004
Poland17695 Posts
Last Edited: 2015-02-16 09:23:12
February 16 2015 08:47 GMT
#11745
Something that finally taught me some stuff about references was this:


void strcpy(char *p, const char *q) {
while (*p++ = *q++);
}


Understanding how this code works made my jaw drop at how beautifully designed it is (apart from possible buffer overflow of course).
Time is precious. Waste it wisely.
netherh
Profile Blog Joined November 2011
United Kingdom333 Posts
February 16 2015 12:34 GMT
#11746

summoning nunez, what is &&variable in the parameter pls :d (http://stackoverflow.com/questions/4549151/c-double-address-operator)


It's a reference to an object whose state we don't care (much) about after the function returns (e.g. a temporary object). This allows destructive, but efficient things, such as move operations to happen using that parameter.

Praise Visual Studio!

/discount nunez
pedrlz
Profile Joined September 2012
Brazil5234 Posts
February 16 2015 15:36 GMT
#11747
So I decided to start learning a programming language (again!). I decided that clojure doesn't have much material for starters and I get a little lost after doing the most tutorials that I found so I decided to change for python because it seems the most similar language from the mainstream (I might just be completely wrong, don't be too harsh with me pls).

I wanted a book to study instead of using web tutorials since I usually like to lie on my bed and read something before sleep. What books do you recommend for python? Think Python is good enough? Should I try others? Thanks.
Manit0u
Profile Blog Joined August 2004
Poland17695 Posts
Last Edited: 2015-02-16 15:42:46
February 16 2015 15:40 GMT
#11748
On February 17 2015 00:36 pedrlz wrote:
So I decided to start learning a programming language (again!). I decided that clojure doesn't have much material for starters and I get a little lost after doing the most tutorials that I found so I decided to change for python because it seems the most similar language from the mainstream (I might just be completely wrong, don't be too harsh with me pls).

I wanted a book to study instead of using web tutorials since I usually like to lie on my bed and read something before sleep. What books do you recommend for python? Think Python is good enough? Should I try others? Thanks.


http://learnpythonthehardway.org/

It's a free web tutorial (and a good one at that) but you can always buy the book for it if you feel like it.

Don't try others. Start with either Python (getting into it is relatively easy) or C (simple language but much more daunting - here's a tutorial, you can check out if it's for you or not) and go with it. The author of both tutorials actually recommends doing the Python stuff before C, since C is targeted at people who are at least somewhat familiar with basic programming concepts.

P. S.

The newest gem I've found at work. Awesome class name: ReasonOfUnable.
Time is precious. Waste it wisely.
CorsairHero
Profile Joined December 2008
Canada9491 Posts
February 16 2015 17:08 GMT
#11749
On February 14 2015 14:47 BisuDagger wrote:
Show nested quote +
On February 14 2015 06:13 CorsairHero wrote:
anyone linux users that are believers in vim here? I'm too used to using windows text based editors -_-

As someone who hates developing in Linux, vim is the only way to go. Learning how to develop using vim helps make you a smart and efficient programmer. It's also great to know because vim is on all Linux devices and you may find yourself without an ide available to edit code on during delivery of a company project. Bottom line, the skill is to damn important to pass up. So don't be cheap and get 'practical vim' off Amazon now and become a wizard.

thanks, i'll take a look at it. I'm also looking at using nerdtree plugin as well for file system access...seems useful.
© Current year.
bangsholt
Profile Joined June 2011
Denmark138 Posts
February 16 2015 17:54 GMT
#11750
On February 16 2015 17:47 Manit0u wrote:
Something that finally taught me some stuff about references was this:


void strcpy(char *p, const char *q) {
while (*p++ = *q++);
}


Understanding how this code works made my jaw drop at how beautifully designed it is (apart from possible buffer overflow of course).


And you probably learned a bit about operator precedence as well ;o)
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
February 16 2015 18:17 GMT
#11751
apparently there's no operator precedence in play with *p++
There is no one like you in the universe.
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2015-02-16 18:44:00
February 16 2015 18:21 GMT
#11752
On February 17 2015 03:17 Blisse wrote:
apparently there's no operator precedence in play with *p++


You have to know if it will post-increment the pointer or the dereference. One of the options doesn't make sense so the answer is apparent, but it is still nifty.

That isn't going to help Travis though because java doesn't have pointers.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Cyx.
Profile Joined November 2010
Canada806 Posts
February 16 2015 23:44 GMT
#11753
On February 17 2015 00:40 Manit0u wrote:
Show nested quote +
On February 17 2015 00:36 pedrlz wrote:
So I decided to start learning a programming language (again!). I decided that clojure doesn't have much material for starters and I get a little lost after doing the most tutorials that I found so I decided to change for python because it seems the most similar language from the mainstream (I might just be completely wrong, don't be too harsh with me pls).

I wanted a book to study instead of using web tutorials since I usually like to lie on my bed and read something before sleep. What books do you recommend for python? Think Python is good enough? Should I try others? Thanks.


http://learnpythonthehardway.org/

It's a free web tutorial (and a good one at that) but you can always buy the book for it if you feel like it.

Don't try others. Start with either Python (getting into it is relatively easy) or C (simple language but much more daunting - here's a tutorial, you can check out if it's for you or not) and go with it. The author of both tutorials actually recommends doing the Python stuff before C, since C is targeted at people who are at least somewhat familiar with basic programming concepts.

P. S.

The newest gem I've found at work. Awesome class name: ReasonOfUnable.


My favourite 'learn to program if you don't know anything at all' resource: Non-Programmer's Guide to Python 3. I learned with it, my girlfriend is learning with it... I love it, it makes things really easy for people who know literally nothing about programming. Sorry, it's not a book, but it's really good for learning with practical, simple examples which require you to be at your computer anyways
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2015-02-16 23:49:43
February 16 2015 23:47 GMT
#11754
On February 16 2015 17:47 Manit0u wrote:
Something that finally taught me some stuff about references was this:


void strcpy(char *p, const char *q) {
while (*p++ = *q++);
}


Understanding how this code works made my jaw drop at how beautifully designed it is (apart from possible buffer overflow of course).


It's actually not as readable as it should be. And what happens if p's length isn't equal to q's length? Undefined behaviour?
tofucake
Profile Blog Joined October 2009
Hyrule19196 Posts
February 16 2015 23:50 GMT
#11755
overflow or segfault
Liquipediaasante sana squash banana
Blitzkrieg0
Profile Blog Joined August 2010
United States13132 Posts
Last Edited: 2015-02-16 23:56:44
February 16 2015 23:54 GMT
#11756
On February 17 2015 08:47 darkness wrote:
Show nested quote +
On February 16 2015 17:47 Manit0u wrote:
Something that finally taught me some stuff about references was this:


void strcpy(char *p, const char *q) {
while (*p++ = *q++);
}


Understanding how this code works made my jaw drop at how beautifully designed it is (apart from possible buffer overflow of course).


It's actually not as readable as it should be. And what happens if p's length isn't equal to q's length? Undefined behaviour?


If p is greater than q then it doesn't matter. If q is larger then you either segfault from accessing protected memory or you're overwriting memory that you shouldn't be.

The function expects a null terminated string so you can also run into problems if your string isn't null terminated. This makes the length of q undefined because it will copy characters until it hits a null character.
I'll always be your shadow and veil your eyes from states of ain soph aur.
Ropid
Profile Joined March 2009
Germany3557 Posts
February 17 2015 00:32 GMT
#11757
On February 17 2015 00:36 pedrlz wrote:
So I decided to start learning a programming language (again!). I decided that clojure doesn't have much material for starters and I get a little lost after doing the most tutorials that I found so I decided to change for python because it seems the most similar language from the mainstream (I might just be completely wrong, don't be too harsh with me pls).

I wanted a book to study instead of using web tutorials since I usually like to lie on my bed and read something before sleep. What books do you recommend for python? Think Python is good enough? Should I try others? Thanks.

Clojure is probably super different from normal mainstream stuff. Data is "immutable" by default, meaning it can't be changed after it's created, and people seem to try to keep that up as much as possible. They write "purely functional" code as much as they can.

In normal imperative thinking, you write code where you take a reference to data, then you run over the data and do the required changes.

In a functional style, your functions only look at the input data and do not touch it, the required changes only show up in the result of the function.

This should need help from the programming language itself or performance will be shit. If the compiler/interpreter knows that the things you work with are always immutable, it might be able to do something smart instead of making copies of everything all the time.

I struggle with the stuff and can't come up with good examples that shows that it's an interesting idea (I'm just a noob trying to learn enough Haskell that I can do something actually useful with it). Working like this is pretty mind blowing in practice coming from a "normal" imperative background, so that's fun. For some reason, complicated ideas end up as super compact code compared to the usual imperative code. When you do changes to your code, you can kind of look at the code as if it's some sort of math/logic proof, and you can then often be very confident that something is still correct after your changes, and then it actually is correct and bug-free. I guess that's the big upside.

Clojure then also is some sort of Lisp and can do Lisp stuff. I guess the big deal with that is "meta-programming"? Here's stuff to promote Lisp:

http://www.paulgraham.com/avg.html (this is some general marketing for Lisp)
http://www.defmacro.org/ramblings/lisp.html (this is trying to explain metaprogramming and why it's neat)

I have no idea what other language with similar ideas to suggest with regards to a good, easy introduction. It's all very hard for me.

Were those even the reasons you started looking at Clojure?
"My goal is to replace my soul with coffee and become immortal."
Manit0u
Profile Blog Joined August 2004
Poland17695 Posts
February 17 2015 02:24 GMT
#11758
On February 17 2015 08:54 Blitzkrieg0 wrote:
Show nested quote +
On February 17 2015 08:47 darkness wrote:
On February 16 2015 17:47 Manit0u wrote:
Something that finally taught me some stuff about references was this:


void strcpy(char *p, const char *q) {
while (*p++ = *q++);
}


Understanding how this code works made my jaw drop at how beautifully designed it is (apart from possible buffer overflow of course).


It's actually not as readable as it should be. And what happens if p's length isn't equal to q's length? Undefined behaviour?


If p is greater than q then it doesn't matter. If q is larger then you either segfault from accessing protected memory or you're overwriting memory that you shouldn't be.

The function expects a null terminated string so you can also run into problems if your string isn't null terminated. This makes the length of q undefined because it will copy characters until it hits a null character.


Well, that's actually part of the beauty of this function. Analysing it has taught me more about C, pointers, buffer overflows, user safe code (since it is one of those functions that let hackers take over your entire system) etc. than anything else. Making it user safe and guarding against buffer overflows is a good learning exercise too. For example you could use memcpy to do the job.
Time is precious. Waste it wisely.
bypLy
Profile Joined June 2013
757 Posts
February 17 2015 09:53 GMT
#11759
hey i was wondering if there is way to get a domain registered for free, including emails, and all the stuff necessary to make an own website
Manit0u
Profile Blog Joined August 2004
Poland17695 Posts
Last Edited: 2015-02-17 10:48:21
February 17 2015 10:22 GMT
#11760
On February 17 2015 18:53 bypLy wrote:
hey i was wondering if there is way to get a domain registered for free, including emails, and all the stuff necessary to make an own website


If you want free hosting then I believe that you can get it with Amazon AWS. Some low-level EC2 instances are free of charge if they don't generate too much traffic (you start paying some low fees after exceeding transfer treshold, but it's relatively high for simple sites).
Time is precious. Waste it wisely.
Prev 1 586 587 588 589 590 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 3h 15m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 469
UpATreeSC 201
OGKoka 160
TKL 109
EmSc Tv 21
Codebar 6
StarCraft: Brood War
Britney 16150
Calm 2225
Mini 345
Shuttle 204
GoRush 30
Rock 15
ajuk12(nOOB) 8
NotJumperer 6
LancerX 2
Dota 2
LuMiX1
League of Legends
JimRising 506
Counter-Strike
fl0m4736
Coldzera 1197
shoxiejesuss501
byalli206
Super Smash Bros
Mew2King31
Heroes of the Storm
Liquid`Hasu364
Khaldor123
Other Games
Grubby2999
FrodaN1034
Beastyqt506
shahzam489
B2W.Neo487
ArmadaUGS154
QueenE60
Trikslyr55
Organizations
StarCraft 2
ComeBackTV 281
Dota 2
PGL Dota 2 - Main Stream165
Other Games
BasetradeTV62
StarCraft 2
EmSc Tv 21
EmSc2Tv 21
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Reevou 7
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV477
• lizZardDota2104
League of Legends
• TFBlade508
Other Games
• imaqtpie1090
• Shiphtur169
Upcoming Events
OSC
3h 15m
The PondCast
13h 15m
KCM Race Survival
13h 15m
WardiTV Team League
15h 15m
OSC
16h 15m
Replay Cast
1d 3h
KCM Race Survival
1d 13h
WardiTV Team League
1d 15h
Korean StarCraft League
2 days
RSL Revival
2 days
Maru vs Zoun
Cure vs ByuN
[ Show More ]
uThermal 2v2 Circuit
2 days
BSL
2 days
RSL Revival
3 days
herO vs MaxPax
Rogue vs TriGGeR
BSL
3 days
Replay Cast
4 days
Replay Cast
4 days
Afreeca Starleague
4 days
Sharp vs Scan
Rain vs Mong
Wardi Open
4 days
Monday Night Weeklies
4 days
Sparkling Tuna Cup
5 days
Afreeca Starleague
5 days
Soulkey vs Ample
JyJ vs sSak
Afreeca Starleague
6 days
hero vs YSC
Larva vs Shine
Liquipedia Results

Completed

Proleague 2026-03-16
WardiTV Winter 2026
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
Jeongseon Sooper Cup
BSL Season 22
CSL Elite League 2026
RSL Revival: Season 4
Nations Cup 2026
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual

Upcoming

ASL Season 21
Acropolis #4 - TS6
2026 Changsha Offline CUP
Acropolis #4
IPSL Spring 2026
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
NationLESS Cup
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 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 © 2026 TLnet. All Rights Reserved.