• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 03:57
CET 09:57
KST 17:57
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
RSL Offline Finals Info - Dec 13 and 14! StarCraft Evolution League (SC Evo Biweekly) RSL Offline FInals Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
BW General Discussion Which season is the best in ASL? Data analysis on 70 million replays BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions
Tourneys
[BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET [Megathread] Daily Proleagues [BSL21] RO16 Group B - Sunday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Nintendo Switch Thread ZeroSpace Megathread Stormgate/Frost Giant Megathread The Perfect Game Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine The Big Programming Thread Artificial Intelligence Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1663 users

The Big Programming Thread - Page 532

Forum Index > General Forum
Post a Reply
Prev 1 530 531 532 533 534 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.
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
Last Edited: 2014-10-19 12:30:16
October 19 2014 12:29 GMT
#10621
On October 19 2014 16:59 CatNzHat wrote:
Show nested quote +
On October 19 2014 00:47 goody153 wrote:
Hello Sir's,

Me and my friends are planning to put some kind of website that has a drawing app inbound. And i am planning to code a drawing application for the website.

I did some googling and there are i found the HTML canvass + Javascript is an easy way to code such tool.

However i am not sure if this is enough for the long run since we may want to build a more powerful and flexible drawing app than our current plans.

Is there any language, library or framework or something that i should know that is for this certain task drawing webapp and should work better than the html5 + javascript ?

Thanks ..

my current knowledge for web development are html, css, js , php and mysql. I'm also not an expert of those.

You will not be limited by javascript, it's only option as far as client-side in browser applications are concerned, and there are various photoshop like web-apps that have very complicated painting engines that all run in the browser (js, canvas)


Or you could make a Java applet for that and take browser compatibility out of the picture entirely? You could also develop it independently of the site itself.
Time is precious. Waste it wisely.
goody153
Profile Blog Joined April 2013
44236 Posts
Last Edited: 2014-10-19 16:07:33
October 19 2014 14:01 GMT
#10622
Well i'll guess i'll settle for js then as of now.

I did have a experience coding java applets(i forgot to mention) before but i do want to stay away from java as much as possible since it the future users of the site to install java in their respective computers. I want it to be as convenient for users as much as possible.

Thanks for the advice.
this is a quote
MinoMoto
Profile Joined June 2011
Latvia107 Posts
Last Edited: 2014-10-19 22:02:16
October 19 2014 21:06 GMT
#10623
On October 19 2014 00:51 Nesserev wrote:
Show nested quote +
On October 18 2014 22:46 darkness wrote:
On October 18 2014 21:02 MinoMoto wrote:
Guys i need help again
I need to create program using "do...while" in C#
1 program is asking you to enter a number(how much times it will do match)
2 program is asking you to enter a number, what will sum with previously entered sum.
[image loading]


Pseudo code.


int iteration = 0;
int maxIterations;
int sum = 0;
int inputValue;

maxIterations := <take value>

do
inputValue := <take value>
Print Sum[iteration]=sum+inputValue
sum += inputValue
++iteration
while iteration < maxIterations

Print Sum[iteration]=sum


+ Show Spoiler +
Bonus: check if maxIterations' value is negative.

It's very easy to do it on your own, and part of that assignment is to teach you C# not math. You may also use arrays instead but I don't find it nice with a do-while loop when you depend on a previous iteration..


Well, only problem with using a do-while loop in this case is that you only check for the amount of iterations after asking for the first value. So, when the user wants zero iterations, he/she still has to give input; it won't work as intended, it's semantically incorrect.

Ty all works
I have another question how can i show arithmetic progression in C# (Using "while")?
For example console is asking to enter 3 variables, first how much will arithmetic progression do match, second number = arithmetic progression start number and 3 how much it will + on each cycle.
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
Last Edited: 2014-10-19 21:26:27
October 19 2014 21:22 GMT
#10624
On October 20 2014 06:06 MinoMoto wrote:
Show nested quote +
On October 19 2014 00:51 Nesserev wrote:
On October 18 2014 22:46 darkness wrote:
On October 18 2014 21:02 MinoMoto wrote:
Guys i need help again
I need to create program using "do...while" in C#
1 program is asking you to enter a number(how much times it will do match)
2 program is asking you to enter a number, what will sum with previously entered sum.
[image loading]


Pseudo code.


int iteration = 0;
int maxIterations;
int sum = 0;
int inputValue;

maxIterations := <take value>

do
inputValue := <take value>
Print Sum[iteration]=sum+inputValue
sum += inputValue
++iteration
while iteration < maxIterations

Print Sum[iteration]=sum


+ Show Spoiler +
Bonus: check if maxIterations' value is negative.

It's very easy to do it on your own, and part of that assignment is to teach you C# not math. You may also use arrays instead but I don't find it nice with a do-while loop when you depend on a previous iteration..


Well, only problem with using a do-while loop in this case is that you only check for the amount of iterations after asking for the first value. So, when the user wants zero iterations, he/she still has to give input; it won't work as intended, it's semantically incorrect.

Ty all works
I have another question how can i show arithmetic progression in C# (Using "while")?


Really? It's even in the while example in C# documentation...
Time is precious. Waste it wisely.
SpiZe
Profile Joined December 2010
Canada3640 Posts
October 19 2014 23:33 GMT
#10625
Hey guys,

I'm gonna pass a couple of interviews for internship soon and I'm a bit nervous. I know they are going to ask technical questions but I'm unsure what kind of question they are going to be, or what topic to are going to cover. Anyone has knowledge of the kind of questions they could ask, knowing I mostly applied on Java and C# offers.

Thanks.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
October 19 2014 23:38 GMT
#10626
Best book for interview study grinding is called "cracking the coding interview". Should give you all the technical questions you'll need.
There is no one like you in the universe.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
October 20 2014 15:21 GMT
#10627
On October 20 2014 08:33 SpiZe wrote:
Hey guys,

I'm gonna pass a couple of interviews for internship soon and I'm a bit nervous. I know they are going to ask technical questions but I'm unsure what kind of question they are going to be, or what topic to are going to cover. Anyone has knowledge of the kind of questions they could ask, knowing I mostly applied on Java and C# offers.

Thanks.


Whatever they ask you, don't be afraid to say "I don't know". They will know when you try to pretend knowing things you have no idea of. It's no shame to not have worked with something before, e.g. in my last PHP job interview a year ago they asked me what $x = &DB::getConnection(...) meant. I had never seen "&someFunction();" because that is PHP4 legacy code and I've never worked with PHP before 5.0 (luckily) since those were my Perl, C and C++ years. Even with now ~25 years of programming there are plenty of things I have no idea of because I've never needed them and the interviewers know that this is the case for everyone, so they mostly look for how you deal with things you don't know.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
October 20 2014 15:31 GMT
#10628
morfildur you old grump!
conspired against by a confederacy of dunces.
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-10-20 21:13:38
October 20 2014 21:12 GMT
#10629
On October 21 2014 00:21 Morfildur wrote:
Show nested quote +
On October 20 2014 08:33 SpiZe wrote:
Hey guys,

I'm gonna pass a couple of interviews for internship soon and I'm a bit nervous. I know they are going to ask technical questions but I'm unsure what kind of question they are going to be, or what topic to are going to cover. Anyone has knowledge of the kind of questions they could ask, knowing I mostly applied on Java and C# offers.

Thanks.


Whatever they ask you, don't be afraid to say "I don't know". They will know when you try to pretend knowing things you have no idea of. It's no shame to not have worked with something before, e.g. in my last PHP job interview a year ago they asked me what $x = &DB::getConnection(...) meant. I had never seen "&someFunction();" because that is PHP4 legacy code and I've never worked with PHP before 5.0 (luckily) since those were my Perl, C and C++ years. Even with now ~25 years of programming there are plenty of things I have no idea of because I've never needed them and the interviewers know that this is the case for everyone, so they mostly look for how you deal with things you don't know.


So as I thought, &function is return by reference. Correct me if I'm wrong but isn't this the default better option in C++? Yeah, I know you talk about PHP but then PHP's explanation is:


Returning by reference is useful when you want to use a function to find to which variable a reference should be bound. Do not use return-by-reference to increase performance. The engine will automatically optimize this on its own. Only return references when you have a valid technical reason to do so.


I don't know if C++ reference is the same as PHP reference but why the warning from excerpt? Is it because of automatic optimisation?
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-10-20 21:31:02
October 20 2014 21:28 GMT
#10630
hm, not quite sure i understand what you are talking about.

a function returning a reference to a value of some type or taking the reference of the returned value from a function?
both only meaningful if the scope of the returnee outlives the function scope, but both have different semantics from each other (a reference is not a pointer), and also different from returning a value. doesn't make sense to me to talk about 'default' better option.

speaking of optimization... an old gcc kept optimizing away the return statement of some driver we had to write in an embedded system construction course, confusion ensued. balls. BALLS. BALLS!
conspired against by a confederacy of dunces.
delHospital
Profile Blog Joined December 2010
Poland261 Posts
Last Edited: 2014-10-20 21:33:37
October 20 2014 21:31 GMT
#10631
On October 21 2014 06:12 darkness wrote:
Show nested quote +
On October 21 2014 00:21 Morfildur wrote:
On October 20 2014 08:33 SpiZe wrote:
Hey guys,

I'm gonna pass a couple of interviews for internship soon and I'm a bit nervous. I know they are going to ask technical questions but I'm unsure what kind of question they are going to be, or what topic to are going to cover. Anyone has knowledge of the kind of questions they could ask, knowing I mostly applied on Java and C# offers.

Thanks.


Whatever they ask you, don't be afraid to say "I don't know". They will know when you try to pretend knowing things you have no idea of. It's no shame to not have worked with something before, e.g. in my last PHP job interview a year ago they asked me what $x = &DB::getConnection(...) meant. I had never seen "&someFunction();" because that is PHP4 legacy code and I've never worked with PHP before 5.0 (luckily) since those were my Perl, C and C++ years. Even with now ~25 years of programming there are plenty of things I have no idea of because I've never needed them and the interviewers know that this is the case for everyone, so they mostly look for how you deal with things you don't know.


So as I thought, &function is return by reference. Correct me if I'm wrong but isn't this the default better option in C++? Yeah, I know you talk about PHP but then PHP's explanation is:

Show nested quote +

Returning by reference is useful when you want to use a function to find to which variable a reference should be bound. Do not use return-by-reference to increase performance. The engine will automatically optimize this on its own. Only return references when you have a valid technical reason to do so.


I don't know if C++ reference is the same as PHP reference but why the warning from excerpt? Is it because of automatic optimisation?

If you return an object in PHP (or Python, or Javascript, or Java, or...), what is returned is a pointer to the object. You don't get a copy by default, so no need to use & here. If you want the same behavior (ie. pointer to a struct, not a copy) in C, you have to ask for it explicitly.

That's why returning a pointer in C is needed very often, but using & in PHP is only necessary when you want to return a pointer to a scalar (or a pointer to a pointer, I suppose).
nunez
Profile Blog Joined February 2011
Norway4003 Posts
October 20 2014 21:37 GMT
#10632
delHospital mixing C and C++?

you could get a pointer to an object if the object outlives the function scope in cpp by taking the reference of the returned lvalue, which seems to be the same behaviour. you don't explicitly have to return a pointer (but you do have to return an lvalue).

#include <iostream>
using namespace std;

int value;

int& function(){ return value; }

int main() {
int* pointer=&function();
cout<<boolalpha<<(pointer==&value)<<endl;
}
conspired against by a confederacy of dunces.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2014-10-20 21:46:30
October 20 2014 21:37 GMT
#10633
--- Nuked ---
delHospital
Profile Blog Joined December 2010
Poland261 Posts
Last Edited: 2014-10-20 22:15:10
October 20 2014 22:05 GMT
#10634
On October 21 2014 06:37 nunez wrote:
delHospital mixing C and C++?

you could get a pointer to an object if the object outlives the function scope in cpp by taking the reference of the returned lvalue, which seems to be the same behaviour. you don't explicitly have to return a pointer (but you do have to return an lvalue).

#include <iostream>
using namespace std;

int value;

int& function(){ return value; }

int main() {
int* pointer=&function();
cout<<boolalpha<<(pointer==&value)<<endl;
}

I said "C" and "pointers" instead of "C++" and "references", because every time I say "C++" I feel like I have to wash out my mouth. The principle is the same, though -- you had to write "int&", because "int" would be a copy (well, int is a bad example, but vector<int> vs. vector<int>& is a better one).
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-10-20 22:26:28
October 20 2014 22:20 GMT
#10635
that is true, you are not worthy of saying c++; but he asked about c++ and references. not c and pointers.
references are not pointers in c++, by talking about pointers when references is the topic you could be confusing people.

int* would also be returning a copy, a copy of a pointer (also an rvalue)... decidedly different semantics than if you were returning a reference.
conspired against by a confederacy of dunces.
delHospital
Profile Blog Joined December 2010
Poland261 Posts
October 20 2014 22:39 GMT
#10636
On October 21 2014 07:20 nunez wrote:
that is true, you are not worthy of saying c++; but he asked about c++ and references. not c and pointers.
references are not pointers in c++, by talking about pointers when references is the topic you could be confusing people.

int* would also be returning a copy, a copy of a pointer (also an rvalue)... decidedly different semantics than if you were returning a reference.

Okay, let's try again.

In C++, when a function returns an object, it returns a copy of that object (by calling the copy constructor). If you want to return a reference, you have to specify it in the return type.

In PHP, when a function returns an object, it returns a pointer to it and there's no easy way of returning a copy.

That's why explicitly returning a reference is rarely needed in PHP.
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-10-20 22:55:20
October 20 2014 22:44 GMT
#10637
right off the bat; it will probably, and should probably, call the move constructor (if possible, cross your fingers).

if you want to return a reference, you have to specify it in the return type yes, and same with pointer or a reference to a pointer.
but a reference is not a pointer, they have different semantics.

when you answer a question about references in c++ with pointers in c you are confusing the guy posing the question: if he was asking about pointers in c++ then you could answer with pointers in c, as they are the same thing (barring any weird caveats).

i'm sure you managed to explained the php, but that's not my gripe. ;>
maybe i misread your post and you moved on, my apologies if that's the case.
conspired against by a confederacy of dunces.
delHospital
Profile Blog Joined December 2010
Poland261 Posts
October 20 2014 23:06 GMT
#10638
On October 21 2014 07:44 nunez wrote:
right off the bat; it will probably, and should probably, call the move constructor (if possible, cross your fingers).

if you want to return a reference, you have to specify it in the return type yes, and same with pointer or a reference to a pointer.
but a reference is not a pointer, they have different semantics.

when you answer a question about references in c++ with pointers in c you are confusing the guy posing the question: if he was asking about pointers in c++ then you could answer with pointers in c, as they are the same thing (barring any weird caveats).

i'm sure you managed to explained the php, but that's not my gripe. ;>
maybe i misread your post and you moved on, my apologies if that's the case.

Yeah, I'm not explaining the C++ part to you, I'm sure you know it better than I do. I just meant to answer the question from scratch, as you're probably right that I'm confusing people by talking about pointers when the question was about references (obviously they're not the same thing, but they both share the characteristic that they don't return the entire struct/object by value, which is what matters here).
nunez
Profile Blog Joined February 2011
Norway4003 Posts
October 20 2014 23:08 GMT
#10639
ah ok, my bad then.
conspired against by a confederacy of dunces.
MysteryMeat1
Profile Blog Joined June 2011
United States3292 Posts
Last Edited: 2014-10-21 07:19:20
October 21 2014 07:13 GMT
#10640
-need to learn to just do it!
"Cause ya know, Style before victory." -The greatest mafia player alive
Prev 1 530 531 532 533 534 1032 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
WardiTV Mondays #62
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 154
-ZergGirl 59
StarCraft: Brood War
Britney 19065
Tasteless 282
BeSt 257
Pusan 108
Killer 95
Sacsri 90
Dewaltoss 62
Sharp 59
sorry 42
Shine 39
[ Show more ]
ToSsGirL 35
Shinee 30
ZergMaN 29
Bale 21
ggaemo 11
Hm[arnc] 6
Dota 2
febbydoto163
NeuroSwarm115
canceldota43
League of Legends
JimRising 544
C9.Mang0266
Reynor85
Counter-Strike
shoxiejesuss339
Super Smash Bros
Westballz33
Other Games
summit1g10971
WinterStarcraft559
crisheroes376
Happy253
ceh9231
Mew2King36
Organizations
Other Games
gamesdonequick605
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• LUISG 21
• Light_VIP 13
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota217
League of Legends
• Lourlo1139
Upcoming Events
The PondCast
1h 3m
OSC
7h 3m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
15h 3m
Korean StarCraft League
1d 18h
CranKy Ducklings
2 days
WardiTV 2025
2 days
SC Evo League
2 days
BSL 21
2 days
Sziky vs OyAji
Gypsy vs eOnzErG
OSC
2 days
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
Sparkling Tuna Cup
3 days
[ Show More ]
WardiTV 2025
3 days
OSC
3 days
BSL 21
3 days
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
4 days
Wardi Open
4 days
StarCraft2.fi
4 days
Monday Night Weeklies
4 days
Replay Cast
4 days
WardiTV 2025
5 days
StarCraft2.fi
5 days
PiGosaur Monday
5 days
StarCraft2.fi
6 days
Tenacious Turtle Tussle
6 days
Liquipedia Results

Completed

Proleague 2025-11-30
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
META Madness #9
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
Kuram Kup
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
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.