• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 00:24
CEST 06:24
KST 13:24
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
[BSL20] Non-Korean Championship 4x BSL + 4x China2Flash Announces Hiatus From ASL63Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event22Esports World Cup 2025 - Final Player Roster16
StarCraft 2
General
Program: SC2 / XSplit / OBS Scene Switcher The SCII GOAT: A statistical Evaluation Statistics for vetoed/disliked maps Weekly Cups (June 23-29): Reynor in world title form? PiG Sty Festival #5: Playoffs Preview + Groups Recap
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament WardiTV Mondays Korean Starcraft League Week 77
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
SC uni coach streams logging into betting site Player “Jedi” cheat on CSL Flash Announces Hiatus From ASL BW General Discussion Practice Partners (Official)
Tourneys
CSL Xiamen International Invitational [BSL20] Non-Korean Championship 4x BSL + 4x China The Casual Games of the Week Thread [BSL20] Grand Finals - Sunday 20:00 CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread What do you want from future RTS games? Beyond All Reason
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Summer Games Done Quick 2025! Trading/Investing Thread Things Aren’t Peaceful in Palestine
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 659 users

The Big Programming Thread - Page 180

Forum Index > General Forum
Post a Reply
Prev 1 178 179 180 181 182 1031 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
Hyrule19031 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 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 6h 36m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nina 292
ProTech60
Ketroc 26
StarCraft: Brood War
Leta 448
Shine 76
Noble 48
Mind 33
ajuk12(nOOB) 15
Bale 3
Dota 2
monkeys_forever1272
Counter-Strike
Stewie2K1286
Super Smash Bros
Mew2King165
Other Games
summit1g8812
ViBE233
Maynarde149
Organizations
Other Games
gamesdonequick39660
BasetradeTV86
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Berry_CruncH302
• Hupsaiya 62
• practicex 31
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki31
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• masondota2445
League of Legends
• Lourlo1190
Upcoming Events
Wardi Open
6h 36m
Replay Cast
19h 36m
Sparkling Tuna Cup
1d 5h
WardiTV European League
1d 11h
MaNa vs sebesdes
Mixu vs Fjant
ByuN vs HeRoMaRinE
ShoWTimE vs goblin
Gerald vs Babymarine
Krystianer vs YoungYakov
PiGosaur Monday
1d 19h
The PondCast
2 days
WardiTV European League
2 days
Jumy vs NightPhoenix
Percival vs Nicoract
ArT vs HiGhDrA
MaxPax vs Harstem
Scarlett vs Shameless
SKillous vs uThermal
uThermal 2v2 Circuit
2 days
Replay Cast
2 days
RSL Revival
3 days
ByuN vs SHIN
Clem vs Reynor
[ Show More ]
Replay Cast
3 days
RSL Revival
4 days
Classic vs Cure
FEL
4 days
RSL Revival
5 days
FEL
5 days
FEL
5 days
Sparkling Tuna Cup
6 days
RSL Revival
6 days
FEL
6 days
Liquipedia Results

Completed

BSL Season 20
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
CSL Xiamen Invitational
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
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
IEM Cologne 2025
FISSURE Playground #1
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.