• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 17:24
CET 23:24
KST 07:24
  • 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 - 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[ASL20] Finals Preview: Arrival13
Community News
[TLMC] Fall/Winter 2025 Ladder Map Rotation12Weekly Cups (Nov 3-9): Clem Conquers in Canada4SC: Evo Complete - Ranked Ladder OPEN ALPHA8StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7
StarCraft 2
General
Mech is the composition that needs teleportation t RotterdaM "Serral is the GOAT, and it's not close" RSL Season 3 - RO16 Groups C & D Preview [TLMC] Fall/Winter 2025 Ladder Map Rotation TL.net Map Contest #21: Winners
Tourneys
RSL Revival: Season 3 Sparkling Tuna Cup - Weekly Open Tournament Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle What happened to TvZ on Retro? SnOw's ASL S20 Finals Review BW General Discussion Brood War web app to calculate unit interactions
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL21] RO32 Group D - Sunday 21:00 CET [BSL21] RO32 Group C - Saturday 21:00 CET
Strategy
PvZ map balance Current Meta Simple Questions, Simple Answers How to stay on top of macro?
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread Clair Obscur - Expedition 33 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
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread US Politics Mega-thread Artificial Intelligence Thread Canadian Politics Mega-thread
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2086 users

The Big Programming Thread - Page 676

Forum Index > General Forum
Post a Reply
Prev 1 674 675 676 677 678 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.
Cynry
Profile Blog Joined August 2010
810 Posts
November 09 2015 09:38 GMT
#13501
On November 07 2015 10:36 Manit0u wrote:
Show nested quote +
On November 07 2015 06:22 Cynry wrote:
Which version of PHP/Apache are you using ? Nothing better to do while I wait for hero to get crushed, so might as well try to help...

Add the following to the end of httpd.conf to increase the Apache stack size to 8MB.

<IfModule mpm_winnt_module>
ThreadStackSize 8388608
</IfModule>


Found that in a bunch of different topics


PHP 5.6.14, Apache 2.4.17. And before you ask, my PHP memory limit is set to 2GB

Edit: Increasing the stack size worked. Thanks a ton!


Wow really ? Haha, wouldn't have bet on it ^^ Nice !
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 10 2015 06:28 GMT
#13502
I would like your opinions on TensorFlow, from Google. What implications does it have? Does anyone have a link to any established educational discussion on it?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Manit0u
Profile Blog Joined August 2004
Poland17433 Posts
Last Edited: 2015-11-11 09:52:18
November 10 2015 11:23 GMT
#13503
On November 09 2015 18:38 Cynry wrote:
Show nested quote +
On November 07 2015 10:36 Manit0u wrote:
On November 07 2015 06:22 Cynry wrote:
Which version of PHP/Apache are you using ? Nothing better to do while I wait for hero to get crushed, so might as well try to help...

Add the following to the end of httpd.conf to increase the Apache stack size to 8MB.

<IfModule mpm_winnt_module>
ThreadStackSize 8388608
</IfModule>


Found that in a bunch of different topics


PHP 5.6.14, Apache 2.4.17. And before you ask, my PHP memory limit is set to 2GB

Edit: Increasing the stack size worked. Thanks a ton!


Wow really ? Haha, wouldn't have bet on it ^^ Nice !


I tried everything without much hope of it succeeding. Was surprised it did
Time is precious. Waste it wisely.
Manit0u
Profile Blog Joined August 2004
Poland17433 Posts
Last Edited: 2015-11-11 17:50:48
November 11 2015 17:44 GMT
#13504
I came up with a pretty nifty trick in PHP/Symfony2 today. Had to create some entities and set some stuff as consts there. Judging by the rate at which we are extending/reusing our classes in various projects I've decided to make it much less painful in the future.

Here are some snippets for those interested:

EntityInterface:

interface EntityInterface
{
const MY_CONST = 'something';
const MY_OTHER_CONST = 'something else';
}


Entity:

class Entity implements EntityInterface
{
protected $someField;

public function setSomeField($value)
{
$interfaces = class_implements(get_class($this));
$interfaceReflection = new ReflectionClass(array_shift($interfaces));
$allowedValues = array_values($interfaceReflection->getConstants());

if (!in_array($value, $allowedValues)) {
throw new \Exception(sprintf('Invalid value "%s". Allowed values: "%s"', $value, implode(', ', $allowedValues)));
}

$this->someField = $value;
}
}


All cool and dandy. We've just added a guard for our entity field to only accept values set currently in interface consts. It doesn't matter if we add, remove or change those consts, the code is working without us touching anything in the Entity class (I guess there might be problems when implementing more interfaces but I'll figure it out later).

Now another cool part. Building forms...

Config (YAML):

parameters:
app.form.type.entity.class: App\AcmeBundle\Form\Type\EntityType

services:
app.form.type.entity:
class: %app.form.type.entity.class%
arguments:
- %app.interface.entity.class%
calls:
- [ setChoices ]
tags:
- { name: form.type, alias: app_entity }


The form:

class EntityType extends AbstractType
{
private $interfaceClass;
private $choices = [];

public function __construct($interfaceClass)
{
$this->interfaceClass = $interfaceClass;
}

public function setChoices()
{
$interfaceReflection = new ReflectionClass($this->interfaceClass);
$values = array_values($interfaceReflection->getConstants());

foreach ($values as $value) {
$this->choices[$value] = sprintf('app.entity.some_field.values.%s', $value);
}
}

public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add(
'someField',
'choice',
[
'label' => 'app.entity.fields.some_field',
'choices' => $this->choices,
]
);
}
}


Here we do pretty much the same thing. We're building our options list for the select field dynamically based on what we have defined as constants in our EntityInterface. We use dependency injection to provide the class name and we automatically call the setChoices method in our form type as soon as it's instantiated.

I really want to experiment with this some more now
Time is precious. Waste it wisely.
espirocephas
Profile Joined November 2015
Belgium2 Posts
November 11 2015 23:50 GMT
#13505
--- Nuked ---
phantomfive
Profile Joined April 2010
Korea (South)404 Posts
November 13 2015 16:26 GMT
#13506
On November 10 2015 15:28 WarSame wrote:
I would like your opinions on TensorFlow, from Google. What implications does it have?

It means that anyone who wants to build a flow graph will now have an easier time of it. They won't have to write the code from scratch.

Generally, if someone tries to hype AI and say we're almost to Star Trek levels, they're completely wrong. See also: "AI Winter." They keep coming.
To ease another's heartache is to forget one's own - Lincoln
xboi209
Profile Blog Joined June 2011
United States1173 Posts
November 15 2015 06:06 GMT
#13507
If anyone has FreeBSD with Clang installed, can you try compiling my project: https://github.com/pvpgn/pvpgn-server
A user has reported errors when compiling, the one that got me confused is that kqueue is undefined(even though CMake is able to find it).
https://github.com/pvpgn/pvpgn-server/issues/184
http://www.reddit.com/r/broodwar/
Manit0u
Profile Blog Joined August 2004
Poland17433 Posts
November 15 2015 16:00 GMT
#13508
Ugh. Assignment operations in if conditions... Hate that.
Time is precious. Waste it wisely.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 15 2015 16:08 GMT
#13509
It's only really forgiveable in file line reading.


if (line=file.readLine()){

}


Otherwise it's extremely risky coding - very easy to miss. I remember reading a story about someone trying to slip a backdoor that gave root access in an if assignment. Something like


if (user.level=0){

}


The story is here. A fairly interesting read.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Soan
Profile Blog Joined August 2010
New Zealand194 Posts
November 15 2015 19:06 GMT
#13510
On November 16 2015 01:08 WarSame wrote:
Otherwise it's extremely risky coding - very easy to miss. I remember reading a story about someone trying to slip a backdoor that gave root access in an if assignment. Something like


if (user.level=0){

}
.


The first tutor I had, basically the guy who taught me programming, taught me to put the constant first, so you can avoid accidentally doing something like that. Now I just do it automatically all the time, co-workers thought it was a bit odd, the first time they noticed during a code review, but no-one's asked me to change it.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
November 15 2015 19:26 GMT
#13511
Assignment in if conditions is never forgiveable, be it line reading or anything else.

Putting the constant first makes code harder to read - at least for me and all the programmers I know. And it only fixes part of the problem. It doesn't do anything when you compare/assign two variables. You should just rely on automated code checks to prevent that kind of stuff. Just have it enforce a "no assignment in condition" rule.
If you have a good reason to disagree with the above, please tell me. Thank you.
Soan
Profile Blog Joined August 2010
New Zealand194 Posts
November 15 2015 20:26 GMT
#13512
It doesn't make the code harder to read if it's what you have been doing your entire coding career.
Cyx.
Profile Joined November 2010
Canada806 Posts
Last Edited: 2015-11-15 20:27:55
November 15 2015 20:27 GMT
#13513
On November 16 2015 04:26 spinesheath wrote:
Assignment in if conditions is never forgiveable, be it line reading or anything else.

Putting the constant first makes code harder to read - at least for me and all the programmers I know. And it only fixes part of the problem. It doesn't do anything when you compare/assign two variables. You should just rely on automated code checks to prevent that kind of stuff. Just have it enforce a "no assignment in condition" rule.

I know a lot of C programmers who prefer


while ((c = getchar()) != EOF) {...}


to


char c = getchar();
while (c != EOF) {
...
c = getchar();
}


I used to really dislike assignments in conditionals too, but in this situation, it significantly reduces the typing and repetition necessary to manage the loop variable, so... I don't mind it at all now, especially since any decent C compiler will warn you if there's an un-bracketed assignment in a condition.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 15 2015 22:54 GMT
#13514
I agree for the same reasons. Even if you do-while it, it's still 1 or 2 unnecessary/ugly lines of code. IMO file line reading in the condition is safer and easier to read.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
Last Edited: 2015-11-16 01:43:49
November 16 2015 01:42 GMT
#13515
Alright, I'm getting confused to hell by Youtube's API. I've made a python script which use Oauth 2 to connect, then adds a video from a youtube link I'm given to my youtube playlist. However, it keeps giving me 403 - Daily Limit Exceeded. So I'm 99% sure it's not recognizing my Oauth credentials - but I have credentials, and I'm including them as

flow = flow_from_clientsecrets(CLIENT_SECRETS_FILE,
scope=YOUTUBE_READ_WRITE_SCOPE,
message=MISSING_CLIENT_SECRETS_MESSAGE)


where CLIENT_SECRETS is my json file with the id and secret. This is exactly what they say to do, but it doesn't work.

The exact error is: here. If anyone has any ideas please let me know - I have no leads to go on right now.

EDIT: The problem occurs only when I try to use the API to add an item to the playlist. It runs fine outside of that.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Thaniri
Profile Blog Joined March 2011
1264 Posts
November 16 2015 05:24 GMT
#13516
Does anyone have an opinion on what sort of degree specialization is most valuable for a bachelors degree? I can choose from either mobile/web app development and newtwork admin/security.

Doing cursory google searching for jobs in my area, they pay about the same in the beginning but mobile/add development seems like it could lead to better growth potential into software development which pays better and is more interesting.

I know that this is a programming thread but at least some people here do work in this industry and I'd like to hear if they had anything to say on the topic.
Myrddraal
Profile Joined December 2010
Australia937 Posts
November 16 2015 05:49 GMT
#13517
On November 16 2015 14:24 Thaniri wrote:
Does anyone have an opinion on what sort of degree specialization is most valuable for a bachelors degree? I can choose from either mobile/web app development and newtwork admin/security.

Doing cursory google searching for jobs in my area, they pay about the same in the beginning but mobile/add development seems like it could lead to better growth potential into software development which pays better and is more interesting.

I know that this is a programming thread but at least some people here do work in this industry and I'd like to hear if they had anything to say on the topic.


From my experience, mobile/web development is probably most sought after for jobs, the only downside being that I think it would likely have more competition. The other upside is that you can work on your own apps and websites in your spare time and attempt to make a living that way, or use them in your portfolio to help you get a job.
[stranded]: http://www.indiedb.com/games/stranded
phantomfive
Profile Joined April 2010
Korea (South)404 Posts
November 16 2015 06:38 GMT
#13518
On November 16 2015 14:24 Thaniri wrote:
Does anyone have an opinion on what sort of degree specialization is most valuable for a bachelors degree? I can choose from either mobile/web app development and newtwork admin/security.

Out of those options, mobile is the best for maximizing income on average. Of course, there are exceptions and you can make plenty of money in all of those.
To ease another's heartache is to forget one's own - Lincoln
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 16 2015 18:39 GMT
#13519
I agree with the previous 2. Sys admin is alright, but there's a lot more available work in mobile/web development.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2015-11-16 19:08:01
November 16 2015 19:05 GMT
#13520
On November 16 2015 05:27 Cyx. wrote:
Show nested quote +
On November 16 2015 04:26 spinesheath wrote:
Assignment in if conditions is never forgiveable, be it line reading or anything else.

Putting the constant first makes code harder to read - at least for me and all the programmers I know. And it only fixes part of the problem. It doesn't do anything when you compare/assign two variables. You should just rely on automated code checks to prevent that kind of stuff. Just have it enforce a "no assignment in condition" rule.

I know a lot of C programmers who prefer


while ((c = getchar()) != EOF) {...}


to


char c = getchar();
while (c != EOF) {
...
c = getchar();
}


I used to really dislike assignments in conditionals too, but in this situation, it significantly reduces the typing and repetition necessary to manage the loop variable, so... I don't mind it at all now, especially since any decent C compiler will warn you if there's an un-bracketed assignment in a condition.

I hope you treat warnings as errors then, though. Obviously the most important part is that you can't make these kinds of mistakes. If you have an automatic check in place that only allows 100% safe assignments then I guess that's fine.

Plus I usually don't go as low level as reading a file line by or character by character. I instead use a method that enumerates the lines or characters for me. I'm thinking C# here, but surely C can do similar things too.
If you have a good reason to disagree with the above, please tell me. Thank you.
Prev 1 674 675 676 677 678 1032 Next
Please log in or register to reply.
Live Events Refresh
The PiG Daily
20:30
Best Games of SC
Serral vs Clem
Solar vs Cure
Serral vs Clem
Reynor vs GuMiho
herO vs Cure
PiGStarcraft327
LiquipediaDiscussion
BSL 21
20:00
ProLeague - RO32 Group C
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
ZZZero.O318
LiquipediaDiscussion
OSC
19:00
Masters Cup #150: Group B
davetesta56
Liquipedia
PSISTORM Gaming Misc
15:55
FSL teamleague CNvsASH, ASHvRR
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft327
Nathanias 101
ProTech70
StarCraft: Brood War
Shuttle 921
ZZZero.O 318
NaDa 57
Dota 2
LuMiX1
Counter-Strike
fl0m1151
Super Smash Bros
AZ_Axe95
Other Games
tarik_tv6434
Grubby5599
gofns3805
summit1g3783
DeMusliM415
Pyrionflax197
Fuzer 196
Dewaltoss11
ViBE5
Organizations
Other Games
EGCTV935
gamesdonequick774
StarCraft 2
angryscii 37
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• StrangeGG 58
• musti20045 14
• Dystopia_ 3
• IndyKCrew
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota2706
• Ler79
Other Games
• imaqtpie1667
• WagamamaTV502
• Shiphtur261
• tFFMrPink 14
Upcoming Events
Sparkling Tuna Cup
11h 36m
RSL Revival
11h 36m
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
13h 36m
Cure vs herO
Reynor vs TBD
WardiTV Korean Royale
13h 36m
BSL 21
21h 36m
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
IPSL
21h 36m
Dewalt vs WolFix
eOnzErG vs Bonyth
Replay Cast
1d
Wardi Open
1d 13h
Monday Night Weeklies
1d 18h
WardiTV Korean Royale
2 days
[ Show More ]
BSL: GosuLeague
2 days
The PondCast
3 days
Replay Cast
4 days
RSL Revival
4 days
BSL: GosuLeague
4 days
RSL Revival
5 days
WardiTV Korean Royale
5 days
RSL Revival
6 days
WardiTV Korean Royale
6 days
IPSL
6 days
Julia vs Artosis
JDConan vs DragOn
Liquipedia Results

Completed

Proleague 2025-11-14
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
CSCL: Masked Kings S3
SLON Tour Season 2
RSL Revival: Season 3
META Madness #9
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
BLAST Open Fall 2025

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 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.