Search Results

Search found 5718 results on 229 pages for 'apply'.

Page 12/229 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • XSLT apply attribute depending on position

    - by Burt
    I am using XSLT for a website based on the 960 grid css framework. I have columns of divs that span across the page if it is the first div in a row it should have a class first applied, if it is the middle one then no class and if it is the 3rd in the row it should have the class last applied. I am really scratching my head as the best way to go about this any help is appreciated. Below is the structure I want to end up with, the numbers inside the divs represent the position. <div class="container_12"> <div id="main-content" class="alpha grid_12" style="margin-bottom: 20px;"> <div class="grid_4 alpha"> 1 </div> <div class="grid_4 "> 2 </div> <div class="grid_4 omega"> 3 </div> <div class="grid_4 alpha"> 4 </div> </div> </div>

    Read the article

  • Apply Xslt on in-memory Xml and returning in-memory Xml

    - by Jan Willem B
    I am looking for a static function in the .NET framework which takes an XML snippet and an Xslt file, applies the transformation in memory, and returns the transformed XML. I would like to do this: string rawXml = invoiceTemplateDoc.MainDocumentPart.Document.InnerXml; rawXml = DoXsltTransformation(rawXml, @"c:\prepare-invoice.xslt")); // ... do more manipulations on the rawXml Alternatively, instead of taking and returning strings, it could be taking and returning XmlNodes. Is there such a function?

    Read the article

  • jquery :has check for images then apply css

    - by sp-1986
    If relatedProductsArea contains NO images then HIDE the div. <div id="RelatedProductsArea" style="border-radius: 7px 7px 7px 7px;"><br clear="all"><div style="clear:both;"></div> </div> Finding NO images means there are no related products. What i have tried: $('#RelatedProductsArea').has('img').css('border', 'none'); Heres an example: http://jsfiddle.net/K2Cp6/

    Read the article

  • Apply css to AREA MAP

    - by PeterCPWong
    I'm created a very large map with many poly areas (over 20 coordinates each) for regions within the map. However, you can't add css to the AREA tag as I was told it's not a visible element. What I want to do is when the user hovers over an area on the map, I want it to be "highlighted" by applying a 1px border to the specific AREA element. Is there a way of doing this? No, I'm not going to resort using rectangles.

    Read the article

  • Easy way to apply a function to an array

    - by alex
    I am aware of array_walk() and array_map(). However when using the former like so (on an old project) it failed array_walk($_POST, 'mysql_real_escape_string'); Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given. So I went with this slightly more ugly version foreach($_POST as $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } So why didn't the first way work? What is the best way to map values of an array to a function?

    Read the article

  • php:: apply backticks to first word in sentence

    - by Hailwood
    Hi guys, basically what I am trying to do is, I have an array that looks something like this: array( array( 'select' =>'first string', 'escape' => true ), array( 'select' =>'second', 'escape' => true ), array( 'select' =>'the third string', 'escape' => true ), array( 'select' =>'fourth string', 'escape' => false ), ) I am looping over it and I want to end up with this output array( array( 'select' =>'`first` string', 'escape' => true ), array( 'select' =>'`second`', 'escape' => true ), array( 'select' =>'`the` third string', 'escape' => true ), array( 'select' =>'fourth string', 'escape' => false ), ) so basic rules are backticks are only applied if escape is true backticks are only applied to the first word in a sentence if there is only one word backticks are applied to the word My plan was to use if($item['escape']) { $pos = (strpos($item['select'], ' ') === false ? strlen($item['select']) : strpos($item['select'], ' ')); $item['select'] = '`' . substr($item['select'], 0, $pos) . '`' . substr($item['select'], $pos, strlen($item['select'])); } but the $item['select'] = line seems rather long winded, is there a better way to write it?

    Read the article

  • How to apply a folder template to more than one selected folder in Vista?

    - by Albic
    I would like to apply a folder template to a number of folders. I selected the folders, opened the properties, selected the folder template (e. g. Music Details) and clicked OK. When I checked the folders I noticed that the template was only applied to the folder I performed the right click to open the properties on. The other folders remained untouched. I can't apply the template to the parent folder and use the "Also apply this template to all subfolders" option because the template should only be applied to specific folders and not all. Going over each folder in not an option because it's a large amount of folders. Is it possible to apply a folder template to more than one selected folder at a time?

    Read the article

  • KnockoutJS 2.3.0 - Uncaught Error: You cannot apply bindings multiple times to the same element.

    - by Aligned
    Originally posted on: http://geekswithblogs.net/Aligned/archive/2013/07/25/knockoutjs-2.3.0---uncaught-error-you-cannot-apply-bindings-multiple.aspxI upgrade KnockoutJs through Nuget and started getting the error ‘Uncaught Error: You cannot apply bindings multiple times to the same element.’ when I used applyBindings after the main page load. I had some dynamically added DOM elements and re-applying bindings worked before. It always seemed like a workaround/hack, but now Knockout is telling me that I shouldn’t do it. The quick way to fix this is to use ko.cleanNode($(‘#id’) and this works. A different/possibly better way, as suggested by x0n might be to use templates and Knockout’s template binding (<script type=’text/html’>…</script>).   Thanks again to the StackOverflow community for quickly providing me with the solution. Check out my question for all the details.

    Read the article

  • Where to apply these akonadi settings for mysql-server?

    - by piedro
    I Am using an external mysql-server to work with akonadi. (using KDE4). Now I could solve all problems with it, but I still have to apply some settings to the "mysql-global.conf"-file of the server. That's what is suggested for example: # wait 365d before dropping the DB connection (default:8h) wait_timeout=31536000 So I tried to change this setting via the mysql console. But it's not reflected anywhere in the /etc/mysql/my.cnf file. (etc/akondai/mysql-global.conf seems to have no effect on the mysql-server either!) My question: Where to put these (or similar) settings to apply them in a way that akonadi won't drop the connection with an external server (globally I guess?)?

    Read the article

  • How do I apply different probability factors in an algorithm for a cricket simulation game?

    - by Komal Sharma
    I am trying to write the algorithm for a cricket simulation game which generates runs on each ball between 0 to 6. The run rate or runs generated changes when these factors come into play like skill of the batsman, skill of the bowler, target to be chased. Wickets left. If the batsman is skilled more runs will be generated. There will be a mode of play of the batsman aggressive, normal, defensive. If he plays aggressive chances of getting out will be more. If the chasing target is more the run rate should be more. If the overs are final the run rate should be more. I am using java random number function for this. The code so far I've written is public class Cricket { public static void main(String args[]) { int totalRuns=0; //i is the balls bowled for (int i = 1; i <= 60 ; i++) { int RunsPerBall = (int)(Math.random()*6); //System.out.println(Random); totalRuns=totalRuns+RunsPerBall; } System.out.println(totalRuns); } } Can somebody help me how to apply the factors in the code. I believe probability will be used with this. I am not clear how to apply the probability of the factors stated above in the code.

    Read the article

  • How do I apply skeletal animation from a .x (Direct X) file?

    - by Byte56
    Using the .x format to export a model from Blender, I can load a mesh, armature and animation. I have no problems generating the mesh and viewing models in game. Additionally, I have animations and the armature properly loaded into appropriate data structures. My problem is properly applying the animation to the models. I have the framework for applying the models and the code for selecting animations and stepping through frames. From what I understand, the AnimationKeys inside the AnimationSet supplies the transformations to transform the bind pose to the pose in the animated frame. As small example: Animation { {Armature_001_Bone} AnimationKey { 2; //Position 121; //number of frames 0;3; 0.000000, 0.000000, 0.000000;;, 1;3; 0.000000, 0.000000, 0.005524;;, 2;3; 0.000000, 0.000000, 0.022217;;, ... } AnimationKey { 0; //Quaternion Rotation 121; 0;4; -0.707107, 0.707107, 0.000000, 0.000000;;, 1;4; -0.697332, 0.697332, 0.015710, 0.015710;;, 2;4; -0.684805, 0.684805, 0.035442, 0.035442;;, ... } AnimationKey { 1; //Scale 121; 0;3; 1.000000, 1.000000, 1.000000;;, 1;3; 1.000000, 1.000000, 1.000000;;, 2;3; 1.000000, 1.000000, 1.000000;;, ... } } So, to apply frame 2, I would take the position, rotation and scale from frame 2, create a transformation matrix (call it Transform_A) from them and apply that matrix the vertices controlled by Armature_001_Bone at their weights. So I'd stuff TransformA into my shader and transform the vertex. Something like: vertexPos = vertexPos * bones[ int(bfs_BoneIndices.x) ] * bfs_BoneWeights.x; Where bfs_BoneIndices and bfs_BoneWeights are values specific to the current vertex. When loading in the mesh vertices, I transform them by the rootTransform and the meshTransform. This ensures they're oriented and scaled correctly for viewing the bind pose. The problem is when I create that transformation matrix (using the position, rotation and scale from the animation), it doesn't properly transform the vertex. There's likely more to it than just using the animation data. I also tried applying the bone transform hierarchies, still no dice. Basically I end up with some twisted models. It should also be noted that I'm working in openGL, so any matrix transposes that might need to be applied should be considered. What data do I need and how do I combine it for applying .x animations to models?

    Read the article

  • How to apply Data Oriented Design with Object Oriented Programming?

    - by Pombal
    I've read lots of articles about Data Oriented Design (DOD) and I understand it but I can't design an Object Oriented Programming (OOP) system with DOD in mind, I think my OOP education is blocking me. How should I think to mix the two? The objective is to have a nice OOP interface while using DOD behind the scenes. I saw this too but didn't help much: http://stackoverflow.com/questions/3872354/how-to-apply-dop-and-keep-a-nice-user-interface

    Read the article

  • How to apply disk quota in ubuntu server on a VPS?

    - by Pedram
    I have a VPS with ubuntu server 10.04 installed on it.Now I want to have some shell users with limited home folder size. It seems quota is the best way to do this, but all tutorials require editing /etc/fstab and add usrquota or grpquota to /home partition options. As my /etc/fstab looks like this: proc /proc proc defaults 0 0 none /dev/pts devpts rw 0 0 how can I apply quota?

    Read the article

  • I'm looking to learn how to apply traditional animation techniques to my graphics engine - are there any tutorials or online-resources that can help?

    - by blueberryfields
    There are many traditional animation techniques - such as blurring of motion, motion along an elliptical curve rather than a straight line, counter-motion before beginning of movement - which help with creating the appearance of a realistic 3D animated character. I'm looking to incorporate tools and short cuts for some of these into my graphics engine, to make it easier for my end users to use these techniques in their animations. Is there a good resource listing the techniques and the principles behind them, especially how they might apply to a graphics engine or 3D animation?

    Read the article

  • How to apply Data Oriented Design with Object Oriented Programming?

    - by Pombal
    Hi. I've read lots of articles about DOD and I understand it but I can't design an Object Oriented system with DOD in mind, I think my OOP education is blocking me. How should I think to mix the two? The objective is to have a nice OO interface while using DOD behind the scenes. I saw this too but didn't help much: http://stackoverflow.com/questions/3872354/how-to-apply-dop-and-keep-a-nice-user-interface

    Read the article

  • I'm looking to learn how to apply traditional animation techniques to my graphics engine - are there any tutorials or online-resources that can help?

    - by blueberryfields
    There are many traditional animation techniques - such as blurring of motion, motion along an elliptical curve rather than a straight line, counter-motion before beginning of movement - which help with creating the appearance of a realistic 3D animated character. I'm looking to incorporate tools and short cuts for some of these into my graphics engine, to make it easier for my end users to use these techniques in their animations. Is there a good resource listing the techniques and the principles behind them, especially how they might apply to a graphics engine or 3D animation?

    Read the article

  • Opposite Force to Apply to a Collided Rigid Body?

    - by Milo
    I'm working on the physics for my GTA2-like game so I can learn more about game physics. The collision detection and resolution are working great. I'm now just unsure how to compute the force to apply to a body after it collides with a wall. My rigid body looks like this: /our simulation object class RigidBody extends Entity { //linear private Vector2D velocity = new Vector2D(); private Vector2D forces = new Vector2D(); private float mass; private Vector2D v = new Vector2D(); //angular private float angularVelocity; private float torque; private float inertia; //graphical private Vector2D halfSize = new Vector2D(); private Bitmap image; private Matrix mat = new Matrix(); private float[] Vector2Ds = new float[2]; private Vector2D tangent = new Vector2D(); private static Vector2D worldRelVec = new Vector2D(); private static Vector2D relWorldVec = new Vector2D(); private static Vector2D pointVelVec = new Vector2D(); private static Vector2D acceleration = new Vector2D(); public RigidBody() { //set these defaults so we don't get divide by zeros mass = 1.0f; inertia = 1.0f; setLayer(LAYER_OBJECTS); } protected void rectChanged() { if(getWorld() != null) { getWorld().updateDynamic(this); } } //intialize out parameters public void initialize(Vector2D halfSize, float mass, Bitmap bitmap) { //store physical parameters this.halfSize = halfSize; this.mass = mass; image = bitmap; inertia = (1.0f / 20.0f) * (halfSize.x * halfSize.x) * (halfSize.y * halfSize.y) * mass; RectF rect = new RectF(); float scalar = 10.0f; rect.left = (int)-halfSize.x * scalar; rect.top = (int)-halfSize.y * scalar; rect.right = rect.left + (int)(halfSize.x * 2.0f * scalar); rect.bottom = rect.top + (int)(halfSize.y * 2.0f * scalar); setRect(rect); } public void setLocation(Vector2D position, float angle) { getRect().set(position.x,position.y, getWidth(), getHeight(), angle); rectChanged(); } public Vector2D getPosition() { return getRect().getCenter(); } @Override public void update(float timeStep) { doUpdate(timeStep); } public void doUpdate(float timeStep) { //integrate physics //linear acceleration.x = forces.x / mass; acceleration.y = forces.y / mass; velocity.x += (acceleration.x * timeStep); velocity.y += (acceleration.y * timeStep); //velocity = Vector2D.add(velocity, Vector2D.scalarMultiply(acceleration, timeStep)); Vector2D c = getRect().getCenter(); v.x = getRect().getCenter().getX() + (velocity.x * timeStep); v.y = getRect().getCenter().getY() + (velocity.y * timeStep); setCenter(v.x, v.y); forces.x = 0; //clear forces forces.y = 0; //angular float angAcc = torque / inertia; angularVelocity += angAcc * timeStep; setAngle(getAngle() + angularVelocity * timeStep); torque = 0; //clear torque } //take a relative Vector2D and make it a world Vector2D public Vector2D relativeToWorld(Vector2D relative) { mat.reset(); Vector2Ds[0] = relative.x; Vector2Ds[1] = relative.y; mat.postRotate(JMath.radToDeg(getAngle())); mat.mapVectors(Vector2Ds); relWorldVec.x = Vector2Ds[0]; relWorldVec.y = Vector2Ds[1]; return relWorldVec; } //take a world Vector2D and make it a relative Vector2D public Vector2D worldToRelative(Vector2D world) { mat.reset(); Vector2Ds[0] = world.x; Vector2Ds[1] = world.y; mat.postRotate(JMath.radToDeg(-getAngle())); mat.mapVectors(Vector2Ds); worldRelVec.x = Vector2Ds[0]; worldRelVec.y = Vector2Ds[1]; return worldRelVec; } //velocity of a point on body public Vector2D pointVelocity(Vector2D worldOffset) { tangent.x = -worldOffset.y; tangent.y = worldOffset.x; pointVelVec.x = (tangent.x * angularVelocity) + velocity.x; pointVelVec.y = (tangent.y * angularVelocity) + velocity.y; return pointVelVec; } public void applyForce(Vector2D worldForce, Vector2D worldOffset) { //add linear force forces.x += worldForce.x; forces.y += worldForce.y; //add associated torque torque += Vector2D.cross(worldOffset, worldForce); } @Override public void draw( GraphicsContext c) { c.drawRotatedScaledBitmap(image, getPosition().x, getPosition().y, getWidth(), getHeight(), getAngle()); } public Vector2D getVelocity() { return velocity; } public void setVelocity(Vector2D velocity) { this.velocity = velocity; } } The way it is given force is by the applyForce method, this method considers angular torque. I'm just not sure how to come up with the vectors in the case where: RigidBody hits static entity RigidBody hits other RigidBody that may or may not be in motion. Would anyone know a way (without too complex math) that I could figure out the opposite force I need to apply to the car? I know the normal it is colliding with and how deep it collided. My main goal is so that say I hit a building from the side, well the car should not just stay there, it should slowly rotate out of it if I'm more than 45 degrees. Right now when I hit a wall I only change the velocity directly which does not consider angular force. Thanks!

    Read the article

  • How do I apply a computer science degree to web development?

    - by T. Webster
    I'm a web programmer, but I haven't found many opportunities to take advantage of a formal education in computer science. Maybe I'm not looking in the right places, but it seems to me like most of the web jobs I come across are CRUD, web forms, and data grids. For these jobs a formal CS background doesn't seem necessary, and you could do fine with O'Reilly cookbooks in jQuery, CSS 3, PHP, SQL, or ASP.NET MVC. What kinds of web developer jobs exist that really let you apply your computer science background? Do I need to branch out into other areas of programming to take full advantage of my degree?

    Read the article

  • Should you apply a language filter to a randomly generated string?

    - by Tim
    A while back I created a licensing system for my companies new product, as well as all products after this one. As with a lot of licensing systems mine generates codes: 25 character product and registration codes, as well as 16 character module unlocking codes. My question is, since some parts of these generated codes are random should I apply a language filter to it to avoid any embarrassing language being given to the end users? I chose to as it was not difficult at all. But has anyone else ever came across something like this? Any viewpoints as to if it is worth the effort?

    Read the article

  • How can I apply Readme Driven Development to an ongoing project?

    - by Metalcoder
    I'm assigned to a project where the goal is to update an existing software. This software was developed in a totally ad hoc manner, which means that any documentation generated is outdated, confused and just plain useless. I do not want to retroactivelly produce all the missing artifacts, since this would just be a waste of time. The code base is ugly, and really need some serious refactoring, but this is another story. What I want is to apply Readme Driven Development to guide this project. So, basically, I want to write a Readme, which will document every change meaningful at the user level. The problem is, I have no idea about how to structure this document. For me, it's pretty clear that it should have a different layout than the traditional Readme. I really want to document changes, and not the current state of affairs. Any ideas?

    Read the article

  • Nitrogen [Apply] seems to be sent to background. Dual monitors, two wallpapers.

    - by schomper
    I'm trying to get two separate wallpapers for my two monitor set up. I've installed nitrogen which I heard is able to do this. However when I press apply in the nitrogen GUI nothing happens on my screens and the old wallpaper is left up. When I log out I can briefly see the wallpaper set up I designed with nitrogen but then it goes back to the old wallpaper. I feel like something is overriding the nitrogen settings. Any help with how to change this will be greatly appreciated. Thank you.

    Read the article

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