• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 17:13
CEST 23:13
KST 06:13
  • 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
Maestros of the Game: Week 1/Play-in Preview9[ASL20] Ro24 Preview Pt2: Take-Off7[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9
Community News
Weekly Cups (August 25-31): Clem's Last Straw?2Weekly Cups (Aug 18-24): herO dethrones MaxPax6Maestros of The Game—$20k event w/ live finals in Paris44Weekly Cups (Aug 11-17): MaxPax triples again!15Weekly Cups (Aug 4-10): MaxPax wins a triple6
StarCraft 2
General
Weekly Cups (August 25-31): Clem's Last Straw? #1: Maru - Greatest Players of All Time Maestros of the Game: Week 1/Play-in Preview Weekly Cups (Aug 11-17): MaxPax triples again! 2024/25 Off-Season Roster Moves
Tourneys
Monday Nights Weeklies LiuLi Cup - September 2025 Tournaments Maestros of The Game—$20k event w/ live finals in Paris 🏆 GTL Season 2 – StarCraft II Team League $5,100+ SEL Season 2 Championship (SC: Evo)
Strategy
Custom Maps
External Content
Mutation # 489 Bannable Offense Mutation # 488 What Goes Around Mutation # 487 Think Fast Mutation # 486 Watch the Skies
Brood War
General
ASL20 General Discussion BGH Auto Balance -> http://bghmmr.eu/ Pros React To: herO's Baffling Game Starcraft at lower levels TvP Easiest luckies way to get out of Asl groups
Tourneys
[ASL20] Ro24 Group F [IPSL] CSLAN Review and CSLPRO Reimagined! Small VOD Thread 2.0 Cosmonarchy Pro Showmatches
Strategy
Simple Questions, Simple Answers Muta micro map competition Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread General RTS Discussion Thread Nintendo Switch Thread Path of Exile Warcraft III: The Frozen Throne
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
Canadian Politics Mega-thread Russo-Ukrainian War Thread US Politics Mega-thread YouTube Thread Things Aren’t Peaceful in Palestine
Fan Clubs
The Happy Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s) Gtx660 graphics card replacement
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
hello world
radishsoup
Lemme tell you a thing o…
JoinTheRain
How Culture and Conflict Imp…
TrAiDoS
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
INDEPENDIENTE LA CTM
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1082 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
Hyrule19083 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 2h 47m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SteadfastSC 294
Livibee 124
JuggernautJason103
ProTech34
Vindicta 32
StarCraft: Brood War
Calm 2582
Sea 2442
Shuttle 483
Larva 466
Mini 288
EffOrt 228
TY 77
sSak 76
Mong 44
Aegong 33
League of Legends
Reynor78
Counter-Strike
fl0m4749
Stewie2K356
byalli162
Super Smash Bros
PPMD107
Heroes of the Storm
Liquid`Hasu497
Other Games
tarik_tv6120
summit1g5718
Grubby2576
Mew2King67
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 22 non-featured ]
StarCraft 2
• kabyraGe 107
• musti20045 35
• davetesta33
• Kozan
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• IndyKCrew
StarCraft: Brood War
• blackmanpl 27
• iopq 8
• Pr0nogo 3
• HerbMon 3
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21432
• WagamamaTV277
League of Legends
• TFBlade860
Counter-Strike
• Shiphtur330
Other Games
• imaqtpie1430
Upcoming Events
Replay Cast
2h 47m
Sparkling Tuna Cup
12h 47m
PiGosaur Monday
1d 2h
LiuLi Cup
1d 13h
Replay Cast
2 days
The PondCast
2 days
RSL Revival
2 days
Maru vs SHIN
MaNa vs MaxPax
OSC
3 days
MaNa vs SHIN
SKillous vs ShoWTimE
Bunny vs TBD
Cham vs TBD
RSL Revival
3 days
Reynor vs Astrea
Classic vs sOs
BSL Team Wars
3 days
Team Bonyth vs Team Dewalt
[ Show More ]
CranKy Ducklings
4 days
RSL Revival
4 days
GuMiho vs Cham
ByuN vs TriGGeR
Cosmonarchy
4 days
TriGGeR vs YoungYakov
YoungYakov vs HonMonO
HonMonO vs TriGGeR
[BSL 2025] Weekly
4 days
RSL Revival
5 days
Cure vs Bunny
Creator vs Zoun
BSL Team Wars
5 days
Team Hawk vs Team Sziky
Sparkling Tuna Cup
6 days
Liquipedia Results

Completed

Acropolis #4 - TS1
SEL Season 2 Championship
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 2
CSL 2025 AUTUMN (S18)
Maestros of the Game
Sisters' Call Cup
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

LASL Season 20
2025 Chongqing Offline CUP
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
EC S1
BLAST Rivals Fall 2025
Skyesports Masters 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
MESA Nomadic Masters Fall
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 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.