Search Results

Search found 1295 results on 52 pages for 'xyz sad'.

Page 14/52 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • Computing a normal matrix in conjunction with gluLookAt

    - by Chris Smith
    I have a hand-rolled camera class that converts yaw, pitch, and roll angles into a forward, side, and up vector suitable for calling gluLookAt. Using this camera class I can modify the model-view matrix to move about the 3D world just fine. However, I am having trouble when using this camera class (and associated model-view matrix) when trying to perform directional lighting in my vertex shader. The problem is that the light direction, (0, 1, 0) for example, is relative to where the 'camera is looking' and not the actual world coordinates. (Or is this eye coordinates vs. model coordinates?) I would like the light direction to be unaffected by the camera's viewing direction. For example, when the camera is looking down the Z axis the ground is lit correctly. However, if I point the camera straight at the ground, then it goes dark. This is (I think) because the light direction is parallel with the camera's 'up' vector which is perpendicular with the ground's normal vector. I tried computing the normal matrix without taking the camera's model view into account, but then none of my objects were rotated correctly. Sorry if this sounds vague. I suspect there is a straight forward answer, but I'm not 100% clear on how the normal matrix should be used for transforming vertex normals in my vertex shader. For reference, here is pseudo code for my rendering loop: pMatrix = new Matrix(); pMatrix = makePerspective(...) mvMatrix = new Matrix() camera.apply(mvMatrix); // Calls gluLookAt // Move the object into position. mvMatrix.translatev(position); mvMatrix.rotatef(rotation.x, 1, 0, 0); mvMatrix.rotatef(rotation.y, 0, 1, 0); mvMatrix.rotatef(rotation.z, 0, 0, 1); var nMatrix = new Matrix(); nMatrix.set(mvMatrix.get().getInverse().getTranspose()); // Set vertex shader uniforms. gl.uniformMatrix4fv(shaderProgram.pMatrixUniform, false, new Float32Array(pMatrix.getFlattened())); gl.uniformMatrix4fv(shaderProgram.mvMatrixUniform, false, new Float32Array(mvMatrix.getFlattened())); gl.uniformMatrix4fv(shaderProgram.nMatrixUniform, false, new Float32Array(nMatrix.getFlattened())); // ... gl.drawElements(gl.TRIANGLES, this.vertexIndexBuffer.numItems, gl.UNSIGNED_SHORT, 0); And the corresponding vertex shader: // Attributes attribute vec3 aVertexPosition; attribute vec4 aVertexColor; attribute vec3 aVertexNormal; // Uniforms uniform mat4 uMVMatrix; uniform mat4 uNMatrix; uniform mat4 uPMatrix; // Varyings varying vec4 vColor; // Constants const vec3 LIGHT_DIRECTION = vec3(0, 1, 0); // Opposite direction of photons. const vec4 AMBIENT_COLOR = vec4 (0.2, 0.2, 0.2, 1.0); float ComputeLighting() { vec4 transformedNormal = vec4(aVertexNormal.xyz, 1.0); transformedNormal = uNMatrix * transformedNormal; float base = dot(normalize(transformedNormal.xyz), normalize(LIGHT_DIRECTION)); return max(base, 0.0); } void main(void) { gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0); float lightWeight = ComputeLighting(); vColor = vec4(aVertexColor.xyz * lightWeight, 1.0) + AMBIENT_COLOR; } Note that I am using WebGL, so if the anser is use glFixThisProblem(...) any pointers on how to re-implement that on WebGL if missing would be appreciated.

    Read the article

  • WIF-less claim extraction from ACS: JWT

    - by Elton Stoneman
    ACS support for JWT still shows as "beta", but it meets the spec and it works nicely, so it's becoming the preferred option as SWT is losing favour. (Note that currently ACS doesn’t support JWT encryption, if you want encrypted tokens you need to go SAML). In my last post I covered pulling claims from an ACS token without WIF, using the SWT format. The JWT format is a little more complex, but you can still inspect claims just with string manipulation. The incoming token from ACS is still presented in the BinarySecurityToken element of the XML payload, with a TokenType of urn:ietf:params:oauth:token-type:jwt: <t:RequestSecurityTokenResponse xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">   <t:Lifetime>     <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2012-08-31T07:39:55.337Z</wsu:Created>     <wsu:Expires xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2012-08-31T09:19:55.337Z</wsu:Expires>   </t:Lifetime>   <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">     <EndpointReference xmlns="http://www.w3.org/2005/08/addressing">       <Address>http://localhost/x.y.z</Address>     </EndpointReference>   </wsp:AppliesTo>   <t:RequestedSecurityToken>     <wsse:BinarySecurityToken wsu:Id="_1eeb5cf4-b40b-40f2-89e0-a3343f6bd985-6A15D1EED0CDB0D8FA48C7D566232154" ValueType="urn:ietf:params:oauth:token-type:jwt" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">[ base64string ] </wsse:BinarySecurityToken>   </t:RequestedSecurityToken>   <t:TokenType>urn:ietf:params:oauth:token-type:jwt</t:TokenType>   <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>   <t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType> </t:RequestSecurityTokenResponse> The token as a whole needs to be base-64 decoded. The decoded value contains a header, payload and signature, dot-separated; the parts are also base-64, but they need to be decoded using a no-padding algorithm (implementation and more details in this MSDN article on validating an Exchange 2013 identity token). The values are then in JSON; the header contains the token type and the hashing algorithm: "{"typ":"JWT","alg":"HS256"}" The payload contains the same data as in the SWT, but JSON rather than querystring format: {"aud":"http://localhost/x.y.z" "iss":"https://adfstest-bhw.accesscontrol.windows.net/" "nbf":1346398795 "exp":1346404795 "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationinstant":"2012-08-31T07:39:53.652Z" "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod":"http://schemas.microsoft.com/ws/2008/06/identity/authenticationmethod/windows" "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname":"xyz" "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress":"[email protected]" "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn":"[email protected]" "identityprovider":"http://fs.svc.x.y.z.com/adfs/services/trust"} The signature is in the third part of the token. Unlike SWT which is fixed to HMAC-SHA-256, JWT can support other protocols (the one in use is specified as the "alg" value in the header). How to: Validate an Exchange 2013 identity token contains an implementation of a JWT parser and validator; apart from the custom base-64 decoding part, it’s very similar to SWT extraction. I've wrapped the basic SWT and JWT in a ClaimInspector.aspx page on gitHub here: SWT and JWT claim inspector. You can drop it into any ASP.Net site and set the URL to be your redirect page in ACS. Swap ACS to issue SWT or JWT, and using the same page you can inspect the claims that come out.

    Read the article

  • Omni-directional light shadow mapping with cubemaps in WebGL

    - by Winged
    First of all I must say, that I have read a lot of posts describing an usage of cubemaps, but I'm still confused about how to use them. My goal is to achieve a simple omni-directional (point) light type shading in my WebGL application. I know that there is a lot more techniques (like using Two-Hemispheres or Camera Space Shadow Mapping) which are way more efficient, but for an educational purpose cubemaps are my primary goal. Till now, I have adapted a simple shadow mapping which works with spotlights (with one exception: I don't know how to cut off the glitchy part beyond the reach of a single shadow map texture): glitchy shadow mapping<<< So for now, this is how I understand the usage of cubemaps in shadow mapping: Setup a framebuffer (in case of cubemaps - 6 framebuffers; 6 instead of 1 because every usage of framebufferTexture2D slows down an execution which is nicely described here <<<) and a texture cubemap. Also in WebGL depth components are not well supported, so I need to render it to RGBA first. this.texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.texture); gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR); for (var face = 0; face < 6; face++) gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, 0, gl.RGBA, this.size, this.size, 0, gl.RGBA, gl.UNSIGNED_BYTE, null); gl.bindTexture(gl.TEXTURE_CUBE_MAP, null); this.framebuffer = []; for (face = 0; face < 6; face++) { this.framebuffer[face] = gl.createFramebuffer(); gl.bindFramebuffer(gl.FRAMEBUFFER, this.framebuffer[face]); gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, this.texture, 0); gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, this.depthbuffer); var e = gl.checkFramebufferStatus(gl.FRAMEBUFFER); // Check for errors if (e !== gl.FRAMEBUFFER_COMPLETE) throw "Cubemap framebuffer object is incomplete: " + e.toString(); } Setup the light and the camera (I'm not sure if should I store all of 6 view matrices and send them to shaders later, or is there a way to do it with just one view matrix). Render the scene 6 times from the light's position, each time in another direction (X, -X, Y, -Y, Z, -Z) for (var face = 0; face < 6; face++) { gl.bindFramebuffer(gl.FRAMEBUFFER, shadow.buffer.framebuffer[face]); gl.viewport(0, 0, shadow.buffer.size, shadow.buffer.size); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); camera.lookAt( light.position.add( cubeMapDirections[face] ) ); scene.draw(shadow.program); } In a second pass, calculate the projection a a current vertex using light's projection and view matrix. Now I don't know If should I calculate 6 of them, because of 6 faces of a cubemap. ScaleMatrix pushes the projected vertex into the 0.0 - 1.0 region. vDepthPosition = ScaleMatrix * uPMatrixFromLight * uVMatrixFromLight * vWorldVertex; In a fragment shader calculate the distance between the current vertex and the light position and check if it's deeper then the depth information read from earlier rendered shadow map. I know how to do it with a 2D Texture, but I have no idea how should I use cubemap texture here. I have read that texture lookups into cubemaps are performed by a normal vector instead of a UV coordinate. What vector should I use? Just a normalized vector pointing to the current vertex? For now, my code for this part looks like this (not working yet): float shadow = 1.0; vec3 depth = vDepthPosition.xyz / vDepthPosition.w; depth.z = length(vWorldVertex.xyz - uLightPosition) * linearDepthConstant; float shadowDepth = unpack(textureCube(uDepthMapSampler, vWorldVertex.xyz)); if (depth.z > shadowDepth) shadow = 0.5; Could you give me some hints or examples (preferably in WebGL code) how I should build it?

    Read the article

  • Redirect from URL with QueryString to the same URL without QueryString

    - by Slauma
    I have a page request with a QueryString, say http://www.xyz.net/Orders.aspx?OrderID=1. The page is displayed in a browser. Now there is an asp:LinkButton on the page which should enable the user to open the page without the QueryString (as if he had entered http://www.xyz.net/Orders.aspx directly in the browser's address bar). I had two ideas: 1) Use the PostBackUrl attribute of the LinkButton: <asp:LinkButton ID="LinkButton1" runat="server" Text="Select" PostBackUrl="~/Orders.aspx" /> 2) Use "RedirectUrl" in an event handler: <asp:LinkButton ID="LinkButton1" runat="server" Text="Select" OnClick="LinkButton1_Click" /> ...and... protected void LinkButton1_Click(object sender, EventArgs e) { Response.Redirect("~/Orders.aspx"); } In both cases the browser's address bar shows http://www.xyz.net/Orders.aspx without the QueryString, as I like to have it. But in the first case the page does not change at all. But it should, because I'm evaluating the QueryString in code-behind and control the appearance of the page depending on whether a QueryString exists or not. The second option works as intended. If I am not wrong the second option requires an additional roundtrip: Browser sends request to server Event handler on server side sends Redirect URL to browser Browser sends again request to the server, but with the new URL Server sends new requested page to browser Is this correct at all? Whereas the first option omits the first two steps in the list above, thus saving the additional roundtrip and resulting in: Browser sends request to the server, but with the new URL (the PostbackURL specified in the LinkButton) Server sends new requested page to browser But, as said, the result isn't the same. I'm sure my try to explain the differences between the two options is wrong somewhere. But I don't know where exactly. Can someone explain what's really the difference? Do I really need this second roundtrip of option (2) to achieve what I want? Thanks in advance!

    Read the article

  • Collision Attacks, Message Digests and a Possible solution

    - by Dominar
    I've been doing some preliminary research in the area of message digests. Specifically collision attacks of cryptographic hash functions such as MD5 and SHA-1, such as the Postscript example and X.509 certificate duplicate. From what I can tell in the case of the postscript attack, specific data was generated and embedded within the header of the postscript (which is ignored during rendering) which brought about the internal state of the md5 to a state such that the modified wording of the document would lead to a final MD equivalent to the original. The X.509 took a similar approach where by data was injected within the comment/whitespace of the certificate. Ok so here is my question, and I can't seem to find anyone asking this question: Why isn't the length of ONLY the data being consumed added as a final block to the MD calculation? In the case of X.509 - Why is the whitespace and comments being taken into account as part of the MD? Wouldn't a simple processes such as one of the following be enough to resolve the proposed collision attacks: MD(M + |M|) = xyz MD(M + |M| + |M| * magicseed_0 +...+ |M| * magicseed_n) = xyz where : M : is the message |M| : size of the message MD : is the message digest function (eg: md5, sha, whirlpool etc) xyz : is the acutal message digest value for the message M magicseed_{i}: Is a set random values generated with seed based on the internal-state prior to the size being added. This technqiue should work, as to date all such collision attacks rely on adding more data to the original message. In short, the level of difficulty involved in generating a collision message such that: It not only generates the same MD But is also comprehensible/parsible/compliant and is also the same size as the original message, is immensely difficult if not near impossible. Has this approach ever been discussed? Any links to papers etc would be nice.

    Read the article

  • Perl to Ruby conversion (multidimensional arrays)

    - by Alex
    I'm just trying to get my head around a multidimensional array creation from a perl script i'm currently converting to Ruby, I have 0 experience in Perl, as in i opened my first Perl script this morning. Here is the original loop: my $tl = {}; for my $zoom ($zoommin..$zoommax) { my $txmin = lon2tilex($lonmin, $zoom); my $txmax = lon2tilex($lonmax, $zoom); # Note that y=0 is near lat=+85.0511 and y=max is near # lat=-85.0511, so lat2tiley is monotonically decreasing. my $tymin = lat2tiley($latmax, $zoom); my $tymax = lat2tiley($latmin, $zoom); my $ntx = $txmax - $txmin + 1; my $nty = $tymax - $tymin + 1; printf "Schedule %d (%d x %d) tiles for zoom level %d for download ...\n", $ntx*$nty, $ntx, $nty, $zoom unless $opt{quiet}; $tl->{$zoom} = []; for my $tx ($txmin..$txmax) { for my $ty ($tymin..$tymax) { push @{$tl->{$zoom}}, { xyz => [ $tx, $ty, $zoom ] }; } } } and what i have so far in Ruby: tl = [] for zoom in zoommin..zoommax txmin = cm.tiles.xtile(lonmin,zoom) txmax = cm.tiles.xtile(lonmax,zoom) tymin = cm.tiles.ytile(latmax,zoom) tymax = cm.tiles.ytile(latmin,zoom) ntx = txmax - txmin + 1 nty = tymax - tymin + 1 tl[zoom] = [] for tx in txmin..txmax for ty in tymin..tymax tl[zoom] << xyz = [tx,ty,zoom] puts tl end end end The part i'm unsure of is nested right at the root of the loops, push @{$tl->{$zoom}},{ xyz => [ $tx, $ty, $zoom ] }; I'm sure this will be very simple for a seasoned Perl programmer, thanks! `

    Read the article

  • Cascading input control is empty while accessing a Jasper Report

    - by Yogesh R
    I call a jasper report through an independent URL through which I pass one of the input controls needed to run the report. E.g. http:// localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&standAlone=true&reportUnit=xyz&ParentFolderUri=abcd&j_username=xyz&j_password=xyz&parameter1=value1& . . . As you can see in the URL, I pass the JasperServer username and password, reportUnit name and location and other mandatory parameters, along with the report input parameter, i.e., "parameter1" which can have a value like "value1". I used a mandatory, read-only and visible input control for this input value. Its value would come from the URL, showed in the box but was read-only and hence could not be changed. The report was working absolutely fine upto this point. But the tragedy began when my client rejected this idea. He wanted a completely invisible input control to my report and the input value would be passed through the URL, just like illustrated above. And then my client asked me to refer to this and made me work on cascading input controls. Recently I added a cascading input control to this report. The input control type is a single select query, which utilizes two parameters that I pass to the report through the URL. Now when the Jasper server responds to the URL with the input parameters, all the other static parameters work properly, except for the cascaded one. When I click the select box of the cascaded input, I can see the desired options for a second, and then, it just goes empty while I'm viewing the select list. But when I make the "Parameter1" input control visible, the cascading input control works! And then I turn in invisible, the cascading input control turns into a beast that does things by itself and not listen to his master. I am not able to understand why this is happening. Could anybody please provide me a solution to this?

    Read the article

  • URL rewriting to a common end point

    - by sunil
    I want to create an asp.net white-label site http://whitelabel.com, that could be styled for each of our clients according to their specific needs. So for example, client abc would see the site in their corporate colours and be accessed through their specific url http://abc.com. Likewise client xyz would see the site in their own styling and url http://xyz.com. Typing either url, in effect, takes the user to http://whitelabel.com where the styling is applied, and the client's url structure is retained. I was thinking of URL rewriting using URLRewriter.Net (http://urlrewriter.net/), or similar, mapping the incoming address to a client id and applying the theme accordingly. So, a url rewrite rule may be something like <rewrite url="http//abc.com/(.+)" to="~/$1?id=1" /> <rewrite url="http//xyz.com/(.+)" to="~/$1?id=2" /> I could then read the id, map it to the client, and with a bit of jiggery-pokery, apply the correct theme. I was wondering if: this is the right approach ? I've overlooked something ? there is a better way to do this ? Any suggestions would be appreciated.

    Read the article

  • How do I pass parameters between request-scoped beans

    - by smayers81
    This is a question that has been bothering me for sometime. My application uses ICEFaces for our UI framework and Spring 2.5 for Dependency Injection. In addition, Spring actually maintains all of our backing beans, not the ICEFaces framework, so our faces-config is basically empty. Navigation is not even really handled through navigation-rules. We perform manual redirects to new windows using window.open. All of our beans are defined in our appContext file as being request-scoped. I have Page ABC which is backed by BackingBeanABC. Inside that backing bean, I have a parameter say: private Order order; I then have Page XYZ backed by BackingBeanXYZ. When I redirect from page ABC to page XYZ, I want to transfer the 'order' property from ABC to XYZ. The problem is since everything is request-scoped and I'm performing a redirect, I am losing the value of 'description'. There has got to be an easier way to pass objects between beans in request scope during a redirect. Can anyone assist with this issue?

    Read the article

  • Loader.php trying to load Doctrine classes, but we use Propel!

    - by kewpiedoll99
    We are finding cases where we get the following 500 error: File xyz.php does not exist or class "xyz" was not found in the file at () in SF_ROOT_DIR/lib/vendor/Zend/Loader.php line 107 ... where xyz == Memcache (when trying to use symfony cc on the command line) or sfDoctrineAdminGenerator (when using an old-ish AdminGenerator-generated CMS page). We use Propel, but Loader.php is trying to load classes used only for Doctrine. Currently I am using a filthy hack where I request Loader.php to check if the file is either of these two cases, and if so simply return rather than trying to load it. Obviously, this is unacceptable longer term. Has anybody encountered this, and how did you solve it? Edited to add: We have: class ProjectConfiguration extends sfProjectConfiguration { public function setup() { // for compatibility / remove and enable only the plugins you want $this->enableAllPluginsExcept(array('sfDoctrinePlugin')); } } And we have a propel.ini file in our top level config directory. This has only started in the past four weeks or so, and we've had a stable build for over a year now. I'm pretty sure Doctrine is totally disabled.

    Read the article

  • How to distribute the android reusable code in a package?

    - by Kaillash
    Hi, I have developed some reusable android component which is basically a class . This class has some resource dependencies e.g. some png drawables, some xml layouts etc. So this class referenced the auto-generated R file.I would like to distribute this code in a single package like jar file to other developers for use in their applications. I have read that the only possible solution is to distribute code together with all my resources, which others have to copy to their "res" folder (source). So I created a jar file having the class file (say MyClass which is in the package com.xyz.android.app) and resources and tried to use this in my new application. So I added the jar file to my new applications build path using add external jars option in eclipse and copied all the resources to my new application's res folder. (The activity class say MainActivity of my new application is in com.abc.myapplication package, just for the case if it may helpful) But when I run this new application there is java.lang.ClassCastException in the MyClass class. I tried to debug the application and then I found that in the MyClass class, there is "R cannot be resolved" problem. Then I changed MainActivity's package to com.xyz.android.app (which is not the way, other developers will be happy to do), But again the same problem. But When I just copy the source java file such that both MainActivity.java and MyClass.java are in com.xyz.android.app package then application runs fine. So if I need to distribute such that other users need not to bother these package naming things, how can I accomplish this? Please help !!

    Read the article

  • Difference in behaviour( gcc and MSVC++ )

    - by Prasoon Saurav
    Consider the following code. #include <stdio.h> #include <vector> #include <iostream> struct XYZ { int X,Y,Z; }; std::vector<XYZ> A; int rec(int idx) { int i = A.size(); A.push_back(XYZ()); if (idx >= 5) return i; A[i].X = rec(idx+1); return i; } int main(){ A.clear(); rec(0); puts("FINISH!"); } I couldn't figure out the reason why the code gives segmentation fault on Linux(IDE used: Code::Blocks) whereas on Windows(IDE used : MSVC++) it doesn't. When I used valgrind just to check what actually the problem was, I got this output. I got Invalid write of size 4 at four different places. Then why didn't the code crash when I used MSVC++? Am I missing something?

    Read the article

  • Difference in behaviour (GCC and Visual C++)

    - by Prasoon Saurav
    Consider the following code. #include <stdio.h> #include <vector> #include <iostream> struct XYZ { int X,Y,Z; }; std::vector<XYZ> A; int rec(int idx) { int i = A.size(); A.push_back(XYZ()); if (idx >= 5) return i; A[i].X = rec(idx+1); return i; } int main(){ A.clear(); rec(0); puts("FINISH!"); } I couldn't figure out the reason why the code gives a segmentation fault on Linux (IDE used: Code::Blocks) whereas on Windows (IDE used: Visual C++) it doesn't. When I used Valgrind just to check what actually the problem was, I got this output. I got Invalid write of size 4 at four different places. Then why didn't the code crash when I used Visual C++? Am I missing something?

    Read the article

  • Run-time error 459 when using WithEvents with a class that implements another

    - by Ken Keenan
    I am developing a VBA project in Word and have encountered a problem with handling events when using a class that implements another. I define an empty class, IMyInterface: Public Sub Xyz() End Sub Public Event SomeEvent() And a class, MyClass that implements the above: Implements IMyInterface Public Event SomeEvent() Public Sub Xyz() ' ... code ... RaiseEvent SomeEvent End Sub Private Sub IMyInterface_Xyz() Xyz End Sub If I create a third class, OtherClass, that declares a member variable with the type of the interface class: Private WithEvents mMy As IMyInterface and try to initialize this variable with an instance of the implementing class: Set mMy = New MyClass I get a run-time error '459': This component doesn't support this set of events. The MSDN page for this error message states: "You tried to use a WithEvents variable with a component that can't work as an event source for the specified set of events. For example, you may be sinking events of an object, then create another object that Implements the first object. Although you might think you could sink the events from the implemented object, that isn't automatically the case. Implements only implements an interface for methods and properties." The above pretty much sums up what I'm trying to do. The wording, "that isn't automatically the case", rather than "this is flat-out impossible", seems to suggest that there is some bit of manual work I need to do to get it to work, but it doesn't tell me what! Does anybody know if this is possible in VBA?

    Read the article

  • SQL Server stored procedure + set error message from the records of a table

    - by lucky
    Hello, My question is I have a table with the set of records. I am calling a stored procedure for some other purpose. But when ever it finds some duplicate records. It need to return as error message back to php. C1 C2 c3 abc 32 21.03.2010 def 35 04.04.2010 pqr 45 30.03.2010 abc 12 04.05.2010 xyz 56 01.03.2010 ghi 21 06.05.2010 def 47 17.02.2010 klm 93 04.03.2010 xyz 11 01.03.2010 For the above set it need to check for the records that has the same c1. The stored procedure should return as abc,def,xyz are duplicate. I tried something like this. This will not work it has more than 1 set of duplicate records. Please help me to enhance this to solve the purpose. SET @duplicate = (SELECT c1 FROM temp GROUP BY c1 HAVING count(c1) > 1) --Check for duplicate concession Nr. IF(len(@duplicate) > '1') BEGIN SET @error = @error + ' Duplicate C1 Number:- ' + @duplicate SET @errorcount = @errorcount + 1 END As this one type error I am checking for errorcount. IF @errorcount <> '0' BEGIN GOTO E_General_Error END -- If an error occurs, rollback and exit E_General_Error: PRINT 'Error' SET @error = @error IF @@error <> 0 SET @error = 'Database update failed' ROLLBACK TRANSACTION update_database RETURN END Now it is able to return Duplicate c1 number abc. If there are more than 1 problem comes. Thanks in advance!

    Read the article

  • how to append a string to next line in perl

    - by tprayush
    hi all , i have a requirement like this.. this just a sample script... $ cat test.sh #!/bin/bash perl -e ' open(IN,"addrss"); open(out,">>addrss"); @newval; while (<IN>) { @col_val=split(/:/); if ($.==1) { for($i=0;$i<=$#col_val;$i++) { print("Enter value for $col_val[$i] : "); chop($newval[$i]=<STDIN>); } $str=join(":"); $_="$str" print OUT; } else { exit 0; } } close(IN); close(OUT); ' when i run this scipt... $ ./test.sh Enter value for NAME : abc Enter value for ADDRESS : asff35 Enter value for STATE : XYZ Enter value for CITY : EIDHFF Enter value for CONTACT : 234656758 $ cat addrss NAME:ADDRESS:STATE:CITY:CONTACT abc:asff35:XYZ:EIDHFF:234656758 when ran it second time $ cat addrss NAME:ADDRESS:STATE:CITY:CONTACT abc:asff35:XYZ:EIDHFF:234656758ioret:56fgdh:ghdgh:afdfg:987643221 ## it is appended in the same line... i want it to be added to the next line..... NOTE: i want to do this by explitly using the filehandles in perl....and not with redirection operators in shell. please help me!!!

    Read the article

  • Move iFrame in the DOM using jQuery

    - by Josh
    My overall aim is to create an editor which I can skin using jQuery UI (by creating a custom toolbar which uses integration calls), using TinyMCE. Lets say I have a TinyMCE editor on a page. The actual editor is an iFrame contained inside a lot of horrible table code, which is also where the current (to be scrapped) toolbar is. I want just the iframe inside a div - ideally get rid of the table code. So...I want to transform: <table> <tr> <td><iframe id="xyz"></iframe></td> </tr> </table> into <div id="test"> <iframe id="xyz"></iframe> </div> So far, I've tried using: $('#xyz').clone(true).appendTo('#test'); Which clones the iframe, but no content inside it. Is there a way to make this work? If not, can I somehow strip the table code from around the iFrame away? If I cant do that, I'll think I'll have to keep the table code.

    Read the article

  • Suffix if statement

    - by Aardschok
    I was looking for a way to add a suffix to jointchain in Maya. The jointchain has specific naming so I create a list with the names they need to be. The first chain has "_1" as suffix, result: R_Clavicle_1|R_UpperArm_1|R_UnderArm_1|R_Wrist_1 When I create the second this is the result: R_Clavicle_2|R_UpperArm_1|R_UnderArm_1|R_Wrist_1 The code: DRClavPos = cmds.xform ('DRClavicle', q=True, ws=True, t=True) DRUpArmPos = cmds.xform ('DRUpperArm', q=True, ws=True, t=True) DRUnArmPos = cmds.xform ('DRUnderArm', q=True, ws=True, t=True) DRWristPos = cmds.xform ('DRWrist', q=True, ws=True, t=True), cmds.xform('DRWrist', q=True, os=True, ro=True) suffix = 1 jntsA = cmds.ls(type="joint", long=True) while True: jntname = ["R_Clavicle_"+str(suffix),"R_UpperArm_"+str(suffix),"R_UnderArm_"+str(suffix),"R_Wrist_"+str(suffix)] if jntname not in jntsA: cmds.select (d=True) cmds.joint ( p=(DRClavPos)) cmds.joint ( p=(DRUpArmPos)) cmds.joint ( 'joint1', e=True, zso=True, oj='xyz', radius=0.5, n=jntname[0]) cmds.joint ( p=(DRUnArmPos)) cmds.joint ( 'joint2', e=True, zso=True, oj='xyz', radius=0.5, n=jntname[1]) cmds.joint ( p=(DRWristPos[0])) cmds.joint ( 'joint3', e=True, zso=True, oj='xyz', radius=0.5, n=jntname[2]) cmds.rename ('joint4', jntname[3]) cmds.select ( cl=True) break else: suffix + 1 I tried adding +1 in jntname which resulted in a good second chain but the third chain had "_2" after R_Clavicle_3 The code, in my eyes should work. Can anybody point me in the correct direction :)

    Read the article

  • Writing to a file in a servlet

    - by ankur verma
    I am working in a servlet and has this code : public void doPost(blah blah){ response.setContentType("text/html"); String datasent = request.getParameter("dataSent"); System.out.println(datasent); try{ FileWriter writer = new FileWriter("C:/xyz.txt"); writer.write("hello"); System.out.println("I wrote"); }catch(Exception ex){ ex.printStackTrace(); } response.getWriter().write("I am from server"); } But everytime it is throwing an error saying Access Denied.. Even when there is no lock on that file and there is no file whose name is C:/xyz.txt what should I do? ;( java.io.FileNotFoundException: C:\xyz.txt (Access is denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(FileOutputStream.java:212) at java.io.FileOutputStream.<init>(FileOutputStream.java:104) at java.io.FileWriter.<init>(FileWriter.java:63) at test.TestServlet.doPost(TestServlet.java:49) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:108) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:558) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:379) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:243) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:259) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:237) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:281) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722)

    Read the article

  • Displaying an image on a LED matrix with a Netduino

    - by Bertrand Le Roy
    In the previous post, we’ve been flipping bits manually on three ports of the Netduino to simulate the data, clock and latch pins that a shift register expected. We did all that in order to control one line of a LED matrix and create a simple Knight Rider effect. It was rightly pointed out in the comments that the Netduino has built-in knowledge of the sort of serial protocol that this shift register understands through a feature called SPI. That will of course make our code a whole lot simpler, but it will also make it a whole lot faster: writing to the Netduino ports is actually not that fast, whereas SPI is very, very fast. Unfortunately, the Netduino documentation for SPI is severely lacking. Instead, we’ve been reliably using the documentation for the Fez, another .NET microcontroller. To send data through SPI, we’ll just need  to move a few wires around and update the code. SPI uses pin D11 for writing, pin D12 for reading (which we won’t do) and pin D13 for the clock. The latch pin is a parameter that can be set by the user. This is very close to the wiring we had before (data on D11, clock on D12 and latch on D13). We just have to move the latch from D13 to D10, and the clock from D12 to D13. The code that controls the shift register has slimmed down considerably with that change. Here is the new version, which I invite you to compare with what we had before: public class ShiftRegister74HC595 { protected SPI Spi; public ShiftRegister74HC595(Cpu.Pin latchPin) : this(latchPin, SPI.SPI_module.SPI1) { } public ShiftRegister74HC595(Cpu.Pin latchPin, SPI.SPI_module spiModule) { var spiConfig = new SPI.Configuration( SPI_mod: spiModule, ChipSelect_Port: latchPin, ChipSelect_ActiveState: false, ChipSelect_SetupTime: 0, ChipSelect_HoldTime: 0, Clock_IdleState: false, Clock_Edge: true, Clock_RateKHz: 1000 ); Spi = new SPI(spiConfig); } public void Write(byte buffer) { Spi.Write(new[] {buffer}); } } All we have to do here is configure SPI. The write method couldn’t be any simpler. Everything is now handled in hardware by the Netduino. We set the frequency to 1MHz, which is largely sufficient for what we’ll be doing, but it could potentially go much higher. The shift register addresses the columns of the matrix. The rows are directly wired to ports D0 to D7 of the Netduino. The code writes to only one of those eight lines at a time, which will make it fast enough. The way an image is displayed is that we light the lines one after the other so fast that persistence of vision will give the illusion of a stable image: foreach (var bitmap in matrix.MatrixBitmap) { matrix.OnRow(row, bitmap, true); matrix.OnRow(row, bitmap, false); row++; } Now there is a twist here: we need to run this code as fast as possible in order to display the image with as little flicker as possible, but we’ll eventually have other things to do. In other words, we need the code driving the display to run in the background, except when we want to change what’s being displayed. Fortunately, the .NET Micro Framework supports multithreading. In our implementation, we’ve added an Initialize method that spins a new thread that is tied to the specific instance of the matrix it’s being called on. public LedMatrix Initialize() { DisplayThread = new Thread(() => DoDisplay(this)); DisplayThread.Start(); return this; } I quite like this way to spin a thread. As you may know, there is another, built-in way to contextualize a thread by passing an object into the Start method. For the method to work, the thread must have been constructed with a ParameterizedThreadStart delegate, which takes one parameter of type object. I like to use object as little as possible, so instead I’m constructing a closure with a Lambda, currying it with the current instance. This way, everything remains strongly-typed and there’s no casting to do. Note that this method would extend perfectly to several parameters. Of note as well is the return value of Initialize, a common technique to add some fluency to the API and enabling the matrix to be instantiated and initialized in a single line: using (var matrix = new LedMS88SR74HC595().Initialize()) The “using” in the previous line is because we have implemented IDisposable so that the matrix kills the thread and clears the display when the user code is done with it: public void Dispose() { Clear(); DisplayThread.Abort(); } Thanks to the multi-threaded version of the matrix driver class, we can treat the display as a simple bitmap with a very synchronous programming model: matrix.Set(someimage); while (button.Read()) { Thread.Sleep(10); } Here, the call into Set returns immediately and from the moment the bitmap is set, the background display thread will constantly continue refreshing no matter what happens in the main thread. That enables us to wait or read a button’s port on the main thread knowing that the current image will continue displaying unperturbed and without requiring manual refreshing. We’ve effectively hidden the implementation of the display behind a convenient, synchronous-looking API. Pretty neat, eh? Before I wrap up this post, I want to talk about one small caveat of using SPI rather than driving the shift register directly: when we got to the point where we could actually display images, we noticed that they were a mirror image of what we were sending in. Oh noes! Well, the reason for it is that SPI is sending the bits in a big-endian fashion, in other words backwards. Now sure you could fix that in software by writing some bit-level code to reverse the bits we’re sending in, but there is a far more efficient solution than that. We are doing hardware here, so we can simply reverse the order in which the outputs of the shift register are connected to the columns of the matrix. That’s switching 8 wires around once, as compared to doing bit operations every time we send a line to display. All right, so bringing it all together, here is the code we need to write to display two images in succession, separated by a press on the board’s button: var button = new InputPort(Pins.ONBOARD_SW1, false, Port.ResistorMode.Disabled); using (var matrix = new LedMS88SR74HC595().Initialize()) { // Oh, prototype is so sad! var sad = new byte[] { 0x66, 0x24, 0x00, 0x18, 0x00, 0x3C, 0x42, 0x81 }; DisplayAndWait(sad, matrix, button); // Let's make it smile! var smile = new byte[] { 0x42, 0x18, 0x18, 0x81, 0x7E, 0x3C, 0x18, 0x00 }; DisplayAndWait(smile, matrix, button); } And here is a video of the prototype running: The prototype in action I’ve added an artificial delay between the display of each row of the matrix to clearly show what’s otherwise happening very fast. This way, you can clearly see each of the two images being displayed line by line. Next time, we’ll do no hardware changes, focusing instead on building a nice programming model for the matrix, with sprites, text and hardware scrolling. Fun stuff. By the way, can any of my reader guess where we’re going with all that? The code for this prototype can be downloaded here: http://weblogs.asp.net/blogs/bleroy/Samples/NetduinoLedMatrixDriver.zip

    Read the article

  • 302: this blog will be closed

    - by preishuber
    After nearly 7 years I will discontinue blogging on this site. My resources are limited. You can reach my German blog which is used to support my customers. Looking back to a long an interesting journey ASP.NET by ScottGu That was the reason to attend this site and support Microsoft as much as I can. For that I was honored as ASP.NET MVP- thanks again. Meet Scoot several times. Great guy! Forums I have left NNTP forums a few years ago and now Microsoft closed it- It was my idea ;-) AJAX Was the wrong way- JQuery won the game IIS7 That is really a great plattform and the IIS team rules. I am sad that is so silent around that topic. ASP.NET after 2.0 Is no longer my world. I love ASP.NET and ASP.NET Server controls. I hate the discussion about how to follow the holy rules of MVC. Microsoft have dropped the goal to bring ASP.NET to #1 and accepted PHP is it. Facebook & Twittering Microblogging takes over a part of the blogging business. Shorter faster cheaper- or as SteveB mentioned - do more with less. Google Google is taking over the web. I am using Bing every time as I can but Google have more options. Sorry Microsoft you will loose that game. Apple That is not the biggest problem of Microsoft. the Ixxx takes over a small part but big money of the market, but the customers are not strongly linked. New wave new hype- Game over Apple. Silverlight My new home. I can reuse a lot of my skills and love the possibilitys. Silverligth will passing WPF-and strike Flash Windows phone 7 Also my skills fit. I just will use it for fun. I am not really satisfied about what I have heard from MIX. Guys from Redmond, I am sad to say you have been the best Smartphone OS and lost everything. The ADO vNext Story That will be the next mystic point. WCF, REST, JSON, ATOM and now OData. Nothing about SQL commands. LINQ, ORM is also not the final solution for multilayered disconnected async scenarios. Personally I prefere the OData idea and dislike the Swiss Army Knife (German Eierlegende Wollmilchsau) WCF. I am still in INETA Speakers board and I am glad to come to your user group. In all other cases you can hire me over ppedv AG. Good by and have good live.

    Read the article

  • Architecture diagram of a computer virus

    - by Shiraz Bhaiji
    I am looking for an architecture diagram of a computer virus. Does anyone have a link to a good example? Edit Looks like I am getting hammered with downvotes. I agree that there is no single architecture for a virus. But somethings must be included for a program to be a virus. Example for components in the SAD: Replication method Trigger Payload Hosts targeted Vulnerabilities targeted Anti detection method

    Read the article

  • How Much Is Novell's Linux OS Really Worth?

    <b>ServerWatch:</b> "Novell, the parent company of SUSE Linux Enterprise Server, seems to have slapped a huge "For Sale!" sign on its front lawn. It's sad, but this famous enterprise OS maker may soon be little more than a mildly interesting footnote to history."

    Read the article

  • The Linux desktop is already here

    <b>Cyber Cynic:</b> "I found it more than a little sad that someone in 2010 could still think that Linux is "still a non-starter on the desktop." Please &#8212; wake up: We're all Linux desktop users now."

    Read the article

  • The Last Nintendo Power Subscriber

    - by Jason Fitzpatrick
    Nintendo recently announced they were discontinuing gaming magazine Nintendo Power after a 24 year run. Once our moment of sad nostalgia at the news passed we were OK, but not everyone has handled the news so calmly. [via Dorkly] HTG Explains: Why Do Hard Drives Show the Wrong Capacity in Windows? Java is Insecure and Awful, It’s Time to Disable It, and Here’s How What Are the Windows A: and B: Drives Used For?

    Read the article

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