• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 15:50
CET 21:50
KST 05:50
  • 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 (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly 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 win3
StarCraft 2
General
Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump 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
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament Tenacious Turtle Tussle StarCraft2.fi 15th Anniversary Cup RSL Offline Finals Info - Dec 13 and 14! StarCraft Evolution League (SC Evo Biweekly)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night
Brood War
General
BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ [BSL21] RO8 Bracket & Prediction Contest Let's talk about Metropolis Foreign Brood War
Tourneys
[ASL20] Grand Finals Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] RO16 Group D - Sunday 21:00 CET
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates Current Meta Game Theory for Starcraft
Other Games
General Games
Path of Exile Nintendo Switch Thread Stormgate/Frost Giant Megathread EVE Corporation ZeroSpace Megathread
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 Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
Formula 1 Discussion 2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
How Sleep Deprivation Affect…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1606 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
Hyrule19177 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 15h 10m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
White-Ra 167
JuggernautJason93
Railgan 88
StarCraft: Brood War
Britney 19390
Bisu 852
Dewaltoss 140
Hyun 106
Dota 2
Gorgc6143
Dendi1125
420jenkins254
Counter-Strike
fl0m6341
zeus414
minikerr15
Heroes of the Storm
Liquid`Hasu405
Other Games
Grubby5203
ArmadaUGS167
ToD164
Fuzer 119
QueenE93
Trikslyr93
C9.Mang080
Organizations
Other Games
BasetradeTV109
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• Hupsaiya 57
• musti20045 21
• Reevou 2
• Kozan
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• IndyKCrew
StarCraft: Brood War
• FirePhoenix12
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota2921
• WagamamaTV512
League of Legends
• TFBlade1215
Other Games
• imaqtpie2749
• Shiphtur154
Upcoming Events
WardiTV 2025
15h 10m
Big Brain Bouts
20h 10m
RSL Revival
1d 7h
StarCraft2.fi
1d 13h
IPSL
1d 20h
Sziky vs JDConan
OSC
1d 20h
Solar vs Percival
Gerald vs Nicoract
Creator vs ByuN
RSL Revival
2 days
Classic vs TBD
herO vs Zoun
WardiTV 2025
2 days
IPSL
2 days
Tarson vs DragOn
Wardi Open
3 days
[ Show More ]
Monday Night Weeklies
3 days
Replay Cast
4 days
Sparkling Tuna Cup
4 days
The PondCast
6 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Revival: Season 3
Kuram Kup

Ongoing

IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
WardiTV 2025
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

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
RSL Offline Finals
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...

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 © 2025 TLnet. All Rights Reserved.