Jump to content

stack0s

Member
  • Posts

    10
  • Joined

  • Last visited

Everything posted by stack0s

  1. So logcat was useless, but wow I am sorry I wasn't declaring it. Lol my bad, you were right. No problem now
  2. I though declaring it initialized it... I only have errors when I try to reassign values to it. I am not sure how to search source code in Java yet so perhaps I should look into that but with out looking I would assume it's a safe be that the is a default constructor already initializing it wouldn't you say? But also, x and y are properties of the Vector3 class so they are already declared null when they are defined in the class so how could reassigning value to them be a problem? Also, yes. Recasting to an int is redundant but I was trying every possible solution as I wasn't sure the exact data types involved in the Vector3 class or how Java handles such assignments I though it was worth a try Anyway, let me try to find something in the log cat I guess
  3. Please excuse my weird variable names Can anyone figure out what the problem is here? This program keeps crashing when I run it on my current test device (google pixel 3 xl). I have tried debugging it and I am certain that the part of the code causing the crashes is the assignment operation from the taco variables into the cVec Vector3 class, this much I know. I have moved and tested it a few ways by moving this portion of code around and removing it completely. At this point I am sure it is atleast part of the problem because when I remove it the program runs fine. Does anyone have any ideas? package craigapps.com; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.math.Vector3; public class MyGdxGame extends ApplicationAdapter { SpriteBatch batch; Texture img; private OrthographicCamera cam; private ShapeRenderer sr; private Vector3 pos; public int tacox = 0; int tacoy = 0; public Vector3 cVec; @Override public void create() { batch = new SpriteBatch(); img = new Texture("badlogic.jpg"); sr = new ShapeRenderer(); cam = new OrthographicCamera(); cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); pos = new Vector3(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0); } public void addcamvalues(){ cVec.x = (int) tacox; cVec.y = (int) tacoy; } @Override public void render() { addcamvalues(); tacox++; tacoy++; Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(img, tacox, tacoy); batch.end(); //render cam.update(); if (Gdx.input.isTouched()) { pos.set(Gdx.input.getX(), Gdx.input.getY(), 0); cam.unproject(pos); } //draw sr.begin(ShapeRenderer.ShapeType.Filled); sr.setColor(Color.GREEN); sr.circle(pos.x, pos.y, 64); sr.end(); } @Override public void dispose() { batch.dispose(); img.dispose(); sr.dispose(); } }
  4. Thanks for the replies! To elaborate, I should have explained that the point of this was to discretely redirect certain computers to the development version of the web page and allow normal visitors to a more restricted version of the site. I suppose I could implement your solution however, I think it is fair to say that this method would be more tedious. I suppose I could parse the logs and some craziness. No other way?
  5. I am working on a website. I want the ability to pull MAC addresses from some visitors for development purposes but came to the understanding because I am using some free shared hosting service I cannot run exec(*) commands. I am using webhost000/hostinger and it appears I do not have access to the php.ini file... so with that being said my options do not seem to include being able to use them. So without asking to many question I would like to say I am open to any of the best possible solutions to this, but specifically I am wondering if it is possible to keep my website there but some how push the client IPs to an alternate server just for PHP content? For example, can I keep my domain name pointed to the same shared hosting server with webhost000 and use them to display all html, process basic php but may I locate specific php files that require elevated privileges on a seperate server that can run them somewhere else (such as a computer I own), and somehow make them work in unison? Ideally, my index.php webpage would still be located at the webhost000 server but since these specific elevated php scripts are not important all the time I would put them on a server at my house that would only be up when needed and process them. I need exec('get-mac') support so if the webhost000 server is doing work between clients and the backend php server (the one at my house) I need to ensure that when 'get-mac' is run that the back end server is indeed referencing the client connected to the server at webhost000 and not webhost000
  6. I basically want to do what the title says. I would like to build a long distance powered WiFi antennae for use on my own property as to not violate and laws and I would like it to be unidirectional as much as possible. What are your thoughts on buildings this, how would I go about amplifying the signal?
  7. Your calculation for findB is wrong... it should be return y - (m*x) it's not division it's subtraction but other than that this helped me because I was having a hard time with the intersection part which you did very well. I translated it back to a program in actionscript 2.0 that runs once and prints then exits. Here it is... var test = true; onEnterFrame = function () { if (test) { var PI = 3.14195; //calculates pi, 3.14159 //data set 1 var x1 = 10; var y1 = 23; var x2 = 65; var y2 = -17; //data set 2 var x3 = 49; var y3 = 25; var x4 = 7; var y4 = -12; var m1 = findM(x1, y1, x2, y2); var m2 = findM(x3, y3, x4, y4); var a = findB(y1, x1, m1); var b = findB(y3, x3, m2); /* view work so far */ trace("EQUATION 1: "); printLineEqu(m1, a); trace("EQUATION 2: "); printLineEqu(m2, b); /* done */ //parallel line check if ((m2-m1) == 0) { trace("both lines are parallel."); return 0; //exit if out of range } //calculate theta var theta = findTheta(m1, m2); if ((theta<0) || (theta>(PI/2))) { trace("theta: "+theta); trace("angle out of range."); return 0; //exit if out of range } //find intersections, if all is well var Xintersection = findXintersection(a, b, m1, m2); trace("X intersection: "+Xintersection); var Yintersection = findYintersection(a, b, m1, m2); trace("Y intersection: "+Yintersection); test = false; } }; //used for plotting on ti-89 as check, plug and chug function printLineEqu(_m:Number, _b:Number) { if (_b<0) { trace("Y = "+_m+"*x"+_b); } else { trace("Y = "+_m+"*x+"+_b); } } //find theta function findTheta(_m1:Number, _m2:Number):Number { _theta = (_m1-_m2)/(1+(_m1*_m2)); _theta = Math.abs(_theta); //absolute value _theta = Math.atan(_theta); //inverse tan return _theta; } //find the y intersection function findYintersection(_a:Number, _b:Number, _m1:Number, _m2:Number):Number { return ((_a*_m2)-(_b*_m1))/(_m2-_m1); } //Fine the x intersection function findXintersection(_a:Number, _b:Number, _m1:Number, _m2:Number):Number { return (_a-_b)/(_m2-_m1); } //find slope function findM(_x1:Number, _y1:Number, _x2:Number, _y2:Number):Number { return (_y2-_y1)/(_x2-_x1); } //find b function findB(_yB:Number, _xB:Number, _mB:Number):Number { return (_yB-(_mB*_xB)); } //find X intercept function findXintercept(_m:Number, _b:Number):Number { return ((0-_b)/_m); } //find Y intercept function findYintercept(_m:Number, _b:Number):Number { return ((_m*0)+_b); } Thanks alot!
  8. Hey thanks this is pretty helpful! But I am trying to find the intersection of two line segments...
  9. Hi I am trying to use some Actionscript 2.0 for this problem but if you can abstraction to basic algebra I think my intentions are clear... I am simply trying to calculate some X Y intercepts but am getting poor results... I studied the algebraic formula to derive this program However! I am still getting the wrong answers. Can someone please help me fix this? Here is my code test = true; var x1 = 3; var y1 = -12; var x2 = 16; var y2 = -10; var x3 = 8; var y3 = -15; var x4 = 12; var y4 = -1; function determineXY():Void { //Solve //initiate lines //line1 //m var line1m = ((y2-y1)/(x2-x1)); var line1msave = line1m; //b var line1b = (y1-(line1m*x1)); var line1bsave = line1b; //line2 //m var line2m = ((y4-y3)/(x4-x3)); var line2msave = line2m; //b var line2b = (y3-(line2m*x3)); var line2bsave = line2b; //Solve X //determine m(x) if (line1b>=0) { line2m = Math.abs(line2m)*1; } if (line1b<0) { line2m = Math.abs(line2m)*-1; } //determine b if (line2msave>=0) { line1b = Math.abs(line1b)*1; } if (line2msave<0) { line1b = Math.abs(line1b)*-1; } xint = ((line1b+line2b)/(line1m+line2m)); //Solve Y yint = ((line2msave*xint)+line2bsave); } function getXYIntercept(inputX1:Number, inputY1:Number, inputX2:Number, inputY2:Number, inputX3:Number, inputY3:Number, inputX4:Number, inputY4:Number):Void { x1 = inputX1; y1 = inputY1; x2 = inputX2; y2 = inputY2; x3 = inputX3; y3 = inputY3; x4 = inputX4; y4 = inputY4; determineXY(); //draw (this is just to visual the results) _root.createEmptyMovieClip("holder", 1); holder.lineStyle(2, 0x000000, 100); holder.moveTo(x1, y1); holder.lineTo(x2, y3); holder.moveTo(x3, y3); holder.lineTo(x4, y4); intersection._x = xint; intersection._y = yint; } onEnterFrame = function () { if (test) { getXYIntercept(x1,y1,x2,y2,x3,y3,x4,y4); trace(xint); trace(yint) } test = false; }; This is it... only thing not in the code is the movie clip referenced above
×