• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 13:42
CEST 19:42
KST 02:42
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #22 - Voting & Ladder Map Selection5Code S Season 2 (2026) - RO8 Preview5[ASL21] Finals Preview: Two Legacies21Code S Season 2 (2026) - RO12 Preview2herO wins GSL Code S Season 1 (2026)7
Community News
[BSL22] Non-Korean Championship from 13 to 28 June0Weekly Cups (May 25-31): Clem doubles, 2v2 circuit heads toward finale0StarCraft II 5.0.16 PTR Patch Notes may 26th151Weekly Cups (May 18-24): MaxPax wins doubles0Crank Gathers Season 4: BW vs SC2 Team League6
StarCraft 2
General
Oliveira Would Have Returned If EWC Continued TL.net Map Contest #22 - Voting & Ladder Map Selection My starcraft 2 changes SCFusion - WoL, HotS & LotV Build Order Optimizer TL Poll: How do you feel about the 5.0.16 PTR balance changes?
Tourneys
Maestros of The Game 2 announcement and schedule ! Crank Gathers Season 4: BW vs SC2 Team League GSL Code S Season 2 (2026) Sparkling Tuna Cup - Weekly Open Tournament RSL Revival: Season 5 - Qualifiers and Main Event
Strategy
[G] Having the right mentality to improve
Custom Maps
[D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 528 Infection Detected Welcome to the External Content forum Mutation # 527 Hell Train
Brood War
General
FlaShFTW vs A.Alm Grudge Match Event FlaSh's ASL S21 Finals Review 14k games analyzed: Cross Spawn Nexus first good? Tesagi Viewer - A new era of replay watching BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL21] Grand Finals [BSL22] Grand Finals - Sunday 21:00 CEST [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2
Strategy
Why doesn't anyone use restoration? Any training maps people recommend? Muta micro map competition [G] Hydra ZvZ: An Introduction
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Warcraft III: The Frozen Throne Path of Exile ZeroSpace Megathread
Dota 2
Looking for a Dota Mentor 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
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread Dating: How's your luck? Trading/Investing Thread Russo-Ukrainian War Thread How cold is too cold to be outdoors?
Fan Clubs
The herO Fan Club!
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread McBoner: A hockey love story TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Facing Challenges in Mobile App Development
TL Community
The Automated Ban List
Blogs
Gauntlet SC2: A Retrospectiv…
Ctone23
Esportsmanship: How to NOT B…
TrAiDoS
Why RTS gamers make better f…
gosubay
ASL S21 English Commentary…
namkraft
StarCraft improvement
iopq
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4697 users

The Big Programming Thread - Page 717

Forum Index > General Forum
Post a Reply
Prev 1 715 716 717 718 719 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.
Wrath
Profile Blog Joined July 2014
3174 Posts
Last Edited: 2016-04-04 16:00:32
April 04 2016 16:00 GMT
#14321
Does anyone have an idea how can I configure an apache virtualhost to point to different servers based on the URI?

I have an apache server that will serve as a reverse proxy for 3 backend servers. I want to be able to hit the backend server with URI. Example

https://apache.server/server1 -> will hit www.server1.com
https://apache.server/server2 -> will hit www.server2.com
https://apache.server/server3 -> will hit www.server3.com

If this is too hard and not possible, what is the better solution? Having 3 different Virtualhost and separate them with port? Having each Virtualhost with different port and hit them with the apache server with the same URL for 3 backend servers but change the port in order to point to the correct one?

Also worth mentioning that we will have an F5 that will act as load balancer to the apache server (or servers, we will be having 2 apache servers serving as reverse proxy for 3 backend servers... my head)
R1CH
Profile Blog Joined May 2007
Netherlands10342 Posts
April 04 2016 16:19 GMT
#14322
A better solution is to use nginx to replace both Apache and the F5 . nginx config format makes this super simple too.

location /server1 { proxy_pass http://www.server1.com/; }
AdministratorTwitter: @R1CH_TL
TL+ Member
Wrath
Profile Blog Joined July 2014
3174 Posts
April 04 2016 17:00 GMT
#14323
Unfortunately it is not up to me to make decision of what we use. They made the environment and they are having configuring the Apache part...
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
April 04 2016 17:17 GMT
#14324
On April 05 2016 02:00 WrathSCII wrote:
Unfortunately it is not up to me to make decision of what we use. They made the environment and they are having configuring the Apache part...


Rarely is it too late for a well reasoned argument for switching infrastructure. If nginx can do everything you need, then all you need to do is convince the ones who make the decision that less time overall will be spent configuring/maintaining an nginx server compared to an Apache one.

But to answer your actual question, see this DO guide on mod_proxy

https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
Any sufficiently advanced technology is indistinguishable from magic
Wrath
Profile Blog Joined July 2014
3174 Posts
April 04 2016 19:33 GMT
#14325
Thanks for the post, but the post you mentioned above specifies how to do it for a single server and does not talk about using a URI to differentiate the backend servers.
Manit0u
Profile Blog Joined August 2004
Poland17756 Posts
April 04 2016 19:44 GMT
#14326
Totally, unrelated:

[image loading]

So... I heard you like callbacks...
Time is precious. Waste it wisely.
Djagulingu
Profile Blog Joined December 2010
Germany3605 Posts
April 04 2016 21:27 GMT
#14327
On April 05 2016 04:44 Manit0u wrote:
Totally, unrelated:

[image loading]

So... I heard you like callbacks...

I am a nodejs developer and I find this funny.

One other thing: So I'm developing this html5 2d shooter game, when a player dies, the game just stops rendering image for that player and I realized a bug: When I kill an enemy in chrome, the killing bullet disappears on impact. But when I kill an enemy in firefox, sometimes the killing bullet disappears on impact, sometimes it does not. I solved the bug by making the player disappear after 50 milliseconds instead of 0 milliseconds but I still wonder why that stuff would happen in firefox but not chrome.
"windows bash is a steaming heap of shit" tofucake
Acrofales
Profile Joined August 2010
Spain18302 Posts
April 04 2016 21:44 GMT
#14328
On April 05 2016 04:44 Manit0u wrote:
Totally, unrelated:

[image loading]

So... I heard you like callbacks...

Why is your indentation so inconsistent?
Manit0u
Profile Blog Joined August 2004
Poland17756 Posts
April 04 2016 22:48 GMT
#14329
On April 05 2016 06:44 Acrofales wrote:
Show nested quote +
On April 05 2016 04:44 Manit0u wrote:
Totally, unrelated:

[image loading]

So... I heard you like callbacks...

Why is your indentation so inconsistent?


It isn't mine. My OCD would make me die for this.
Time is precious. Waste it wisely.
BlueRoyaL
Profile Blog Joined February 2006
United States2493 Posts
April 04 2016 23:30 GMT
#14330
Hey guys, I just finished a side project called ChartStream if you guys want to check it out:
https://chartstream.herokuapp.com/

It lets you browse/stream complete music charts from various sources (mostly EDM). Want to load an entire Beatport chart and stream them in full? np!

I used react + redux and I gotta say that it's really fun building with it, compared to say something like angular
WHAT'S HAPPENIN
emperorchampion
Profile Blog Joined December 2008
Canada9496 Posts
April 04 2016 23:51 GMT
#14331
On April 05 2016 04:44 Manit0u wrote:
Totally, unrelated:

[image loading]

So... I heard you like callbacks...


I really hope that column marker is placed at 80 lines...
TRUEESPORTS || your days as a respected member of team liquid are over
berated-
Profile Blog Joined February 2007
United States1134 Posts
April 04 2016 23:54 GMT
#14332
On April 05 2016 04:33 WrathSCII wrote:
Thanks for the post, but the post you mentioned above specifies how to do it for a single server and does not talk about using a URI to differentiate the backend servers.


At a certain point its up to you to figure out how to make stuff work as well. Mod_proxy is exactly what you need. You just need to dig a bit longer and find the right example to do what you want.
mTwRINE
Profile Joined February 2006
Germany318 Posts
April 06 2016 17:23 GMT
#14333
On April 05 2016 04:44 Manit0u wrote:
Totally, unrelated:

[image loading]

So... I heard you like callbacks...



Manit0u
Profile Blog Joined August 2004
Poland17756 Posts
April 06 2016 20:36 GMT
#14334
Finally thecodinglove got a gif that pretty much sums up everything I have to endure while dealing with all the legacy code:

[image loading]
Time is precious. Waste it wisely.
Itsmedudeman
Profile Blog Joined March 2011
United States19229 Posts
Last Edited: 2016-04-08 06:37:29
April 08 2016 06:37 GMT
#14335
Can someone help me understand this code in an android app, specifically the super.onActivityresult() call?

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
// When an Image is picked
if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK
&& null != data) {
// Get the Image from data

Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };

// Get the cursor
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
// Move to first row
cursor.moveToFirst();

int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
imgDecodableString = cursor.getString(columnIndex);
cursor.close();
ImageView imgView = (ImageView) findViewById(R.id.imgView);
// Set the Image in ImageView after decoding the String
imgView.setImageBitmap(BitmapFactory
.decodeFile(imgDecodableString));

} else {
Toast.makeText(this, "You haven't picked Image",
Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG)
.show();
}

}


I don't understand the need for the super call here. Or what it would even accomplish.The code is from here: http://programmerguru.com/android-tutorial/how-to-pick-image-from-gallery/
Djagulingu
Profile Blog Joined December 2010
Germany3605 Posts
Last Edited: 2016-04-08 06:45:32
April 08 2016 06:45 GMT
#14336
On April 08 2016 15:37 Itsmedudeman wrote:
Can someone help me understand this code in an android app, specifically the super.onActivityresult() call?
+ Show Spoiler +


protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
// When an Image is picked
if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK
&& null != data) {
// Get the Image from data

Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };

// Get the cursor
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
// Move to first row
cursor.moveToFirst();

int columnIndex = cursor.getColumnIndex(filePathColumn[0];
imgDecodableString = cursor.getString(columnIndex);
cursor.close();
ImageView imgView = (ImageView) findViewById(R.id.imgView);
// Set the Image in ImageView after decoding the String
imgView.setImageBitmap(BitmapFactory
.decodeFile(imgDecodableString));

} else {
Toast.makeText(this, "You haven't picked Image",
Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG)
.show();
}

}




I don't understand the need for the super call here. Or what it would even accomplish.The code is from here: http://programmerguru.com/android-tutorial/how-to-pick-image-from-gallery/

Me and my limited experience with android would go on and say this: The super handler might be doing some stuff in the background that has to be done so that the app doesn't break reliably whenever you do some random sequence of things in the same order.

If I'm wrong, feel free to correct me as well though
"windows bash is a steaming heap of shit" tofucake
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
April 08 2016 08:04 GMT
#14337
--- Nuked ---
Acrofales
Profile Joined August 2010
Spain18302 Posts
Last Edited: 2016-04-08 10:52:30
April 08 2016 10:52 GMT
#14338
What Djagulingu and Nesserev said. In this case, the super call is not needed. In the general case, however, there are many Android methods that, when you override them, absolutely need to call super.method in order not to break. Activity.onCreate is the most obvious and well-known example.

As Nesserev said, this is always mentioned in the Android documentation, which is a far better source of information than trying to dig into the Android code yourself. For onActivityResult see here: http://developer.android.com/reference/android/app/Activity.html#onActivityResult(int, int, android.content.Intent)
berated-
Profile Blog Joined February 2007
United States1134 Posts
April 08 2016 10:52 GMT
#14339
On April 08 2016 17:04 Nesserev wrote:
Show nested quote +
On April 08 2016 15:45 Djagulingu wrote:
On April 08 2016 15:37 Itsmedudeman wrote:
Can someone help me understand this code in an android app, specifically the super.onActivityresult() call?
+ Show Spoiler +


protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
// When an Image is picked
if (requestCode == RESULT_LOAD_IMG && resultCode == RESULT_OK
&& null != data) {
// Get the Image from data

Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };

// Get the cursor
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
// Move to first row
cursor.moveToFirst();

int columnIndex = cursor.getColumnIndex(filePathColumn[0];
imgDecodableString = cursor.getString(columnIndex);
cursor.close();
ImageView imgView = (ImageView) findViewById(R.id.imgView);
// Set the Image in ImageView after decoding the String
imgView.setImageBitmap(BitmapFactory
.decodeFile(imgDecodableString));

} else {
Toast.makeText(this, "You haven't picked Image",
Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG)
.show();
}

}




I don't understand the need for the super call here. Or what it would even accomplish.The code is from here: http://programmerguru.com/android-tutorial/how-to-pick-image-from-gallery/

Me and my limited experience with android would go on and say this: The super handler might be doing some stuff in the background that has to be done so that the app doesn't break reliably whenever you do some random sequence of things in the same order.

If I'm wrong, feel free to correct me as well though

You're correct Djagulingu; when you overwrite a function of a superclass, you often EXTEND its behaviour. In such a case, it often suffices to call the overwritten method at some point, and write your added functionality before and/or after the call to the overwritten method; but I think itsmedudeman already knew that.

Here's the class definition, method can be found at around line 5000.
https://github.com/android/platform_frameworks_base/blob/master/core/java/android/app/Activity.java

If you look at the implementation of the Activity class (something that you normally shouldn't do to make these decisions), you can see that it's just an empty method. This is probably done so that you don't have to implement it yourself when using Activity as a base class, and don't need to use it.

If it was a required call (now or in the future), the documentation should've mentioned it, but it doesn't. So feel free not to call it, or do call it... it doesn't matter.


I think your assumptions would be true for most platforms, but not for android. This one example might be inconsequential now, but, the docs are not always in line with the code.

This link seems to suggest that it is required in some cased.

All in all I'm not a big fan of how android handles the super calls, but its the way the framework works and therefore you have to play by their rules.

A short explanation on calling super in android.

Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2016-04-08 11:28:27
April 08 2016 11:22 GMT
#14340
--- Nuked ---
Prev 1 715 716 717 718 719 1032 Next
Please log in or register to reply.
Live Events Refresh
PSISTORM Gaming Misc
16:00
FSL s11 TeamLeague: ASH vs ST
Freeedom33
Liquipedia
Grudge Match
16:00
Best of 7
FlaShFTW vs A.Alm
Discussion
uThermal 2v2 Circuit
15:00
Season Finals: Group Stage 1
uThermal1578
TaKeTV 381
mouzHeroMarine336
Classic270
SteadfastSC264
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
uThermal 1578
mouzHeroMarine 336
Classic 270
SteadfastSC 264
BRAT_OK 54
LamboSC2 30
trigger 28
sc2solar 11
StarCraft: Brood War
Britney 26698
Calm 7807
EffOrt 899
Hyuk 606
ggaemo 302
sorry 27
Rock 26
yabsab 23
GoRush 20
IntoTheRainbow 19
[ Show more ]
Sexy 9
Dota 2
Gorgc6266
Counter-Strike
fl0m8751
byalli589
zeus295
Super Smash Bros
Mew2King105
Heroes of the Storm
Khaldor390
MindelVK7
Other Games
gofns18988
tarik_tv8922
Grubby2864
FrodaN2171
Mlord472
Dendi441
B2W.Neo406
KnowMe210
Hui .83
OptimusSC213
Organizations
Other Games
EGCTV819
gamesdonequick604
StarCraft 2
angryscii 9
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 19 non-featured ]
StarCraft 2
• printf 21
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• Kozan
• IndyKCrew
StarCraft: Brood War
• Airneanach51
• Azhi_Dahaki31
• FirePhoenix6
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• lizZardDota258
League of Legends
• Jankos2033
Other Games
• WagamamaTV420
• Shiphtur149
• tFFMrPink 10
Upcoming Events
OSC
3h 18m
MaxPax vs YoungYakov
Krystianer vs Shameless
GgMaChine vs Creature
LetaleX vs MiniZergUA
ReBellioN vs TBD
ArT vs HiGhDrA
Nicoract vs Azura
GSL
14h 18m
herO vs Rogue
Maru vs Cure
Patches Events
19h 18m
uThermal 2v2 Circuit
21h 18m
BSL
1d 1h
Bonyth vs Dewalt
OSC
1d 6h
Monday Night Weeklies
1d 22h
Replay Cast
2 days
Sparkling Tuna Cup
2 days
Replay Cast
3 days
[ Show More ]
Kung Fu Cup
3 days
Maestros of the Game
3 days
Classic vs Lambo
Clem vs Maru
Replay Cast
4 days
The PondCast
4 days
Replay Cast
5 days
Replay Cast
6 days
CranKy Ducklings
6 days
uThermal 2v2 Circuit
6 days
Liquipedia Results

Completed

KK 2v2 League Season 1
RSL Revival: Season 5
Heroes Pulsing #1

Ongoing

BSL Season 22
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
CSCL: Masked Kings S4
YSL S3
SCTL 2026 Spring
WardiTV Spring 2026
Maestros of the Game 2
uThermal 2v2 2026 Main Event
2026 GSL S2
Murky Cup 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026

Upcoming

BSL 22 Non-Korean Championship
CSLAN 4
Blizzard Classic Cup 2026
Kung Fu Cup 2026 Grand Finals
CranK Gathers Season 4: BW vs SC2 Team League
HSC XXIX
Heroes Pulsing #3
Heroes Pulsing #2
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
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.