• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:01
CEST 20:01
KST 03:01
  • 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
[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy18ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book20
Community News
Weekly Cups (March 23-29): herO takes triple6Aligulac acquired by REPLAYMAN.com/Stego Research8Weekly Cups (March 16-22): herO doubles, Cure surprises3Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool51Weekly Cups (March 9-15): herO, Clem, ByuN win4
StarCraft 2
General
Rongyi Cup S3 - Preview & Info Team Liquid Map Contest #22 - Presented by Monster Energy Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool What mix of new & old maps do you want in the next ladder pool? (SC2) Aligulac acquired by REPLAYMAN.com/Stego Research
Tourneys
RSL Season 4 announced for March-April Sparkling Tuna Cup - Weekly Open Tournament StarCraft Evolution League (SC Evo Biweekly) WardiTV Mondays World University TeamLeague (500$+) | Signups Open
Strategy
Custom Maps
[M] (2) Frigid Storage Publishing has been re-enabled! [Feb 24th 2026]
External Content
The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power Mutation # 518 Radiation Zone
Brood War
General
ASL21 General Discussion Gypsy to Korea so ive been playing broodwar for a week straight. Pros React To: JaeDong vs Queen BSL 22 Map Contest — Submissions OPEN to March 10
Tourneys
[ASL21] Ro24 Group F Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues [ASL21] Ro24 Group E
Strategy
What's the deal with APM & what's its true value Fighting Spirit mining rates Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game Nintendo Switch Thread General RTS Discussion Thread Darkest Dungeon
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
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 Five o'clock TL Mafia
Community
General
US Politics Mega-thread The Chess Thread Russo-Ukrainian War Thread NASA and the Private Sector Things Aren’t Peaceful in Palestine
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Broowar part 2
qwaykee
China Uses Video Games to Sh…
TrAiDoS
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
ASL S21 English Commentary…
namkraft
Electronics
mantequilla
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1478 users

The Big Programming Thread - Page 180

Forum Index > General Forum
Post a Reply
Prev 1 178 179 180 181 182 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.
tofucake
Profile Blog Joined October 2009
Hyrule19200 Posts
October 19 2012 16:31 GMT
#3581
after { hit enter
Liquipediaasante sana squash banana
Thorakh
Profile Joined April 2011
Netherlands1788 Posts
Last Edited: 2012-10-19 17:23:06
October 19 2012 17:00 GMT
#3582
Quick question. What on earth is different between

+ Show Spoiler +

for (int i=0; i<ProgramWindow.profile.column.length; i++)
{
switch (ProgramWindow.profile.column[i])
{
case "A":column[i] = 0;break;
case "B":column[i] = 1;break;
case "C":column[i] = 2;break;
case "D":column[i] = 3;break;
case "E":column[i] = 4;break;
case "F":column[i] = 5;break;
case "G":column[i] = 6;break;
case "H":column[i] = 7;break;
case "I":column[i] = 8;break;
case "J":column[i] = 9;break;
case "K":column[i] = 10;break;
case "L":column[i] = 11;break;
case "M":column[i] = 12;break;
}
}

and
+ Show Spoiler +

for (int i=0; i<ProgramWindow.profile.column.length; i++)
{
if (ProgramWindow.profile.column[i] == "A") {column[i] = 0;}
else if (ProgramWindow.profile.column[i] == "B") {column[i] = 1;}
else if (ProgramWindow.profile.column[i] == "C") {column[i] = 2;}
else if (ProgramWindow.profile.column[i] == "D") {column[i] = 3;}
else if (ProgramWindow.profile.column[i] == "E") {column[i] = 4;}
else if (ProgramWindow.profile.column[i] == "F") {column[i] = 5;}
else if (ProgramWindow.profile.column[i] == "G") {column[i] = 6;}
else if (ProgramWindow.profile.column[i] == "H") {column[i] = 7;}
else if (ProgramWindow.profile.column[i] == "I") {column[i] = 8;}
else if (ProgramWindow.profile.column[i] == "J") {column[i] = 9;}
else if (ProgramWindow.profile.column[i] == "K") {column[i] = 10;}
else if (ProgramWindow.profile.column[i] == "L") {column[i] = 11;}
else if (ProgramWindow.profile.column[i] == "M") {column[i] = 12;}
}


Because Java 1.6 can't switch on a string value I have to convert my code to something else and my solution isn't working. I'm probably missing the obvious here but it has me stumped. There probably is a better way to convert A to 0, B to 1, C to 2, etc. than a switch statement as well.

The indentation is a bit fucked apparently, don't mind it :p

edit: oh for fuck's sake, you can't use == for String comparison. I should've used if (stringVariable.equals("A")) etc. The solution is so obvious, just as I thought!
edit2: and found a neater solution as well
+ Show Spoiler +
String[] letters = {"A","B","C","D","E","F","G","H","I","J","K","L","M"};
for (int j=0; j<letters.length; j++)
{
if (ProgramWindow.profile.column[i].equals(letters[j]))
{
column[i] = j;
break;
}
}
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
October 19 2012 17:07 GMT
#3583
On October 20 2012 02:00 Thorakh wrote:
Quick question. What on earth is different between

+ Show Spoiler +

for (int i=0; i<ProgramWindow.profile.column.length; i++)
{
switch (ProgramWindow.profile.column[i]
{
case "A":column[i] = 0;break;
case "B":column[i] = 1;break;
case "C":column[i] = 2;break;
case "D":column[i] = 3;break;
case "E":column[i] = 4;break;
case "F":column[i] = 5;break;
case "G":column[i] = 6;break;
case "H":column[i] = 7;break;
case "I":column[i] = 8;break;
case "J":column[i] = 9;break;
case "K":column[i] = 10;break;
case "L":column[i] = 11;break;
case "M":column[i] = 12;break;
}
}

and
+ Show Spoiler +

for (int i=0; i<ProgramWindow.profile.column.length; i++)
{
if (ProgramWindow.profile.column[i] == "A") {column[i] = 0;}
else if (ProgramWindow.profile.column[i] == "B") {column[i] = 1;}
else if (ProgramWindow.profile.column[i] == "C") {column[i] = 2;}
else if (ProgramWindow.profile.column[i] == "D") {column[i] = 3;}
else if (ProgramWindow.profile.column[i] == "E") {column[i] = 4;}
else if (ProgramWindow.profile.column[i] == "F") {column[i] = 5;}
else if (ProgramWindow.profile.column[i] == "G") {column[i] = 6;}
else if (ProgramWindow.profile.column[i] == "H") {column[i] = 7;}
else if (ProgramWindow.profile.column[i] == "I") {column[i] = 8;}
else if (ProgramWindow.profile.column[i] == "J") {column[i] = 9;}
else if (ProgramWindow.profile.column[i] == "K") {column[i] = 10;}
else if (ProgramWindow.profile.column[i] == "L") {column[i] = 11;}
else if (ProgramWindow.profile.column[i] == "M") {column[i] = 12;}
}


Because Java 1.6 can't switch on a string value I have to convert my code to something else and my solution isn't working. I'm probably missing the obvious here but it has me stumped. There probably is a better way to convert A to 0, B to 1, C to 2, etc. than a switch statement as well.

The indentation is a bit fucked apparently, don't mind it :p


The main difference is that i would kill those that use the second solution where the first would work.

Also, try this (not sure about exact syntax since i don't use java often):

column[i] = (int)ProgramWindow.profile.column[i].charAt(0) - (int)"A".charAt(0);
Thorakh
Profile Joined April 2011
Netherlands1788 Posts
October 19 2012 17:09 GMT
#3584
The main difference is that i would kill those that use the second solution where the first would work.
Yeah but as I already said, you can't switch on String values in Java 1.6, which is what version my program needs to run on :p
Nitro68
Profile Blog Joined December 2007
France470 Posts
October 19 2012 17:23 GMT
#3585
You cannot use "==" to compare Strings in Java, you must use equals (even if sometimes it works). I think that's your problem with solution 2.
Jonrock
Profile Blog Joined October 2012
Germany80 Posts
October 19 2012 22:12 GMT
#3586
Can anybody recommend a good book on Code Performance Optimization?

Ideally for C++ / C / Assembler
Maybe something more recent touching subjects like coding for multi-processor systems and single-operation-multiple-input
I am mostly interested in optimizing numerical calculations not so much into hardware specific stuff

Thanks in advance
take apart your head
white_horse
Profile Joined July 2010
1019 Posts
October 19 2012 22:39 GMT
#3587
Can you guys help me figure out whats wrong with my code? I don't understand whats supposed to go in the while condition in the do while loop. Our professor gave us a pseudocode to help us.

+ Show Spoiler +

1. Waldo starts his journey at location (x, y) = (0, 0), the front door of the Frat house, the center of the universe that Waldo is in. Waldo’s universe is a 2-dimensional plane that measures 20 × 20, that is, −10 <= x <= 10 and −10 <= y <= 10. Waldo’s home is a 2 × 2 square in the upper right hand corner, 8 <= x <= 10 and 8 <= y <= 10.
2. Declare a variable called atHome and give it an initial value of 0 (false) which means that Waldo has not
yet found his way home.
3. Declare another variable called stepsToTry and give it an initial fixed value of 5000. Waldo hopes to get
home before 5000 steps. If he doesn’t, he gives up and sleeps on the nearest park bench.

PSEUDOCODE:

FOR-LOOP until 5000 steps are taken and while Waldo has not yet reached home.
DO (Loop for choosing the direction of the step)
Take a proposed step of unit length in a random direction. (See note on the next page.)
WHILE (endpoint of the step is outside of Waldo’s universe)

Take the step.
If Waldo’s new location is within the square defined as his home, set atHome to true.
END FOR-LOOP

IF (atHome), print out the total number of steps that Waldo has taken and stop the program.
ELSE, print out a message that indicates that Waldo is lost and will not make it home that night.
End the program.



+ Show Spoiler +


const double PI = 4*atan(1.0);
double x = 0.0;
double y = 0.0;
double dx;
double dy;
int counter = 0;
bool atHome = false;

for (int i = 0; i < stepsToTry; i++)
{
do
{
double angle = 2*PI*rand()/RAND_MAX;
dx = cos(angle);
dy = sin(angle);

}while ((-10 <= x && x <= 10) && (-10 <= y && y <= 10));

x = x + dx;
y = y + dy;
counter = counter + 1;


if ((x >= xHomeLimit) && (y >= yHomeLimit))
{
atHome = true;
}

}


Translator
uSiN
Profile Joined January 2009
United States208 Posts
October 20 2012 00:11 GMT
#3588
On October 20 2012 02:09 Thorakh wrote:
Show nested quote +
The main difference is that i would kill those that use the second solution where the first would work.
Yeah but as I already said, you can't switch on String values in Java 1.6, which is what version my program needs to run on :p


Morfildur showed you an easier way to do it. Instead of switching, treat each character in the string as an integer and subtract 'A' or 65 (ASCII value of 'A'). If your still confused put the following few lines of code inside a main and run it.

+ Show Spoiler +
char myA = 'A';
char myB = 'B';
char myC = 'C';

int intA = (int) myA;
int intB = (int) myB;
int intC = (int) myC;

System.out.println(intA);
System.out.println(intB);
System.out.println(intC);
.-.
uSiN
Profile Joined January 2009
United States208 Posts
October 20 2012 00:15 GMT
#3589
On October 20 2012 07:39 white_horse wrote:
Can you guys help me figure out whats wrong with my code? I don't understand whats supposed to go in the while condition in the do while loop. Our professor gave us a pseudocode to help us.

+ Show Spoiler +

1. Waldo starts his journey at location (x, y) = (0, 0), the front door of the Frat house, the center of the universe that Waldo is in. Waldo’s universe is a 2-dimensional plane that measures 20 × 20, that is, −10 <= x <= 10 and −10 <= y <= 10. Waldo’s home is a 2 × 2 square in the upper right hand corner, 8 <= x <= 10 and 8 <= y <= 10.
2. Declare a variable called atHome and give it an initial value of 0 (false) which means that Waldo has not
yet found his way home.
3. Declare another variable called stepsToTry and give it an initial fixed value of 5000. Waldo hopes to get
home before 5000 steps. If he doesn’t, he gives up and sleeps on the nearest park bench.

PSEUDOCODE:

FOR-LOOP until 5000 steps are taken and while Waldo has not yet reached home.
DO (Loop for choosing the direction of the step)
Take a proposed step of unit length in a random direction. (See note on the next page.)
WHILE (endpoint of the step is outside of Waldo’s universe)

Take the step.
If Waldo’s new location is within the square defined as his home, set atHome to true.
END FOR-LOOP

IF (atHome), print out the total number of steps that Waldo has taken and stop the program.
ELSE, print out a message that indicates that Waldo is lost and will not make it home that night.
End the program.



+ Show Spoiler +


const double PI = 4*atan(1.0);
double x = 0.0;
double y = 0.0;
double dx;
double dy;
int counter = 0;
bool atHome = false;

for (int i = 0; i < stepsToTry; i++)
{
do
{
double angle = 2*PI*rand()/RAND_MAX;
dx = cos(angle);
dy = sin(angle);

}while ((-10 <= x && x <= 10) && (-10 <= y && y <= 10));

x = x + dx;
y = y + dy;
counter = counter + 1;


if ((x >= xHomeLimit) && (y >= yHomeLimit))
{
atHome = true;
}

}




With the do while loop in the for loop what are you trying to prevent?

The do in the do while is generating a random direction to step into. What if Waldo is at (10,5) and you generate randomly to step into square (11, 5)? How big is Waldo's universe?
.-.
JeanLuc
Profile Joined September 2010
Canada377 Posts
Last Edited: 2012-10-20 06:38:47
October 20 2012 06:35 GMT
#3590
On October 20 2012 07:39 white_horse wrote:
Can you guys help me figure out whats wrong with my code? I don't understand whats supposed to go in the while condition in the do while loop. Our professor gave us a pseudocode to help us.

+ Show Spoiler +

1. Waldo starts his journey at location (x, y) = (0, 0), the front door of the Frat house, the center of the universe that Waldo is in. Waldo’s universe is a 2-dimensional plane that measures 20 × 20, that is, −10 <= x <= 10 and −10 <= y <= 10. Waldo’s home is a 2 × 2 square in the upper right hand corner, 8 <= x <= 10 and 8 <= y <= 10.
2. Declare a variable called atHome and give it an initial value of 0 (false) which means that Waldo has not
yet found his way home.
3. Declare another variable called stepsToTry and give it an initial fixed value of 5000. Waldo hopes to get
home before 5000 steps. If he doesn’t, he gives up and sleeps on the nearest park bench.

PSEUDOCODE:

FOR-LOOP until 5000 steps are taken and while Waldo has not yet reached home.
DO (Loop for choosing the direction of the step)
Take a proposed step of unit length in a random direction. (See note on the next page.)
WHILE (endpoint of the step is outside of Waldo’s universe)

Take the step.
If Waldo’s new location is within the square defined as his home, set atHome to true.
END FOR-LOOP

IF (atHome), print out the total number of steps that Waldo has taken and stop the program.
ELSE, print out a message that indicates that Waldo is lost and will not make it home that night.
End the program.



+ Show Spoiler +


const double PI = 4*atan(1.0);
double x = 0.0;
double y = 0.0;
double dx;
double dy;
int counter = 0;
bool atHome = false;

for (int i = 0; i < stepsToTry; i++)
{
do
{
double angle = 2*PI*rand()/RAND_MAX;
dx = cos(angle);
dy = sin(angle);

}while ((-10 <= x && x <= 10) && (-10 <= y && y <= 10));

x = x + dx;
y = y + dy;
counter = counter + 1;


if ((x >= xHomeLimit) && (y >= yHomeLimit))
{
atHome = true;
}

}




if I'm not mistaken your do/while loop is gonna cycle endlessly if x and y are within the specified range. the exit condition of your do loop is based on where x and y is, and x and y are not being altered within the body of the loop. you should be changing x and y within the loop. and if x and y after random step is outside the range, you need to rescind the change you made to x and y and only then loop again.

Edit:
actually instead of making the step and taking it back, in the exit condition test whether x+dx and y + dy falls OUTSIDE the world. right now you are checking if x and y fall INSIDE the world.
If you can't find it within yourself to stand up and tell the truth-- you don't deserve to wear that uniform
Thorakh
Profile Joined April 2011
Netherlands1788 Posts
October 20 2012 09:50 GMT
#3591
On October 20 2012 09:11 uSiN wrote:
Show nested quote +
On October 20 2012 02:09 Thorakh wrote:
The main difference is that i would kill those that use the second solution where the first would work.
Yeah but as I already said, you can't switch on String values in Java 1.6, which is what version my program needs to run on :p


Morfildur showed you an easier way to do it. Instead of switching, treat each character in the string as an integer and subtract 'A' or 65 (ASCII value of 'A'). If your still confused put the following few lines of code inside a main and run it.

+ Show Spoiler +
char myA = 'A';
char myB = 'B';
char myC = 'C';

int intA = (int) myA;
int intB = (int) myB;
int intC = (int) myC;

System.out.println(intA);
System.out.println(intB);
System.out.println(intC);
Ah yes, of course. So smart ^^
Fyodor
Profile Blog Joined September 2010
Canada971 Posts
October 20 2012 17:09 GMT
#3592
On October 20 2012 07:12 Jonrock wrote:
Can anybody recommend a good book on Code Performance Optimization?

Ideally for C++ / C / Assembler
Maybe something more recent touching subjects like coding for multi-processor systems and single-operation-multiple-input
I am mostly interested in optimizing numerical calculations not so much into hardware specific stuff

Thanks in advance

http://www.amazon.ca/C-Concurrency-Action-Practical-Multithreading/dp/1933988770/ref=sr_1_1?ie=UTF8&qid=1350752722&sr=8-1

There's also a course on Coursera about heterogeneous computing if you're interested in that.

Most optimization happens at the algorithm level anyways so you might want an advanced book on that too?
llllllllllllllllllllllllllllllllllllllllllll
LukeNukeEm
Profile Joined February 2012
31 Posts
October 20 2012 19:34 GMT
#3593
Can anybody point me towards the right direction regarding an intersection-test between a transformed object and an axis-aligned bounding box? I have the ray - transformed object intersection working, i have the axis-aligned bounding box transformation/redefinition working, i have the non-transformed-object - axis aligned bounding box intersection working.
but my mind draws a blank when it comes to the intersection of the box and the transformed object
heishe
Profile Blog Joined June 2009
Germany2284 Posts
October 20 2012 21:23 GMT
#3594
On October 20 2012 07:12 Jonrock wrote:
Can anybody recommend a good book on Code Performance Optimization?

Ideally for C++ / C / Assembler
Maybe something more recent touching subjects like coding for multi-processor systems and single-operation-multiple-input
I am mostly interested in optimizing numerical calculations not so much into hardware specific stuff

Thanks in advance


There's really not that much to know. The big field is parallelism, cause that's where you will always be able to get the most performance. Just google "stackoverflow books parallelism".

As for SIMD stuff, there's not much to learn other than how to actually use it. From then on it's just you identifying situations where you can apply it (every time where the same operation is executed lots of times on different elements which are close together).

As for micro-optimization stuff: The three big things you need to know are keeping your stuff close together in cache, avoid branches (ifs and switches) like the plague, and write custom allocators if you notice slowdowns due to allocation patterns.

That stuff should get you going with googling, but I don't know of any one book that covers them all.
If you value your soul, never look into the eye of a horse. Your soul will forever be lost in the void of the horse.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
October 21 2012 21:46 GMT
#3595
On October 21 2012 04:34 LukeNukeEm wrote:
Can anybody point me towards the right direction regarding an intersection-test between a transformed object and an axis-aligned bounding box? I have the ray - transformed object intersection working, i have the axis-aligned bounding box transformation/redefinition working, i have the non-transformed-object - axis aligned bounding box intersection working.
but my mind draws a blank when it comes to the intersection of the box and the transformed object

Intersection of box to transformed object? What is the transformed object? A circle, a square, a rect, a rhombus? What?
mmp
Profile Blog Joined April 2009
United States2130 Posts
Last Edited: 2012-10-22 11:30:14
October 22 2012 11:20 GMT
#3596
The algorithm converts a string sentence "a b {c d} e" and converts it to a list of words and nested sentences, ["a", "b", "{c d}", "e"].

def tokenize_line(self, line):
out = []
block = []
nest = 0
line = line.strip()
grams = line.split(' ')
for word in grams:
nested = nest > 0
if word[0] == '{':
if nest == 0:
word = word[1:]
nest = nest + 1
nested = True
if word[-1] == '}':
nest = nest - 1
if nest == 0:
word = word[:-1]
nested = True
if nested:
block.append(word)
else:
out.append(self.scan_word(word))
if nest == 0:
if len(block) > 0:
out.append(self.scan(' '.join(block)))
nest = 0
block = []
if nest != 0:
error.fail('unbalanced {}')
return sentence.Sentence(out)


It works, but is terrible to read. Can someone help simplify this?
I (λ (foo) (and (<3 foo) ( T_T foo) (RAGE foo) )) Starcraft
teamamerica
Profile Blog Joined July 2010
United States958 Posts
October 22 2012 11:42 GMT
#3597
On October 19 2012 18:20 billy5000 wrote:
Show nested quote +
On October 19 2012 18:07 Blisse wrote:
On October 19 2012 17:54 billy5000 wrote:
On October 19 2012 17:36 Blisse wrote:
On October 19 2012 17:29 billy5000 wrote:
Hey guys, I've been thinking about getting an android device so I can make a few apps for it (I already have some small ones in mind). However, I'm pretty new to the mobile world and I don't plan on buying a phone. Instead, I found this. Would I be able to make apps for this as well as other android devices? I'm 99% sure that it would (as with all android based devices), but I just need to confirm this before I waste $150.


Please make a few applications, run them on the emulator and see if you actually like the Android environment. It's very easy to just borrow a friend's phone for a couple hours, or call them over to your house to play a bit and use their phone in the meantime, versus spending $150 and then realizing it's not all that you thought it would be. Once you've gotten a taste for it, and actually like it, then you can start thinking about buying a dedicated testing device.

The linked device only supports Android 2.3, so if you're really considering it, start to look into development a bit there first.


Actually, you somehow persuaded me that I should make web based apps. Somehow lol. I just had a moment of realization why I don't even own an android/ios device in the first place. It's just that 90% of my friends have them, and..yeah, naive.


Well, to be fair, it really doesn't hurt to give development on the emulator a go to see how you feel about it. You may feel that environment has the right feel, or that you really like it, or that you hate it with a passion. Can't tell until you give it a try.

It just seemed like you jumping the gun a bit by spending $150 then flipping a coin on whether you actually like developing on Android. Lots of developers do, and lots of developers don't. It's a preference, and you can't know until you try it out a bit. Not really naive, just a discovery process to see what you like and don't like.

The point is never to reject an idea immediately, but don't jump the gun and focus all your development and learning to the next big, and I use this loosely, "FOTM" when you don't even know if you'll like it. It's never wrong to learn, but you don't want to hurt yourself senselessly.


I actually have it set up on my eclipse, but the emulator runs unbearably slow on my computer. In addition, I have absolutely no handheld device experience, so there's not a clear distinction of what the consumer wants and does not want.

Anyway, I was mainly curious because I want to finally do something fun and practical after 1 year at my university. It just hit me that I haven't thought about the web. Android/ios apps have that cutesy characteristic, which is probably the reason why I was interested.



Make sure you turn on GPU emulation for the emulator - for some reason it's not on by default (@ adt tools v.20). Having a device is nicer then an emulator but if you have to use emulator, follow the instructions at:

http://codebutler.com/2012/10/10/configuring-a-usable-android-emualtor/

And I had an emulator that was decent. I had some problem with partition size but I think I changed one of the emulator run flags. Stackoverflow should solve any problems you have setting up.

I'd also recommend against buying a device right off the bat - friends stuff or emulator - but if you buy the galaxy player XDA forums can guide you into upgrading into 4.0 or installing a custom ROM. Smart people there ^^.

Make an app that you want to use so at least if no one else in the world uses it, you'll have 1 user.
RIP GOMTV. RIP PROLEAGUE.
LukeNukeEm
Profile Joined February 2012
31 Posts
October 22 2012 11:55 GMT
#3598
On October 22 2012 06:46 CecilSunkure wrote:
Show nested quote +
On October 21 2012 04:34 LukeNukeEm wrote:
Can anybody point me towards the right direction regarding an intersection-test between a transformed object and an axis-aligned bounding box? I have the ray - transformed object intersection working, i have the axis-aligned bounding box transformation/redefinition working, i have the non-transformed-object - axis aligned bounding box intersection working.
but my mind draws a blank when it comes to the intersection of the box and the transformed object

Intersection of box to transformed object? What is the transformed object? A circle, a square, a rect, a rhombus? What?
That's the problem, it's unknown - all I know is that it has implemented the methods getAABB, intersectRay and intersectAABB. I think what I want to do is not possible. Right now I calculate the transformed AABB of the object and test for intersection against that. This approach returns false positives, which is bad, but it still works.

On to the next question!
I have implemented an octree, with nodes like this:
class Node
{
public:
Node** children;
Data* data;
...
};

However, I only need data on my leafnodes, so I have a bunch of nullpointers in my Octree. How would I change this Implementation so that it works something like this:
class NonLeafNode
{
public:
Node** children;
};
class LeafNode
{
public:
Data* data;
};

CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2012-10-22 15:39:57
October 22 2012 15:39 GMT
#3599
On October 22 2012 20:20 mmp wrote:
The algorithm converts a string sentence "a b {c d} e" and converts it to a list of words and nested sentences, ["a", "b", "{c d}", "e"].

def tokenize_line(self, line):
out = []
block = []
nest = 0
line = line.strip()
grams = line.split(' ')
for word in grams:
nested = nest > 0
if word[0] == '{':
if nest == 0:
word = word[1:]
nest = nest + 1
nested = True
if word[-1] == '}':
nest = nest - 1
if nest == 0:
word = word[:-1]
nested = True
if nested:
block.append(word)
else:
out.append(self.scan_word(word))
if nest == 0:
if len(block) > 0:
out.append(self.scan(' '.join(block)))
nest = 0
block = []
if nest != 0:
error.fail('unbalanced {}')
return sentence.Sentence(out)


It works, but is terrible to read. Can someone help simplify this?

I don't get how the nested sentences are supposed to work. How are multiple nested sentences supposed to work?
Ian Ian Ian
Profile Blog Joined August 2009
915 Posts
October 22 2012 16:12 GMT
#3600
Is there a way for an if statement to return nothing? My code looks like
+ Show Spoiler +

n = 1
pmf = binomial(1,n,0.5)
while pmf > 0 :
n += 1
pmf = binomial(1,n,0.5)
if pmf == 0:
print n
else:


I'm supposed to find what value n needs to be to have pmf = 0. It is n = 1075. I don't want to see python print n every single time the loop is ran so I threw in an if statement. But it keeps giving me an error because the else statement has nothing there, but I don't want it to do anything either!

Also, how are people writing their code in those white boxes? :S
Prev 1 178 179 180 181 182 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 14h 59m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ProTech143
Railgan 67
StarCraft: Brood War
Calm 4321
Mind 668
Horang2 579
actioN 297
Hyuk 148
Dewaltoss 111
Sexy 37
Movie 33
Hm[arnc] 24
yabsab 20
[ Show more ]
GoRush 18
Terrorterran 13
soO 13
ajuk12(nOOB) 11
NaDa 8
Dota 2
Gorgc5698
qojqva3387
420jenkins335
Counter-Strike
fl0m3446
zeus467
edward70
Heroes of the Storm
Khaldor183
MindelVK17
Other Games
Grubby2294
FrodaN1753
Beastyqt693
ArmadaUGS128
Livibee71
Trikslyr70
C9.Mang054
Organizations
StarCraft 2
angryscii 22
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• Adnapsc2 21
• Reevou 2
• intothetv
• Kozan
• sooper7s
• Migwel
• AfreecaTV YouTube
• LaughNgamezSOOP
• IndyKCrew
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV756
• lizZardDota267
League of Legends
• Nemesis1807
• Jankos1703
Other Games
• imaqtpie764
• Shiphtur199
Upcoming Events
CranKy Ducklings
14h 59m
Sparkling Tuna Cup
15h 59m
PiGosaur Cup
1d 5h
Replay Cast
1d 14h
Kung Fu Cup
1d 17h
Replay Cast
2 days
The PondCast
2 days
CranKy Ducklings
3 days
WardiTV Team League
3 days
Replay Cast
4 days
[ Show More ]
CranKy Ducklings
4 days
WardiTV Team League
4 days
uThermal 2v2 Circuit
4 days
BSL
5 days
Sparkling Tuna Cup
5 days
WardiTV Team League
5 days
BSL
6 days
Replay Cast
6 days
Replay Cast
6 days
Wardi Open
6 days
Liquipedia Results

Completed

Escore Tournament S2: W1
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
CSL Elite League 2026
ASL Season 21
CSL Season 20: Qualifier 2
CSL 2026 SPRING (S20)
StarCraft2 Community Team League 2026 Spring
Nations Cup 2026
PGL Bucharest 2026
Stake Ranked Episode 1
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

Upcoming

Escore Tournament S2: W2
IPSL Spring 2026
Escore Tournament S2: W3
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
uThermal 2v2 Last Chance Qualifiers 2026
RSL Revival: Season 5
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
CCT Season 3 Global Finals
IEM Rio 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...

Disclosure: This page contains affiliate marketing links that support TLnet.

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.