Search Results

Search found 2851 results on 115 pages for 'min'.

Page 10/115 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • 4096 and 8192 block size read slower than write? by using lsi 9361-8i RAID10

    - by Min Hong Tan
    is it possible that 1024 and 2048 block size read speed is faster than 4096 and 8192 block? I'm using lsi 9361-8i with RAID 10 , with 8 x Kingston E50 250G. result: 1024 = Write: 2,251 MB/s Read: 2,625 MB/s 2048 = Write: 2,141 MB/s Read: 3,672 MB/s 4096 = Write: 2,147 MB/s Read: 231 MB/s 8192 = Write: 2,147 MB/s Read: 442 MB/s is there any possible? and below is the reading when i simply want to test out the RAID 10 function and disaster test by taking out one of the 250G harddisk. the result is different like below: Result: 1024 = Write: 825 MB/s Read: 1,139 MB/s 2048 = Write: 797 MB/s Read: 1,312 MB/s 4096 = Write: 911 MB/s Read: 1,342 MB/s 8192 = Write: 786 MB/s Read: 1,204 MB/s and the result for 4096 and 8192block are different? can any one explain to me is it normal? or I need to do some tuning/configuration? will it affect my host linux performance?

    Read the article

  • How to populate RRD database with CPU and MEM usage data?

    - by Tomaszs
    I have a Lighttpd server (on Centos) and would like to display 4 graphs: lighttpd traffic, lighttpd requests per second, CPU usage and MEM usage. I've set place for rrd database for lighttpd config like this: rrdtool.binary = "/usr/bin/rrdtool" rrdtool.db-name = "/var/www/lighttpd.rrd" And put into my WWW cgi-bin sh file that gets data from lighttpd RRD file and creates graphs of traffic and requests per second like this: #!/bin/sh RRDTOOL=/usr/bin/rrdtool OUTDIR=//var/www/graphs INFILE=/var/www/lighttpd.rrd OUTPRE=lighttpd-traffic WIDTH=400 HEIGHT=100 DISP="-v bytes --title TrafficWebserver \ DEF:binraw=$INFILE:InOctets:AVERAGE \ DEF:binmaxraw=$INFILE:InOctets:MAX \ DEF:binminraw=$INFILE:InOctets:MIN \ DEF:bout=$INFILE:OutOctets:AVERAGE \ DEF:boutmax=$INFILE:OutOctets:MAX \ DEF:boutmin=$INFILE:OutOctets:MIN \ CDEF:bin=binraw,-1,* \ CDEF:binmax=binmaxraw,-1,* \ CDEF:binmin=binminraw,-1,* \ CDEF:binminmax=binmaxraw,binminraw,- \ CDEF:boutminmax=boutmax,boutmin,- \ AREA:binmin#ffffff: \ STACK:binmax#f00000: \ LINE1:binmin#a0a0a0: \ LINE1:binmax#a0a0a0: \ LINE2:bin#efb71d:incoming \ GPRINT:bin:MIN:%.2lf \ GPRINT:bin:AVERAGE:%.2lf \ GPRINT:bin:MAX:%.2lf \ AREA:boutmin#ffffff: \ STACK:boutminmax#00f000: \ LINE1:boutmin#a0a0a0: \ LINE1:boutmax#a0a0a0: \ LINE2:bout#a0a735:outgoing \ GPRINT:bout:MIN:%.2lf \ GPRINT:bout:AVERAGE:%.2lf \ GPRINT:bout:MAX:%.2lf \ " $RRDTOOL graph $OUTDIR/$OUTPRE-hour.png -a PNG --start -14400 $DISP -w $WIDTH -h $HEIGHT $RRDTOOL graph $OUTDIR/$OUTPRE-day.png -a PNG --start -86400 $DISP -w $WIDTH -h $HEIGHT $RRDTOOL graph $OUTDIR/$OUTPRE-month.png -a PNG --start -2592000 $DISP -w $WIDTH -h $HEIGHT OUTPRE=lighttpd-requests DISP="-v req --title RequestsperSecond -u 1 \ DEF:req=$INFILE:Requests:AVERAGE \ DEF:reqmax=$INFILE:Requests:MAX \ DEF:reqmin=$INFILE:Requests:MIN \ CDEF:reqminmax=reqmax,reqmin,- \ AREA:reqmin#ffffff: \ STACK:reqminmax#00f000: \ LINE1:reqmin#a0a0a0: \ LINE1:reqmax#a0a0a0: \ LINE2:req#00a735:requests" $RRDTOOL graph $OUTDIR/$OUTPRE-hour.png -a PNG --start -14400 $DISP -w $WIDTH -h $HEIGHT $RRDTOOL graph $OUTDIR/$OUTPRE-day.png -a PNG --start -86400 $DISP -w $WIDTH -h $HEIGHT $RRDTOOL graph $OUTDIR/$OUTPRE-month.png -a PNG --start -2592000 $DISP -w $WIDTH -h $HEIGHT Basically it's not my script, i get it from somewhere from the internet. Now i would like to do the same for CPU usage and MEM usage. I don't like to use any additional packages! As you can see lighttpd populates lighttpd.rrd file with traffic data and requests per second. Now i would like to the system to populate second rrd file with CPU and MEM usage, so i can add to sh file code to generate graphs for this data. How can I populate RRD file with CPU and MEM usage data? Please, NO THIRD-PARTY tools !

    Read the article

  • Excel Help: Data Input Help

    - by B-Ballerl
    Everyday I download data from a site that will have rows each filled with individual data for clients. I'm able to input the data into excel as a whole but after that I'm having trouble figuring out how to put it into a chart. For example Web visits time. So say Client 1 stayed for 5 min increasing his total time on the site to 20 min and Client 2 stayed for 0 min keeping his time of 10 min and they were both registered on new years eve, and R1's last login was today and R2's was yesterday. (R for some reason repersents Client, no idea why...). Client 3 hasn't been on since he registered keeping his total at 4 min So my data would look something like this for Today (20110104) R1,20101231,20110104,20 R2,20101231,20110103,10 R3,20101231,20101231,4 And this for the day before (201101030), R1,20101231,20110102,15 R2,20101231,20110103,10 R3,20101231,20101231,4 I get about 200+ client rows each day where even the names of the Client list are changing. Is it possible to import the data each day and fill it in a excel sheet where the Client number is off on the left hand side in a table, and the amount of time (Whole Number ex. 4) each day it spends on the site extend to the right under it's specific date see Picture? I've manage to create a manual sheet but have been unsucessful at getting excel to do any of it for me. Here are two pictures:

    Read the article

  • Copying single files into a folder that changes name every time the batch file is executed

    - by Daniel Jochem
    Can you please help, I am using this to put the text files made by the batch file into the folder created by the batch file as well. but my problem is that the name is changed of the new folder every time because it is named by the date and time it was created. This is the code: @echo off for /F " tokens=1,2,3* delims=/, " %%i IN ('date /T') DO ( set CUR_DAY_OF_WEEK=%%i set CUR_MONTH=%%j set CUR_DAY=%%k set CUR_YEAR=%%l) for /F " tokens=1,2,3* delims=:, " %%i IN ('time /T') DO ( set CUR_HOUR=%%i set CUR_MIN=%%j set AM_PM=%%k) if not exist E:\Private goto :F cd E:\Private md "E:\Private\%CUR_HOUR%.%CUR_MIN%%AM_PM% %j%%CUR_MONTH%-%CUR_DAY%-%CUR_YEAR%" goto :start :F if not exist F:\Private goto :G cd F:\Private md "F:\Private\%CUR_HOUR%.%CUR_MIN%%AM_PM% %j%%CUR_MONTH%-%CUR_DAY%-%CUR_YEAR%" goto :start :G cd G:\Private md "G:\Private\%CUR_HOUR%.%CUR_MIN%%AM_PM% %j%%CUR_MONTH%-%CUR_DAY%-%CUR_YEAR%" goto :start :start start /min A /stext A.txt start /min B /stext B.txt start /min C /stext C.txt start /min D /stext D.txt (As the directory (E:-G:) changes, how can I check all without an error? And once that is found, then put all these text files into the date folder.

    Read the article

  • Template problems: No matching function for call

    - by Nick Sweet
    I'm trying to create a template class, and when I define a non-member template function, I get the "No matching function for call to randvec()" error. I have a template class defined as: template <class T> class Vector { T x, y, z; public: //constructors Vector(); Vector(const T& x, const T& y, const T& z); Vector(const Vector& u); //accessors T getx() const; T gety() const; T getz() const; //mutators void setx(const T& x); void sety(const T& y); void setz(const T& z); //operations void operator-(); Vector plus(const Vector& v); Vector minus(const Vector& v); Vector cross(const Vector& v); T dot(const Vector& v); void times(const T& s); T length() const; //Vector<T>& randvec(); //operators Vector& operator=(const Vector& rhs); friend std::ostream& operator<< <T>(std::ostream&, const Vector<T>&); }; and the function in question, which I've defined after all those functions above, is: //random Vector template <class T> Vector<double>& randvec() { const int min=-10, max=10; Vector<double>* r = new Vector<double>; int randx, randy, randz, temp; const int bucket_size = RAND_MAX/(max-min +1); temp = rand(); //voodoo hackery do randx = (rand()/bucket_size)+min; while (randx < min || randx > max); r->setx(randx); do randy = (rand()/bucket_size)+min; while (randy < min || randy > max); r->sety(randy); do randz = (rand()/bucket_size)+min; while (randz < min || randz > max); r->setz(randz); return *r; } Yet, every time I call it in my main function using a line like: Vector<double> a(randvec()); I get that error. However, if I remove the template and define it using 'double' instead of 'T', the call to randvec() works perfectly. Why doesn't it recognize randvec()? P.S. Don't mind the bit labeled voodoo hackery - this is just a cheap hack so that I can get around another problem I encountered.

    Read the article

  • Movement and Collision with AABB

    - by Jeremy Giberson
    I'm having a little difficulty figuring out the following scenarios. http://i.stack.imgur.com/8lM6i.png In scenario A, the moving entity has fallen to (and slightly into the floor). The current position represents the projected position that will occur if I apply the acceleration & velocity as usual without worrying about collision. The Next position, represents the corrected projection position after collision check. The resulting end position is the falling entity now rests ON the floor--that is, in a consistent state of collision by sharing it's bottom X axis with the floor's top X axis. My current update loop looks like the following: // figure out forces & accelerations and project an objects next position // check collision occurrence from current position -> projected position // if a collision occurs, adjust projection position Which seems to be working for the scenario of my object falling to the floor. However, the situation becomes sticky when trying to figure out scenario's B & C. In scenario B, I'm attempt to move along the floor on the X axis (player is pressing right direction button) additionally, gravity is pulling the object into the floor. The problem is, when the object attempts to move the collision detection code is going to recognize that the object is already colliding with the floor to begin with, and auto correct any movement back to where it was before. In scenario C, I'm attempting to jump off the floor. Again, because the object is already in a constant collision with the floor, when the collision routine checks to make sure moving from current position to projected position doesn't result in a collision, it will fail because at the beginning of the motion, the object is already colliding. How do you allow movement along the edge of an object? How do you allow movement away from an object you are already colliding with. Extra Info My collision routine is based on AABB sweeping test from an old gamasutra article, http://www.gamasutra.com/view/feature/3383/simple_intersection_tests_for_games.php?page=3 My bounding box implementation is based on top left/bottom right instead of midpoint/extents, so my min/max functions are adjusted. Otherwise, here is my bounding box class with collision routines: public class BoundingBox { public XYZ topLeft; public XYZ bottomRight; public BoundingBox(float x, float y, float z, float w, float h, float d) { topLeft = new XYZ(); bottomRight = new XYZ(); topLeft.x = x; topLeft.y = y; topLeft.z = z; bottomRight.x = x+w; bottomRight.y = y+h; bottomRight.z = z+d; } public BoundingBox(XYZ position, XYZ dimensions, boolean centered) { topLeft = new XYZ(); bottomRight = new XYZ(); topLeft.x = position.x; topLeft.y = position.y; topLeft.z = position.z; bottomRight.x = position.x + (centered ? dimensions.x/2 : dimensions.x); bottomRight.y = position.y + (centered ? dimensions.y/2 : dimensions.y); bottomRight.z = position.z + (centered ? dimensions.z/2 : dimensions.z); } /** * Check if a point lies inside a bounding box * @param box * @param point * @return */ public static boolean isPointInside(BoundingBox box, XYZ point) { if(box.topLeft.x <= point.x && point.x <= box.bottomRight.x && box.topLeft.y <= point.y && point.y <= box.bottomRight.y && box.topLeft.z <= point.z && point.z <= box.bottomRight.z) return true; return false; } /** * Check for overlap between two bounding boxes using separating axis theorem * if two boxes are separated on any axis, they cannot be overlapping * @param a * @param b * @return */ public static boolean isOverlapping(BoundingBox a, BoundingBox b) { XYZ dxyz = new XYZ(b.topLeft.x - a.topLeft.x, b.topLeft.y - a.topLeft.y, b.topLeft.z - a.topLeft.z); // if b - a is positive, a is first on the axis and we should use its extent // if b -a is negative, b is first on the axis and we should use its extent // check for x axis separation if ((dxyz.x >= 0 && a.bottomRight.x-a.topLeft.x < dxyz.x) // negative scale, reverse extent sum, flip equality ||(dxyz.x < 0 && b.topLeft.x-b.bottomRight.x > dxyz.x)) return false; // check for y axis separation if ((dxyz.y >= 0 && a.bottomRight.y-a.topLeft.y < dxyz.y) // negative scale, reverse extent sum, flip equality ||(dxyz.y < 0 && b.topLeft.y-b.bottomRight.y > dxyz.y)) return false; // check for z axis separation if ((dxyz.z >= 0 && a.bottomRight.z-a.topLeft.z < dxyz.z) // negative scale, reverse extent sum, flip equality ||(dxyz.z < 0 && b.topLeft.z-b.bottomRight.z > dxyz.z)) return false; // not separated on any axis, overlapping return true; } public static boolean isContactEdge(int xyzAxis, BoundingBox a, BoundingBox b) { switch(xyzAxis) { case XYZ.XCOORD: if(a.topLeft.x == b.bottomRight.x || a.bottomRight.x == b.topLeft.x) return true; return false; case XYZ.YCOORD: if(a.topLeft.y == b.bottomRight.y || a.bottomRight.y == b.topLeft.y) return true; return false; case XYZ.ZCOORD: if(a.topLeft.z == b.bottomRight.z || a.bottomRight.z == b.topLeft.z) return true; return false; } return false; } /** * Sweep test min extent value * @param box * @param xyzCoord * @return */ public static float min(BoundingBox box, int xyzCoord) { switch(xyzCoord) { case XYZ.XCOORD: return box.topLeft.x; case XYZ.YCOORD: return box.topLeft.y; case XYZ.ZCOORD: return box.topLeft.z; default: return 0f; } } /** * Sweep test max extent value * @param box * @param xyzCoord * @return */ public static float max(BoundingBox box, int xyzCoord) { switch(xyzCoord) { case XYZ.XCOORD: return box.bottomRight.x; case XYZ.YCOORD: return box.bottomRight.y; case XYZ.ZCOORD: return box.bottomRight.z; default: return 0f; } } /** * Test if bounding box A will overlap bounding box B at any point * when box A moves from position 0 to position 1 and box B moves from position 0 to position 1 * Note, sweep test assumes bounding boxes A and B's dimensions do not change * * @param a0 box a starting position * @param a1 box a ending position * @param b0 box b starting position * @param b1 box b ending position * @param aCollisionOut xyz of box a's position when/if a collision occurs * @param bCollisionOut xyz of box b's position when/if a collision occurs * @return */ public static boolean sweepTest(BoundingBox a0, BoundingBox a1, BoundingBox b0, BoundingBox b1, XYZ aCollisionOut, XYZ bCollisionOut) { // solve in reference to A XYZ va = new XYZ(a1.topLeft.x-a0.topLeft.x, a1.topLeft.y-a0.topLeft.y, a1.topLeft.z-a0.topLeft.z); XYZ vb = new XYZ(b1.topLeft.x-b0.topLeft.x, b1.topLeft.y-b0.topLeft.y, b1.topLeft.z-b0.topLeft.z); XYZ v = new XYZ(vb.x-va.x, vb.y-va.y, vb.z-va.z); // check for initial overlap if(BoundingBox.isOverlapping(a0, b0)) { // java pass by ref/value gotcha, have to modify value can't reassign it aCollisionOut.x = a0.topLeft.x; aCollisionOut.y = a0.topLeft.y; aCollisionOut.z = a0.topLeft.z; bCollisionOut.x = b0.topLeft.x; bCollisionOut.y = b0.topLeft.y; bCollisionOut.z = b0.topLeft.z; return true; } // overlap min/maxs XYZ u0 = new XYZ(); XYZ u1 = new XYZ(1,1,1); float t0, t1; // iterate axis and find overlaps times (x=0, y=1, z=2) for(int i = 0; i < 3; i++) { float aMax = max(a0, i); float aMin = min(a0, i); float bMax = max(b0, i); float bMin = min(b0, i); float vi = XYZ.getCoord(v, i); if(aMax < bMax && vi < 0) XYZ.setCoord(u0, i, (aMax-bMin)/vi); else if(bMax < aMin && vi > 0) XYZ.setCoord(u0, i, (aMin-bMax)/vi); if(bMax > aMin && vi < 0) XYZ.setCoord(u1, i, (aMin-bMax)/vi); else if(aMax > bMin && vi > 0) XYZ.setCoord(u1, i, (aMax-bMin)/vi); } // get times of collision t0 = Math.max(u0.x, Math.max(u0.y, u0.z)); t1 = Math.min(u1.x, Math.min(u1.y, u1.z)); // collision only occurs if t0 < t1 if(t0 <= t1 && t0 != 0) // not t0 because we already tested it! { // t0 is the normalized time of the collision // then the position of the bounding boxes would // be their original position + velocity*time aCollisionOut.x = a0.topLeft.x + va.x*t0; aCollisionOut.y = a0.topLeft.y + va.y*t0; aCollisionOut.z = a0.topLeft.z + va.z*t0; bCollisionOut.x = b0.topLeft.x + vb.x*t0; bCollisionOut.y = b0.topLeft.y + vb.y*t0; bCollisionOut.z = b0.topLeft.z + vb.z*t0; return true; } else return false; } }

    Read the article

  • How do I get same scrollbar style for gtk-2.0 and gtk-3.0 apps?

    - by David López
    Sorry for my English mistakes, I'm Spanish. I'm using Ubuntu 11.10 in a tablet. I've removed overlay-scrollbars and I have increased the scrollbars size to use them with fingers. In /usr/share/themes/Ambiance/gtk-2.0/gtkrc I've changed: GtkScrollbar::slider-width = 23 GtkScrollbar::min-slider-length = 51 and added: GtkScrollbar::has-backward-stepper = 0 GtkScrollbar::has-forward-stepper = 0 In /usr/share/themes/Ambiance/gtk-3.0/gtk-widgets.css I've changed: GtkScrollbar-min-slider-length: 51; GtkRange-slider-width: 23; (in .scrollbar item) Now my scrollbars are usable with fingers, but they seem different for gtk-2.0 and gtk-3.0 apps. In the picture the left scrollbar is a gtk-2.0 app and the right one is a gtk-3.0 I want to setup gtk2.0 bar to be exactly the same as gtk3.0, that is Make upper and lower extremes empty (oranges circles in the picture) Reduce the length of the 3 horizontal lines (black ellipse) Can somebody help me? Thanks. Hola. Uso ubuntu 11.10 en una tableta; he quitado overlay-scrollbars y he incrementado el tamaño de las barras para poder usarlas con los dedos. Concretamente en /usr/share/themes/Ambiance/gtk-2.0/gtkrc be cambiado GtkScrollbar::slider-width = 23 GtkScrollbar::min-slider-length = 51 y añadido GtkScrollbar::has-backward-stepper = 0 GtkScrollbar::has-forward-stepper = 0 En /usr/share/themes/Ambiance/gtk-3.0/gtk-widgets.css he cambiado GtkScrollbar-min-slider-length: 51; GtkRange-slider-width: 23; (en el apartado.scrollbar) Mis barras son manejables con dedos, pero se ven muy distintas para aplicaciones gtk-2.0 y gtk-3.0. La barra de la izquierda de la imagen es 2.0 y la de la derecha es 3.0 Quiero configurar las barras 2.0 exactamente como las 3.0, para lo que necesito Vaciar los extremos de la barra (círculos naranjas en la imagen) Reducir la longitud de las 3 líneas horizontales (elipses negras en la imagen) ¿Alguna idea? Gracias.

    Read the article

  • JQuery Mobile: Fire Mobileinit Event

    - by Yousef_Jadallah
     Many people asked that the Mobileinit event didn't work. Simplicity just you need to follow this sequence: <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" />     <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>     <script>         $(document).bind("mobileinit", function () {             alert('mobileinit is fired');         });     </script>     <script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script> Hope that helps.  

    Read the article

  • Installed Ubuntu In a low Specs PC and it is too slow, even with LXDE

    - by Herudae
    I'm new with Linux and started with Ubuntu 11.10, I installed it in my PC (Core2Duo 2Ghz, 512Mb Ram DDR2, integrated video in Motherboard), I know the requirements for Unity are 1Gb Ram so I decided to download a Desktop environment more lightweight, so I Installed LXDE, it loads very fast, compared to the 3.5 min from login screen to open desktop in Unity, but it freezes every time I open a single program, I can't even navigate in Internet, it freezes, sometimes for a pair of minutes and the graph at bottom right is all green as if iyt were using 100% CPU, it happens with every program. As additional data it takes 3+ min to get from boot system selection screen to Login screen and 3.5 Min more to get into Ubuntu with Unity, with LXDE it turns to 30 secs aproximately. Is Ubuntu + LXDE Desktop Environment Package = Lubuntu? or should I download Lubuntu directly instead? I installed some other desktop environments, as Gnome but it doesn't log in, the screen just turns grey. Should I get an older Ubuntu version? I'm thinking about uninstalling Ubuntu but I'll try to deplete the options, thanks for your support.

    Read the article

  • Example: Controlling randomizer using code contracts

    - by DigiMortal
    One cool addition to Visual Studio 2010 is support for code contracts. Code contracts make sure that all conditions under what method is supposed to run correctly are met. Those who are familiar with unit tests will find code contracts easy to use. In this posting I will show you simple example about static contract checking (example solution is included). To try out code contracts you need at least Visual Studio 2010 Standard Edition. Also you need code contracts package. You can download package from DevLabs Code Contracts page. NB! Speakers, you can use the example solution in your presentations as long as you mention me and this blog in your sessions. Solution has readme.txt file that gives you steps to go through when presenting solution in sessions. This blog posting is companion posting for Visual Studio solution referred below. As an example let’s look at the following class. public class Randomizer {     public static int GetRandomFromRange(int min, int max)     {         var rnd = new Random();         return rnd.Next(min, max);     }       public static int GetRandomFromRangeContracted(int min, int max)     {         Contract.Requires(min < max, "Min must be less than max");           var rnd = new Random();         return rnd.Next(min, max);     } } GetRandomFromRange() method returns results without any checking. GetRandomFromRangeContracted() uses one code contract that makes sure that minimum value is less than maximum value. Now let’s run the following code. class Program {     static void Main(string[] args)     {         var random1 = Randomizer.GetRandomFromRange(0, 9);         Console.WriteLine("Random 1: " + random1);           var random2 = Randomizer.GetRandomFromRange(1, 1);         Console.WriteLine("Random 2: " + random2);           var random3 = Randomizer.GetRandomFromRangeContracted(5, 5);         Console.WriteLine("Random 3: " + random3);           Console.WriteLine(" ");         Console.WriteLine("Press any key to exit ...");         Console.ReadKey();     } } As we have not turned on support for code contracts the code runs without any problems and we get no warnings by Visual Studio that something is wrong. Now let’s turn on static checking for code contracts. As you can see then code still compiles without any errors but Visual Studio warns you about possible problems with contracts. Click on image to see it at original size.  When we open Error list and run our application we get the following output to errors list. Note that these messages are not shown immediately. There is little delay between application starting and appearance of these messages. So wait couple of seconds before going out of your mind. Click on image to see it at original size.  If you look at these warnings you can see that warnings show you illegal calls and also contracts against what they are going. Third warning points to GetRandomFromRange() method and shows that there should be also problem that can be detected by contract. Download Code Contracts example VS2010 solution | 30KB

    Read the article

  • Is chess-like AI really inapplicable in turn-based strategy games?

    - by Joh
    Obviously, trying to apply the min-max algorithm on the complete tree of moves works only for small games (I apologize to all chess enthusiasts, by "small" I do not mean "simplistic"). For typical turn-based strategy games where the board is often wider than 100 tiles and all pieces in a side can move simultaneously, the min-max algorithm is inapplicable. I was wondering if a partial min-max algorithm which limits itself to N board configurations at each depth couldn't be good enough? Using a genetic algorithm, it might be possible to find a number of board configurations that are good wrt to the evaluation function. Hopefully, these configurations might also be good wrt to long-term goals. I would be surprised if this hasn't been thought of before and tried. Has it? How does it work?

    Read the article

  • What's the best way to version CSS and JS URLs?

    - by David Eyk
    As per Yahoo's much-ballyhooed Best Practices for Speeding Up Your Site, we serve up static content from a CDN using far-future cache expiration headers. Of course, we need to occasionally update these "static" files, so we currently add an infix version as part of the filename (based on the SHA1 sum of the file contents). Thus: styles.min.css Becomes: styles.min.abcd1234.css However, managing the versioned files can become tedious, and I was wondering if a GET argument notation might be cleaner and better: styles.min.css?v=abcd1234 Which do you use, and why? Are there browser- or proxy/cache-related considerations that I should consider?

    Read the article

  • Construct an array from an existing array

    - by Luv
    Given an array of integers A[1...n-1] where 'N' is the length of array A[ ]. Construct an array B such that B[i] = min(A[i], A[i+1], ..., A[i+K-1]), where K will be given. Array B will have N-K+1 elements. We can solve the problem using min-heaps Construct min-heap for k elements - O(k) For every next element delete the first element and insert the new element and heapify Hence Worst Case Time - O( (n-k+1)*k ) + O(k) Space - O(k) Can we do it better?

    Read the article

  • Consuming too much power on a Dell 15R

    - by Daniel Davis
    I'm new to Ubuntu, and I've just installed Ubuntu 11.10, and I must say I really like it a lot. I'm getting used to Ubuntu faster than I thought but the only issue I'm having is the power consumption. I have a " dell 15R with BIOS a07" and I uninstalled Ubuntu 11.04 because of some glitches I hated. None of those appear on this Ubuntu but now my computer discharges way too quick. when I check the power icon, it states that I have like 3:45 min remaining, which is fairly the same as what win7 and Ubuntu 11.04 used to tell me but 15 min later I check again and it gives me only 1:15 min remaining. Also, my computer seems to get a lot hotter than it used to. Is there more options to control the power usage on my laptop?

    Read the article

  • The table/view 'TABLE1' does not have a primary key defined and no valid primary key could be inferr

    - by Nickson
    I get the following error message The table/view 'TABLE1' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity you will need to review your schema, add the correct keys and uncomment it when I try to add a view to an Entity Data Model. For testing, I have created a very simple view and I still get the error. below is the view definition SELECT DISTINCT TOP (100) PERCENT MIN(id) AS Expr4, MIN(EmpNo) AS Expr1, MIN(Name) AS Expr2, MIN(Category) AS Expr3 FROM dbo.MYView1 GROUP BY id does any one know of a simple work around. I have looked at this thread http://stackoverflow.com/questions/745341/can-ms-sql-views-have-primary-and-foriegn-keys but in my scenario, what is recommended is not applicable. If I could only have the view added to the Model.

    Read the article

  • How to change theme for AlertDialog.

    - by Min Soo Kim
    Hello everyone, I was wondering if someone could help me out. I am trying to create a custom AlertDialog. In order to do this, I added the following line of code in styles.xml @drawable/color_panel_background color_panel_background.9.png is located in drawable folder. This is also available in Android SDK res folder. The following is the main activity. package com.customdialog; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; public class CustomDialog extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); this.setTheme(R.style.CustomAlertDialog); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage("HELLO!"); builder .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //MyActivity.this.finish(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { //dialog.cancel(); } }); AlertDialog alertdialog = builder.create(); alertdialog.show(); } } In order to apply the theme to an AlertDialog, I had to set the theme to the current context. However, I just can't seem to get the app to show customized AlertDialog. Can anyone help me out with this, and thank you very much in advance!

    Read the article

  • Concatenate & Minify JS on the fly OR at build time - ASP.NET MVC

    - by Charlino
    As an extension to this question here Linking JavaScript Libraries in User Controls I was after some examples of how people are concatinating & minifying javascript on the fly OR at build time. I would also like to see how it then works into your master pages. I don't mind page specific files being minified and linked inidividually as they currently are (see below) but all the js files on the main master page (I have about 5 or 6) I would like concatenated and minified. Bonus points for anyone who also incorporates CSS concatenation & minification! :-) Current master page with the common js files that I would like concatenated & minified: <%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> <head runat="server"> ... BLAH ... <asp:ContentPlaceHolder ID="AdditionalHead" runat="server" /> ... BLAH ... <%= Html.CSSBlock("/styles/site.css") %> <%= Html.CSSBlock("/styles/jquery-ui-1.7.1.css") %> <%= Html.CSSBlock("/styles/jquery.lightbox-0.5.css") %> <%= Html.CSSBlock("/styles/ie6.css", 6) %> <%= Html.CSSBlock("/styles/ie7.css", 7) %> <asp:ContentPlaceHolder ID="AdditionalCSS" runat="server" /> </head> <body> ... BLAH ... <%= Html.JSBlock("/scripts/jquery-1.3.2.js", "/scripts/jquery-1.3.2.min.js") %> <%= Html.JSBlock("/scripts/jquery-ui-1.7.1.js", "/scripts/jquery-ui-1.7.1.min.js") %> <%= Html.JSBlock("/scripts/jquery.validate.js", "/scripts/jquery.validate.min.js") %> <%= Html.JSBlock("/scripts/jquery.lightbox-0.5.js", "/scripts/jquery.lightbox-0.5.min.js") %> <%= Html.JSBlock("/scripts/global.js", "/scripts/global.min.js") %> <asp:ContentPlaceHolder ID="AdditionalJS" runat="server" /> </body> Used in a page like this (which I'm happy with): <asp:Content ID="signUpContent" ContentPlaceHolderID="AdditionalJS" runat="server"> <%= Html.JSBlock("/scripts/pages/account.signup.js", "/scripts/pages/account.signup.min.js") %> </asp:Content> EDIT: What I'm using now Since asking this question, Microsoft have released their own JS & CSS compression library called Microsoft AJAX Minifier, I'd definitely recommend checking it out. It includes MSBuild tasks which are the duck's nuts.

    Read the article

  • Masked Time control in WPF

    - by Ashish Ashu
    We are in need of a control in which we can show the elapsed time in "Hour:Min:Sec" format. This control should have a spin control attached with it. Whenever we spin the spin window, it should increment the selected option ( Either hour, or min , or sec). Also the Hour may have values between 0 to 99 , Min many have values between 0 to 59 and Sec may have values between 0 to 59. Is anybody know this type of control in WPF?

    Read the article

  • Convert RGB value to HSV

    - by marionmaiden
    I've found a method on the Internet to convert RGB values to HSV values. Unfortunately, when the values are R=G=B, I'm getting a NaN, because of the 0/0 operation. Do you know if there is an implemented method for this conversion in Java, or what do I have to do when I get the 0/0 division to get the right value of the HSV? Here comes my method, adapted from some code on the Internet: public static double[] RGBtoHSV(double r, double g, double b){ double h, s, v; double min, max, delta; min = Math.min(Math.min(r, g), b); max = Math.max(Math.max(r, g), b); // V v = max; delta = max - min; // S if( max != 0 ) s = delta / max; else { s = 0; h = -1; return new double[]{h,s,v}; } // H if( r == max ) h = ( g - b ) / delta; // between yellow & magenta else if( g == max ) h = 2 + ( b - r ) / delta; // between cyan & yellow else h = 4 + ( r - g ) / delta; // between magenta & cyan h *= 60; // degrees if( h < 0 ) h += 360; return new double[]{h,s,v}; }

    Read the article

  • Macro doesn't work in the function.

    - by avp
    I have problems with following code: http://lisper.ru/apps/format/96 The problem is in "normalize" function, which does not work. It fails on the fifth line: (zero-p a indexes i) (defun normalize (a &optional indexes i) "Returns normalized A." (pragma (format t "Data=~A ~A ~A" a indexes i) (if (zero-p a indexes i) a ;; cannot normalize empty vector (let* ((mmm (format t "Zero?=~a" (zero-p a indexes i))) (L (sqrt (+ (do-op-on * a :x a :x indexes i indexes i) (do-op-on * a :y a :y indexes i indexes i) (do-op-on * a :z a :z indexes i indexes i)))) (mmm (format t "L=~a" L)) (L (/ 1D0 L)) (mmm (format t "L=~a" L))) ; L=1/length(A) (make-V3 (* (ref-of a :x indexes i) l) (* (ref-of a :y indexes i) l) (* (ref-of a :z indexes i) l)))))) in function "normalize" I call the macro "zero-p", which in turn calls macro "ref-of", which is the last in the chain. (defmacro zero-p (v &optional indexes index) "Checks if the vector is 'almost' zero length." `(and (< (ref-of ,v :x ,indexes ,index) *min+*) (< (ref-of ,v :y ,indexes ,index) *min+*) (< (ref-of ,v :z ,indexes ,index) *min+*) (> (ref-of ,v :x ,indexes ,index) *min-*) (> (ref-of ,v :y ,indexes ,index) *min-*) (> (ref-of ,v :z ,indexes ,index) *min-*))) Here is ref-of: (defmacro ref-of (values coordinate &optional indexes index) "Please see DATA STRUCTURE for details." (if indexes (cond ((eq coordinate :x) `(aref ,values (aref ,indexes ,index))) ((eq coordinate :y) `(aref ,values (+ 1 (aref ,indexes ,index)))) ((eq coordinate :z) `(aref ,values (+ 2 (aref ,indexes ,index)))) (T (error "The symbol ~S is not :X, :Y or :Z." coordinate))) (cond ((eq coordinate :x) `(aref ,values 0)) ((eq coordinate :y) `(aref ,values 1)) ((eq coordinate :z) `(aref ,values 2)) (T (error "The symbol ~S is not :X, :Y or :Z." coordinate))))) Also, in "normalize" I call the macro "do-op-on", which calls "ref-of" as well. (defmacro do-op-on (op name1 coord1 name2 coord2 &optional is1 i1 is2 i2) "Example: (do-op-on * A :x B :y i n) == A[i[n]].x*B.y" `(,op (ref-of ,name1 ,coord1 ,is1 ,i1) (ref-of ,name2 ,coord2 ,is2 ,i2))) As a result, instead of having this: (aref some-array 0) I have (aref NIL NIL) which is created in "ref-of". I suppose that I lose the symbol A from the call (normalize A). I just feel that the symbol does not survive the macroexpanson. The thing is, macroexpansoin works in REPL for each macro independently. Can anyone explain where is the mistake?

    Read the article

  • Neural Networks in C# using NeuronDotNet

    - by kingrichard2005
    Hello, I'm testing the NeuronDotNet library for a class assignment using C#. I have a very simple console application that I'm using to test some of the code snippets provided in the manual fro the library, the goal of the assignment is to teach the program how to distinguish between random points in a square which may or may not be within a circle that is also inside the square. So basically, which points inside the square are also inside the circle. Here is what I have so far: namespace _469_A7 { class Program { static void Main(string[] args) { //Initlaize the backpropogation network LinearLayer inputLayer = new LinearLayer(2); SigmoidLayer hiddenLayer = new SigmoidLayer(8); SigmoidLayer outputLayer = new SigmoidLayer(2); new BackpropagationConnector(inputLayer, hiddenLayer); new BackpropagationConnector(hiddenLayer, outputLayer); BackpropagationNetwork network = new BackpropagationNetwork(inputLayer, outputLayer); //Generate a training set for the ANN TrainingSet trainingSet = new TrainingSet(2, 2); //TEST: Generate random set of points and add to training set, //for testing purposes start with 10 samples; Point p; Program program = new Program(); //Used to access randdouble function Random rand = new Random(); for(int i = 0; i < 10; i++) { //These points will be within the circle radius Type A if(rand.NextDouble() > 0.5) { p = new Point(rand.NextDouble(), rand.NextDouble()); trainingSet.Add(new TrainingSample(new double[2] { p.getX(), p.getY() }, new double[2] { 1, 0 })); continue; } //These points will either be on the border or outside the circle Type B p = new Point(program.randdouble(1.0, 4.0), program.randdouble(1.0, 4.0)); trainingSet.Add(new TrainingSample(new double[2] { p.getX(), p.getY() }, new double[2] { 0, 1 })); } //Start network learning network.Learn(trainingSet, 100); //Stop network learning //network.StopLearning(); } //generates a psuedo-random double between min and max public double randdouble(double min, double max) { Random rand = new Random(); if (min > max) { return rand.NextDouble() * (min - max) + max; } else { return rand.NextDouble() * (max - min) + min; } } } //Class defines a point in X/Y coordinates public class Point { private double X; private double Y; public Point(double xVal, double yVal) { this.X = xVal; this.Y = yVal; } public double getX() { return X; } public double getY() { return Y; } } } This is basically all that I need, the only question I have is how to handle output?? More specifically, I need to output the value of the "step size" and the momentum, although it would be nice to output other information as well. Anyone with experience using NeuronDotNet, your input is appreciated.

    Read the article

  • cordova :: XMLHttpRequest :: setRequestHeader does not work with JSONP

    - by Aaron Saunders
    in hello world cordova 2.3.0 app trying to work with ripple added basic BackboneJS code and I get error shown above <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <script type="text/javascript" src="http://static.stackmob.com/js/json2-min.js"></script> <script type="text/javascript" src="http://static.stackmob.com/js/underscore-1.4.3-min.js"></script> <script type="text/javascript" src="http://static.stackmob.com/js/backbone-0.9.10-min.js"></script> I have started google with the proper flags --allow-file-access-from-files

    Read the article

  • Special case when calling InvokeScript with the winforms WebBrowser control does not work

    - by wang-min
    I am trying to use InvokeScript method on the WebBrowser control to execute a script on the web page that has been loaded into my WebBrowser control. If I am calling just a simple javascript function, this works properly. However, the javascript function that I am trying to call is nested within a variable like this: var holder = { DoA: function() { .... }, DoB: function() { ..... } } Calling holder.DoA works fine when called from within the javascript, but the function is not called successfully when I try to call it from within my C# code like this: object obj1 = m_webBrowser.Document.InvokeScript("holder.DoA"); Any ideas?

    Read the article

  • Java script simple question

    - by butteff
    Sorry for my bad English! I have got one question. Why when i click on the button at second time, Occurs nothing? But at first click everything is good! <form name="alert"><input type="text" name="hour"><input type="text" name="min"><input type="button" value="ok" onclick="budilnik(this.form)"> <script type="text/javascript"> function budilnik(form) { budilnik=1; min=form.min.value; hour=form.hour.value; alert (min+' '+hour+' '+budilnik); } </script>

    Read the article

  • Linq : problem with primary key

    - by Nickson
    I get the following error message The table/view 'TABLE1' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity you will need to review your schema, add the correct keys and uncomment it when I try to add a view to an Entity Data Model. For testing, I have created a very simple view and I still get the error. below is the view definition SELECT DISTINCT TOP (100) PERCENT MIN(id) AS Expr4, MIN(EmpNo) AS Expr1, MIN(Name) AS Expr2, MIN(Category) AS Expr3 FROM dbo.MYView1 GROUP BY id does any one know of a simple work around. I have looked at this thread http://stackoverflow.com/questions/745341/can-ms-sql-views-have-primary-and-foriegn-keys but in my scenario, what is recommended is not applicable. If I could only have the view added to the Model.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >