Daily Archives

Articles indexed Monday October 8 2012

Page 7/17 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • My vertex shader doesn't affect texture coords or diffuse info but works for position

    - by tina nyaa
    I am new to 3D and DirectX - in the past I have only used abstractions for 2D drawing. Over the past month I've been studying really hard and I'm trying to modify and adapt some of the shaders as part of my personal 'study project'. Below I have a shader, modified from one of the Microsoft samples. I set diffuse and tex0 vertex shader outputs to zero, but my model still shows the full texture and lighting as if I hadn't changed the values from the vertex buffer. Changing the position of the model works, but nothing else. Why is this? // // Skinned Mesh Effect file // Copyright (c) 2000-2002 Microsoft Corporation. All rights reserved. // float4 lhtDir = {0.0f, 0.0f, -1.0f, 1.0f}; //light Direction float4 lightDiffuse = {0.6f, 0.6f, 0.6f, 1.0f}; // Light Diffuse float4 MaterialAmbient : MATERIALAMBIENT = {0.1f, 0.1f, 0.1f, 1.0f}; float4 MaterialDiffuse : MATERIALDIFFUSE = {0.8f, 0.8f, 0.8f, 1.0f}; // Matrix Pallette static const int MAX_MATRICES = 100; float4x3 mWorldMatrixArray[MAX_MATRICES] : WORLDMATRIXARRAY; float4x4 mViewProj : VIEWPROJECTION; /////////////////////////////////////////////////////// struct VS_INPUT { float4 Pos : POSITION; float4 BlendWeights : BLENDWEIGHT; float4 BlendIndices : BLENDINDICES; float3 Normal : NORMAL; float3 Tex0 : TEXCOORD0; }; struct VS_OUTPUT { float4 Pos : POSITION; float4 Diffuse : COLOR; float2 Tex0 : TEXCOORD0; }; float3 Diffuse(float3 Normal) { float CosTheta; // N.L Clamped CosTheta = max(0.0f, dot(Normal, lhtDir.xyz)); // propogate scalar result to vector return (CosTheta); } VS_OUTPUT VShade(VS_INPUT i, uniform int NumBones) { VS_OUTPUT o; float3 Pos = 0.0f; float3 Normal = 0.0f; float LastWeight = 0.0f; // Compensate for lack of UBYTE4 on Geforce3 int4 IndexVector = D3DCOLORtoUBYTE4(i.BlendIndices); // cast the vectors to arrays for use in the for loop below float BlendWeightsArray[4] = (float[4])i.BlendWeights; int IndexArray[4] = (int[4])IndexVector; // calculate the pos/normal using the "normal" weights // and accumulate the weights to calculate the last weight for (int iBone = 0; iBone < NumBones-1; iBone++) { LastWeight = LastWeight + BlendWeightsArray[iBone]; Pos += mul(i.Pos, mWorldMatrixArray[IndexArray[iBone]]) * BlendWeightsArray[iBone]; Normal += mul(i.Normal, mWorldMatrixArray[IndexArray[iBone]]) * BlendWeightsArray[iBone]; } LastWeight = 1.0f - LastWeight; // Now that we have the calculated weight, add in the final influence Pos += (mul(i.Pos, mWorldMatrixArray[IndexArray[NumBones-1]]) * LastWeight); Normal += (mul(i.Normal, mWorldMatrixArray[IndexArray[NumBones-1]]) * LastWeight); // transform position from world space into view and then projection space //o.Pos = mul(float4(Pos.xyz, 1.0f), mViewProj); o.Pos = mul(float4(Pos.xyz, 1.0f), mViewProj); o.Diffuse.x = 0.0f; o.Diffuse.y = 0.0f; o.Diffuse.z = 0.0f; o.Diffuse.w = 0.0f; o.Tex0 = float2(0,0); return o; } technique t0 { pass p0 { VertexShader = compile vs_3_0 VShade(4); } } I am currently using the SlimDX .NET wrapper around DirectX, but the API is extremely similar: public void Draw() { var device = vertexBuffer.Device; device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.White, 1.0f, 0); device.SetRenderState(RenderState.Lighting, true); device.SetRenderState(RenderState.DitherEnable, true); device.SetRenderState(RenderState.ZEnable, true); device.SetRenderState(RenderState.CullMode, Cull.Counterclockwise); device.SetRenderState(RenderState.NormalizeNormals, true); device.SetSamplerState(0, SamplerState.MagFilter, TextureFilter.Anisotropic); device.SetSamplerState(0, SamplerState.MinFilter, TextureFilter.Anisotropic); device.SetTransform(TransformState.World, Matrix.Identity * Matrix.Translation(0, -50, 0)); device.SetTransform(TransformState.View, Matrix.LookAtLH(new Vector3(-200, 0, 0), Vector3.Zero, Vector3.UnitY)); device.SetTransform(TransformState.Projection, Matrix.PerspectiveFovLH((float)Math.PI / 4, (float)device.Viewport.Width / device.Viewport.Height, 10, 10000000)); var material = new Material(); material.Ambient = material.Diffuse = material.Emissive = material.Specular = new Color4(Color.White); material.Power = 1f; device.SetStreamSource(0, vertexBuffer, 0, vertexSize); device.VertexDeclaration = vertexDeclaration; device.Indices = indexBuffer; device.Material = material; device.SetTexture(0, texture); var param = effect.GetParameter(null, "mWorldMatrixArray"); var boneWorldTransforms = bones.OrderedBones.OrderBy(x => x.Id).Select(x => x.CombinedTransformation).ToArray(); effect.SetValue(param, boneWorldTransforms); effect.SetValue(effect.GetParameter(null, "mViewProj"), Matrix.Identity);// Matrix.PerspectiveFovLH((float)Math.PI / 4, (float)device.Viewport.Width / device.Viewport.Height, 10, 10000000)); effect.SetValue(effect.GetParameter(null, "MaterialDiffuse"), material.Diffuse); effect.SetValue(effect.GetParameter(null, "MaterialAmbient"), material.Ambient); effect.Technique = effect.GetTechnique(0); var passes = effect.Begin(FX.DoNotSaveState); for (var i = 0; i < passes; i++) { effect.BeginPass(i); device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, skin.Vertices.Length, 0, skin.Indicies.Length / 3); effect.EndPass(); } effect.End(); } Again, I set diffuse and tex0 vertex shader outputs to zero, but my model still shows the full texture and lighting as if I hadn't changed the values from the vertex buffer. Changing the position of the model works, but nothing else. Why is this? Also, whatever I set in the bone transformation matrices doesn't seem to have an effect on my model. If I set every bone transformation to a zero matrix, the model still shows up as if nothing had happened, but changing the Pos field in shader output makes the model disappear. I don't understand why I'm getting this kind of behaviour. Thank you!

    Read the article

  • how to generate random bubbles from array of sprites in cocos2d?

    - by prakash s
    I am devoloping the bubble shooter game in cocos2d how to generate random bubbles from array of sprites here is my code (void)addTarget { CGSize winSize = [[CCDirector sharedDirector] winSize]; //CCSprite *target = [CCSprite spriteWithFile:@"3.png" rect:CGRectMake(0, 0, 256, 256)]; NSMutableArray * movableSprites = [[NSMutableArray alloc] init]; NSArray *images = [NSArray arrayWithObjects:@"1.png", @"2.png", @"3.png", @"4.png",@"5.png",@"1.png",@"5.png", @"3.png", nil]; for(int i = 0; i < images.count; ++i) { NSString *image = [images objectAtIndex:i]; // generate random number based on size of array (array size is larger than 10) CCSprite*target = [CCSprite spriteWithFile:image]; float offsetFraction = ((float)(i+1))/(images.count+1); target.position = ccp(winSize.width*offsetFraction, winSize.height/2); target.position = ccp(350*offsetFraction, 460); [self addChild:target]; [movableSprites addObject:target]; //[target runAction:]; id actionMove = [CCMoveTo actionWithDuration:10 position:ccp(winSize.width/2,winSize. height/2)]; This code generating bubbles with *.png colour bubbles but i want to generate randomly because for shooting the bubbles by shooter class help me please id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)]; [target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]]; } }

    Read the article

  • How to apply a filter to the screen of a running program?

    - by Shahbaz
    The idea is to take old games without modifying them, but have the graphics card apply a series of filters to their output before sending them to the monitor. A very crude example would be to take a game that has a resolution of 640x480 and do: Increase the resolution to 1280x960 Apply a blur (low pass filter) Apply a sharpen (1 + high pass filter) These steps may not necessarily be the best to improve the visuals of an old game, but there are a lot of techniques that are well-known in image processing for this purpose. The question is, do the (NVidia) graphics cards give the ability to load a program that modifies the screen before sending it to the monitor? If so, how are they called and what terminology should I use to search? I would be comfortable with doing the programming myself if this ability is part of a library. Also, would the solution be different between Windows and Linux? If so, either is fine, since most of the games are probably runnable by wine.

    Read the article

  • How can I ease the work of getting pixel coordinates from a spritesheet?

    - by ThePlan
    When it comes to spritesheets they're usually easier to use, and they're very efficient memory-wise, but the problem that I'm always having is getting the actual position of a sprite from a sheet. Usually, I have to throw in some aproximated values and modify them several times until I get it right. My question: is there a tool which can basically show you the coordinates of the mouse relative to the image you have opened? Or is there a simpler method of getting the exact rectangle that the sprite is contained in?

    Read the article

  • Using glReadBuffer/glReadPixels returns black image instead of the actual image only on Intel cards

    - by cloudraven
    I have this piece of code glReadBuffer( GL_FRONT ); glReadPixels( 0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer ); Which works just perfectly in all the Nvidia and AMD GPUs I have tried, but it fails in almost every single Intel built-in video that I have tried. It actually works in a very old 945GME, but fails in all the others. Instead of getting a screenshot I am actually getting a black screen. If it helps, I am working with the Doom3 Engine, and that code is derived from the built-in screen capture code. By the way, even with the original game I cannot do screen capture on those intel devices anyway. My guess is that they are not implementing the standard correctly or something. Is there a workaround for this?

    Read the article

  • Use Zip to Pre-Populate City/State Form with jQuery AJAX

    - by Paul
    I'm running into a problem that I can solve fine by just submitting a form and calling a db to retrieve/echo the information, but AJAX seems to be a bit different for doing this (and is what I need). Earlier in a form process I ask for the zip code like so: <input type="text" maxlength="5" size="5" id="zip" /> Then I have a button to continue, but this button just runs a javascript function that shows the rest of the form. When the rest of the form shows, I want to pre-populate the City input with their city, and pre-populate the State dropdown with their state. I figured I would have to find a way to set city/state to variables, and echo the variables into the form. But I can't figure out how to get/set those variables with AJAX as opposed to a form submit. Here's how I did it without ajax: $zip = mysql_real_escape_string($_POST['zip']); $q = " SELECT city FROM citystatezip WHERE zip = $zip"; $r = mysql_query($q); $row = mysql_fetch_assoc($r); $city = $row['city']; Can anybody help me out with using AJAX to set these variables? Thanks!

    Read the article

  • Like-Button problems

    - by user1729293
    my name is Sebastian and i have massive problems with my like button on www.starsontv.com Everything should be ok said this link https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.starsontv.com%2F2012%2F10%2F06%2Fx-factor-2012-wer-schafft-es-noch-ins-juryhaus%2Fartikel-0014315%2F But you can´t use the like button. What is the problem? How can i solve this problem? This problems is there since yesterday. I have no idea and i didn´t change my website. Can anyone help me, please? Thank you very much.... Greetings from germany Sebastian

    Read the article

  • Django test client gets 301 redirection when accessing url

    - by Michal Klich
    I am writing unittests for django views. I have observed that one of my views returns redirection code 301, which is not expected. Here is my views.py mentioned earlier. def index(request): return render(request, 'index.html', {'form': QueryForm()}) def query(request): if request.is_ajax(): form = QueryForm(request.POST) return HttpResponse('valid') Below is urls.py. urlpatterns = patterns('', url(r'^$', 'core.views.index'), url(r'^query/$', 'core.views.query') ) And unittest that will fail. def so_test(self): response = self.client.post('/') self.assertEquals(response.status_code, 200) response = self.client.post('/query', {}) self.assertEquals(response.status_code, 200) My question is: why there is status 301 returned?

    Read the article

  • time(NULL) returning different time

    - by cornerback84
    I am trying to get current time in C using time_t current_time = time(NULL). As I understand, it would return me the current time of system. I am later trying to convert it into GMT time using struct tm* gmt = gmtime(&current_time). I print both times using ctime() and asctime() functions. The current time on my system is GMT + 1. But gmtime() returns me the same time as current_time is. I could not understand why gmtime() is returning me same time. Any help will be appreciated.

    Read the article

  • error message fix

    - by user1722654
    for (int i = 0; i < dataGridView1.Rows.Count; i++) { //bool sleected = false; if (dataGridView1.Rows[i].Cells[3].Value != null) { selected.Add(i); } } //string donew = ""; // line off error textBox1.Text = ((String)dataGridView1.Rows[1].Cells[2].Value); /* for (int i = 0; i < selected.Count; i++) { textAdded.Add((String)dataGridView1.Rows[0].Cells[2].Value); // donew += (String)dataGridView1.Rows[selected[i]].Cells[2].Value; }*/ I keep getting the error Unable to cast object of type 'System.Double' to type 'System.String' What can I do to overcome this?

    Read the article

  • What are the differences between these?

    - by Amit Ranjan
    What are the differences between the two queries? SELECT CountryMaster.Id FROM Districts INNER JOIN CountryMaster ON Districts.CountryId = CountryMaster.Id SELECT CountryMaster.Id FROM CountryMaster INNER JOIN Districts ON Districts.CountryId = CountryMaster.Id Please mind the i) Table positions and second ii) On Fields As I know, output will be same. But I want to know, is there any drastic effects of the same if I neglect positions of tables and columns in complex queries or tables having tons of data like thousands and lakhs of rows...

    Read the article

  • How to access a field's value in an object using reflection

    - by kentcdodds
    My Question: How to overcome an IllegalAccessException to access the value of a an object's field using reflection. Expansion: I'm trying to learn about reflection to make some of my projects more generic. I'm running into an IllegalAccessException when trying to call field.getValue(object) to get the value of that field in that object. I can get the name and type just fine. If I change the declaration from private to public then this works fine. But in an effort to follow the "rules" of encapsulation I don't want to do this. Any help would be greatly appreciated! Thanks! My Code: package main; import java.lang.reflect.Field; public class Tester { public static void main(String args[]) throws Exception { new Tester().reflectionTest(); } public void reflectionTest() throws Exception { Person person = new Person("John Doe", "555-123-4567", "Rover"); Field[] fields = person.getClass().getDeclaredFields(); for (Field field : fields) { System.out.println("Field Name: " + field.getName()); System.out.println("Field Type: " + field.getType()); System.out.println("Field Value: " + field.get(person)); //The line above throws: Exception in thread "main" java.lang.IllegalAccessException: Class main.Tester can not access a member of class main.Tester$Person with modifiers "private final" } } public class Person { private final String name; private final String phoneNumber; private final String dogsName; public Person(String name, String phoneNumber, String dogsName) { this.name = name; this.phoneNumber = phoneNumber; this.dogsName = dogsName; } } } The Output: run: Field Name: name Field Type: class java.lang.String Exception in thread "main" java.lang.IllegalAccessException: Class main.Tester can not access a member of class main.Tester$Person with modifiers "private final" at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:95) at java.lang.reflect.AccessibleObject.slowCheckMemberAccess(AccessibleObject.java:261) at java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:253) at java.lang.reflect.Field.doSecurityCheck(Field.java:983) at java.lang.reflect.Field.getFieldAccessor(Field.java:927) at java.lang.reflect.Field.get(Field.java:372) at main.Tester.reflectionTest(Tester.java:17) at main.Tester.main(Tester.java:8) Java Result: 1 BUILD SUCCESSFUL (total time: 0 seconds)

    Read the article

  • Get Two row with multiple column in asp.net c#

    - by Gaurav Naik
    How to get data from database with two rows and multiple column with seperator will be there after the 1 row end as an example: <div class="_thum_bar"> <div class="box1"> <div class="_t1_box"><a href="#!/condom_details"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> <div class="box2"> <div class="_t1_box"><a href="#!/condom_details"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> <div class="box3"> <div class="_t1_box"><a href="#"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> </div> <div class="_t_spacer">&nbsp;</div> <div class="_thum_bar"> <div class="box1"> <div class="_t1_box"><a href="#!/condom_details"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> <div class="box2"> <div class="_t1_box"><a href="#!/condom_details"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> </div> <div class="_t_spacer">&nbsp;</div>

    Read the article

  • floats in NSArray

    - by JordanC
    I have an NSArray of floats which I did by encapsulating the floats using [NSNumber numberWithFloat:myFloat] ; Then I passed that array somewhere else and I need to pull those floats out of the array and perform basic arithmatic. When I try [myArray objectAtIndex:i] ; The compiler complains that I'm trying to perform arithmatic on a type id. It also won't let me cast to float or double. Any ideas? This seems like it should be an easy problem. Maybe it will come to me after another cup of coffee, but some help would be appreciated. Thanks.

    Read the article

  • C# remove duplicates from List<List<int>>

    - by marseilles84
    I'm having trouble coming up with the most efficient algorithm to remove duplicates from List<List<int>>, for example (I know this looks like a list of int[], but just doing it that way for visual purposes: my_list[0]= {1, 2, 3}; my_list[1]= {1, 2, 3}; my_list[2]= {9, 10, 11}; my_list[3]= {1, 2, 3}; So the output would just be new_list[0]= {1, 2, 3}; new_list[1]= {9, 10, 11}; Let me know if you have any ideas. I would really appreciate it.

    Read the article

  • get best streak with all details of each row

    - by Pritesh Gupta
    ID user_id win 1 1 1 2 1 1 3 1 0 4 1 1 5 2 1 6 2 0 7 2 0 8 2 1 9 1 0 10 1 1 11 1 1 12 1 1 13 1 1 14 3 1 I needs to get the complete row for the best streak. I am able to get best streak no. for each user using this post. get consecutive records in mysql Now, I needs to get each rows data for that are involved in the best streak. i.e. for user=1, I need the complete row data for id=10,11,12,13. i.e. user_id,win and id value for these best streak row using mysql. Kindly help me on this.

    Read the article

  • Periods in Javascript function definition (function window.onload(){}) [closed]

    - by nemec
    Possible Duplicate: JavaScript Function Syntax Explanation: function object.myFunction(){..} I've seen some (legacy) javascript code recently that looks like: function window.onload(){ // some code } This doesn't look like valid javascript to me since you can't have a period in an identifier, but it seems to work in IE8. I assume it's the equivalent of: window.onload = function(){} I've tried the same code in Chrome and IE9 and both of them raise syntax exceptions, so am I correct in thinking that this "feature" of IE8 is some non-standard function definition that should be replaced? The code in question is only sent to IE browsers, so that's probably why I haven't run into this issue before.

    Read the article

  • Differences between matrix implementation in C

    - by tempy
    I created two 2D arrays (matrix) in C in two different ways. I don't understand the difference between the way they're represented in the memory, and the reason why I can't refer to them in the same way: scanf("%d", &intMatrix1[i][j]); //can't refer as &intMatrix1[(i * lines)+j]) scanf("%d", &intMatrix2[(i * lines)+j]); //can't refer as &intMatrix2[i][j]) What is the difference between the ways these two arrays are implemented and why do I have to refer to them differently? How do I refer to an element in each of the arrays in the same way (?????? in my printMatrix function)? int main() { int **intMatrix1; int *intMatrix2; int i, j, lines, columns; lines = 3; columns = 2; /************************* intMatrix1 ****************************/ intMatrix1 = (int **)malloc(lines * sizeof(int *)); for (i = 0; i < lines; ++i) intMatrix1[i] = (int *)malloc(columns * sizeof(int)); for (i = 0; i < lines; ++i) { for (j = 0; j < columns; ++j) { printf("Type a number for intMatrix1[%d][%d]\t", i, j); scanf("%d", &intMatrix1[i][j]); } } /************************* intMatrix2 ****************************/ intMatrix2 = (int *)malloc(lines * columns * sizeof(int)); for (i = 0; i < lines; ++i) { for (j = 0; j < columns; ++j) { printf("Type a number for intMatrix2[%d][%d]\t", i, j); scanf("%d", &intMatrix2[(i * lines)+j]); } } /************** printing intMatrix1 & intMatrix2 ****************/ printf("intMatrix1:\n\n"); printMatrix(*intMatrix1, lines, columns); printf("intMatrix2:\n\n"); printMatrix(intMatrix2, lines, columns); } /************************* printMatrix ****************************/ void printMatrix(int *ptArray, int h, int w) { int i, j; printf("Printing matrix...\n\n\n"); for (i = 0; i < h; ++i) for (j = 0; j < w; ++j) printf("array[%d][%d] ==============> %d\n, i, j, ??????); }

    Read the article

  • spring 3 uploadify giving 404 Error

    - by Rajkumar
    I am using Spring 3 and implementing Uploadify. The problem is, the files are updating properly but it is giving HTTP Error 404, on completion of file upload. I tried every possible solution, but none of them works. The files are uploaded. Values are storing in DB properly, only that i am getting HTTP Error 404. Any help is appreciated and Thanks in advance. The JSP Page $(function() { $('#file_upload').uploadify({ 'swf' : 'scripts/uploadify.swf', 'fileObjName' : 'the_file', 'fileTypeExts' : '*.gif; *.jpg; *.jpeg; *.png', 'multi' : true, 'uploader' : '/photo/savePhoto', 'fileSizeLimit' : '10MB', 'uploadLimit' : 50, 'onUploadStart' : function(file) { $('#file_upload').uploadify('settings', 'formData', {'trip_id' :'1', 'trip_name' :'Sample Trip', 'destination_trip' :'Mumbai','user_id' :'1','email' :'[email protected]','city_id' :'12'}); }, 'onQueueComplete' : function(queueData) { console.log('queueData : '+queueData); window.location.href = "trip/details/1"; } }); }); The Controller @RequestMapping(value="photo/{action}", method=RequestMethod.POST) public String postHandler(@PathVariable("action") String action, HttpServletRequest request) { if(action.equals("savePhoto")) { try{ MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request; MultipartFile file = multipartRequest.getFile("the_file"); String trip_id = request.getParameter("trip_id"); String trip_name = request.getParameter("trip_name"); String destination_trip = request.getParameter("destination_trip"); String user_id = request.getParameter("user_id"); String email = request.getParameter("email"); String city_id = request.getParameter("city_id"); photo.savePhoto(file,trip_id,trip_name,destination_trip,user_id,email,city_id); photo.updatetrip(photo_id,trip_id); }catch(Exception e ){e.printStackTrace();} } return ""; } spring config <bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver" id="multipartResolver"> <property name="maxUploadSize" value="10000000"/> </bean>

    Read the article

  • Pull news from an RDF Feed using Ruby and Nokogiri?

    - by Christian
    I would like to pull the titleand description fields from the newsfeed at http://www.tagesschau.de/newsticker.rdf to feed them to the Mac's Text-to-Speech engine. My search for a nice Ruby Gem to do this has brought me to Nokogiri, but all examples that "pull something out" of a given XML seem to be centered around CSS somehow. Does anyone have any idea how to save the titleand description fields in an array?

    Read the article

  • Error in eclipse: "The project cannot be built until build path errors are resolved"

    - by Darkphenom
    I am a CS student learning java so I do some work at home and at college on a mixture of linux and windows. I have a problem after copying a new project into the eclipse workspace. The project shows up but with a red exclamation mark and an error saying: "The project cannot be built until build path errors are resolved" Can somebody help me out with this? I tried this http://www.scottdstrader.com/blog/ether_archives/000921.html but it didn't work. Also, are there any good ways of syncing an eclipse workspace across multiple computers?

    Read the article

  • Collision of dot and line in 2D space

    - by Anderiel
    So i'm trying to make my first game on android. The thing is i have a small moving ball and i want it to bounce from a line that i drew. For that i need to find if the x,y of the ball are also coordinates of one dot from the line. I tried to implement these equations about lines x=a1 + t*u1 y=a2 + t*u2 = (x-a1)/u1=(y-a2)/u2 (t=t which has to be if the point is on the line) where x and y are the coordinates im testing, dot[a1,a2] is a dot that is on the line and u(u1,u2) is the vector of the line. heres the code: public boolean Collided() { float u1 =Math.abs(Math.round(begin_X)-Math.round(end_X)); float u2 =Math.abs(Math.round(begin_Y)-Math.round(end_Y)); float t_x =Math.round((elect_X - begin_X)/u1); float t_y =Math.round((elect_Y - begin_Y)/u2); if(t_x==t_y) { return true; } else { return false; } } points [begin_X,end_X] and [begin_Y,end_Y] are the two points from the line and [elect_X,elect_Y] are the coordinates of the ball theoreticaly it should work, but in the reality the ball most of the time just goes straigth through the line or bounces somewhere else where it shouldnt

    Read the article

  • PHP/Java Bridge - Access Java objects in PHP

    - by Omer Hassan
    I have a Red5 application which defines some public Java methods. When I start the server, an object of the application class gets created. I am trying to call the public methods of the application class from PHP using the existing instance of the Java application class. So here's my Java application: public class App extends org.red5.server.adapter.ApplicationAdapter { public boolean appStart(IScope app) { // This method gets called when the application starts // and an object of this App class is created. return true; } // This is the method I would like to call from PHP. public void f() { } } From PHP, I would like to get access to the App object that is created and call the method f() on it. I have tried playing around with this thing called "context". So in the Java method App.appStart(), I did this: // Save a reference to this App object to be retrieved later in PHP. new PhpScriptContextFactory().getContext().put("x", this); And in PHP, I tried to access the saved object like this: require_once("http://localhost:5080/JavaBridge/java/Java.inc"); var_dump(java_is_null(java_context()->get("x"))); Unfortunately, the java_is_null() function in PHP returns true. I also tried saving the App object in a static variable of App class but when I access that variable in PHP, its value is null.

    Read the article

  • Linkedin: Registering Application for both Web and Mobile

    - by VishwaKumar
    My project deals with both Web app and Mobile app. So before we can use Linkedin API's into our project we need to register our app with Linkedin according to this Quick Start. But for my situation where i use Linkedin API's for both web and mobile, Do i need to register two application with Linkedin. Or is there any other way to register a single application and use the same for both web and mobile? In the registration page i don't see any distinction for Web and Mobile, unlike facebook where a single application registered can be used for both web and mobile app. If anyone could point me to appropriate docs or pointers, it would be really helpful. Please forgive me for posting here as there wasn't any appropriate forum to choose from. Thank you.

    Read the article

  • combine 2 files with AWK based last colums

    - by mohammad reshad
    i have two files file1 ------------------------------- 1 a t p b 2 b c f a 3 d y u b 2 b c f a 2 u g t c 2 b j h c file2 -------------------------------- 1 a b 2 p c 3 n a 4 4 a i want combine these 2 files based last columns (column 5 of file1 and column 3 of file2) using awk result ---------------------------------------------- 1 a t p 1 a b 2 b c f 3 n a 2 b c f 4 4 a 3 d y u 1 a b 2 b c f 3 n a 2 b c f 4 4 a 2 u g t 2 p c 2 b j h 2 p c

    Read the article

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