Search Results

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

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

  • How to apply Seq map function?

    - by netmatrix01
    Hello All, I been recently playing with F# . I was wondering instead of using a for loop to generate a sequence to element which are multiplied with every other element in the list how can I use a Seq map function or something similar to generate something like below. So for e.g. I have a list [1..10] I would like to apply a fun which generates a result something like [(1*1); (1*2);(1*3); (1*4); (1*5)......(2*1);(2*2);(2*3).....(3*1);(3*2)...] How can i achieve this ?. Many thanks for all you help.

    Read the article

  • MSBuild Script and VS2010 publish apply Web.config Transform

    - by Jason
    So, I have VS 2010 installed and am in the process of modifying my MSBuild script for our TeamCity build integration. Everything is working great with one exception. How can I tell MSBuild that I want to apply the Web.conifg transform files that I've created when I publish the build... I have the following which produces the compiled web site but, it outputs a Web.config, Web.Debug.config and, Web.Release.config files (All 3) to the compiled output directory. In studio when I perform a publish to file system it will do the transform and only output the Web.config with the appropriate changes... <Target Name="CompileWeb"> <MSBuild Projects="myproj.csproj" Properties="Configuration=Release;" /> </Target> <Target Name="PublishWeb" DependsOnTargets="CompileWeb"> <MSBuild Projects="myproj.csproj" Targets="ResolveReferences;_CopyWebApplication" Properties="WebProjectOutputDir=$(OutputFolder)$(WebOutputFolder); OutDir=$(TempOutputFolder)$(WebOutputFolder)\;Configuration=Release;" /> </Target> Any help would be great..! I know this can be done by other means but I would like to do this using the new VS 2010 way if possible

    Read the article

  • How to apply stereotypes on UML Relationships' MemberEnds?

    - by Cristi Potlog
    I'm running this code on a UML Class Diagram, and it works just fine, but when trying to apply stereotypes from PropertiesEditor in Visual Studio for relationship ends (FirstRole and SecondRole), the stereotypes combo doesn't load even if in code there seems to be applicable stereotypes valid for association properties. What should I put in metaclasses tag in the UML profile except for IProperty? <metaclassMoniker name="/MyUmlProfile/Microsoft.VisualStudio.Uml.Classes.IProperty"/> This is the code: using Microsoft.VisualStudio.Uml.Classes; foreach( IShape shape in currentDiagram.GetSelectedShapes<IElement>() ) { IElement element = shape.GetElement(); foreach( IStereotype stereotype in element.ApplicableStereotypes ) { if( element is Microsoft.VisualStudio.Uml.Classes.IClass ) { IClass classItem = (IClass)element; if( classItem.SuperClasses.Count() > 0 ) { if( stereotype.Name == "SubclassAttribute" ) { element.ApplyStereotype( stereotype ); } } else if( stereotype.Name == "ClassAttribute" ) { element.ApplyStereotype( stereotype ); } } else if( element is Microsoft.VisualStudio.Uml.Classes.IProperty ) { IProperty property = (IProperty)element; if( property.Association != null ) { if( stereotype.Name == "Set" && property.UpperValue != null && property.UpperValue.ToString() == "*" ) { element.ApplyStereotype( stereotype ); } else if( stereotype.Name == "ManyToOne" && ( property.UpperValue == null || property.UpperValue.ToString() == "1" ) ) { element.ApplyStereotype( stereotype ); } } else if( stereotype.Name == "Property" ) { element.ApplyStereotype( stereotype ); } } } }

    Read the article

  • Apply Storyboard Animation to DataGridTemplateColumn depending on Binding value change

    - by Neo
    I have a DataGridTemplateColumn on a WPF DataGrid which has a binding to a double type. I wish to apply a Storyboard Animation when the value goes down and another Storyboard Animation when the value goes up. I've got the following code to start with: <dg:DataGridTemplateColumn Header="My Double"> <dg:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Path=MyDouble, NotifyOnTargetUpdated=True}" TargetUpdated="dgRates_TargetUpdated"> <TextBlock.Triggers> <EventTrigger RoutedEvent="Binding.TargetUpdated"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:2" From="1.0" To="0.0" /> </Storyboard> </BeginStoryboard> </EventTrigger> </TextBlock.Triggers> </TextBlock> </DataTemplate> </dg:DataGridTemplateColumn.CellTemplate> </dg:DataGridTemplateColumn> How can I achieve this? Thanks.

    Read the article

  • How can I apply a style to existing tikz node on specific slides

    - by Eugene Pimenov
    This is what I'm trying to do \begin{tikzpicture} [node distance = 1cm, auto,font=\footnotesize, % STYLES every node/.style={node distance=1.3cm}, comment/.style={rectangle, inner sep= 5pt, text width=4cm, node distance=0.25cm, font=}, module/.style={rectangle, drop shadow, draw, fill=black!10, inner sep=5pt, text width=3cm, text badly centered, minimum height=0.8cm, font=\bfseries\footnotesize\sffamily,rounded corners}, selected/.style={fill=red!40}] \node [module] (nodeA) {node A}; \node [module, below of=nodeA] (nodeA) {node B}; \only<1>{ \node [comment, text width=6cm, right=0.25 of nodeA] {short description of Node A}; \node [comment, text width=6cm, right=0.25 of nodeB] {short description of Node B}; } \only<2>{ \node [selected] (nodeA) {}; \node [comment, text width=6cm, right=0.25 of nodeA] {long description of node A}; } \only<3>{ \node [selected] (nodeB) {}; \node [comment, text width=6cm, right=0.25 of nodeA] {long description of node B}; } \end{tikzpicture} The problem is \node [selected] (nodeB) {}; creates a new node, but I want it to apply the style for the existing node. Is there any way to do so? Of course I could have copies of every node in selected state and not-selected state, but I really want to have a normal solution.

    Read the article

  • how to apply iddata into calculation?

    - by Sam
    I am trying to figure out how to combine the input and output data into the ARX model and then apply it into the BIC (Bayesian Information Criterion) formula. Below is the code that I am currently working on: for i=1:30; %% Set Model Order data=iddata(output,input,1); model = arx(data,[8 9 i]); yp = predict(model,data); ye = regress(data,yp{1,1}(1:4018,1)); M(i) = var(yp); BIC(i)=(N+i*(log(N)-1))/(N-i)*log(M(i)); end But it does not work. It keep on giving me an error something like below: "The syntax "Data{...}" is not supported. Use the "getexp" command to extract individual experiments from an IDDATA object." I did not understand what does that mean. Can someone explain it to me and where do I do wrong on my piece of code? Thanks in advance. Sam.

    Read the article

  • Apply Quaternion to Camera in libGDX

    - by Alex_Hyzer_Kenoyer
    I am trying to rotate my camera using a Quaternion in libGDX. I have a Quaternion created and being manipulated but I have no idea how to apply it to the camera, everything I've tried hasn't moved the camera at all. Here is how I set up the rotation Quaternion: public void rotateX(float amount) { tempQuat.set(tempVector.set(1.0f, 0.0f, 0.0f), amount * MathHelper.PIOVER180); rotation = rotation.mul(tempQuat); } public void rotateY(float amount) { tempQuat.set(tempVector.set(0.0f, 1.0f, 0.0f), amount * MathHelper.PIOVER180); rotation = tempQuat.mul(rotation); } Here is how I am trying to update the camera (Same update method as the original libGDX version but I added the part about the rotation matrix to the top): public void update(boolean updateFrustum) { float[] matrix = new float[16]; rotation.toMatrix(matrix); Matrix4 m = new Matrix4(); m.set(matrix); camera.view.mul(m); //camera.direction.mul(m).nor(); //camera.up.mul(m).nor(); float aspect = camera.viewportWidth / camera.viewportHeight; camera.projection.setToProjection(Math.abs(camera.near), Math.abs(camera.far), camera.fieldOfView, aspect); camera.view.setToLookAt(camera.position, tempVector.set(camera.position).add(camera.direction), camera.up); camera.combined.set(camera.projection); Matrix4.mul(camera.combined.val, camera.view.val); if (updateFrustum) { camera.invProjectionView.set(camera.combined); Matrix4.inv(camera.invProjectionView.val); camera.frustum.update(camera.invProjectionView); } }

    Read the article

  • Find all CSS rules that apply to an element

    - by Carl Byström
    Many tools/APIs provide ways of selecting elements of specific classes or IDs. There's also possible to inspect the raw stylesheets loaded by the browser. However, for browsers to render an element, they'll compile all CSS rules (possibly from different stylesheet files) and apply it to the element. This is what you see with Firebug or the WebKit Inspector - the full CSS inheritance tree for an element. How can I reproduce this feature in pure JavaScript without requiring additional browser plugins? Perhaps an example can provide some clarification for what I'm looking for: <style type="text/css"> p { color :red; } #description { font-size: 20px; } </style> <p id="description">Lorem ipsum</p> Here the p#description element have two CSS rules applied: a red color and a font size of 20 px. I would like to find the source from where these computed CSS rules originate from (color comes the p rule and so on).

    Read the article

  • Apply [ThreadStatic] attribute to a method in external assembly

    - by Sen Jacob
    Can I use an external assembly's static method like [ThreadStatic] method? Here is my situation. The assembly class (which I do not have access to its source) has this structure public class RegistrationManager() { private RegistrationManager() {} public static void RegisterConfiguration(int ID) {} public static object DoWork() {} public static void UnregisterConfiguration(int ID) {} } Once registered, I cannot call the DoWork() with a different ID without unregistering the previously registered one. Actually I want to call the DoWork() method with different IDs simultaneously with multi-threading. If the RegisterConfiguration(int ID) method was [ThreadStatic], I could have call it in different threads without problems with calls, right? So, can I apply the [ThreadStatic] attribute to this method or is there any other way I can call the two static methods same time without waiting for other thread to unregister it? If I check it like the following, it should work. for(int i=0; i < 10; i++) { new Thread(new ThreadStart(() => Checker(i))).Start(); } public string Checker(int i) { public static void RegisterConfiguration(i); // Now i cannot register second time public static object DoWork(i); Thread.Sleep(5000); // DoWork() may take a little while to complete before unregistered public static void UnregisterConfiguration(i); }

    Read the article

  • How to easily apply a function to a collection in C++

    - by Jesse Beder
    I'm storing images as arrays, templated based on the type of their elements, like Image<unsigned> or Image<float>, etc. Frequently, I need to perform operations on these images; for example, I might need to add two images, or square an image (elementwise), and so on. All of the operations are elementwise. I'd like get as close as possible to writing things like: float Add(float a, float b) { return a+b; } Image<float> result = Add(img1, img2); and even better, things like complex ComplexCombine(float a, float b) { return complex(a, b); } Image<complex> result = ComplexCombine(img1, img2); or struct FindMax { unsigned currentMax; FindMax(): currentMax(0) {} void operator(unsigned a) { if(a > currentMax) currentMax = a; } }; FindMax findMax; findMax(img); findMax.currentMax; // now contains the maximum value of 'img' Now, I obviously can't exactly do that; I've written something so that I can call: Image<float> result = Apply(img1, img2, Add); but I can't seem to figure out a generic way for it to detect the return type of the function/function object passed, so my ComplexCombine example above is out; also, I have to write a new one for each number of arguments I'd like to pass (which seems inevitable). Any thoughts on how to achieve this (with as little boilerplate code as possible)?

    Read the article

  • Blit SDL_Surface onto another SDL_Surface and apply a colorkey

    - by NordCoder
    I want to load an SDL_Surface into an OpenGL texture with padding (so that NPOT-POT) and apply a color key on the surface afterwards. I either end up colorkeying all pixels, regardless of their color, or not colorkey anything at all. I have tried a lot of different things, but none of them seem to work. Here's the working snippet of my code. I use a custom color class for the colorkey (range [0-1]): // Create an empty surface with the same settings as the original image SDL_Surface* paddedImage = SDL_CreateRGBSurface(image->flags, width, height, image->format->BitsPerPixel, #if SDL_BYTEORDER == SDL_BIG_ENDIAN 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff #else 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 #endif ); // Map RGBA color to pixel format value Uint32 colorKeyPixelFormat = SDL_MapRGBA(paddedImage->format, static_cast<Uint8>(colorKey.R * 255), static_cast<Uint8>(colorKey.G * 255), static_cast<Uint8>(colorKey.B * 255), static_cast<Uint8>(colorKey.A * 255)); SDL_FillRect(paddedImage, NULL, colorKeyPixelFormat); // Blit the image onto the padded image SDL_BlitSurface(image, NULL, paddedImage, NULL); SDL_SetColorKey(paddedImage, SDL_SRCCOLORKEY, colorKeyPixelFormat); Afterwards, I generate an OpenGL texture from paddedImage using similar code to the SDL+OpenGL texture loading code found online (I'll post if necessary). This code works if I just want the texture with or without padding, and is likely not the problem. I realize that I set all pixels in paddedImage to have alpha zero which causes the first problem I mentioned, but I can't seem to figure out how to do this. Should I just loop over the pixels and set the appropriate colors to have alpha zero?

    Read the article

  • Texture will not apply to my 3d Cube directX

    - by numerical25
    I am trying to apply a texture onto my 3d cube but it is not showing up correctly. I believe that it might some what be working because the cube is all brown which is almost the same complexion as the texture. And I did not originally make the cube brown. These are the steps I've done to add the texture I first declared 2 new varibles ID3D10EffectShaderResourceVariable* pTextureSR; ID3D10ShaderResourceView* textureSRV; I also added a variable and a struct to my shader .fx file Texture2D tex2D; SamplerState linearSampler { Filter = MIN_MAG_MIP_LINEAR; AddressU = Wrap; AddressV = Wrap; }; I then grabbed the image from my local hard drive from within the .cpp file. I believe this was successful, I checked all varibles for errors, everything has a memory address. Plus I pulled resources before and never had a problem. D3DX10CreateShaderResourceViewFromFile(mpD3DDevice,L"crate.jpg",NULL,NULL,&textureSRV,NULL); I grabbed the tex2d varible from my fx file and placed into my resource varible pTextureSR = modelObject.pEffect->GetVariableByName("tex2D")->AsShaderResource(); And added the resource to the varible pTextureSR->SetResource(textureSRV); I also added the extra property to my vertex layout D3D10_INPUT_ELEMENT_DESC layout[] = { {"POSITION",0,DXGI_FORMAT_R32G32B32_FLOAT, 0 , 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, {"COLOR",0,DXGI_FORMAT_R32G32B32A32_FLOAT, 0 , 12, D3D10_INPUT_PER_VERTEX_DATA, 0}, {"NORMAL",0,DXGI_FORMAT_R32G32B32A32_FLOAT, 0 , 24, D3D10_INPUT_PER_VERTEX_DATA, 0}, {"TEXCOORD",0, DXGI_FORMAT_R32G32_FLOAT, 0 , 36, D3D10_INPUT_PER_VERTEX_DATA, 0} }; as well as my struct struct VertexPos { D3DXVECTOR3 pos; D3DXVECTOR4 color; D3DXVECTOR3 normal; D3DXVECTOR2 texCoord; }; Then I created a new pixel shader that adds the texture to it. Below is the code in its entirety matrix Projection; matrix WorldMatrix; Texture2D tex2D; float3 lightSource; float4 lightColor = {0.5, 0.5, 0.5, 0.5}; // PS_INPUT - input variables to the pixel shader // This struct is created and fill in by the // vertex shader struct PS_INPUT { float4 Pos : SV_POSITION; float4 Color : COLOR0; float4 Normal : NORMAL; float2 Tex : TEXCOORD; }; SamplerState linearSampler { Filter = MIN_MAG_MIP_LINEAR; AddressU = Wrap; AddressV = Wrap; }; //////////////////////////////////////////////// // Vertex Shader - Main Function /////////////////////////////////////////////// PS_INPUT VS(float4 Pos : POSITION, float4 Color : COLOR, float4 Normal : NORMAL, float2 Tex : TEXCOORD) { PS_INPUT psInput; // Pass through both the position and the color psInput.Pos = mul( Pos, Projection ); psInput.Normal = Normal; psInput.Tex = Tex; return psInput; } /////////////////////////////////////////////// // Pixel Shader /////////////////////////////////////////////// float4 PS(PS_INPUT psInput) : SV_Target { float4 finalColor = 0; finalColor = saturate(dot(lightSource, psInput.Normal) * lightColor); return finalColor; } float4 textured( PS_INPUT psInput ) : SV_Target { return tex2D.Sample( linearSampler, psInput.Tex ); } // Define the technique technique10 Render { pass P0 { SetVertexShader( CompileShader( vs_4_0, VS() ) ); SetGeometryShader( NULL ); SetPixelShader( CompileShader( ps_4_0, textured() ) ); } } Below is my CPU code. It maybe a little sloppy. But I am just adding code anywhere cause I am just experimenting and playing around. You should find most of the texture code at the bottom createObject #include "MyGame.h" #include "OneColorCube.h" /* This code sets a projection and shows a turning cube. What has been added is the project, rotation and a rasterizer to change the rasterization of the cube. The issue that was going on was something with the effect file which was causing the vertices not to be rendered correctly.*/ typedef struct { ID3D10Effect* pEffect; ID3D10EffectTechnique* pTechnique; //vertex information ID3D10Buffer* pVertexBuffer; ID3D10Buffer* pIndicesBuffer; ID3D10InputLayout* pVertexLayout; UINT numVertices; UINT numIndices; }ModelObject; ModelObject modelObject; // World Matrix D3DXMATRIX WorldMatrix; // View Matrix D3DXMATRIX ViewMatrix; // Projection Matrix D3DXMATRIX ProjectionMatrix; ID3D10EffectMatrixVariable* pProjectionMatrixVariable = NULL; ID3D10EffectMatrixVariable* pWorldMatrixVarible = NULL; ID3D10EffectVectorVariable* pLightVarible = NULL; ID3D10EffectShaderResourceVariable* pTextureSR; bool MyGame::InitDirect3D() { if(!DX3dApp::InitDirect3D()) { return false; } D3D10_RASTERIZER_DESC rastDesc; rastDesc.FillMode = D3D10_FILL_WIREFRAME; rastDesc.CullMode = D3D10_CULL_FRONT; rastDesc.FrontCounterClockwise = true; rastDesc.DepthBias = false; rastDesc.DepthBiasClamp = 0; rastDesc.SlopeScaledDepthBias = 0; rastDesc.DepthClipEnable = false; rastDesc.ScissorEnable = false; rastDesc.MultisampleEnable = false; rastDesc.AntialiasedLineEnable = false; ID3D10RasterizerState *g_pRasterizerState; mpD3DDevice->CreateRasterizerState(&rastDesc, &g_pRasterizerState); //mpD3DDevice->RSSetState(g_pRasterizerState); // Set up the World Matrix D3DXMatrixIdentity(&WorldMatrix); D3DXMatrixLookAtLH(&ViewMatrix, new D3DXVECTOR3(0.0f, 10.0f, -20.0f), new D3DXVECTOR3(0.0f, 0.0f, 0.0f), new D3DXVECTOR3(0.0f, 1.0f, 0.0f)); // Set up the projection matrix D3DXMatrixPerspectiveFovLH(&ProjectionMatrix, (float)D3DX_PI * 0.5f, (float)mWidth/(float)mHeight, 0.1f, 100.0f); if(!CreateObject()) { return false; } return true; } //These are actions that take place after the clearing of the buffer and before the present void MyGame::GameDraw() { static float rotationAngleY = 15.0f; static float rotationAngleX = 0.0f; static D3DXMATRIX rotationXMatrix; static D3DXMATRIX rotationYMatrix; D3DXMatrixIdentity(&rotationXMatrix); D3DXMatrixIdentity(&rotationYMatrix); // create the rotation matrix using the rotation angle D3DXMatrixRotationY(&rotationYMatrix, rotationAngleY); D3DXMatrixRotationX(&rotationXMatrix, rotationAngleX); rotationAngleY += (float)D3DX_PI * 0.0008f; rotationAngleX += (float)D3DX_PI * 0.0005f; WorldMatrix = rotationYMatrix * rotationXMatrix; // Set the input layout mpD3DDevice->IASetInputLayout(modelObject.pVertexLayout); pWorldMatrixVarible->SetMatrix((float*)&WorldMatrix); // Set vertex buffer UINT stride = sizeof(VertexPos); UINT offset = 0; mpD3DDevice->IASetVertexBuffers(0, 1, &modelObject.pVertexBuffer, &stride, &offset); // Set primitive topology mpD3DDevice->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST); //ViewMatrix._43 += 0.005f; // Combine and send the final matrix to the shader D3DXMATRIX finalMatrix = (WorldMatrix * ViewMatrix * ProjectionMatrix); pProjectionMatrixVariable->SetMatrix((float*)&finalMatrix); // make sure modelObject is valid // Render a model object D3D10_TECHNIQUE_DESC techniqueDescription; modelObject.pTechnique->GetDesc(&techniqueDescription); // Loop through the technique passes for(UINT p=0; p < techniqueDescription.Passes; ++p) { modelObject.pTechnique->GetPassByIndex(p)->Apply(0); // draw the cube using all 36 vertices and 12 triangles mpD3DDevice->Draw(36,0); } } //Render actually incapsulates Gamedraw, so you can call data before you actually clear the buffer or after you //present data void MyGame::Render() { DX3dApp::Render(); } bool MyGame::CreateObject() { //Create Layout D3D10_INPUT_ELEMENT_DESC layout[] = { {"POSITION",0,DXGI_FORMAT_R32G32B32_FLOAT, 0 , 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, {"COLOR",0,DXGI_FORMAT_R32G32B32A32_FLOAT, 0 , 12, D3D10_INPUT_PER_VERTEX_DATA, 0}, {"NORMAL",0,DXGI_FORMAT_R32G32B32A32_FLOAT, 0 , 24, D3D10_INPUT_PER_VERTEX_DATA, 0}, {"TEXCOORD",0, DXGI_FORMAT_R32G32_FLOAT, 0 , 36, D3D10_INPUT_PER_VERTEX_DATA, 0} }; UINT numElements = (sizeof(layout)/sizeof(layout[0])); modelObject.numVertices = sizeof(vertices)/sizeof(VertexPos); for(int i = 0; i < modelObject.numVertices; i += 3) { D3DXVECTOR3 out; D3DXVECTOR3 v1 = vertices[0 + i].pos; D3DXVECTOR3 v2 = vertices[1 + i].pos; D3DXVECTOR3 v3 = vertices[2 + i].pos; D3DXVECTOR3 u = v2 - v1; D3DXVECTOR3 v = v3 - v1; D3DXVec3Cross(&out, &u, &v); D3DXVec3Normalize(&out, &out); vertices[0 + i].normal = out; vertices[1 + i].normal = out; vertices[2 + i].normal = out; } //Create buffer desc D3D10_BUFFER_DESC bufferDesc; bufferDesc.Usage = D3D10_USAGE_DEFAULT; bufferDesc.ByteWidth = sizeof(VertexPos) * modelObject.numVertices; bufferDesc.BindFlags = D3D10_BIND_VERTEX_BUFFER; bufferDesc.CPUAccessFlags = 0; bufferDesc.MiscFlags = 0; D3D10_SUBRESOURCE_DATA initData; initData.pSysMem = vertices; //Create the buffer HRESULT hr = mpD3DDevice->CreateBuffer(&bufferDesc, &initData, &modelObject.pVertexBuffer); if(FAILED(hr)) return false; /* //Create indices DWORD indices[] = { 0,1,3, 1,2,3 }; ModelObject.numIndices = sizeof(indices)/sizeof(DWORD); bufferDesc.ByteWidth = sizeof(DWORD) * ModelObject.numIndices; bufferDesc.BindFlags = D3D10_BIND_INDEX_BUFFER; initData.pSysMem = indices; hr = mpD3DDevice->CreateBuffer(&bufferDesc, &initData, &ModelObject.pIndicesBuffer); if(FAILED(hr)) return false;*/ ///////////////////////////////////////////////////////////////////////////// //Set up fx files LPCWSTR effectFilename = L"effect.fx"; modelObject.pEffect = NULL; hr = D3DX10CreateEffectFromFile(effectFilename, NULL, NULL, "fx_4_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, mpD3DDevice, NULL, NULL, &modelObject.pEffect, NULL, NULL); if(FAILED(hr)) return false; pProjectionMatrixVariable = modelObject.pEffect->GetVariableByName("Projection")->AsMatrix(); pWorldMatrixVarible = modelObject.pEffect->GetVariableByName("WorldMatrix")->AsMatrix(); pTextureSR = modelObject.pEffect->GetVariableByName("tex2D")->AsShaderResource(); ID3D10ShaderResourceView* textureSRV; D3DX10CreateShaderResourceViewFromFile(mpD3DDevice,L"crate.jpg",NULL,NULL,&textureSRV,NULL); pLightVarible = modelObject.pEffect->GetVariableByName("lightSource")->AsVector(); //Dont sweat the technique. Get it! LPCSTR effectTechniqueName = "Render"; D3DXVECTOR3 vLight(1.0f, 1.0f, 1.0f); pLightVarible->SetFloatVector(vLight); modelObject.pTechnique = modelObject.pEffect->GetTechniqueByName(effectTechniqueName); if(modelObject.pTechnique == NULL) return false; pTextureSR->SetResource(textureSRV); //Create Vertex layout D3D10_PASS_DESC passDesc; modelObject.pTechnique->GetPassByIndex(0)->GetDesc(&passDesc); hr = mpD3DDevice->CreateInputLayout(layout, numElements, passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, &modelObject.pVertexLayout); if(FAILED(hr)) return false; return true; } And here is my cube coordinates. I actually only added coordinates to one side. And that is the front side. To double check I flipped the cube in all directions just to make sure i didnt accidentally place the text on the incorrect side //Create vectors and put in vertices // Create vertex buffer VertexPos vertices[] = { // BACK SIDES { D3DXVECTOR3(-5.0f, 5.0f, 5.0f), D3DXVECTOR4(1.0f,0.0f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(-5.0f, -5.0f, 5.0f), D3DXVECTOR4(1.0f,0.0f,0.0f,0.0f), D3DXVECTOR2(1.0,0.0)}, { D3DXVECTOR3(5.0f, 5.0f, 5.0f), D3DXVECTOR4(1.0f,0.0f,0.0f,0.0f), D3DXVECTOR2(0.0,1.0)}, { D3DXVECTOR3(5.0f, 5.0f, 5.0f), D3DXVECTOR4(1.0f,0.0f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(-5.0f, -5.0f, 5.0f), D3DXVECTOR4(1.0f,0.0f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, -5.0f, 5.0f), D3DXVECTOR4(1.0f,0.0f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, // 2 FRONT SIDE { D3DXVECTOR3(-5.0f, 5.0f, -5.0f), D3DXVECTOR4(0.0f,1.0f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, 5.0f, -5.0f), D3DXVECTOR4(0.0f,1.0f,0.0f,0.0f), D3DXVECTOR2(2.0,0.0)}, { D3DXVECTOR3(-5.0f, -5.0f, -5.0f), D3DXVECTOR4(0.0f,1.0f,0.0f,0.0f), D3DXVECTOR2(0.0,2.0)}, { D3DXVECTOR3(-5.0f, -5.0f, -5.0f), D3DXVECTOR4(0.0f,1.0f,0.0f,0.0f), D3DXVECTOR2(0.0,2.0)}, { D3DXVECTOR3(5.0f, 5.0f, -5.0f), D3DXVECTOR4(0.0f,1.0f,0.0f,0.0f) , D3DXVECTOR2(2.0,0.0)}, { D3DXVECTOR3(5.0f, -5.0f, -5.0f), D3DXVECTOR4(0.0f,1.0f,0.0f,0.0f), D3DXVECTOR2(2.0,2.0)}, // 3 { D3DXVECTOR3(-5.0f, 5.0f, 5.0f), D3DXVECTOR4(0.0f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, 5.0f, 5.0f), D3DXVECTOR4(0.0f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(-5.0f, 5.0f, -5.0f), D3DXVECTOR4(0.0f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(-5.0f, 5.0f, -5.0f), D3DXVECTOR4(0.0f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, 5.0f, 5.0f), D3DXVECTOR4(0.0f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, 5.0f, -5.0f), D3DXVECTOR4(0.0f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, // 4 { D3DXVECTOR3(-5.0f, -5.0f, 5.0f), D3DXVECTOR4(1.0f,0.5f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(-5.0f, -5.0f, -5.0f), D3DXVECTOR4(1.0f,0.5f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, -5.0f, 5.0f), D3DXVECTOR4(1.0f,0.5f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, -5.0f, 5.0f), D3DXVECTOR4(1.0f,0.5f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(-5.0f, -5.0f, -5.0f), D3DXVECTOR4(1.0f,0.5f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, -5.0f, -5.0f), D3DXVECTOR4(1.0f,0.5f,0.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, // 5 { D3DXVECTOR3(5.0f, 5.0f, -5.0f), D3DXVECTOR4(0.0f,1.0f,0.5f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, 5.0f, 5.0f), D3DXVECTOR4(0.0f,1.0f,0.5f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, -5.0f, -5.0f), D3DXVECTOR4(0.0f,1.0f,0.5f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, -5.0f, -5.0f), D3DXVECTOR4(0.0f,1.0f,0.5f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, 5.0f, 5.0f), D3DXVECTOR4(0.0f,1.0f,0.5f,0.0f), D3DXVECTOR2(0.0,0.0)}, { D3DXVECTOR3(5.0f, -5.0f, 5.0f), D3DXVECTOR4(0.0f,1.0f,0.5f,0.0f), D3DXVECTOR2(0.0,0.0)}, // 6 {D3DXVECTOR3(-5.0f, 5.0f, -5.0f), D3DXVECTOR4(0.5f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, {D3DXVECTOR3(-5.0f, -5.0f, -5.0f), D3DXVECTOR4(0.5f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, {D3DXVECTOR3(-5.0f, 5.0f, 5.0f), D3DXVECTOR4(0.5f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, {D3DXVECTOR3(-5.0f, 5.0f, 5.0f), D3DXVECTOR4(0.5f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, {D3DXVECTOR3(-5.0f, -5.0f, -5.0f), D3DXVECTOR4(0.5f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, {D3DXVECTOR3(-5.0f, -5.0f, 5.0f), D3DXVECTOR4(0.5f,0.0f,1.0f,0.0f), D3DXVECTOR2(0.0,0.0)}, };

    Read the article

  • Stringtemplate: is it ok to Apply Templates, in which HashMap uses, To Multi-Valued Attributes

    - by user1071830
    There is two template in my .stg file, and both of them apply on multi-value a HashMap. The HashMap is employed as an injected object. And I need those instance of HashMap can be injected for many times. My trouble is, when I switch to another template, ANTLR seems to consider the second HashMap as a List -- multipul objects and null value. Part of my .stg file shows as follows: tpl_hash(BAR, FOO) ::= << <FOO:foo(); separator="\n"> <BAR:bar(); separator="\n"> >> foo(nn) ::= << foo: <nn.name; null="NULL"> . <nn.national; null="NULL"> >> bar(mm) ::= << bar: <mm.name> @ <mm.national> >> Part of my .g file shows: HashMap hm = new HashMap(); hm.put("name", $name.text); hm.put("national", "German"); tpl_hash.add("FOO",new HashMap(hm)); HashMap hm2 = new HashMap(); hm2.put("name", $name.text); hm2.put("national", "German"); tpl_hash.add("BAR",new HashMap(hm2)); The result I expect is : bar: Kant @ German foo: Russell @ England But, I got: foo: NULL . NULL foo: NULL . NULL bar: @ bar: @ If we replace BAR with FOO, as is, keeping FOO and BAR with identical template, the output is right, like the following. bar: Russell @ German bar: Russell @ German In docs, "synchronized ST add (String name, Object value) in org.stringtemplate.v4.ST" said: "If you send in a List and then inject a single value element, add() copies original list and adds the new value." What about a HashMap? Does ANTLR consider the HashMap, key/value pair access, an object purposely, as a List and as multi-value injected by mistake? Thanks a lot in advance.

    Read the article

  • Stuck with Regular Expression code to apply HTML tag to text but exclude if inside <?> tag

    - by James Buckingham
    Hi there. I'm trying to write a bit of regex which would go through some text, written by our Editors, and apply an <acronym> tag to the first instance it finds of an abbreviation set we hold in our "Glossary of Terms". So for this example I've used the abbreviation ITS. 1st thing I thought I'd do is setup an example with a mix of scenerios I could test against, i.e. ITS sitting with punctuation, in HTML tags & ones that we've applied this to already (in other words the script has run through this before, so no need to do again). I'm almost there but just got stuck at the last point :-(. Here's the regex I've got so far - <[^<|]+?>?>ITS<[^<]+?>|ITS The Example - FROM ( EVERY ITS IN BOLD TO BE WRAPPED WITH ACRONYM ): I want you to tag thisITS, but not this wrapped one - <acronym title="ITS" id="thisIsATest">ITS</acronym> This is another test as I still want to update <p>ITS</p> that have other HTML tags wrapped around them.` ITS want ones that start sentences and ones that finish ITS. ITS, and ones which are wrapped in punctuation.` Test link: <a href="index.cfm>ITS</a> AND I WANT THIS CHANGE TO : I want you to tag this <acronym title="ITS">ITS</acronym>, but not this wrapped one - <acronym title="ITS">ITS</acronym> This is another test as I still want to update <acronym title="ITS">ITS</acronym> that have other HTML tags wrapped around them.` <acronym title="ITS">ITS</acronym> want ones that start sentences and ones that finish <acronym title="ITS">ITS</acronym>. <acronym title="ITS">ITS</acronym>, and ones which are wrapped in punctuation. Test link: <acronym title="ITS"><a href="index.cfm>ITS</a></acronym> Are there any Reg Ex experts out there that could help me finish this off? Any other hints tips would also be appreciated. Thanks a lot, James P.S. This is going to be placed in a ColdFusion application if that helps anyone in specific syntax.

    Read the article

  • Apply jquery selectbox style on chained selectbox

    - by ktsixit
    Hi all, I have created a pair of chained selectboxes in my page. The second selectbox is filled with a set of values, depending on the first box's selected value. The script that makes the two selectboxes work like this, uses php and javascript. This is the code I'm using: form <select name="continent" tabindex="1" onChange="getCountry(this.value)"> <option value="#">-Select-</option> <option value="Europe">Europe</option> <option value="Asia">Asia</option> </select> <div id="countrydiv"> <select name="country" tabindex="2"> <option></option> </select> </div> <input type="submit" /> </form> javascript code $(document).ready(function() { $('select[name="continent"]').selectbox({debug: true}); $('select[name="country"]').selectbox({debug: true}); }); function getXMLHTTP() { //fuction to return the xml http object var xmlhttp=false; try{ xmlhttp=new XMLHttpRequest(); } catch(e) { try{ xmlhttp= new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1){ xmlhttp=false; } } } return xmlhttp; } function getCountry(continentId) { var strURL="findCountry.php?continent="+continentId; var req = getXMLHTTP(); if (req) { req.onreadystatechange = function() { if (req.readyState == 4) { // only if "OK" if (req.status == 200) { document.getElementById('countrydiv').innerHTML=req.responseText; } else { alert("There was a problem while using XMLHTTP:\n" + req.statusText); } } } req.open("GET", strURL, true); req.send(null); } } php code (findCountry.php) <? $continent=intval($_GET['continent']); if ($_GET['continent'] == 'Europe') { ?> <select name="country"> <option value="France">France</option> <option value="Germany">Germany</option> <option value="Spain">Spain</option> <option value="Italy">Italy</option> </select> <? } if ($_GET['continent'] == 'Asia') { ?> <select name="country"> <option value="China">China</option> <option value="India">India</option> <option value="Japan">Japan</option> </select> <? } ?> What I want to do is to apply jquery selectbox styling on these selectboxes. I haven't succeeded in doing that yet. The problem is that jquery is hiding the normal selectbox and is replacing it with a list. Furthermore, after selectbox's content is refreshed, jquery cannot re-construct it into a list. You can take a look of the jquery code here Is there something I can do to combine these techniques? I have tried a million things but nothing worked. Can you please help me?

    Read the article

  • Storyboard apply to all labels

    - by ThitoO
    Hi everyone ! I whant to apply a little storyboard to a collection of labels in my window. My storyboard is like that : <Storyboard x:Key="Storyboard1" AutoReverse="True" RepeatBehavior="Forever"> <ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="label" Storyboard.TargetProperty="(Label.Foreground).(SolidColorBrush.Color)"> <SplineColorKeyFrame KeyTime="00:00:00.1000000" Value="#FFFFFF"/> </ColorAnimationUsingKeyFrames> </Storyboard> I have a window composed of that : <Grid Background="#FF000000"> <Viewbox HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="Uniform"> <UniformGrid x:Name="grid" Background="#FF000000" /> </Viewbox> </Grid> When I want to start my storyboard I do that : Storyboard.SetTarget( _stb, myLabel ); _stb.Begin(); where _std is my storyboard loaded by the window's resources. The animation works fine, but on all labels (not only the one I want). I tried to switch SetTarget by SetTargetName but labels are created into my window by the constructor and names can not be founded when I try "SetTargetName". Do you have any ideas ? Thanks :) ------------ Edit : We asked me to be more descriptive -------------------------------------------------------------------- Label are not created directly in the xaml, they are created by the constructor of the window : public SpellerWindow(IKeyboard keyboard, int colomnNumber, SolidColorBrush background, SolidColorBrush foreground ) { InitializeComponent(); grid.Columns = colomnNumber; int i = 0; foreach( IKey key in keyboard.Zones.Default.Keys ) { Label lb = new Label(); lb.Foreground = foreground; lb.Name = "label"+(i++).ToString(); lb.Content = key.ActualKeys[keyboard.CurrentMode].UpLabel; lb.HorizontalAlignment = HorizontalAlignment.Center; lb.VerticalAlignment = VerticalAlignment.Center; Viewbox box = new Viewbox(); box.Stretch = Stretch.Fill; box.Child = lb; box.Tag = key; grid.Children.Add( box ); } } Animations are started by an event handler : void Highlighter_StartAnimation( object sender, HiEventArgs e ) { Storyboard stb; if( !_anims.TryGetValue( e.Step.Animation.Name, out stb ) ) { stb = (Storyboard)_window.FindResource( e.Step.Animation.Name ); _anims.Add( e.Step.Animation.Name, stb ); } DoAnimations( _zones[e.Step.Zone], stb ); } Finally, animations are started by DoAnimations : void DoAnimations( List<Label> labels, Storyboard stb ) { foreach( Label lb in labels ) { Storyboard.SetTarget( stb, lb ); stb.Begin(); } } I want to highlight a collection of labels, but all labels are flashing. I don't know why, but I try to create a label into the Xaml directly, and set a Storyboard.TargetName (bound to the name of the label) in the Xaml of the storyboard. And it's working ... Now you know everything. Thanks for you help :)

    Read the article

  • R : remove columns from dataframe where ALL values are NA

    - by Sophomore
    hello everybody! I'm having some trouble with my huge data frame and couldn't really resolve that question myself: The dataframe has some properties as columns and each row represents one data set. I've done some sanatizing to this dataframe (e.g. get rid of datasets which are not to be included in evaluation). (Whoever might be interested: Beforehand I aggregate around 5000 single text files and put them in a tsv, some of the proerties have a sequence number like "button.pressed.1" ... ""button.pressed.n". Some of the sets excluded had really high numbers for n but got excluded, all sets left have much smaller numbers for n but the property "button.presed.50" is still there and all remaining sets have an NA in that column. Actually its a different property but the example should clarify my intention...) So the question is quite simple (for some sophisticated R pro): I need to get rid of columns where for ALL rows the value is NA. Could someone please help me out? (All I have managed to get rid of columns where at least one NA exists which dropped about half my columns)...

    Read the article

  • Don’t Delay - Apply the New 12.1.3 Procurement Rollup Patch NOW!

    - by user793553
    A new critical rollup patch (RUP) has just been released by Development for our 12.1.3 Procurement customers.  This new Patch 14254641:R12.PRC_PF.B contains important fixes for Purchasing, Internet Supplier Portal (iSupplier), Sourcing  and iProcurement (Web).  Go to My Oracle Support and enter Document ID 1468883.1 in the Knowledge Base search. This note contains information on who should apply the patch, how to apply the patch, critical fixes and important new features.

    Read the article

  • Can you apply noatime on Ext3 partitions at realtime?

    - by bzero
    an application accesses a disk directory containing about 3 million files (including directories). I would like to apply the noatime option for that filesystem and I would like to know whether I can do that while applications are running and accessing that filesystem. the command I'd apply would look like this: mount -o remount,noatime / Any experience with that? I run one single application using the file system, and it is a 100% Java application (1 JVM running). Ubuntu Version: 9.10 (Karmic) Thanks!

    Read the article

  • How to apply a .patch from codeplex / ajax toolkit

    - by maxp
    I have obtained the necessary patch for the asyncfileupload control in the codeplex / microsoft ajax control toolkit. However, what i have download is a .patch (AJAXControlToolkit_Issue_Item_#24854.patch), and i cant see any instructions on what im supposed to do from here onwards?

    Read the article

  • Can I apply a texture to UIToolbar?

    - by Ben
    I tried doing this: [toolbar setTint:[UIColor colorWithPatternImage:[UIImage imageNamed:@"thingFromMyBundle.png"]]]; but it just ended up black. At first I assumed you weren't allowed to "tint" with a texture, but I've seen apps recently that can do this. Am I missing something? Thanks.

    Read the article

  • Ninject : ninject.web - How to apply on a regular ASP.Net Web (!MVC)

    - by No Body
    What I am looking is something similar to the below (http://github.com/ninject/ninject.web.mvc): README.markdown This extension allows integration between the Ninject core and ASP.NET MVC projects. To use it, just make your HttpApplication (typically in Global.asax.cs) extend NinjectHttpApplication: public class YourWebApplication : NinjectHttpApplication { public override void OnApplicationStarted() { // This is only needed in MVC1 RegisterAllControllersIn("Some.Assembly.Name"); } public override IKernel CreateKernel() { return new StandardKernel(new SomeModule(), new SomeOtherModule(), ...); // OR, to automatically load modules: var kernel = new StandardKernel(); kernel.AutoLoadModules("~/bin"); return kernel; } } Once you do this, your controllers will be activated via Ninject, meaning you can expose dependencies on their constructors (or properties, or methods) to request injections.

    Read the article

  • CSS How to apply child:hover but not parent:hover

    - by CNelson
    With the following html, when I hover over child, I get a green background on parent. How can I stop that from happening? I do want the green background if I am hovering outside of the child element. CSS3 is fine. <style> .parent { padding: 100px; width: 400px; height:400px; } .parent:hover { background-color: green; } .child { padding: 100px; width: 200px; height:200px; } .child:hover { background-color: blue; } </style> <div class="parent"> <div class="child">Child</div> </div>

    Read the article

  • How to apply text shadow to UITextView?

    - by mystify
    Actually I love UILabel. They're sweet. Now I had to go to UITextView because UILabel is not aligning text vertically to the top. Damn. One thing I really need is a text shadow. UILabel has it. UITextView seems to not have it. But I guess that guy just uses the same underlying UIKit NSString additions?? Maybe someone already has a solution for that problem? What would I overwrite?

    Read the article

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