Search Results

Search found 328 results on 14 pages for 'bryan marble'.

Page 1/14 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Applications: Some more marble fun!

    - by TechTwaddle
    Well, yesterday night I was watching a tutorial on XNA when I came across this neat little trick. It was a simple XNA application with a Windows Phone logo in it and whenever the user clicked on the device the logo would move towards the click point, and I couldn't resist experimenting with the marble (; The code is written in C# using CF3.5. Here is a video of the demo,   You probably noticed that the motion of the marble towards the click point (destination) is not linear. The marble starts off with a high velocity and slows down as it reaches its destination. This is achieved by making the speed of the marble a function of the distance between marble's current position and the destination, so as the marble approaches the destination point, the distance between them reduces and so does the speed, until it becomes zero. More on the code and the logic behind it in the next post. What I'd like to do next is, instead of making the marble stop at the click point, it should continue to move beyond it, bounce around the screen a few times and eventually come to a stop after a while. Let's see how that goes.

    Read the article

  • Applications: The mathematics of movement, Part 1

    - by TechTwaddle
    Before you continue reading this post, a suggestion; if you haven’t read “Programming Windows Phone 7 Series” by Charles Petzold, go read it. Now. If you find 150+ pages a little too long, at least go through Chapter 5, Principles of Movement, especially the section “A Brief Review of Vectors”. This post is largely inspired from this chapter. At this point I assume you know what vectors are, how they are represented using the pair (x, y), what a unit vector is, and given a vector how you would normalize the vector to get a unit vector. Our task in this post is simple, a marble is drawn at a point on the screen, the user clicks at a random point on the device, say (destX, destY), and our program makes the marble move towards that point and stop when it is reached. The tricky part of this task is the word “towards”, it adds a direction to our problem. Making a marble bounce around the screen is simple, all you have to do is keep incrementing the X and Y co-ordinates by a certain amount and handle the boundary conditions. Here, however, we need to find out exactly how to increment the X and Y values, so that the marble appears to move towards the point where the user clicked. And this is where vectors can be so helpful. The code I’ll show you here is not ideal, we’ll be working with C# on Windows Mobile 6.x, so there is no built-in vector class that I can use, though I could have written one and done all the math inside the class. I think it is trivial to the actual problem that we are trying to solve and can be done pretty easily once you know what’s going on behind the scenes. In other words, this is an excuse for me being lazy. The first approach, uses the function Atan2() to solve the “towards” part of the problem. Atan2() takes a point (x, y) as input, Atan2(y, x), note that y goes first, and then it returns an angle in radians. What angle you ask. Imagine a line from the origin (0, 0), to the point (x, y). The angle which Atan2 returns is the angle the positive X-axis makes with that line, measured clockwise. The figure below makes it clear, wiki has good details about Atan2(), give it a read. The pair (x, y) also denotes a vector. A vector whose magnitude is the length of that line, which is Sqrt(x*x + y*y), and a direction ?, as measured from positive X axis clockwise. If you’ve read that chapter from Charles Petzold’s book, this much should be clear. Now Sine and Cosine of the angle ? are special. Cosine(?) divides x by the vectors length (adjacent by hypotenuse), thus giving us a unit vector along the X direction. And Sine(?) divides y by the vectors length (opposite by hypotenuse), thus giving us a unit vector along the Y direction. Therefore the vector represented by the pair (cos(?), sin(?)), is the unit vector (or normalization) of the vector (x, y). This unit vector has a length of 1 (remember sin2(?) + cos2(?) = 1 ?), and a direction which is the same as vector (x, y). Now if I multiply this unit vector by some amount, then I will always get a point which is a certain distance away from the origin, but, more importantly, the point will always be on that line. For example, if I multiply the unit vector with the length of the line, I get the point (x, y). Thus, all we have to do to move the marble towards our destination point, is to multiply the unit vector by a certain amount each time and draw the marble, and the marble will magically move towards the click point. Now time for some code. The application, uses a timer based frame draw method to draw the marble on the screen. The timer is disabled initially and whenever the user clicks on the screen, the timer is enabled. The callback function for the timer follows the standard Update and Draw cycle. private double totLenToTravelSqrd = 0; private double startPosX = 0, startPosY = 0; private double destX = 0, destY = 0; private void Form1_MouseUp(object sender, MouseEventArgs e) {     destX = e.X;     destY = e.Y;     double x = marble1.x - destX;     double y = marble1.y - destY;     //calculate the total length to be travelled     totLenToTravelSqrd = x * x + y * y;     //store the start position of the marble     startPosX = marble1.x;     startPosY = marble1.y;     timer1.Enabled = true; } private void timer1_Tick(object sender, EventArgs e) {     UpdatePosition();     DrawMarble(); } Form1_MouseUp() method is called when ever the user touches and releases the screen. In this function we save the click point in destX and destY, this is the destination point for the marble and we also enable the timer. We store a few more values which we will use in the UpdatePosition() method to detect when the marble has reached the destination and stop the timer. So we store the start position of the marble and the square of the total length to be travelled. I’ll leave out the term ‘sqrd’ when speaking of lengths from now on. The time out interval of the timer is set to 40ms, thus giving us a frame rate of about ~25fps. In the timer callback, we update the marble position and draw the marble. We know what DrawMarble() does, so here, we’ll only look at how UpdatePosition() is implemented; private void UpdatePosition() {     //the vector (x, y)     double x = destX - marble1.x;     double y = destY - marble1.y;     double incrX=0, incrY=0;     double distanceSqrd=0;     double speed = 6;     //distance between destination and current position, before updating marble position     distanceSqrd = x * x + y * y;     double angle = Math.Atan2(y, x);     //Cos and Sin give us the unit vector, 6 is the value we use to magnify the unit vector along the same direction     incrX = speed * Math.Cos(angle);     incrY = speed * Math.Sin(angle);     marble1.x += incrX;     marble1.y += incrY;     //check for bounds     if ((int)marble1.x < MinX + marbleWidth / 2)     {         marble1.x = MinX + marbleWidth / 2;     }     else if ((int)marble1.x > (MaxX - marbleWidth / 2))     {         marble1.x = MaxX - marbleWidth / 2;     }     if ((int)marble1.y < MinY + marbleHeight / 2)     {         marble1.y = MinY + marbleHeight / 2;     }     else if ((int)marble1.y > (MaxY - marbleHeight / 2))     {         marble1.y = MaxY - marbleHeight / 2;     }     //distance between destination and current point, after updating marble position     x = destX - marble1.x;     y = destY - marble1.y;     double newDistanceSqrd = x * x + y * y;     //length from start point to current marble position     x = startPosX - (marble1.x);     y = startPosY - (marble1.y);     double lenTraveledSqrd = x * x + y * y;     //check for end conditions     if ((int)lenTraveledSqrd >= (int)totLenToTravelSqrd)     {         System.Console.WriteLine("Stopping because destination reached");         timer1.Enabled = false;     }     else if (Math.Abs((int)distanceSqrd - (int)newDistanceSqrd) < 4)     {         System.Console.WriteLine("Stopping because no change in Old and New position");         timer1.Enabled = false;     } } Ok, so in this function, first we subtract the current marble position from the destination point to give us a vector. The first three lines of the function construct this vector (x, y). The vector (x, y) has the same length as the line from (marble1.x, marble1.y) to (destX, destY) and is in the direction pointing from (marble1.x, marble1.y) to (destX, destY). Note that marble1.x and marble1.y denote the center point of the marble. Then we use Atan2() to get the angle which this vector makes with the positive X axis and use Cosine() and Sine() of that angle to get the unit vector along that same direction. We multiply this unit vector with 6, to get the values which the position of the marble should be incremented by. This variable, speed, can be experimented with and determines how fast the marble moves towards the destination. After this, we check for bounds to make sure that the marble stays within the screen limits and finally we check for the end condition and stop the timer. The end condition has two parts to it. The first case is the normal case, where the user clicks well inside the screen. Here, we stop when the total length travelled by the marble is greater than or equal to the total length to be travelled. Simple enough. The second case is when the user clicks on the very corners of the screen. Like I said before, the values marble1.x and marble1.y denote the center point of the marble. When the user clicks on the corner, the marble moves towards the point, and after some time tries to go outside of the screen, this is when the bounds checking comes into play and corrects the marble position so that the marble stays inside the screen. In this case the marble will never travel a distance of totLenToTravelSqrd, because of the correction is its position. So here we detect the end condition when there is not much change in marbles position. I use the value 4 in the second condition above. After experimenting with a few values, 4 seemed to work okay. There is a small thing missing in the code above. In the normal case, case 1, when the update method runs for the last time, marble position over shoots the destination point. This happens because the position is incremented in steps (which are not small enough), so in this case too, we should have corrected the marble position, so that the center point of the marble sits exactly on top of the destination point. I’ll add this later and update the post. This has been a pretty long post already, so I’ll leave you with a video of how this program looks while running. Notice in the video that the marble moves like a bot, without any grace what so ever. And that is because the speed of the marble is fixed at 6. In the next post we will see how to make the marble move a little more elegantly. And also, if Atan2(), Sine() and Cosine() are a little too much to digest, we’ll see how to achieve the same effect without using them, in the next to next post maybe. Ciao!

    Read the article

  • Architecture Forum in the North 2010 - Hosted by Black Marble

    - by Stuart Brierley
    On Thursday the 8th of December I attended the "Architecture Forum in the North 2010" hosted by Black Marble. The third time this annual event has been held, it was pitched as featuring Black Marble and Microsoft UK architecture experts focusing on “Tools and Methods for Architects.... a unique opportunity to provide IT Managers, IT and software architects from Northern businesses the chance to learn about the latest technologies and best practices from Microsoft in the field of Architecture....insightful information about the latest techniques, demonstrating how with Microsoft’s architecture tools and technologies you can address your current business needs." Following a useful overview of the Architecture features of Visual Studio 2010, the rest of the day was given over to various features and ways to make use of Microsoft's Azure offerings.  While I did feel that a wider spread of technologies could have been covered (maybe a bit of Sharepoint or BizTalk even), the technological and architectural overviews of the Azure platform were well presented, informative and useful. The day was well organised and all those involved were friendly and approachable for questions and discussions.  If you are in "the North" and get a chance to attend next year I would highly recommend it.

    Read the article

  • Applications: The Mathematics of Movement, Part 2

    - by TechTwaddle
    In part 1 of this series we saw how we can make the marble move towards the click point, with a fixed speed. In this post we’ll see, first, how to get rid of Atan2(), sine() and cosine() in our calculations, and, second, reducing the speed of the marble as it approaches the destination, so it looks like the marble is easing into it’s final position. As I mentioned in one of the previous posts, this is achieved by making the speed of the marble a function of the distance between the marble and the destination point. Getting rid of Atan2(), sine() and cosine() Ok, to be fair we are not exactly getting rid of these trigonometric functions, rather, replacing one form with another. So instead of writing sin(?), we write y/length. You see the point. So instead of using the trig functions as below, double x = destX - marble1.x; double y = destY - marble1.y; //distance between destination and current position, before updating marble position distanceSqrd = x * x + y * y; double angle = Math.Atan2(y, x); //Cos and Sin give us the unit vector, 6 is the value we use to magnify the unit vector along the same direction incrX = speed * Math.Cos(angle); incrY = speed * Math.Sin(angle); marble1.x += incrX; marble1.y += incrY; we use the following, double x = destX - marble1.x; double y = destY - marble1.y; //distance between destination and marble (before updating marble position) lengthSqrd = x * x + y * y; length = Math.Sqrt(lengthSqrd); //unit vector along the same direction as vector(x, y) unitX = x / length; unitY = y / length; //update marble position incrX = speed * unitX; incrY = speed * unitY; marble1.x += incrX; marble1.y += incrY; so we replaced cos(?) with x/length and sin(?) with y/length. The result is the same.   Adding oomph to the way it moves In the last post we had the speed of the marble fixed at 6, double speed = 6; to make the marble decelerate as it moves, we have to keep updating the speed of the marble in every frame such that the speed is calculated as a function of the length. So we may have, speed = length/12; ‘length’ keeps decreasing as the marble moves and so does speed. The Form1_MouseUp() function remains the same as before, here is the UpdatePosition() method, private void UpdatePosition() {     double incrX = 0, incrY = 0;     double lengthSqrd = 0, length = 0, lengthSqrdNew = 0;     double unitX = 0, unitY = 0;     double speed = 0;     double x = destX - marble1.x;     double y = destY - marble1.y;     //distance between destination and marble (before updating marble position)     lengthSqrd = x * x + y * y;     length = Math.Sqrt(lengthSqrd);     //unit vector along the same direction as vector(x, y)     unitX = x / length;     unitY = y / length;     //speed as a function of length     speed = length / 12;     //update marble position     incrX = speed * unitX;     incrY = speed * unitY;     marble1.x += incrX;     marble1.y += incrY;     //check for bounds     if ((int)marble1.x < MinX + marbleWidth / 2)     {         marble1.x = MinX + marbleWidth / 2;     }     else if ((int)marble1.x > (MaxX - marbleWidth / 2))     {         marble1.x = MaxX - marbleWidth / 2;     }     if ((int)marble1.y < MinY + marbleHeight / 2)     {         marble1.y = MinY + marbleHeight / 2;     }     else if ((int)marble1.y > (MaxY - marbleHeight / 2))     {         marble1.y = MaxY - marbleHeight / 2;     }     //distance between destination and marble (after updating marble position)     x = destX - (marble1.x);     y = destY - (marble1.y);     lengthSqrdNew = x * x + y * y;     /*      * End Condition:      * 1. If there is not much difference between lengthSqrd and lengthSqrdNew      * 2. If the marble has moved more than or equal to a distance of totLenToTravel (see Form1_MouseUp)      */     x = startPosX - marble1.x;     y = startPosY - marble1.y;     double totLenTraveledSqrd = x * x + y * y;     if ((int)totLenTraveledSqrd >= (int)totLenToTravelSqrd)     {         System.Console.WriteLine("Stopping because Total Len has been traveled");         timer1.Enabled = false;     }     else if (Math.Abs((int)lengthSqrd - (int)lengthSqrdNew) < 4)     {         System.Console.WriteLine("Stopping because no change in Old and New");         timer1.Enabled = false;     } } A point to note here is that, in this implementation, the marble never stops because it travelled a distance of totLenToTravelSqrd (first if condition). This happens because speed is a function of the length. During the final few frames length becomes very small and so does speed; and so the amount by which the marble shifts is quite small, and the second if condition always hits true first. I’ll end this series with a third post. In part 3 we will cover two things, one, when the user clicks, the marble keeps moving in that direction, rebounding off the screen edges and keeps moving forever. Two, when the user clicks on the screen, the marble moves towards it, with it’s speed reducing by every frame. It doesn’t come to a halt when the destination point is reached, instead, it continues to move, rebounds off the screen edges and slowly comes to halt. The amount of time that the marble keeps moving depends on how far the user clicks from the marble. I had mentioned this second situation here. Finally, here’s a video of this program running,

    Read the article

  • How to configure Logitech Marble trackball

    - by user27189
    You can configure it using xinput. I tested this in 11.10 and it works very nicely. This selection is from "Ubuntuwiki" Avoid using Hal for this release because it has known issues. Put the following into terminal, using gedit: Edit $HOME/bin/trackball.sh using this command: gedit $HOME/bin/trackball.sh Then paste this into the file: #!/bin/bash dev="Logitech USB Trackball" we="Evdev Wheel Emulation" xinput set-int-prop "$dev" "$we Button" 8 8 xinput set-int-prop "$dev" "$we" 8 1 # xinput set-int-prop "$dev" "$we" 8 1 # xinput set-int-prop "$dev" "$we Button" 8 9 # xinput set-int-prop "$dev" "$we X Axis" 8 6 7 # xinput set-int-prop "$dev" "$we Y Axis" 8 4 5 # xinput set-int-prop "$dev" "Drag Lock Buttons" 8 8 Make sure trackball.sh begins with #!/bin/bash. Make the script executable by running this: chmod +x $HOME/bin/trackball.sh` Add the following lines to $HOME/.bashrc, using gedit $HOME/.bashrc and put this in the file even if it is empty: xmodmap $HOME/.Xmodmap > /dev/null 2>&1 $HOME/bin/trackball.sh Edit $HOME/.Xmodmap using: gedit $HOME/.Xmodmap pointer = 1 8 3 4 5 6 7 9 Log out and back in and viola!

    Read the article

  • Applications: The Mathematics of Movement, Part 3

    - by TechTwaddle
    Previously: Part 1, Part 2 As promised in the previous post, this post will cover two variations of the marble move program. The first one, Infinite Move, keeps the marble moving towards the click point, rebounding it off the screen edges and changing its direction when the user clicks again. The second version, Finite Move, is the same as first except that the marble does not move forever. It moves towards the click point, rebounds off the screen edges and slowly comes to rest. The amount of time that it moves depends on the distance between the click point and marble. Infinite Move This case is simple (actually both cases are simple). In this case all we need is the direction information which is exactly what the unit vector stores. So when the user clicks, you calculate the unit vector towards the click point and then keep updating the marbles position like crazy. And, of course, there is no stop condition. There’s a little more additional code in the bounds checking conditions. Whenever the marble goes off the screen boundaries, we need to reverse its direction.  Here is the code for mouse up event and UpdatePosition() method, //stores the unit vector double unitX = 0, unitY = 0; double speed = 6; //speed times the unit vector double incrX = 0, incrY = 0; private void Form1_MouseUp(object sender, MouseEventArgs e) {     double x = e.X - marble1.x;     double y = e.Y - marble1.y;     //calculate distance between click point and current marble position     double lenSqrd = x * x + y * y;     double len = Math.Sqrt(lenSqrd);     //unit vector along the same direction (from marble towards click point)     unitX = x / len;     unitY = y / len;     timer1.Enabled = true; } private void UpdatePosition() {     //amount by which to increment marble position     incrX = speed * unitX;     incrY = speed * unitY;     marble1.x += incrX;     marble1.y += incrY;     //check for bounds     if ((int)marble1.x < MinX + marbleWidth / 2)     {         marble1.x = MinX + marbleWidth / 2;         unitX *= -1;     }     else if ((int)marble1.x > (MaxX - marbleWidth / 2))     {         marble1.x = MaxX - marbleWidth / 2;         unitX *= -1;     }     if ((int)marble1.y < MinY + marbleHeight / 2)     {         marble1.y = MinY + marbleHeight / 2;         unitY *= -1;     }     else if ((int)marble1.y > (MaxY - marbleHeight / 2))     {         marble1.y = MaxY - marbleHeight / 2;         unitY *= -1;     } } So whenever the user clicks we calculate the unit vector along that direction and also the amount by which the marble position needs to be incremented. The speed in this case is fixed at 6. You can experiment with different values. And under bounds checking, whenever the marble position goes out of bounds along the x or y direction we reverse the direction of the unit vector along that direction. Here’s a video of it running;   Finite Move The code for finite move is almost exactly same as that of Infinite Move, except for the difference that the speed is not fixed and there is an end condition, so the marble comes to rest after a while. Code follows, //unit vector along the direction of click point double unitX = 0, unitY = 0; //speed of the marble double speed = 0; private void Form1_MouseUp(object sender, MouseEventArgs e) {     double x = 0, y = 0;     double lengthSqrd = 0, length = 0;     x = e.X - marble1.x;     y = e.Y - marble1.y;     lengthSqrd = x * x + y * y;     //length in pixels (between click point and current marble pos)     length = Math.Sqrt(lengthSqrd);     //unit vector along the same direction as vector(x, y)     unitX = x / length;     unitY = y / length;     speed = length / 12;     timer1.Enabled = true; } private void UpdatePosition() {     marble1.x += speed * unitX;     marble1.y += speed * unitY;     //check for bounds     if ((int)marble1.x < MinX + marbleWidth / 2)     {         marble1.x = MinX + marbleWidth / 2;         unitX *= -1;     }     else if ((int)marble1.x > (MaxX - marbleWidth / 2))     {         marble1.x = MaxX - marbleWidth / 2;         unitX *= -1;     }     if ((int)marble1.y < MinY + marbleHeight / 2)     {         marble1.y = MinY + marbleHeight / 2;         unitY *= -1;     }     else if ((int)marble1.y > (MaxY - marbleHeight / 2))     {         marble1.y = MaxY - marbleHeight / 2;         unitY *= -1;     }     //reduce speed by 3% in every loop     speed = speed * 0.97f;     if ((int)speed <= 0)     {         timer1.Enabled = false;     } } So the only difference is that the speed is calculated as a function of length when the mouse up event occurs. Again, this can be experimented with. Bounds checking is same as before. In the update and draw cycle, we reduce the speed by 3% in every cycle. Since speed is calculated as a function of length, speed = length/12, the amount of time it takes speed to reach zero is directly proportional to length. Note that the speed is in ‘pixels per 40ms’ because the timeout value of the timer is 40ms.  The readability can be improved by representing speed in ‘pixels per second’. This would require you to add some more calculations to the code, which I leave out as an exercise. Here’s a video of this second version,

    Read the article

  • Weird scp behavior

    - by bryan1967
    I am trying to scp a file but it returns immediately with the DATE and not file is copied: [cosmo] Downloads > scp V17530-01_1of2.zip bryan@elphaba:Downloads bryan@elphaba's password: Sat Apr 10 13:35:41 PDT 2010 I have never seen this before. I have confirmed that I have the sshd running on the target system and that the firewall is allowing 22/tcp. Any help on what is going on would be very much appreciated. Thanks, Bryan

    Read the article

  • Blocking Just the Parent Domain via robots.txt

    - by Bryan Hadaway
    Let's say you have a parent domain: parent.com and children subdomains under that parent domain: child1.com child2.com child3.com Is there a way to use just the following within parent.com: User-agent: * Disallow: / Considering each child has their own robots.txt stating: User-agent: * Allow: / Or is the parent robots.txt still going to have to make an exception for every single subdomain: User-agent: * Disallow: / Allow: /child1/ Allow: /child2/ Allow: /child3/ Obviously this is important and tricky territory SEO wise so I'm looking to learn the definitive and safe, best practice method here to sharpen my skills. Thanks, Bryan

    Read the article

  • Weird scp behavior

    - by bryan1967
    I am trying to scp a file but it returns immediately with the DATE and not file is copied: [cosmo] Downloads > scp V17530-01_1of2.zip bryan@elphaba:Downloads bryan@elphaba's password: Sat Apr 10 13:35:41 PDT 2010 I have never seen this before. I have confirmed that I have the sshd running on the target system and that the firewall is allowing 22/tcp. Any help on what is going on would be very much appreciated. Thanks, Bryan

    Read the article

  • Detect Autocomplete

    - by Bryan Marble
    Hello, I have some forms that have inlined labels. I have some javascript (jQuery) that detects when focus has changed or when a user is entering text that changes the class so that the inlined label disappears and isn't blocking the user's view of their entered text. The problem I'm having occurs when the browser autocompletes the form. None of the conditions below are triggered so I can't clear out the inlined label. How can I detect the fact that text has been entered via autocomplete so that I can clear the labels? The js I'm using (from http://www.zurb.com/playground/inline-form-labels): $( document ).ready( function() { $( "label.inlined + .input-text" ).each( function( type ) { $( this ).focus( function() { $( this ).prev( "label.inlined" ).addClass( "focus" ); } ); $( this ).keypress( function() { $( this ).prev( "label.inlined" ).addClass( "has-text" ) .removeClass( "focus" ); } ); $( this ).blur( function() { if( $( this ).val() == "" ) { $( this ).prev( "label.inlined" ).removeClass( "has-text" ) .removeClass( "focus" ); } } ); } ); } ); Thanks! Bryan

    Read the article

  • Best Ergonomic trackball (finger-operated, with scroll wheel) for programmer

    - by Clay Nichols
    We programmers are at great risk of RSI. After 10 years, I was having shoulder problems and switched to a trackball, which helped, then switched to my left hand which helped even more. I'm looking for a good finger-operated trackball with a scroll wheel. (I do not like the ones where you control the ball w/ your thumb. My thumb isn't as dexterous). I also want to have a scroll wheel. I currently use a Logitech Marble Mouse but the scrolling implementation is very poor. EDIT: I just tried the Marble Scroll (free software that provides better scrolling. Works great. Another option is the KatMouse addon (which I've not tried) for trackballs. I hear the old Logitech Trackman was very good, but is no longer available. Anyone have experience with the Marble Mouse (and the above fixes) ? Or any suggestions of a good trackball.

    Read the article

  • What happens to running processes when I lose a remote connection to a *nix box?

    - by David Marble
    I occasionally lose my remote SSH connection to my VPS. I use screen for long-running processes, but am wondering what happens to the processes I had running aside from those run within a screen session if I lose the connection to the box. When I re-establish a connection to the box, what happened to the bash and sshd processes that were running when I lost the connection? Today I lost connection repeatedly and noticed many more bash and sshd processes than usual. If there are processes hanging around, do I need to kill them? How could I determine which processes were abandoned from my previous session? Thanks for any replies!

    Read the article

  • Transfer DNS zones from master to slave (MS DNS to BIND9)

    - by Bryan
    Hello, I have a problem with DNS servers. My master dns server runs on Microsoft DNS server and now I want to start slave DNS server on Linux Bind9. The problems is that master MS DNS server can't validate slave DNS server (bind9) and can't resolve FQDN. Maybe, I missed something... firewall, dns configuration and network looks like ok. And the second question is: How I can make full transfer of dns zones to slave dns server? from MS DNS to BIND9 Thanks in advance. Regards, Bryan

    Read the article

  • In Rails, how to speed up machinist tests?

    - by Bryan Shen
    I'm replacing test fixtures with Machinist. But using Machinist to set up test data is very slow, because whenever a test method is run some new data are made by Machinist and saved to database. Is there any way to cache the data in memory so that using Machinist isn't so slow? Thanks, Bryan

    Read the article

  • Disable mysql startup in Ubuntu 10.04

    - by Bryan
    Hi all, I want to prevent mysql from starting in ubuntu 10.04 I have used update-rc.d -f mysql remove and confirmed that there is no link to the /etc/inid.d/mysql script from any of the rc?.d directories. I also ran sysv-rc-conf and it shows me that mysql is being called as part of the rc.d scripts. It is still starting on boot. How do I disable it? Regards, Bryan

    Read the article

  • method with two parameters which both need to be double dispatched

    - by mixm
    lets say i have a method which has two parameters. i have been implementing them as: if(aObj instance of Marble) { if(bObj instance of Bomb) { this.resolve((Marble)aObj,(Bomb)bObj); } } as you can see its not a very pretty solution. i plan to implement using double dispatching, but with two parameters which both need double dispatching, im afraid im a bit stumped. any ideas please. im implementing in java btw.

    Read the article

  • Maintain List of Active Users for Web

    - by Bryan Marble
    Problem Statement - Would like to know if particular web app user is active (i.e. logged in and using site) and be able to query for list of active users or determine a user's activity status. Constraints - Doesn't need to be exact (i.e. if a user was active within a certain timeframe, that's ok to say that they're active even if they've closed their browser). I feel like there should be a design pattern for this type of problem but haven't been able to find anything here or elsewhere on the web. Approaches I'm considering: Maintain a table that is updated any time a user performs an action (or some subset of actions). Would then query for users that have performed an action within some threshold of time. Try to monitor session information and maintain a table that lists logged in users and times out after a certain period of time. Some other more standard way of doing this? How would you approach this problem (again, from a design pattern perspective)? Thanks!

    Read the article

  • Javascript || or operator with a undefinded variable

    - by bryan sammon
    I have been doing some reading lately one article I read was from Opera. http://dev.opera.com/articles/view/javascript-best-practices/ In that article they write this: Another common situation in JavaScript is providing a preset value for a variable if it is not defined, like so: if(v){ var x = v; } else { var x = 10; } The shortcut notation for this is the double pipe character: var x = v || 10; For some reason I cant get this to work for me. Is it really possible to check to see if v is defined, if not x = 10? --Thanks. Bryan

    Read the article

  • typedef of a template with a template type as its parameter

    - by bryan sammon
    Im having a problem with a typedef below, I can seem to get it right: template <typename T> struct myclass1 { static const int member1 = T::GetSomeInt(); }; template <int I> struct myclass2 { typedef myclass1< myclass2<I> > anotherclass; static int GetSomeInt(); }; anotherclass MyObj1; // ERROR here not instantiating the class When I try and initialize a anotherclass object, it gives me an error. Any idea what I am doing wrong? There seems to be a problem with my typedef. Any help is appreciated, Thanks Bryan

    Read the article

  • Use DataSource in DataFormWebPart

    - by Bryan Shen
    I'm writing a custom web part that extends DataFormWebPart. public class MyCustomWebPart : DataFormWebPart{ // other methods public override void DataBind() { XmlDataSource source = new XmlDataSource() { Data = @" <Person> <name cap='true'>Bryan</name> <occupation>student</occupation> </Person> " }; DataSources.Add(source); base.DataBind(); } } The only noticeable thing I do is overriding the DataBind() method, where I use xml as the data source. After I deploy the web part, I set the following XSL to it: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xmp> <xsl:copy-of select="*"/> </xmp> </xsl:template> </xsl:stylesheet> This xsl will surround the input xml with a tag . So I expected the web part to display the original xml data as I wrote in C# code behind. But what shows up in the web part is this: <Person> <name cap="true" /> <occupation /> </Person> All the values within the inner-most tags disappear. What's going on? Can anybody help me? Thanks.

    Read the article

  • How to Use DataSource Property in DataFormWebPart

    - by Bryan Shen
    I'm writing a custom web part that extends DataFormWebPart. public class MyCustomWebPart : DataFormWebPart{ // other methods public override void DataBind() { XmlDataSource source = new XmlDataSource() { Data = @" <Person> <name cap='true'>Bryan</name> <occupation>student</occupation> </Person> " }; DataSources.Add(source); base.DataBind(); } } The only noticeable thing I do is overriding the DataBind() method, where I use xml as the data source. After I deploy the web part, I set the following XSL to it: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xmp> <xsl:copy-of select="*"/> </xmp> </xsl:template> </xsl:stylesheet> This xsl will surround the input xml with a tag . So I expected the web part to display the original xml data as I wrote in C# code behind. But what shows up in the web part is this: <Person> <name cap="true" /> <occupation /> </Person> All the values within the inner-most tags disappear. What's going on? Can anybody help me? Thanks.

    Read the article

  • entity framework POCO template in a n-tiers design question

    - by bryan
    HI all I was trying to follow the POCO Template walkthrough . And now I am having problems using it in n-tiers design. By following the article, I put my edmx model, and the template generated context.tt in my DAL project, and moved the generated model.tt entity classes to my Business Logic layer (BLL) project. By doing this, I could use those entities inside my BLL without referencing the DAL, I guess that is the idea of PI; without knowing anything about the data source. Now, I want to extend the entities (inside the model.tt) to perform some CUD action in the BLL project,so I added a new partial class same name as the one generated from template, public partial class Company { public static IEnumerable AllCompanies() { using(var context = new Entities()){ var q = from p in context.Companies select p; return q.ToList(); } } } however visual studio won't let me do that, and I think it was because the context.tt is in the DAL project, and the BLL project could not add a reference to the DAL project as DAL has already reference to the BLL. So I tried to added this class to the DAL and it compiled, but intelisense won't show up the BLL.Company.AllCompanies() in my web service method from my webservice project which has reference to my BLL project. What should I do now? I want to add CUD methods to the template generated entities in my BLL project, and call them in my web services from another project. I have been looking for this answer a few days already, and I really need some guides from here please. Bryan

    Read the article

  • Why is my Android app camera preview running out of memory on my AVD?

    - by Bryan
    I have yet to try this on an actual device, but expect similar results. Anyway, long story short, whenever I run my app on the emulator, it crashes due to an out of memory exception. My code really is essentially the same as the camera preview API demo from google, which runs perfectly fine. The only file in the app (that I created/use) is as below- package berbst.musicReader; import java.io.IOException; import android.app.Activity; import android.content.Context; import android.hardware.Camera; import android.os.Bundle; import android.view.SurfaceHolder; import android.view.SurfaceView; /********************************* * Music Reader v.0001 * Still VERY under construction. * @author Bryan * *********************************/ public class MusicReader extends Activity { private MainScreen main; @Override //Begin activity public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); main = new MainScreen(this); setContentView(main); } class MainScreen extends SurfaceView implements SurfaceHolder.Callback { SurfaceHolder sHolder; Camera cam; MainScreen(Context context) { super(context); //Set up SurfaceHolder sHolder = getHolder(); sHolder.addCallback(this); sHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } public void surfaceCreated(SurfaceHolder holder) { // Open the camera and start viewing cam = Camera.open(); try { cam.setPreviewDisplay(holder); } catch (IOException exception) { cam.release(); cam = null; } } public void surfaceDestroyed(SurfaceHolder holder) { // Kill all our crap with the surface cam.stopPreview(); cam.release(); cam = null; } public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { // Modify parameters to match size. Camera.Parameters params = cam.getParameters(); params.setPreviewSize(w, h); cam.setParameters(params); cam.startPreview(); } } }

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >