Search Results

Search found 647 results on 26 pages for 'rand mate'.

Page 7/26 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Javascript function is not getting called onclick of hx:commandExButton

    - by Sunny Mate
    When I click on the hx:commandExButton the Javascript function should get called, but it is not getting called. The Javascript function is as follows: function test() { alert('ss'); return "true"; } The hx:commandButton is as follows: <hx:commandExButton type="submit" value="Search" styleClass="action2" id="searchButton" onclick="return test();" action="#{pc_WorkInProgressUserGrid.doSearchButtonAction}" immediate="true"> </hx:commandExButton> Any suggestion would be helpful.

    Read the article

  • javascript function is not getting called onclick of hx:commant button

    - by Sunny Mate
    hi i have method called test() when iu click on the commandButton the method should get called but the method is not getting called my code is as follows method **function test() { alert('ss'); return "true"; }** and method calling is <hx:commandExButton type="submit" value="Search" styleClass="action2" id="searchButton" **onclick="return test();"** action="#{pc_WorkInProgressUserGrid.doSearchButtonAction}" immediate="true </hx:commandExButton> any suggestion would be helpful

    Read the article

  • sampling integers uniformly efficiently in python using numpy/scipy

    - by user248237
    I have a problem where depending on the result of a random coin flip, I have to sample a random starting position from a string. If the sampling of this random position is uniform over the string, I thought of two approaches to do it: one using multinomial from numpy.random, the other using the simple randint function of Python standard lib. I tested this as follows: from numpy import * from numpy.random import multinomial from random import randint import time def use_multinomial(length, num_points): probs = ones(length)/float(length) for n in range(num_points): result = multinomial(1, probs) def use_rand(length, num_points): for n in range(num_points): rand(1, length) def main(): length = 1700 num_points = 50000 t1 = time.time() use_multinomial(length, num_points) t2 = time.time() print "Multinomial took: %s seconds" %(t2 - t1) t1 = time.time() use_rand(length, num_points) t2 = time.time() print "Rand took: %s seconds" %(t2 - t1) if __name__ == '__main__': main() The output is: Multinomial took: 6.58072400093 seconds Rand took: 2.35189199448 seconds it seems like randint is faster, but it still seems very slow to me. Is there a vectorized way to get this to be much faster, using numpy or scipy? thanks.

    Read the article

  • javascript function is not getting called onclick of hx:commandButton

    - by Sunny Mate
    When I click on the hx:commandButton the method should get called but the method is not getting called. My code is as follows: function test() { alert('ss'); return "true"; } and method calling is : <hx:commandExButton type="submit" value="Search" styleClass="action2" id="searchButton" onclick="return test();" action="#{pc_WorkInProgressUserGrid.doSearchButtonAction}" immediate="true"> </hx:commandExButton> Any suggestion would be helpful.

    Read the article

  • Generating random numbers in C

    - by moonstruckhorrors
    While searching for Tutorials on generating random numbers in C I found This Topic When I try to use the rand() function with parameters, I always get the random number generated 0. When I try to use the rand() function with parameters, I always get the value 41. And whenever I try to use arc4random() and random() functions, I get a LNK2019 error. Here's what I'm doing: #include <stdlib.h> int main() { int x; x = rand(6); printf("%d", x); } This code always generate 41. Where am I going wrong?? P.S. : I'm running Windows XP SP3 and using VS2010 Command Prompt as compiler. P.P.S. : Took me 15 minutes to learn how to format properly.

    Read the article

  • keeping the header fixed in datatable while allowing its contents to scroll

    - by Sunny Mate
    I have a table with header and data. When I am scrolling the header is also getting scrolled my code is as follows: <div style="height:200px;overflow-x:auto;overflow-y:scroll;"> <h:dataTable cellpadding="0" cellspacing="0" border="0" width="60%" headerClass="HeaderCellSorted" columnClasses="DataCell" rowClasses="OddRow,EvenRow" styleClass="SearchResults" footerClass="FooterCell" id="userListTable" value="#{pc_WorkInProgressUserGrid.userGridModel.rebalanceByUserList}" var="userGridDO"> <h:column id="userNameColumn"> <f:facet name="header"> <h:outputLink id="userNameColumnLink" styleClass="Header" value="#" onclick="refreshUserGrid('DISPLAYNAME')"> <h:outputText id="userNameColID" styleClass="outputText" value="User"/> Any suggestion would be helpful.

    Read the article

  • Variable might not have been initialized error

    - by David
    When i try to compile this: public static Rand searchCount (int[] x) { int a ; int b ; ... for (int l= 0; l<x.length; l++) { if (x[l] == 0) a++ ; else if (x[l] == 1) b++ ; } ... } I get these errors: Rand.java:72: variable a might not have been initialized a++ ; ^ Rand.java:74: variable b might not have been initialized b++ ; ^ 2 errors it seems to me that i initialized them at the top of the method. Whats going wrong?

    Read the article

  • hi when i write <h:outputText value="Login Name"/> tag in my jsp i am getting Cannot find FacesConte

    - by Sunny Mate
    hi when i write <h:outputText value="Login Name"/> tag in my jsp i am getting "Cannot find FacesContext" error , with out that tag my jsp working fine here is my JSP <%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <body> Login Name <input type="text" value=""/><br> **<h:outputText value="Login Name"/>** Password<input type="password" value=""/><br> <input type="submit" value="Login"> </body> </html>

    Read the article

  • How do I generate a random string of up to a certain length?

    - by slavy13
    I would like to generate a random string (or a series of random strings, repetitions allowed) of length between 1 and n characters from some (finite) alphabet. Each string should be equally likely (in other words, the strings should be uniformly distributed). The uniformity requirement means that an algorithm like this doesn't work: alphabet = "abcdefghijklmnopqrstuvwxyz" len = rand(1, n) s = "" for(i = 0; i < len; ++i) s = s + alphabet[rand(0, 25)] (pseudo code, rand(a, b) returns a integer between a and b, inclusively, each integer equally likely) It doesn't work because shorter lengths are as likely as longer ones, meaning it's more likely to generate a shorter string than a longer one, so the result is not uniform.

    Read the article

  • subplot matplotlib wrong syntax

    - by madptr
    I am using matplotlib to subplot in a loop. For instance, i would like to subplot 49 data sets, and from the doc, i implemented it this way; import numpy as np import matplotlib.pyplot as plt X1=list(range(0,10000,1)) X1 = [ x/float(10) for x in X1 ] nb_mix = 2 parameters = [] for i in range(49): param = [] Y = [0] * len(X1) for j in range(nb_mix): mean = 5* (1 + (np.random.rand() * 2 - 1 ) * 0.5 ) var = 10* (1 + np.random.rand() * 2 - 1 ) scale = 5* ( 1 + (np.random.rand() * 2 - 1) * 0.5 ) Y = [ Y[k] + scale * np.exp(-((X1[k] - mean)/float(var))**2) for k in range(len(X1)) ] param = param + [[mean, var, scale]] ax = plt.subplot(7, 7, i + 1) ax.plot(X1, Y) parameters = parameters + [param] ax.show() However, i have an index out of range error from i=0 onwards. Where can i do better to have it works ? Thanks

    Read the article

  • Set the output of a function equal to a variable

    - by ryno
    How would i set the output of a custom php function to a variable? The function is: function getRandomColor1() { global $cols; $num_cols = count($cols); $rand = array_rand($cols); $rand_col = $cols[$rand]; echo $rand_col; unset($cols[$rand]); } How would i set getRandomColor1 equal to $RandomColor1? I need it to be a variable so I can use it in css like: #boxone1 { height: 150px; width: 150px; background: <?=$RandomColor1?>; float: left; } If its not possible to set it as a variable, how else could i put the output of the function into css?

    Read the article

  • 1 error with an array "missing return statement"

    - by danielit0w
    import javax.swing.JOptionPane; public class Mate { double suma (double x1,double x2) {return x1+x2;} double suma (double x1,double x2,double x3) {return x1+x2+x3;} double suma (int num [ ]) {int i=num.length; int j=0; int s=0; for(j=0;j < i;j++) {return (double)(s);}}} // here appears the error "missing return statement" class AplicacionMate {public static void main (String arg []) {int n[ ]={5,4,3,2,1}; double r=0.0; Mate m=new Mate ( ); r=m.suma(5,4); JOptionPane.showMessageDialog(null,"La suma 1="+r); r=m.suma(5,5,4); JOptionPane.showMessageDialog(null,"La suma 2="+r); r=m.suma(n); JOptionPane.showMessageDialog(null,"La suma del arreglo="+r); System.exit(0);}}

    Read the article

  • Particle and Physics problem.

    - by Quincy
    This was originally a forum post so I hope you guys don't mind it being 2 questions in one. I am making a game and I got some basic physics implemented. I have 2 problems, 1 with particles being drawn in the wrong place and one with going through walls while jumping in corners. Skip over to about 15 sec video showing the 2 problems : http://youtube.com/watch?v=Tm9nfWsWfiM So the problem with the particles seems to be coming from the removal, as soon as I remove that piece of code it instantly works, but there shouldn't be a problem since they shouldn't even draw when their energy gets to 0 (and then they get removed) So my first question is, how are these particles getting warped all over the screen ? Relevant code : Particle class : class Particle { //Physics public Vector2 position = new Vector2(0,0); public float direction = 180; public float speed = 100; public float energy = 1; protected float startEnergy = 1; //Visual public Sprite sprite; public float rotation = 0; public float scale = 1; public byte alpha = 255; public BlendMode blendMode { get { return sprite.BlendMode; } set { sprite.BlendMode = value; } } public Particle() { } public virtual void Think(float frameTime) { if (energy - frameTime < 0) energy = 0; else energy -= frameTime; position += new Vector2((float)Math.Cos(MathHelper.DegToRad(direction)), (float)Math.Sin(MathHelper.DegToRad(direction))) * speed * frameTime; alpha = (byte)(255 * energy / startEnergy); sprite.Rotation = rotation; sprite.Position = position; sprite.Color = new Color(sprite.Color.R, sprite.Color.G, sprite.Color.B, alpha); } public virtual void Draw(float frameTime) { if (energy > 0) { World.camera.DrawSprite(sprite); } } // Basic particle implementation class BasicSprite : Particle { public BasicSprite(Sprite _sprite) { sprite = _sprite; } } Emitter : class Emitter { protected static Random rand = new Random(); protected List<Particle> particles = new List<Particle>(); public BaseEntity target = null; public Vector2 position = new Vector2(0, 0); public bool Active = true; public float timeAlive = 0; public int particleCount = 0; public int ParticlesPerSeccond { get { return (int)(1 / particleSpawnTime); } set { particleSpawnTime = 1 / (float)value; } } public float dieTime = float.MaxValue; float particleSpawnTime = 0.05f; float spawnTime = 0; public Emitter() { } public virtual void Think(float frametime) { spawnTime += frametime; if (dieTime != float.MaxValue) { timeAlive += frametime; if (timeAlive >= dieTime) Active = false; } if (Active) { if (target != null) position = target.Position; while (spawnTime > particleSpawnTime) { spawnTime -= particleSpawnTime; AddParticle(); particleCount++; } } for (int i = 0; i < particles.Count; i++) { particles[i].Think(frametime); if (particles[i].energy <= 0) { particles.Remove(particles[i]); // As soon as this is removed, it works particleCount--; } } } public virtual void AddParticle() { } public virtual void Draw(float frametime) { foreach (Particle particle in particles) { particle.Draw(frametime); } } } class BloodEmitter : Emitter { Image image; public BloodEmitter() { image = new Image(@"Content/Particles/TinyCircle.png"); image.CreateMaskFromColor(new Color(255, 0, 255, 255)); this.dieTime = 0.5f; this.ParticlesPerSeccond = 100; } public override void AddParticle() { Sprite sprite = new Sprite(image); sprite.Color = new Color((byte)(rand.NextDouble() * 255), (byte)(rand.NextDouble() * 255), (byte)(rand.NextDouble() * 255)); BasicSprite particle = new BasicSprite(sprite); particle.direction = (float)rand.NextDouble() * 360; particle.position = position; particle.blendMode = BlendMode.Alpha; particles.Add(particle); } } The seccond problem is the physics problem, for some reason I can get through the right bottom corner while jumping. I think this is coming from me switching animations but I thought I made it compensate for that. Relevant code : PhysicsEntity : class PhysicsEntity : BaseEntity { // Horizontal movement constants protected const float maxHorizontalSpeed = 1000; protected const float horizontalAcceleration = 15; protected const float horizontalDragAir = 0.95f; protected const float horizontalDragGround = 0.95f; // Vertical movement constants protected const float maxVerticalSpeed = 1000; protected const float verticalAcceleration = 20; // Everything needed for movement and correct animations protected float movement = 0; protected bool onGround = false; protected Vector2 Velocity = new Vector2(0, 0); protected float maxSpeed = 0; float lastThink = 0; float thinkTime = 1f/60f; public PhysicsEntity(Vector2 position, Sprite sprite) : base(position, sprite) { } public override void Draw(float frameTime) { base.Draw(frameTime); } public override void Think(float frameTime) { CalculateMovement(frameTime); base.Think(frameTime); } protected void CalculateMovement(float frameTime) { lastThink += frameTime; while (lastThink > thinkTime) { onGround = false; Velocity.X = MathHelper.Clamp(Velocity.X + horizontalAcceleration * movement, -maxHorizontalSpeed, maxHorizontalSpeed); if (onGround) Velocity.X *= horizontalDragGround; else Velocity.X *= horizontalDragAir; if (maxSpeed < Velocity.X) maxSpeed = Velocity.X; Velocity.Y = MathHelper.Clamp(Velocity.Y + verticalAcceleration, -maxVerticalSpeed, maxVerticalSpeed); lastThink -= thinkTime; DoCollisions(thinkTime); DoAnimations(thinkTime); } } public virtual void DoAnimations(float frameTime) { } public void DoCollisions(float frameTime) { Position.Y += Velocity.Y * frameTime; Vector2 tileCollision = GetTileCollision(); if (tileCollision.X != -1 || tileCollision.Y != -1) { Vector2 collisionDepth = CollisionRectangle.DepthIntersection( new Rectangle( tileCollision.X * World.tileEngine.TileWidth, tileCollision.Y * World.tileEngine.TileHeight, World.tileEngine.TileWidth, World.tileEngine.TileHeight ) ); Position.Y += collisionDepth.Y; if (collisionDepth.Y < 0) onGround = true; Velocity.Y = 0; } Position.X += Velocity.X * frameTime; tileCollision = GetTileCollision(); if (tileCollision.X != -1 || tileCollision.Y != -1) { Vector2 collisionDepth = CollisionRectangle.DepthIntersection( new Rectangle( tileCollision.X * World.tileEngine.TileWidth, tileCollision.Y * World.tileEngine.TileHeight, World.tileEngine.TileWidth, World.tileEngine.TileHeight ) ); Position.X += collisionDepth.X; Velocity.X = 0; } } public void DoCollisions(Vector2 difference) { CollisionRectangle.Y = Position.Y - difference.Y; CollisionRectangle.Height += difference.Y; Vector2 tileCollision = GetTileCollision(); if (tileCollision.X != -1 || tileCollision.Y != -1) { Vector2 collisionDepth = CollisionRectangle.DepthIntersection( new Rectangle( tileCollision.X * World.tileEngine.TileWidth, tileCollision.Y * World.tileEngine.TileHeight, World.tileEngine.TileWidth, World.tileEngine.TileHeight ) ); Position.Y += collisionDepth.Y; if (collisionDepth.Y < 0) onGround = true; Velocity.Y = 0; } CollisionRectangle.X = Position.X - difference.X; CollisionRectangle.Width += difference.X; tileCollision = GetTileCollision(); if (tileCollision.X != -1 || tileCollision.Y != -1) { Vector2 collisionDepth = CollisionRectangle.DepthIntersection( new Rectangle( tileCollision.X * World.tileEngine.TileWidth, tileCollision.Y * World.tileEngine.TileHeight, World.tileEngine.TileWidth, World.tileEngine.TileHeight ) ); Position.X += collisionDepth.X; Velocity.X = 0; } } Vector2 GetTileCollision() { int topLeftTileX = (int)(CollisionRectangle.TopLeft.X / World.tileEngine.TileWidth); int topLeftTileY = (int)(CollisionRectangle.TopLeft.Y / World.tileEngine.TileHeight); int BottomRightTileX = (int)(CollisionRectangle.DownRight.X / World.tileEngine.TileWidth); int BottomRightTileY = (int)(CollisionRectangle.DownRight.Y / World.tileEngine.TileHeight); if (CollisionRectangle.DownRight.Y % World.tileEngine.TileHeight == 0) // If your exactly against the tile don't count that as being inside the tile BottomRightTileY -= 1; if (CollisionRectangle.DownRight.X % World.tileEngine.TileWidth == 0) // If your exactly against the tile don't count that as being inside the tile BottomRightTileX -= 1; for (int i = topLeftTileX; i <= BottomRightTileX; i++) { for (int j = topLeftTileY; j <= BottomRightTileY; j++) { if (World.tileEngine.TileIsSolid(i, j)) { return new Vector2(i, j); } } } return new Vector2(-1, -1); } } Player : enum State { Standing, Running, Jumping, Falling, Sliding, WallSlide } class Player : PhysicsEntity { private State state { get { return currentState; } set { if (currentState != value) { currentState = value; animationChanged = true; } } } private State currentState = State.Standing; private BasicEmitter basicEmitter = new BasicEmitter(); public bool flipped; public bool animationChanged = false; protected const float jumpPower = 600; AnimationManager animationManager; Rectangle DrawRectangle; public override Rectangle CollisionRectangle { get { return new Rectangle( Position.X - DrawRectangle.Width / 2f, Position.Y - DrawRectangle.Height / 2f, DrawRectangle.Width, DrawRectangle.Height ); } } public Player(Vector2 position, Sprite sprite) : base(position, sprite) { // Only posted the relevant bit DrawRectangle = animationManager.currentAnimation.drawingRectangle; } public override void Draw(float frameTime) { World.camera.DrawSprite( Sprite, Position + new Vector2(DrawRectangle.X, DrawRectangle.Y), animationManager.currentAnimation.drawingRectangle ); } public override void Think(float frameTime) { //I only posted the relevant stuff if (animationChanged) { // if the animation has changed make sure we compensate for the change in with and height animationChanged = false; DoCollisions(animationManager.getSizeDifference()); } DoCustomMovement(); base.Think(frameTime); if (!onGround && Velocity.Y > 0) { state = State.Falling; } } void DoCustomMovement() { if (onGround) { if (World.renderWindow.Input.IsKeyDown(KeyCode.W)) { Velocity.Y = -jumpPower; state = State.Jumping; } } } public override void DoAnimations(float frameTime) { string stateName = Enum.GetName(typeof(State), state); if (!animationManager.currentAnimationIs(stateName)) { animationManager.PlayAnimation(stateName); } animationManager.Think(frameTime); DrawRectangle = animationManager.currentAnimation.drawingRectangle; Sprite.Center = new Vector2( DrawRectangle.X + DrawRectangle.Width / 2, DrawRectangle.Y + DrawRectangle.Height / 2 ); Sprite.FlipX(flipped); } So why am I warping through walls ? I have given this some thought but I just can't seem to find out why this is happening. Full source if needed : source : http://www.mediafire.com/?rc7ddo09gnr68zd (download link)

    Read the article

  • Write a program using 3 threads, one prints 10 'A's and the second prints 'B's and the third prints 10 'C's with synchrornization

    - by user132967
    Iam try to implement this questions using threads and mutex this is my code : include include include include include define Num_thread 3 pthread_mutex_t lett[Num_thread]; void Sleep_rand(double max) { struct timespec delai; delai.tv_sec=max; delai.tv_nsec=0; nanosleep(&delai,NULL); } void *Print_Sequence(); int main() { int i; pthread_t tid[Num_thread];// this is threads identifier for(i=0;i<Num_thread;i++) pthread_mutex_init(&lett[i],0); for(i=0;i<Num_thread;i++) { printf("i=%d\n",i); /* create the threads / pthread_create(&tid[i], / This variable will have the thread is after successful creation / NULL, / send the thread attributes / Print_Sequence, / the function the thread will run / &i/ send the parameter's address to the function */); } /* Wait till threads are complete and join before main continues */ for (i = 0; i pthread_join(tid[i], NULL); } return 0; } /* The thread will begin control in this function */ void Print_Sequence(void param) { int i,j=(int)param; printf("j=%d\n",(*j)); int max; pthread_mutex_lock(&lett[0]); pthread_mutex_lock(&lett[1]); for (i = 1; i <= 10; i++) { max=(int) (8*rand()/(RAND_MAX+1.0)); Sleep_rand( max); printf("A"); } pthread_mutex_unlock(&lett[0]); pthread_mutex_lock(&lett[2]); for (i = 1; i <= 10; i++) { max=(int) (2*rand()/(RAND_MAX+1.0)); Sleep_rand( max); printf("B"); } for (i = 1; i <= 10; i++) { max=(int) (15*rand()/(RAND_MAX+1.0)); Sleep_rand( max); printf("C"); } pthread_mutex_unlock(&lett[1]); pthread_mutex_unlock(&lett[2]); pthread_exit(0); } and the o/p is like : AAAAAAAAAABBBBBBBBBBCCCCCCCCCCAAAAAAAAAABBBBBBBBBBCCCCCCCCCCAAAAAAAAAABBBBBBBBBBCCCCCCCCCC COULD ANYONE PLEASE EXPLAIN WHAT IS THE WRONG WITH CODE ??

    Read the article

  • Where i set touch effect when a spawn Srite are comming on the screen?

    - by shihab_returns
    I just create a scene where create a spawn spirit that comes from above screen height in Landscape mode. Now i want to remove spirits when i touch on it. I tried but seems the code not works and crashed also after a while. here is my code: /** TimerHandler for collision detection and cleaning up */ IUpdateHandler detect = new IUpdateHandler() { @Override public void reset() { } @Override public void onUpdate(float pSecondsElapsed) { Iterator<AnimatedSprite> targets = targetLL.iterator(); AnimatedSprite _target; while (targets.hasNext()) { _target = targets.next(); if (_target.getY() >= cameraHeight) { // removeSprite(_target, targets); tPool.recyclePoolItem(_target); targets.remove(); Log.d("ok", "---------Looop Inside-----"); // fail(); break; } } targetLL.addAll(TargetsToBeAdded); TargetsToBeAdded.clear(); } }; /** adds a target at a random location and let it move along the y-axis */ public void addTarget() { Random rand = new Random(); int minX = mTargetTextureRegion.getWidth(); int maxX = (int) (mCamera.getWidth() - mTargetTextureRegion.getWidth()); int rangeX = maxX - minX; Log.d("----point----", "minX:" + minX + "maxX:" + maxX + "rangeX:" + rangeX); int rX = rand.nextInt(rangeX) + minX; int rY = (int) mCamera.getHeight() + mTargetTextureRegion.getHeight(); Log.d("---Random x----", "Random x" + rX + "Random y" + rY); target = tPool.obtainPoolItem(); target.setPosition(rX, rY); target.animate(100); mMainScene.attachChild(target, 1); mMainScene.registerTouchArea(target); int minDuration = 2; int maxDuration = 32; int rangeDuration = maxDuration - minDuration; int actualDuration = rand.nextInt(rangeDuration) + minDuration; // MoveXModifier mod = new MoveXModifier(actualDuration, target.getX(), // -target.getWidth()); MoveYModifier mody = new MoveYModifier(actualDuration, -target.getHeight(), cameraHeight + 10); target.registerEntityModifier(mody.deepCopy()); TargetsToBeAdded.add(target); } @Override public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final ITouchArea pTouchArea, final float pTouchAreaLocalX, final float pTouchAreaLocalY) { if (pTouchArea == target) { Toast.makeText(getApplicationContext(), "Yoooooooo", Toast.LENGTH_LONG).show(); } return true; } ** My question is where i implements IOnAreaTouchListener in My code. ? ** Thanks in Advance.

    Read the article

  • sum with matlab code

    - by user27089
    i need help it is only put sum in a code line if you can understand in below i have a code in this line below -> X(i,k+1) = X(i,k) + (( X(j,k)-X(i,k))); i want to change it as: X(i,k+1) = X(i,k) + sum(( X(j,k)-X(i,k))); briefly how can I put sum on the code line clear;rand('state', 1); global xLocation; N = 4; xLocation = rand(N,1); t=2;k=1;X=[N,t]; for i=1:N X(i,1)=xLocation(i); end while( k < t ) for i = 1 : N for j = 1 : N X(i,k+1) = X(i,k) + (( X(j,k)-X(i,k))); end end k = k + 1; end

    Read the article

  • Create xml file to be used in wordpress post import

    - by adedoy
    Alright here is the thing, I have this site that was once wordpress but have been converted into 70+ static pages, the admin is deleted and the whole site is static(which means every page is in index.html), I want to create a script that makes an xml so that I will just have to import it in the new wordpress install. So far, I am able to create an XML but it only imports one post. The data source is the URL of a page and I use jquery $get to filter only to gather the post of a given archive. //html <input type="text" class="full_path"> <input type="button" value="Get Data" class="getdata"> //script $('.getdata').click(function(){ $.get($('.full_path').val(), function(data) { post = $(data).find('div [style*="width:530px;"]'); $('.result').html(post.html()); }); });//get Data Through AJAX I send the cleaned data into a php below that creates the XML: $file = 'newpost.xml'; $post_data = $_REQUEST['post_data']; // Open the file to get existing content $current = file_get_contents($file); // Append a new post to the file $catStr = ''; if(isset($post_data['categories']) && count($post_data['categories']) > 0){ foreach($post_data['categories'] as $category) { $catStr .= '<category domain="category" nicename="'.$category.'"><![CDATA['.$category.']]></category>'; } } $tagStr = ''; if(isset($post_data['tags']) && count($post_data['tags']) > 0){ foreach($post_data['tags'] as $tag) { $tagStr = '<category domain="post_tag" nicename="'.$tag.'"><![CDATA['.$tag.']]></category>'; } } $post_name = str_replace(' ','-',$post_data["title"]); $post_name = str_replace(array('"','/',':','.',',','[',']','“','”'),'',strtolower($post_name)); $post_date = '2011-4-0'.rand(1, 29).''.rand(1, 12).':'.rand(1, 59).':'.rand(1, 59); $pubTime = rand(1, 12).':'.rand(1, 59).':'.rand(1, 59).' +0000'; $post = ' <item> <title>'.$post_data["title"].'</title> <link>'.$post_data["link"].'</link> <pubDate>'.$post_data["date"].' '.$pubTime.'</pubDate> <dc:creator>admin</dc:creator> <guid isPermaLink="false">http://localhost/saunders/?p=1</guid> <description></description> <content:encoded><![CDATA['.$post_data["content"].']]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>1</wp:post_id> <wp:post_date>'.$post_date.'</wp:post_date> <wp:post_date_gmt>'.$post_date.'</wp:post_date_gmt> <wp:comment_status>open</wp:comment_status> <wp:ping_status>open</wp:ping_status> <wp:post_name>'.$post_name.'</wp:post_name> <wp:status>publish</wp:status> <wp:post_parent>0</wp:post_parent> <wp:menu_order>0</wp:menu_order> <wp:post_type>post</wp:post_type> <wp:post_password></wp:post_password> <wp:is_sticky>0</wp:is_sticky> '.$catStr.' '.$tagStr.' <wp:postmeta> <wp:meta_key>_edit_last</wp:meta_key> <wp:meta_value><![CDATA[1]]></wp:meta_value> </wp:postmeta> </item> '; // Write the contents back to the file with the appended post file_put_contents($file, $current.$post); After being appended I add the code below to complete the xml rss tag </channel> </rss> If I look and compare the xml file of one that is exported from a wordpress site, I see little difference. Please HELP!! here is a sample of a generated xml: <?xml version="1.0" encoding="UTF-8" ?> <rss version="2.0" xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wp="http://wordpress.org/export/1.2/" > <channel> <title>lols why</title> <link>http://localhost/lols</link> <description>Just another WordPress site</description> <pubDate>Wed, 03 Oct 2012 04:24:04 +0000</pubDate> <language>en-US</language> <wp:wxr_version>1.2</wp:wxr_version> <wp:base_site_url>http://localhost/lols</wp:base_site_url> <wp:base_blog_url>http://localhost/lols</wp:base_blog_url> <wp:author><wp:author_id>1</wp:author_id><wp:author_login>adedoy</wp:author_login><wp:author_email>[email protected]</wp:author_email><wp:author_display_name><![CDATA[adedoy]]></wp:author_display_name><wp:author_first_name><![CDATA[]]></wp:author_first_name><wp:author_last_name><![CDATA[]]></wp:author_last_name></wp:author> <generator>http://wordpress.org/?v=3.4.1</generator> <item> <title>Sample lift?</title> <link>../../breast-lift/delaware-breast-surgery-do-i-need-a-breast-lift/</link> <pubDate>Wed, 03 Oct 2012 9:29:16 +0000</pubDate> <dc:creator>admin</dc:creator> <guid isPermaLink="false">http://localhost/lols/?p=1</guid> <description></description> <content:encoded><![CDATA[<p>sample</p>]]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>1</wp:post_id> <wp:post_date>2011-4-0132:45:4</wp:post_date> <wp:post_date_gmt>2011-4-0132:45:4</wp:post_date_gmt> <wp:comment_status>open</wp:comment_status> <wp:ping_status>open</wp:ping_status> <wp:post_name>sample-lift?</wp:post_name> <wp:status>publish</wp:status> <wp:post_parent>0</wp:post_parent> <wp:menu_order>0</wp:menu_order> <wp:post_type>post</wp:post_type> <wp:post_password></wp:post_password> <wp:is_sticky>0</wp:is_sticky> <category domain="category" nicename="Sample Lift"><![CDATA[Sample Lift]]></category><category domain="category" nicename="Sample Procedures"><![CDATA[Yeah Procedures]]></category> <category domain="post_tag" nicename="delaware"><![CDATA[delaware]]></category> <wp:postmeta> <wp:meta_key>_edit_last</wp:meta_key> <wp:meta_value><![CDATA[1]]></wp:meta_value> </wp:postmeta> </item> <item> <title>lalalalalala</title> <link>../../administrative-tips-for-surgery/delaware-cosmetic-surgery-a-better-experience/</link> <pubDate>Wed, 03 Oct 2012 3:20:43 +0000</pubDate> <dc:creator>admin</dc:creator> <guid isPermaLink="false">http://localhost/lols/?p=1</guid> <description></description> <content:encoded><![CDATA[ lalalalalala ]]></content:encoded> <excerpt:encoded><![CDATA[]]></excerpt:encoded> <wp:post_id>1</wp:post_id> <wp:post_date>2011-4-0124:39:30</wp:post_date> <wp:post_date_gmt>2011-4-0124:39:30</wp:post_date_gmt> <wp:comment_status>open</wp:comment_status> <wp:ping_status>open</wp:ping_status> <wp:post_name>lalalalalala</wp:post_name> <wp:status>publish</wp:status> <wp:post_parent>0</wp:post_parent> <wp:menu_order>0</wp:menu_order> <wp:post_type>post</wp:post_type> <wp:post_password></wp:post_password> <wp:is_sticky>0</wp:is_sticky> <category domain="category" nicename="lalalalalala"><![CDATA[lalalalalala]]></category> <category domain="post_tag" nicename="oink"><![CDATA[oink]]></category> <wp:postmeta> <wp:meta_key>_edit_last</wp:meta_key> <wp:meta_value><![CDATA[1]]></wp:meta_value> </wp:postmeta> </item> </channel> </rss> Please tell me what am I missing....

    Read the article

  • USB key to pass password in Centos 6

    - by Andrew
    I had a room mate that put a livecd in my desktop and looked around on my machine. I caught him in the act and threw him out. I haven't had a room mate for a while now and so as to avoid the livecd issue again I encrypted the hard drive, the machine is running centos 6.3. Is there anyway that I can avoid typing the password in each time if I have usb key in the machine to feed the password to the system? Additional question. Is there anything you can suggest to solve the problem I have ? Thanks

    Read the article

  • What is user/owner 24561?

    - by ralphthemagician
    So, I just installed the node.js package from nodejs.org and I was poking around to see what it installed. Over in /usr/local/bin I saw this owner 24561. I see it in a few other places too. What is this? What does it mean? Should it be root like everything else? lrwxr-xr-x 1 root wheel 66 Jun 23 13:02 mate -> /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate -rwxr-xr-x 1 24561 wheel 18865984 Jun 29 09:32 node -rwxr-xr-x 1 24561 wheel 355 Jun 29 09:32 node-waf lrwxr-xr-x 1 root wheel 38 Jul 3 12:15 npm -> ../lib/node_modules/npm/bin/npm-cli.js What was curious is that I couldn't find any other information about this user by Googling. Using OS X Lion 10.7.4 with Xcode installed if that makes any difference.

    Read the article

  • CodePlex Daily Summary for Sunday, July 01, 2012

    CodePlex Daily Summary for Sunday, July 01, 2012Popular ReleasesEnterprise Library 5 Caching with ProtoBuf.NET: Initial Release: This is the initial version, which includes zipped up sourcecode????: ????2.0.3: 1、???????????。 2、????????。 3、????????????。 4、bug??,????。Apworks: Apworks (v2.5.4563.21309, 30JUN2012): Installation Prerequisites: 1. Microsoft .NET Framework 4.0 SP1 2. Microsoft Visual Studio 2010 SP1 3. Other required libraries & assemblies are now included in the installation package so no more prerequisites needed Functional Updates: 1. Refactor the identity field of the IEntity interface from 'Id' to 'ID' 2. Changed the MySql Storage to use the MySql NetConnector version 6.4.4. 3. Implemented the paging support for the repositories. 4. Added the Eager Loading Property specification t...Turing Machine Simulator in C#: TuringMachineSimulator 1.0 Setup: Initial release.RESTester: First version: First beta release that contain following features: - specify http method - specify content type - specify url - specify custom headers - make request - see request result in plain text, XML, JSON, WEB form - save request to DB - load request from DB - delete request from DBScreen Mate: ScreenMate17551.7z: ScreenMate17551.7z - Full Source StarTrek.exe - Just the exe for USSExcelsiorNCC-2000myManga: myManga v1.0.0.6: ChangeLogUpdating from Previous Version: Extract contents of Release - myManga v1.0.0.5.zip to previous version's folder. Replaces: myManga.exe BakaBox.dll CoreMangaClasses.dll Manga.dll Plugins/MangaReader.manga.dll Plugins/MangaFox.manga.dll Plugins/MangaHere.manga.dll Plugins/MangaPanda.manga.dllMagelia WebStore Open-source Ecommerce software: Magelia WebStore 2.0: User Right Licensing ContentType version 2.0.267.1Supporting Guidance and Whitepapers: v1 - Supporting Media: Welcome to the Release Candidate (RC) release of the ALM Rangers Readiness supporting edia As this is a RC release and the quality bar for the final Release has not been achieved, we value your candid feedback and recommend that you do not use or deploy these RC artifacts in a production environment. Quality-Bar Details All critical bugs have been resolved Known Issues / Bugs Practical Ruck training workshop not yet includedDesigning Windows 8 Applications with C# and XAML: Chapters 1 - 7 Release Preview: Source code for all examples from Chapters 1 - 7 for the Release PreviewMicrosoft Ajax Minifier: Microsoft Ajax Minifier 4.57: Fix for issue #18284: evaluating literal expressions in the pattern c1 * (x / c2) where c1/c2 is an integer value (as opposed to c2/c1 being the integer) caused the expression to be destroyed.Visual Studio ALM Quick Reference Guidance: v2 - Visual Studio 2010 (Japanese): Rex Tang (?? ??) http://blogs.msdn.com/b/willy-peter_schaub/archive/2011/12/08/introducing-the-visual-studio-alm-rangers-rex-tang.aspx, Takaho Yamaguchi (?? ??), Masashi Fujiwara (?? ??), localized and reviewed the Quick Reference Guidance for the Japanese communities, based on http://vsarquickguide.codeplex.com/releases/view/52402. The Japanese guidance is available in AllGuides and Everything packages. The AllGuides package contains guidances in PDF file format, while the Everything packag...Visual Studio Team Foundation Server Branching and Merging Guide: v1 - Visual Studio 2010 (Japanese): Rex Tang (?? ??) http://blogs.msdn.com/b/willy-peter_schaub/archive/2011/12/08/introducing-the-visual-studio-alm-rangers-rex-tang.aspx, Takaho Yamaguchi (?? ??), Hirokazu Higashino (?? ??), localized and reviewed the Branching Guidance for the Japanese communities, based on http://vsarbranchingguide.codeplex.com/releases/view/38849. The Japanese guidance is available in AllGuides and Everything packages. The AllGuides package contains guidances in PDF file format, while the Everything packag...SQL Server FineBuild: Version 3.1.0: Top SQL Server FineBuild Version 3.1.0This is the stable version of FineBuild for SQL Server 2012, 2008 R2, 2008 and 2005 Documentation FineBuild Wiki containing details of the FineBuild process Known Issues Limitations with this release FineBuild V3.1.0 Release Contents List of changes included in this release Please DonateFineBuild is free, but please donate what you think FineBuild is worth as everything goes to charity. Tearfund is one of the UK's leading relief and de...EasySL: RapidSL V2: Rewrite RapidSL UI Framework, Using Silverlight 5.0 EF4.1 Code First Ria Service SP2 + Lastest Silverlight Toolkit.SOLID by example: All examples: All solid examplesSiteMap Editor for Microsoft Dynamics CRM 2011: SiteMap Editor (1.1.1726.406): Use of new version of connection controls for a full support of OSDP authentication mechanism for CRM Online.Umbraco CMS: Umbraco CMS 5.2: Development on Umbraco v5 discontinued After much discussion and consultation with leaders from the Umbraco community it was decided that work on the v5 branch would be discontinued with efforts being refocused on the stable and feature rich v4 branch. For full details as to why this decision was made please watch the CodeGarden 12 Keynote. What about all that hard work?!?? We are not binning everything and it does not mean that all work done on 5 is lost! we are taking all of the best and m...CodeGenerate: CodeGenerate Alpha: The Project can auto generate C# code. Include BLL Layer、Domain Layer、IDAL Layer、DAL Layer. Support SqlServer And Oracle This is a alpha program,but which can run and generate code. Generate database table info into MS WordXDA ROM HUB: XDA ROM HUB v0.9: Kernel listing added -- Thanks to iONEx Added scripts installer button. Added "Nandroid On The Go" -- Perform a Nandroid backup without a PC! Added official Android app!New ProjectsAdventureWorks Portal: This project will serve as a demonstration of web-based composite application using HTML 5 (with JSRender), ASP.NET MVC 4, Unity, and Entity Framework.Arkalia Core: Basic vD1.29.1 emulatorBooncraft: This project is a launcher for minecraft that loads and updates the BoonCraft mod pack. See 352n.dyndns.org for more info on BoonCraft.CloudWebSiteDemo: Windows Azure demo codeComputer Mayhem: Computer Mayhem is a growing collection of computer related add-ons for Mayhem.CSharp Extensions: Piccolo insieme di estensioni alla libreria standard di C#D3MediaLib: Diablo 3 Media LibraryEpub Editor: A simple epub editor that allows you to make quick changes to epub source files.IpScanner: The IpScanner windows application should help discovering hosts in a ip based network. The project is written in C#jQuery UI Script# Import Library: This library allows you to develop C# code against the jQueryUI API. This library is a Script# import library with definitions for the jQueryUI v1.8.21 API.Mayhem KeyLogger: The reaction module created allows for a given user to write text to a given file. When enough mappings between Key Press Events and my reaction module, the MayMayhem Keypress Module: The Mayhem Keypress Module was written as a reaction module for the purpose of simulating a keypress. Given an event, a certain key will be pressed in reaction.mIP - A C# Managed TCP/IP Stack for .NET Micro Framework: A fully managed TCP/IP stack for .NET MicroFramework with the primary purpose of enabling web servers. Local Name Resolution for Windows and iOS is automatic!OL 2012 Mayhem: OL 2012 Mayhem is a collection of OL 2012 related add-ons for Mayhem.PHP Code Model: A PHP class library that abstracts PHP language constructs with the goal is to facilitate automated PHP code generationQTalk: QChat, using Gtalk technologyreal date & time for command mode in windows OS: This is a console application to output date and time in specified format in Windows OS both 32 and 64 bits.RESTester: Help to create web requests with all needed customization. Available possibility to save any request to database and in any time recover it.Screen Mate: This project is an open source Visual Studio 2010 C# WinForms screen mate template. As a Star Trek fan (Trekee) my first screen mate will be starships.Sensor Mayhem: Sensor Mayhem is a growing collection of sensor and location related add-ons for Mayhem.SharpTFTP: TFTP server/client lib for .Net/C# (v3.5) implementing RFC1350 The TFTP Protocol (Revision 2), RFC2347 TFTP Option Extension and RFC 2348 TFTP Blocksize Option.Turing Machine Simulator in C#: Turing machine simulator simulates the working of Turing machine. Turing machine is used to study model of computation. Twilio Mayhem: Twilio Mayhem is a growing collection of Twilio related add-ons for Mayhem.Vimeo API for Metro and Windows Runtime: This library helps you to easily access the Vimeo Advanced API from your Metro style applications. It is based on the VimeoDotNet code, and supports Upload API.?????????? ?????: ?????????? ????? ?????????? ? ?????????????? ????????? ??????? ?????????????????? ? ????????? ???????

    Read the article

  • Genetic Algorithm new generation exponentially increasing

    - by Rdz
    I'm programming Genetic Algorithm in C++ and after searching all kind of ways of doing GA'a operators (selection, crossover, mutation) I came up with a doubt. Let's say I have an initial population of 500. My selection will consist in getting the top 20% of 500(based on best fitness). So I get 100 individuals to mate. When I do the crossover I'll get 2 children where both together have 50% of surviving. So far so good. I start the mutation, and everything's ok.. Now when I start choosing the Next generation, I see that I have a big number of children (in this case, 4950 if you wanna know). Now the thing is, every time I run GA, if I send all the children to the next generation, the number of individuals per generation will increase exponentially. So there must be a way of choosing the children to fulfill a new generation without getting out of this range of the initial population. What I'm asking here is if there is anyway of choosing the children to fill the new generations OR should I choose somehow (and maybe reduce) the parents to mate so I don't get so many children in the end. Thanks :)

    Read the article

  • Random number Generator in C#

    - by Sunil
    Why do i need to create an instance of Random class, if i want to create a random number between 1 and 100 ....like Random rand = new Random(); rand.Next(1,100); Is there any static function of Random class to do the same? like... Random.Next(1,100); I don't want to create an instance unnecessarily

    Read the article

  • Why is this class re-initialized every time?

    - by pinnacler
    I have 4 files and the code 'works' as expected. I try to clean everything up, place code into functions, etc... and everything looks fine... and it doesn't work. Can somebody please explain why MatLab is so quirky... or am I just stupid? Normally, I type terminator = simulation(100,20,0,0,0,1); terminator.animate(); and it should produce a map of trees with the terminator walking around in a forest. Everything rotates to his perspective. When I break it into functions... everything ceases to work. I really only changed a few lines of code, shown in comments. Code that works: classdef simulation properties landmarks robot end methods function obj = simulation(mapSize, trees, x,y,heading,velocity) obj.landmarks = landmarks(mapSize, trees); obj.robot = robot(x,y,heading,velocity); end function animate(obj) %Setup Plots fig=figure; xlabel('meters'), ylabel('meters') set(fig, 'name', 'Phil''s AWESOME 80''s Robot Simulator') xymax = obj.landmarks.mapSize*3; xymin = -(obj.landmarks.mapSize*3); l=scatter([0],[0],'bo'); axis([xymin xymax xymin xymax]); obj.landmarks.apparentPositions %Simulation Loop THIS WAS ORGANIZED for n = 1:720, %Calculate and Set Heading/Location obj.robot.headingChange = navigate(n); %Update Position obj.robot.heading = obj.robot.heading + obj.robot.headingChange; obj.landmarks.heading = obj.robot.heading; y = cosd(obj.robot.heading); x = sind(obj.robot.heading); obj.robot.x = obj.robot.x + (x*obj.robot.velocity); obj.robot.y = obj.robot.y + (y*obj.robot.velocity); obj.landmarks.x = obj.robot.x; obj.landmarks.y = obj.robot.y; %Animate set(l,'XData',obj.landmarks.apparentPositions(:,1),'YData',obj.landmarks.apparentPositions(:,2)); rectangle('Position',[-2,-2,4,4]); drawnow end end end end ----------- classdef landmarks properties fixedPositions %# positions in a fixed coordinate system. [ x, y ] mapSize = 10; %Map Size. Value is side of square x=0; y=0; heading=0; headingChange=0; end properties (Dependent) apparentPositions end methods function obj = landmarks(mapSize, numberOfTrees) obj.mapSize = mapSize; obj.fixedPositions = obj.mapSize * rand([numberOfTrees, 2]) .* sign(rand([numberOfTrees, 2]) - 0.5); end function apparent = get.apparentPositions(obj) %-STILL ROTATES AROUND ORIGINAL ORIGIN currentPosition = [obj.x ; obj.y]; apparent = bsxfun(@minus,(obj.fixedPositions)',currentPosition)'; apparent = ([cosd(obj.heading) -sind(obj.heading) ; sind(obj.heading) cosd(obj.heading)] * (apparent)')'; end end end ---------- classdef robot properties x y heading velocity headingChange end methods function obj = robot(x,y,heading,velocity) obj.x = x; obj.y = y; obj.heading = heading; obj.velocity = velocity; end end end ---------- function headingChange = navigate(n) %steeringChange = 5 * rand(1) * sign(rand(1) - 0.5); Most chaotic shit %Draw an S if n <270 headingChange=1; elseif n<540 headingChange=-1; elseif n<720 headingChange=1; else headingChange=1; end end Code that does not work... classdef simulation properties landmarks robot end methods function obj = simulation(mapSize, trees, x,y,heading,velocity) obj.landmarks = landmarks(mapSize, trees); obj.robot = robot(x,y,heading,velocity); end function animate(obj) %Setup Plots fig=figure; xlabel('meters'), ylabel('meters') set(fig, 'name', 'Phil''s AWESOME 80''s Robot Simulator') xymax = obj.landmarks.mapSize*3; xymin = -(obj.landmarks.mapSize*3); l=scatter([0],[0],'bo'); axis([xymin xymax xymin xymax]); obj.landmarks.apparentPositions %Simulation Loop for n = 1:720, %Calculate and Set Heading/Location %Update Position headingChange = navigate(n); obj.robot.updatePosition(headingChange); obj.landmarks.updatePerspective(obj.robot.heading, obj.robot.x, obj.robot.y); %Animate set(l,'XData',obj.landmarks.apparentPositions(:,1),'YData',obj.landmarks.apparentPositions(:,2)); rectangle('Position',[-2,-2,4,4]); drawnow end end end end ----------------- classdef landmarks properties fixedPositions; %# positions in a fixed coordinate system. [ x, y ] mapSize; %Map Size. Value is side of square x; y; heading; headingChange; end properties (Dependent) apparentPositions end methods function obj = createLandmarks(mapSize, numberOfTrees) obj.mapSize = mapSize; obj.fixedPositions = obj.mapSize * rand([numberOfTrees, 2]) .* sign(rand([numberOfTrees, 2]) - 0.5); end function apparent = get.apparentPositions(obj) %-STILL ROTATES AROUND ORIGINAL ORIGIN currentPosition = [obj.x ; obj.y]; apparent = bsxfun(@minus,(obj.fixedPositions)',currentPosition)'; apparent = ([cosd(obj.heading) -sind(obj.heading) ; sind(obj.heading) cosd(obj.heading)] * (apparent)')'; end function updatePerspective(obj,tempHeading,tempX,tempY) obj.heading = tempHeading; obj.x = tempX; obj.y = tempY; end end end ----------------- classdef robot properties x y heading velocity end methods function obj = robot(x,y,heading,velocity) obj.x = x; obj.y = y; obj.heading = heading; obj.velocity = velocity; end function updatePosition(obj,headingChange) obj.heading = obj.heading + headingChange; tempy = cosd(obj.heading); tempx = sind(obj.heading); obj.x = obj.x + (tempx*obj.velocity); obj.y = obj.y + (tempy*obj.velocity); end end end The navigate function is the same... I would appreciate any help as to why things aren't working. All I did was take the code from the first section from under comment: %Simulation Loop THIS WAS ORGANIZED and break it into 2 functions. One in robot and one in landmarks. Is a new instance created every time because it's constantly printing the same heading for this line int he robot class obj.heading = obj.heading + headingChange;

    Read the article

  • Random numbers from -10 to 10 in C++

    - by Chris_45
    How does one make random numbers in the interval -10 to 10 in C++ ? srand(int(time(0)));//seed for(int i = 0; i < size; i++){ myArray[i] = 1 + rand() % 20 - 10;//this will give from -9 to 10 myArray2[i] =rand() % 20 - 10;//and this will -10 to 9 }

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >