• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 20:02
CEST 02:02
KST 09:02
  • 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 #21: Voting9[ASL20] Ro4 Preview: Descent11Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5
Community News
BSL Team A vs Koreans - Sat-Sun 16:00 CET5Weekly Cups (Oct 6-12): Four star herO85.0.15 Patch Balance Hotfix (2025-10-8)80Weekly Cups (Sept 29-Oct 5): MaxPax triples up3PartinG joins SteamerZone, returns to SC2 competition32
StarCraft 2
General
Revisiting the game after10 years and wow it's bad Stellar Fest: StarCraft II returns to Canada The New Patch Killed Mech! herO Talks: Poor Performance at EWC and more... TL.net Map Contest #21: Voting
Tourneys
SC2's Safe House 2 - October 18 & 19 $1,200 WardiTV October (Oct 21st-31st) WardiTV Mondays RSL Offline Finals Dates + Ticket Sales! SC4ALL $6,000 Open LAN in Philadelphia
Strategy
Custom Maps
External Content
Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment Mutation # 493 Quick Killers Mutation # 492 Get Out More
Brood War
General
BSL Team A vs Koreans - Sat-Sun 16:00 CET BW General Discussion Question regarding recent ASL Bisu vs Larva game [Interview] Grrrr... 2024 Pros React To: BarrackS + FlaSh Coaching vs SnOw
Tourneys
[ASL20] Semifinal B SC4ALL $1,500 Open Bracket LAN [Megathread] Daily Proleagues [ASL20] Semifinal A
Strategy
BW - ajfirecracker Strategy & Training Relatively freeroll strategies Current Meta Siegecraft - a new perspective
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV Path of Exile Nintendo Switch Thread ZeroSpace Megathread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
SPIRED by.ASL Mafia {211640} TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Men's Fashion Thread Sex and weight loss
Fan Clubs
The herO Fan Club! The Happy Fan Club!
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Series you have seen recently... Movie Discussion!
Sports
Formula 1 Discussion 2024 - 2026 Football Thread MLB/Baseball 2023 NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
The Heroism of Pepe the Fro…
Peanutsc
Rocket League: Traits, Abili…
TrAiDoS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1612 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
Hyrule19144 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 9h 58m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SpeCial 103
StarCraft: Brood War
Britney 31942
ZZZero.O 101
Dota 2
monkeys_forever535
LuMiX0
Counter-Strike
Stewie2K592
Super Smash Bros
AZ_Axe151
Heroes of the Storm
Khaldor222
Other Games
summit1g11590
Grubby2897
Skadoodle463
ZombieGrub418
Mew2King142
ViBE61
Trikslyr50
Organizations
Other Games
gamesdonequick3257
BasetradeTV170
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• RyuSc2 33
• davetesta30
• OhrlRock 3
• IndyKCrew
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• LaughNgamezSOOP
StarCraft: Brood War
• HerbMon 15
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• Ler21
Other Games
• imaqtpie1306
• Scarra651
• WagamamaTV353
Upcoming Events
Sparkling Tuna Cup
9h 58m
Safe House 2
16h 58m
IPSL
18h 58m
Sziky vs Havi
Artosis vs Klauso
Monday Night Weeklies
1d 15h
WardiTV Invitational
2 days
WardiTV Invitational
2 days
Tenacious Turtle Tussle
3 days
The PondCast
4 days
WardiTV Invitational
5 days
Online Event
5 days
[ Show More ]
RSL Revival
6 days
RSL Revival
6 days
WardiTV Invitational
6 days
Liquipedia Results

Completed

Acropolis #4 - TS2
WardiTV TLMC #15
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
EC S1
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
BSL 21 Non-Korean Championship
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
CranK Gathers Season 2: SC II Pro Teams
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 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.