• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 20:26
CET 02:26
KST 10:26
  • 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 Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship Constellation Cup - Main Event - Stellar Fest RSL Revival: Season 3
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
ZeroSpace Megathread Stormgate/Frost Giant Megathread Nintendo Switch Thread 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
Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread US Politics Mega-thread 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
James Bond movies ranking - pa…
Topin
Esports Earnings: Bigger Pri…
TrAiDoS
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1632 users

The Big Programming Thread - Page 481

Forum Index > General Forum
Post a Reply
Prev 1 479 480 481 482 483 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.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
May 16 2014 00:56 GMT
#9601
--- Nuked ---
3FFA
Profile Blog Joined February 2010
United States3931 Posts
Last Edited: 2014-05-19 11:53:59
May 16 2014 19:18 GMT
#9602
Thank you so much Ben and Nesserev! Especially for explaining it to me so that now I understand the why behind all of this.

Fixed Code as requested below.
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
May 16 2014 21:08 GMT
#9603
--- Nuked ---
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
May 17 2014 10:23 GMT
#9604
[image loading]

Hahahaha
Time is precious. Waste it wisely.
BungaBunga
Profile Joined May 2014
Italy23 Posts
May 17 2014 15:10 GMT
#9605
Are there any iOS developers around here?
jtype
Profile Blog Joined April 2009
England2167 Posts
May 18 2014 09:16 GMT
#9606
On May 18 2014 00:10 BungaBunga wrote:
Are there any iOS developers around here?


Do you have a question for them?
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
May 18 2014 09:34 GMT
#9607
It's a lot easier if you ask the question instead of asking if you should ask the question :p
There is no one like you in the universe.
BungaBunga
Profile Joined May 2014
Italy23 Posts
May 18 2014 10:03 GMT
#9608
Here is my question:
I've put a lot of effort into making an Android app. The app is doing ok and I can currently live off it.
Now the question is if it makes sense to repeat the same thing for iOS.

I cannot afford hiring another developer or designer.
So I would basically have to do it all by myself.
It would probably take me about 2 years to get the iOS app done.

Here are the things that concern me:
- I would need to buy all the Apple stuff (laptop, iPhone, tablet)
- I'm not a designer myself. Even though the app looks ok for Android, I know that the bar for iOS is a lot higher.
- On Android it is relatively easy to get steady downloads with good SEO. On iOS I've heard that you need to spend loads of money on marketing just to be visible. I'm wondering if anyone has some experience with that.

Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
Last Edited: 2014-05-18 13:43:00
May 18 2014 10:48 GMT
#9609
On May 18 2014 19:03 BungaBunga wrote:
Here is my question:
I've put a lot of effort into making an Android app. The app is doing ok and I can currently live off it.
Now the question is if it makes sense to repeat the same thing for iOS.

I cannot afford hiring another developer or designer.
So I would basically have to do it all by myself.
It would probably take me about 2 years to get the iOS app done.

Here are the things that concern me:
- I would need to buy all the Apple stuff (laptop, iPhone, tablet)
- I'm not a designer myself. Even though the app looks ok for Android, I know that the bar for iOS is a lot higher.
- On Android it is relatively easy to get steady downloads with good SEO. On iOS I've heard that you need to spend loads of money on marketing just to be visible. I'm wondering if anyone has some experience with that.


http://www.xda-developers.com/android/google-tool-helps-developers-port-android-apps-to-ios/

Maybe this can help...

On another note, do you guys have an idea how can one access the private function of a parent class from one of its child classes?
Time is precious. Waste it wisely.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
May 18 2014 13:58 GMT
#9610
On May 18 2014 19:48 Manit0u wrote:

On another note, do you guys have an idea how can one access the private function of a parent class from one of its child classes?


You don't.

Private: Only visible to the current class.
Protected: Visible to the current class and any classes inheriting this class.
Public: Visible to everyone.

What you want is a protected method, not a private one.
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
Last Edited: 2014-05-18 14:05:22
May 18 2014 14:04 GMT
#9611
On May 18 2014 22:58 Morfildur wrote:
Show nested quote +
On May 18 2014 19:48 Manit0u wrote:

On another note, do you guys have an idea how can one access the private function of a parent class from one of its child classes?


You don't.

Private: Only visible to the current class.
Protected: Visible to the current class and any classes inheriting this class.
Public: Visible to everyone.

What you want is a protected method, not a private one.


That much I knew, thought that maybe there's some hacks you could use that I didn't know of. The thing is, I have a big private function in one class in the big framework. I need to alter this function ever so slightly without having to rewrite a ton of stuff (the class containing the private function has lots of children). Simply changing it to protected won't work since I don't know if any of its children won't override it then. It's a poor design by the creator of this thing...

Anyway, another question, this time about JS (of which I don't know much so I'll write it more in pseudo-code than anything):


func(args)
{
print(args.length);
print(args[1]);
}


Input/Output:

> func blahblah
undefined
blahblah


Any idea why it doesn't return the .length property? I know that it would be true in the past for array-like objects but I hear it isn't the case now... I'm confused.
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
May 18 2014 14:25 GMT
#9612
Technically with Reflection (at least in some languages) you can circumvent any protection levels you want. You really don't want that though.

If you have access to the source code of the problematic class, you probably can introduce a level of indirection to safely lower the protection level to protected:

First write a protected method that simply forwards to the private method you want to override. Then change all references to the private method to use the new method instead. If you made sure that the name of the new protected method won't clash with any method names of any potential subclasses, you now have a protected hook that nobody uses yet.
If you have a good reason to disagree with the above, please tell me. Thank you.
berated-
Profile Blog Joined February 2007
United States1134 Posts
May 18 2014 14:39 GMT
#9613
On May 18 2014 23:04 Manit0u wrote:
Show nested quote +
On May 18 2014 22:58 Morfildur wrote:
On May 18 2014 19:48 Manit0u wrote:

On another note, do you guys have an idea how can one access the private function of a parent class from one of its child classes?


You don't.

Private: Only visible to the current class.
Protected: Visible to the current class and any classes inheriting this class.
Public: Visible to everyone.

What you want is a protected method, not a private one.


That much I knew, thought that maybe there's some hacks you could use that I didn't know of. The thing is, I have a big private function in one class in the big framework. I need to alter this function ever so slightly without having to rewrite a ton of stuff (the class containing the private function has lots of children). Simply changing it to protected won't work since I don't know if any of its children won't override it then. It's a poor design by the creator of this thing...

Anyway, another question, this time about JS (of which I don't know much so I'll write it more in pseudo-code than anything):


func(args)
{
print(args.length);
print(args[1]);
}


Input/Output:

> func blahblah
undefined
blahblah


Any idea why it doesn't return the .length property? I know that it would be true in the past for array-like objects but I hear it isn't the case now... I'm confused.


what type would you say blahblah is?

Your example isn't 100% clear to me, but hopefully some of this helps? If you are actually passing in an argument like args, then its possible in your example that args could be an object, not an array.


var obj = {};
obj[1] = 'test';


Above would be an example where you obj[1] would return a value but length would not be known.

If you are actually trying to access the arguments of a function, then, the keyword is arguments and it isn't passed into the function, its just kind of there.

Example of arguments
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
May 18 2014 15:10 GMT
#9614
On May 18 2014 23:39 berated- wrote:
Show nested quote +
On May 18 2014 23:04 Manit0u wrote:
On May 18 2014 22:58 Morfildur wrote:
On May 18 2014 19:48 Manit0u wrote:

On another note, do you guys have an idea how can one access the private function of a parent class from one of its child classes?


You don't.

Private: Only visible to the current class.
Protected: Visible to the current class and any classes inheriting this class.
Public: Visible to everyone.

What you want is a protected method, not a private one.


That much I knew, thought that maybe there's some hacks you could use that I didn't know of. The thing is, I have a big private function in one class in the big framework. I need to alter this function ever so slightly without having to rewrite a ton of stuff (the class containing the private function has lots of children). Simply changing it to protected won't work since I don't know if any of its children won't override it then. It's a poor design by the creator of this thing...

Anyway, another question, this time about JS (of which I don't know much so I'll write it more in pseudo-code than anything):


func(args)
{
print(args.length);
print(args[1]);
}


Input/Output:

> func blahblah
undefined
blahblah


Any idea why it doesn't return the .length property? I know that it would be true in the past for array-like objects but I hear it isn't the case now... I'm confused.


what type would you say blahblah is?

Your example isn't 100% clear to me, but hopefully some of this helps? If you are actually passing in an argument like args, then its possible in your example that args could be an object, not an array.


var obj = {};
obj[1] = 'test';


Above would be an example where you obj[1] would return a value but length would not be known.

If you are actually trying to access the arguments of a function, then, the keyword is arguments and it isn't passed into the function, its just kind of there.

Example of arguments


Trying to help some poor soul using stuff I didn't create with my (very) limited knowledge of JS. Can't get more specific since that's all I got from said person.
Time is precious. Waste it wisely.
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2014-05-18 19:24:35
May 18 2014 19:24 GMT
#9615
On the comments on reflection above:

Manit0u - the direct answer to your question is yes, you can do it. Spine is in the right direction with reflection, here is an example in Java: http://stackoverflow.com/questions/14398157/how-to-invoke-parent-private-method-from-child

Morfildur is in the more correct direction though - even though it's possible, you really should not do this except under some very rare circumstances.

You might need it in a very specific unit test to ensure the exact behavior of some type of configuration - but even then you should exhaust all other possibilities of designing your code in a way that doesn't force you to use reflection on private methods.
Who after all is today speaking about the destruction of the Armenians?
Manit0u
Profile Blog Joined August 2004
Poland17496 Posts
May 18 2014 20:59 GMT
#9616
On May 19 2014 04:24 phar wrote:
On the comments on reflection above:

Manit0u - the direct answer to your question is yes, you can do it. Spine is in the right direction with reflection, here is an example in Java: http://stackoverflow.com/questions/14398157/how-to-invoke-parent-private-method-from-child

Morfildur is in the more correct direction though - even though it's possible, you really should not do this except under some very rare circumstances.

You might need it in a very specific unit test to ensure the exact behavior of some type of configuration - but even then you should exhaust all other possibilities of designing your code in a way that doesn't force you to use reflection on private methods.


Thanks, Reflection is what I needed. I can't change the design since I have to work with something designed by someone else that's already in production environment so I don't really have much leeway here. I'm not even sure I'm still going to use this (most likely not), just wanted to know if it was possible.
Time is precious. Waste it wisely.
phar
Profile Joined August 2011
United States1080 Posts
May 19 2014 03:30 GMT
#9617
Yea I strongly, strongly encourage you to not use it if at all possible. Even if it works relatively well now, it's a bitch to maintain that code.
Who after all is today speaking about the destruction of the Armenians?
Shield
Profile Blog Joined August 2009
Bulgaria4824 Posts
Last Edited: 2014-05-19 05:27:30
May 19 2014 05:22 GMT
#9618
This reflection thing seems like a hack. No direct instance of the superclass is created, yet you call its private methods. Isn't this against OOP?

Edit: Or is this the superclass instance?

Method m = getClass().getSuperclass().getDeclaredMethod("a", new Class<?>[]{});

Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2014-05-19 06:07:34
May 19 2014 06:02 GMT
#9619
--- Nuked ---
teamamerica
Profile Blog Joined July 2010
United States958 Posts
May 19 2014 06:15 GMT
#9620
On May 18 2014 22:58 Morfildur wrote:
Show nested quote +
On May 18 2014 19:48 Manit0u wrote:

On another note, do you guys have an idea how can one access the private function of a parent class from one of its child classes?


You don't.

Private: Only visible to the current class.
Protected: Visible to the current class and any classes inheriting this class.
Public: Visible to everyone.

What you want is a protected method, not a private one.


Just as a useless tidbit, afaik protected is visible to any children classes as well as any classes in the same package. Apparently in Javaland, at some point they imagined the atomic units of code being packages?
RIP GOMTV. RIP PROLEAGUE.
Prev 1 479 480 481 482 483 1032 Next
Please log in or register to reply.
Live Events Refresh
Replay Cast
00:00
WardiTV Mondays #62
CranKy Ducklings114
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft499
elazer 162
Nathanias 60
CosmosSc2 49
StarCraft: Brood War
Artosis 672
Larva 175
Bale 39
Noble 27
Dota 2
monkeys_forever545
NeuroSwarm46
League of Legends
C9.Mang0241
Counter-Strike
Foxcn222
Other Games
summit1g12507
tarik_tv5188
FrodaN1212
Day[9].tv726
shahzam520
RotterdaM153
Maynarde132
Mew2King65
ViBE33
ToD29
Organizations
Other Games
gamesdonequick741
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• Hupsaiya 51
• davetesta22
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• RayReign 41
• Azhi_Dahaki14
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• Ler56
League of Legends
• Doublelift4765
Other Games
• imaqtpie1390
• Day9tv726
Upcoming Events
The PondCast
8h 34m
OSC
14h 34m
Demi vs Mixu
Nicoract vs TBD
Babymarine vs MindelVK
ForJumy vs TBD
Shameless vs Percival
Replay Cast
22h 34m
Korean StarCraft League
2 days
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.