Daily Archives

Articles indexed Monday December 17 2012

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

  • Amazon Affiliate search using a movie title

    - by Matt Walker
    I am currently working on a movie trailer site. I have over 300 movies and I do not want to add an amazon affiliate link to each one individually. Does amazon offer any sort of api that will allow me to use a movie title to search for a dvd on amazon? Ex. For the movie skyfall, the amazon affiliate link would be amazon.com/search/dvd/skyfall/affiliateid ^ I just made the link up as i don't know how their system works, but I just want it to do a search on the movie title Thanks in advance for any help you can give me!

    Read the article

  • XCart Skip Checkout Steps

    - by user900553
    I am using xcart. In the checkout process, skip the step that appears after a customer clicks the add to cart button on the product page. It takes them to a page that shows the product and the text Added to your shopping cart. I want to take them directly to the view cart page, right before the checkout page. I also tried: Enable Redirect customer to cart after adding a product option in X-Cart admin back-end -Settings - General settings. Still not working. Anybody have Idea about this?

    Read the article

  • Optimal sprite size for rotations

    - by Panda Pajama
    I am making a sprite based game, and I have a bunch of images that I get in a ridiculously large resolution and I scale them to the desired sprite size (for example 64x64 pixels) before converting them to a game resource, so when draw my sprite inside the game, I don't have to scale it. However, if I rotate this small sprite inside the game (engine agnostically), some destination pixels will get interpolated, and the sprite will look smudged. This is of course dependent on the rotation angle as well as the interpolation algorithm, but regardless, there is not enough data to correctly sample a specific destination pixel. So there are two solutions I can think of. The first is to use the original huge image, rotate it to the desired angles, and then downscale all the reaulting variations, and put them in an atlas, which has the advantage of being quite simple to implement, but naively consumes twice as much sprite space for each rotation (each rotation must be inscribed in a circle whose diameter is the diagonal of the original sprite's rectangle, whose area is twice of that original rectangle, supposing square sprites). It also has the disadvantage of only having a predefined set of rotations available, which may be okay or not depending on the game. So the other choice would be to store a larger image, and rotate and downscale while rendering, which leads to my question. What is the optimal size for this sprite? Optimal meaning that a larger image will have no effect in the resulting image. This is definitely dependent on the image size, the amount of desired rotations without data loss down to 1/256, which is the minimum representable color difference. I am looking for a theoretical general answer to this problem, because trying a bunch of sizes may be okay, but is far from optimal.

    Read the article

  • ConsumeStructuredBuffer, what am I doing wrong?

    - by John
    I'm trying to implement the 3rd exercise in chapter 12 of Introduction to 3D Game Programming with DirectX 11, that is: Implement a Compute Shader to calculate the length of 64 vectors. Previous exercises ask you to do the same with typed buffers and regular structured buffers and I had no problems with them. For what I've read, [Consume|Append]StructuredBuffers are bound to the pipeline using UnorderedAccessViews (as long as they use the D3D11_BUFFER_UAV_FLAG_APPEND, and the buffers have both D3D11_BIND_SHADER_RESOURCE and D3D11_BIND_UNORDERED_ACCESS bind flags). Problem is: my AppendStructuredBuffer works, since I can append data to it and retrieve it from the application to write to a results file, but the ConsumeStructuredBuffer always returns zeroed data. Data is in the buffer, since if I change the UAV to a ShaderResourceView and to a StructuredBuffer in the HLSL side it works. I don't know what I am missing: Should I initialize the ConsumeStructuredBuffer on the GPU, or can I do it when I create the buffer (as I amb currently doing). Is it OK to bind the buffer with a UAV as described above? Do I need to bind it as a ShaderResourceView somehow? Maybe I am missing some step? This is the declaration of buffers in the Compute Shader: struct Data { float3 v; }; struct Result { float l; }; ConsumeStructuredBuffer<Data> gInput; AppendStructuredBuffer<Result> gOutput; And here the creation of the buffer and UAV for input data: D3D11_BUFFER_DESC inputDesc; inputDesc.Usage = D3D11_USAGE_DEFAULT; inputDesc.ByteWidth = sizeof(Data) * mNumElements; inputDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS; inputDesc.CPUAccessFlags = 0; inputDesc.StructureByteStride = sizeof(Data); inputDesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED; D3D11_SUBRESOURCE_DATA vinitData; vinitData.pSysMem = &data[0]; HR(md3dDevice->CreateBuffer(&inputDesc, &vinitData, &mInputBuffer)); D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc; uavDesc.Format = DXGI_FORMAT_UNKNOWN; uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER; uavDesc.Buffer.FirstElement = 0; uavDesc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_APPEND; uavDesc.Buffer.NumElements = mNumElements; md3dDevice->CreateUnorderedAccessView(mInputBuffer, &uavDesc, &mInputUAV); Initial data is an array of Data structs, which contain a XMFLOAT3 with random data. I bind the UAV to the shader using the Effects framework: ID3DX11EffectUnorderedAccessViewVariable* Input = mFX->GetVariableByName("gInput")->AsUnorderedAccessView(); Input->SetUnorderedAccessView(uav); // uav is mInputUAV Any ideas? Thank you.

    Read the article

  • Blending transition in cocos2d

    - by fiddler
    In my cocos2d-iphone game, I have 2 backgrounds (CCnodes), each containing a quite complex hierarchy of sprites. I would like to make a smooth transition between them: initially, only the first background is visible at the end, only the second one is visible Is there a good way to set the opacity of a full hierarchy of sprites ? I tried to recursively set the opacity of all the contained sprites. It kinda works except that: i guess it's not very efficient i would like the opacity of overlapping sprites to be 'merged' (as if the background was one single big sprite)

    Read the article

  • Collisions on complex map 2D

    - by waxx
    I'm currently thinking about collision and map system that I want to use in my next game and I'm kind of puzzled. Maps are going to be somewhat complex with lots of irregularities and thus tiling is out of question. I thought about an editor where you'd draw rectangles on the map that would represent areas that are collidable with and then saving such "collision map" with only black/white gfx. Or maybe should I save exact rectangles data with their x/y/width/height into some text file and go from there? What would you recommend? Thanks.

    Read the article

  • c++ How to use angular velocity that derived from inertia and force(torque) in 3d

    - by user1217203
    I am relatively new to game development. May my terminology and description are not appropriate. Please excuse my poor phrasing and help me by giving advice on how to question better if this question seems less fitting. I really appreciate your efforts. Hi. I am having hard time interpreting the set of values I have. I have inertia and force(torque) in terms of x y z. FYI I used x and y coordinates as my ground, flat coordinates and z as my up/down. I am assuming that since f = ma, that angular acceleration must be a = f / m. So I divide my torque by inertia. Then I add those x y z values to my angular velocity variable's x y z. However these x y z values confuse me. Don't I need angle/sec or radian/sec sort of values in order to apply rotation? The x y z values I have seemed to not say anything about radians or angular movement. Question : If I have ( 1, 2, 3 ) or any ( x, y, z ) as my angular velocity, how do I actually apply it as angular movement? FYI Here I am pasting my code : float mass = 100; float devidedMass = 1.0/12 * mass; Vec3 innertia( devidedMass* (_box._size.z*_box._size.z + _box._size.x*_box._size.x), devidedMass* (_box._size.y*_box._size.y + _box._size.x*_box._size.x), devidedMass* (_box._size.y*_box._size.y + _box._size.z*_box._size.z )); box._angAccel += forceAng/innertia; box._angVelo += box._angAccel; box._angAccel.allZero(); source of my inertia calculation http://www.health.uottawa.ca/biomech/courses/apa4311/solids.pdf

    Read the article

  • Starting to make 2D games in C++

    - by Ashley
    I'm fairly experienced with C and C#, but I've only ever created console/windows applications. I'm also experienced with AS3 and I've made some flash games. I want to make proper 2D games in C++, but I have no idea where to begin with graphics. There are entire books devoted to game development in C++ that only work with console applications and I'm finding the lack of resources and tutorials for proper 2D games frustrating... I'm also not particularly interested in using existing engines because I want total control of what I create. I've heard of the Allegro library; is it something important/popular that I should look into? How will I use DirectX? Any resources or links to tutorials or information is greatly appreciated.

    Read the article

  • Crash when using Cocos2d

    - by ipodfreak0313
    Sorry about the poor question title, it's just that this seems to big for a title. So here's the dirt: I am making a game (obviously) and I want the enemies to shoot (not necessarily at the player). I want the shoot method to be in the Enemies file, so as not to clutter up my HelloWorldLayer.m file even more. Here's what I'm using right now: HelloWorldLayer.m -(void)addEnemy:(BigAndStrongEnemy *)enemy { enemy = nil; if((arc4random() % 4) == 3) { enemy = [BigAndStrongEnemy enemy]; } else { enemy = [SmallAndFastEnemy enemy]; } if(buffDude.position.y > character.position.y || buffDude.position.y < (character.position.y + 10)) { } int rand = arc4random() % 320; if((arc4random() % 2 == 1)) { [enemy setPosition:ccp(0,rand)]; }else{ [enemy setPosition:ccp(480,rand)]; } [self animateEnemy:enemy]; [self addChild:enemy]; } -(void)animateEnemy:(BigAndStrongEnemy *)enemy2 { float randX = arc4random() % 480; float randY = arc4random() % 320; int rand = arc4random() % 320; CGPoint moveToPoint = CGPointMake(randX, (randY - rand)); [enemies addObject:enemy2]; action = [CCSequence actions: [CCMoveBy actionWithDuration:1 position:ccpMult(ccpNormalize(ccpSub(moveToPoint, enemy2.position)), 75)], [CCMoveBy actionWithDuration:3 position:ccp(buffDude.position.x,buffDude.position.y)], nil]; CCCallFuncO *a = [CCCallFuncO actionWithTarget:self selector:(@selector(shoot:)) object:enemy2]; CCSequence *s = [CCSequence actions:action,a, nil]; CCRepeatForever *repeat = [CCRepeatForever actionWithAction:s]; [enemy2 runAction:repeat]; } And here's the Shoot info from the Enemies class: Enemies.m: -(void)shoot:(id)sender { self = (BigAndStrongEnemy *)sender; [self shoot]; } -(void)spriteMoveFinished:(id)sender { CCSprite *b = (CCSprite *)sender; [self removeChild:b cleanup:YES]; } -(void)shoot { self = [CCSprite spriteWithFile:@"bigAndStrongEnemy.gif"]; CCSprite *b = [CCSprite spriteWithFile:@"bullet.gif"]; b.position = ccp(self.position.x,self.position.y); b.tag = 2; [self addChild:b]; [bullets addObject:b]; CGSize winSize = [[CCDirector sharedDirector] winSize]; CGPoint point = CGPointMake((winSize.width - (winSize.width - self.position.x)),0); [b runAction:[CCSequence actions: [CCMoveBy actionWithDuration:0.5 position:point], [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)], nil]]; } Every time the 3 seconds goes by, the app crashes, and goes to the breakpoint in the CCCallFuncO file. I haven't touched it, is the thing. I am completely confused. Any help is greatly appreciated.

    Read the article

  • UIView Login screen to tabbar logic

    - by Benjamin De Bos
    Folks, i'm having trouble with some navigation logic. Currently i have a simple two tabbed tabbar application. But i want to show a loginscreen in front. So that would be an UIView. Currently the code is as follows: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UIViewController *viewController1 = [[roosterViewController alloc] initWithNibName:@"roosterViewController" bundle:nil]; UIViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; self.tabBarController = [[UITabBarController alloc] init]; self.tabBarController.viewControllers = @[viewController1, viewController2]; self.window.rootViewController = self.tabBarController; [self.window makeKeyAndVisible]; return YES; } SO this pushes a simple tabcontroller. Well, now i want to have a login screen. So that would be a simple UIView which pushes the tabbar controller. But i can't seem to see the logic on how to do this. I've been trying to present a modal view controller, but the thing is: the tabbar will be loaded on the background. Since i need the username/password information to work on the tabbarview, this won't work. My Logic would be: delegate load loginViewController load tabbar controller But, then i need to be able to "logout". So i need to destroy the tabbar controller and present the login screen. Any thoughts on this?

    Read the article

  • C# to loop through folder until it finds the correct files

    - by Liton Uddin
    I’m running a batch to do an update to my sql table. I’m using windows scheduler to run the batch file. Each day files come in at different time. Sometime they come in after my scheduled time therefore the batch file doesn’t run when there’s no file before the scheduled task in the folder. I want to create a c# program where it will loop through the folder until it finds the files and then move to the next step in the batch file. Basically my goal is to create a program that will look for those particular files and once they finds the correct files then it will start the update. I’m new to programming and need some direction. Can someone please help me with this? Thanks.

    Read the article

  • Error reading in date using Zoo in R

    - by SASnewby
    I am trying to use the Zoo package to read in daily observations which do not occur on each day. The date format looks like this, and it is in the first column of dataset: 25-May-07 The command I use is: z <- read.zoo("multiplier7.csv", sep = ";", header = TRUE, format="%d-%b-%y") I get this error: Error in strptime(x, format, tz = "GMT") : input string is too long First question is: 1. Is Zoo the right package to use if I want to use lm regression with a spline time dummy? The bs command does not work because I need to convert it into a time series. 2. Why is this error occurring and how to fix?

    Read the article

  • Strange problems with the Spring RestTemplate in Android application

    - by HarryCater
    I begin to use RESTful api of the Spring Framework in my android client application. But I have encountered with problems when I tried to execute HTTP request via postForObject/postForEntity methods. Here is my code: public String _URL = "https://noticemed.com/app/mobile/login"; public void BeginAuthorization(View view) { HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.setContentType(MediaType.APPLICATION_JSON); HttpEntity<String> _entity = new HttpEntity<String>(requestHeaders); RestTemplate templ = new RestTemplate(); templ.setRequestFactory(new HttpComponentsClientHttpRequestFactory()); templ.getMessageConverters().add(new MappingJacksonHttpMessageConverter()); ResponseEntity<String> _response = templ.postForEntity(_URL,_entity,String.class); //HERE APP CRASHES String _body = _response.getBody(); And here is a stack trace in logcat after app crashing. As you see there is no definite error message. So the question what am I doing wrong? How to fix this? May there is other way to do it?I really need a help. Thanks in advance!

    Read the article

  • How to make a report with count of type of cases in each month in Acess 2010

    - by amir shadaab
    I have a database is access with each record having a date and yes/no type columns for each record which shows which category the record comes under. I want to create a report which shows the types of cases in each month by taking a date range as a parameter through prompts. I have done the prompt part but I'm not sure how the query should be to show values for each month in that date range. Can someone please help me with this?

    Read the article

  • Multiple Table Join in Linq C# Dynamically

    - by kmkperumal
    I have 3 data table a,b,c In this I need to write Join Query Dynamically using linQ. The Selecting columns given by customer and Condition columns also given customer at run time. So i need to create Querys dynamically.Please check below example.Because i dont which table they want and which column also For example Select a.c1,a.c2,b.c1,b.c2 From a Left Join b on a.c1=b.c1 2.Select c.c1,c.c2,a.c1,a.c2 From c Left Join a on c.c3=a.c1 3.Select a.c1,a.c2,b.c1,b.c2,c.c1,c.c2 From a Left Join b on a.c2=b.c2 Left join c on c.c1=a.c1 Like i need create different set of query's. Please help me on this.

    Read the article

  • Pointing to array element

    - by regular
    What I'm trying to achieve is say i have an array, i want to be able to modify a specific array element throughout my code, by pointing at it. for example in C++ i can do this int main(){ int arr [5]= {1,2,3,4,5}; int *c = &arr[3]; cout << arr[3] <<endl; *c = 0; cout << arr[3]<<endl; } I did some googling and there seems to be a way to do it through 'unsafe', but i don't really want to go that route. I guess i could create a variable to store the indexes, but I'm actually dealing with slightly more complexity (a list within a list. so having two index variables seems to add complexity to the code.) C# has a databinding class, so what I'm currently doing is binding the array element to a textbox (that i have hidden) and modifying that textbox whenever i want to modify the specific array element, but that's also not a good solution (since i have a textbox that's not being used for its intended purpose - a bit misleading).

    Read the article

  • Calling function and running it

    - by devs
    I am quite new to objects and OOP. I really don't know how to explain it well but I'll try. So I am trying to read though JSON with JS, the JSON is passed from PHP. This would be easy if all of the information was on the same html page, but I' am trying something that I am new too. So let me show my code... First is the JS which is in app.js var Donors = function(){ var api = this.list; $(document).ready(function(){ $.getJSON(api, function(){ var donorObj = api.payload; $.each(donorObj, function(i, donor){ //console.log(donor.ign); }); }); }); } What I want this part to do is read from the JSON I'm giving it and console.log each name (or donor.ign) when the document is ready. On the html page, or header.php <script> $(function(){ var list = <?php cbProxy(); ?>; var Dons = new Donors(); Dons.list = list; }); </script> the data that's in list is the below JSON. You already know what the rest does, it just passes the JSON to the Donors() function. JSON example: { "code": 0, "payload": [ { "time": 1349661897, "packages": [ "49381" ], "ign": "Notch", "price": "15.99", "currency": "USD" } I'm use to just making functions and calling it on the same page or file and this is my first doing this kind of function. How can I get the function to run with the data I sent it so it console.log() each name.

    Read the article

  • Sencha : how to pass parameter to php using Ext.data.HttpProxy?

    - by Lauraire Jérémy
    I have successfully completed this great tutorial : http://www.sencha.com/learn/ext-js-grids-with-php-and-sql/ I just can't use the baseParams field specified with the proxy... Here is my code that follows tutorial description : __ My Store : Communes.js ____ Ext.define('app.store.Communes', { extend: 'Ext.data.Store', id: 'communesstore', requires: ['app.model.Commune'], config: { model: 'app.model.Commune', departement:'var', // the proxy with POST method proxy: new Ext.data.HttpProxy({ url: 'app/php/communes.php', // File to connect to method: 'POST' }), // the parameter passed to the proxy baseParams:{ departement: "VAR" }, // the JSON parser reader: new Ext.data.JsonReader({ // we tell the datastore where to get his data from rootProperty: 'results' }, [ { name: 'IdCommune', type: 'integer' }, { name: 'NomCommune', type: 'string' } ]), autoLoad: true, sortInfo:{ field: 'IdCommune', direction: "ASC" } } }); _____ The php file : communes.php _____ <?php /** * CREATE THE CONNECTION */ mysql_connect("localhost", "root", "pwd") or die("Could not connect: " . mysql_error()); mysql_select_db("databasename"); /** * INITIATE THE POST */ $departement = 'null'; if ( isset($_POST['departement'])){ $departement = $_POST['departement']; // Get this from Ext } getListCommunes($departement); /** * */ function getListCommunes($departement) { [CODE HERE WORK FINE : just a connection and query but $departement is NULL] } ?> There is no parameter passed as POST method... Any idea?

    Read the article

  • How to select form input based on label inner HTML?

    - by Shane
    I have multiple forms that are dynamically created with different input names and id's. The only thing unique they will have is the inner HTML of the label. Is it possible to select the input via the label inner HTML with jQuery? Here is an example of one of my patient date of birth blocks, there are many and all unique except for innerHTML. <div class="iphorm-element-spacer iphorm-element-spacer-text iphorm_1_8-element-spacer"> <label for="iphorm_081a9e2e6b9c83d70496906bb4671904150cf4b43c0cb1_8">events=Object { mouseover=[1], mouseout=[1]}handle=function()data=Object { InFieldLabels={...}} Patient DOB <span class="iphorm-required">*</span> </label> <div class="iphorm-input-wrap iphorm-input-wrap-text iphorm_1_8-input-wrap"> <input id="iphorm_081a9e2e6b9c83d70496906bb4671904150cf4b43c0cb1_8" class="iphorm-element-text iphorm_1_8" type="text" value="" name="iphorm_1_8">events=Object { focus=[1], blur=[1], keydown=[1], more...}handle=function() </div> <div class="iphorm-errors-wrap iphorm-hidden"> </div> This is in a Wordpress Plugin and because we are building to allow employees to edit their sites (this is actually a Wordpress Network), we do not want to alter the plugin if possible. Note that the label "for" and the input "id" share the same dynamic key, so this might be a way to maybe get the id, but wanted to see if there is a shorter way of doing this.

    Read the article

  • Magento - Authorize.net - Get Payment Update for expired transactions

    - by pspahn
    Magento 1.6.1 I have set up Authorize.net (AIM) for the client's store. Previously they were using saved CC method and entering information manually in Authorize.net's merchant terminal. Most of it is working as expected, however for transactions that are flagged as 'Suspected Fraud' by Authorize.net, if the client does not update the transaction manually before the authorization expires, using 'Get Payment Update' in Magento fails because the transaction is expired (I believe it's five days for an authorize only transaction). For the client, it seems the only way to update this order in Magento is to simply delete the order, as it doesn't appear the Paygate model knows about expired transactions. Performing 'Get Payment Update' simply returns 'There is no update for this payment'. I have already modified the file: /app/code/core/Mage/Paygate/Model/Authorize.net to have the correct API URL as described in issue #27117 ( http://www.magentocommerce.com/bug-tracking/issue?issue=12991 - must be logged in to view ). This resolved the button not working for all other orders; however this does not fix the issue I am describing. Is anyone familiar with Authorize.net's AIM API so that we can update these orders in Magento to something that makes sense (canceled, etc.) without having to delete the order? I am thinking it should be a case of adding a new order status to Magento, checking the update for an 'Expired' status, and setting the order to the newly created order status. -- edit -- I just ran a diff for the file mentioned above and noticed that Magento 1.7.0.2 includes the _isTransactionExpired() method which seems like it would be the fix. Can it be as simple as updating this model with the newer version?

    Read the article

  • Add objects to Arraylist inside loop and get a list of them outside loops

    - by AgusDG
    Im already done with a method to do a shot on a board (bidimensional array). THe shot goes from the bottom to the top, and depending of the direction, it do bounces on the walls to get to the top. The thing is that I did the method to represent the trayectory with an 'x'. Now, I want to add the coordinates x and y of each position of the shot (b [x][y]) to and Arraylist of Objects Position. public Position(int row,int col) { this.row = row; this.col = col; } The thing is that the method uses a for loop and inside if loops, and I'll need to create the objects inside, and get them outside. I did that : public static ArrayList<Position> showTrayectory (char [][] b , int shotDirection, char bubble){ int row = 0, col = 0; ArrayList<Position> aListPos = new ArrayList<Position>(); Position positionsOfShot = new Position(row,col); START = ((RIGHT_WALL)/2) + shotDirection; boolean shotRight = false; if(shotDirection < 0) shotRight = false; else if(shotDirection > 0) shotRight = true; for(int y = BOTTOM,x = START ;y >= 0;y--) { if(!isOut(y,x) && !emptyCell(y,x)) break; if(x <= LEFT_WALL) shotRight = true; if(x >= RIGHT_WALL) shotRight = false; if(!isOut(y,x) && shotRight == true) { positionsOfShot = new Position(y,x); aListPos.add(positionsOfShot); b[y][x] = SHOT; ++x; } if(!isOut(y,x) && shotRight == false){ positionsOfShot = new Position(y,x); aListPos.add(positionsOfShot); b[y][x] = SHOT; --x; } } // The nested for loops below are for showing the positions // But I dont need it that way // I must get the trayectory from an ArrayList and print it from there for(int y=0;y < b.length;y++){ System.out.println(); for(int x=0;x < b[y].length;x++){ System.out.print(" "+b [y][x]+" "); } } System.out.println("\nTrayectory of the shot ["+shotDirection+"]"); System.out.println("Next bubble ["+bubble+"]"); for( Position ii : aListPos){ System.out.println("(" + positionsOfShot.getFila() + "," + positionsOfShot.getColumna()+")"); } return aListPos; } The sentence " b[y][x] = SHOT; " is still there, to see the proper trayectory of the shot (its not needed that way), but what I need, is getting the trayectory in an ArrayList, and print the trayectory from there. All that I get is a wrong position, and repeated during the number of positions the shot goes through. I need some help. I suppose the problem is that Im creating and adding Position Objects inside an ArrayList inside loops, but in a wrong way. I will need you to explain me how to do it properly ; ) Thanks in advance. I'll add the output for you see better what is that above haha *************************** y b y b g r b g o y g a a r y o y y r b y g r r o b o y y g b a r y r o a y y o o r r g r - - - x - - - - - - - - - x - - - - - - - - - x - - - - - - - - - x - - - - - - - - - x - - - - - - - - - x - - - - - - - x - - - - - - - x - - - - - - - x - - - Trayectory of the shot [1] Next bubble [y] (5,3) (5,3) (5,3) (5,3) (5,3) (5,3) (5,3) (5,3) (5,3) Action?

    Read the article

  • Non standard interaction among two tables to avoid very large merge

    - by riko
    Suppose I have two tables A and B. Table A has a multi-level index (a, b) and one column (ts). b determines univocally ts. A = pd.DataFrame( [('a', 'x', 4), ('a', 'y', 6), ('a', 'z', 5), ('b', 'x', 4), ('b', 'z', 5), ('c', 'y', 6)], columns=['a', 'b', 'ts']).set_index(['a', 'b']) AA = A.reset_index() Table B is another one-column (ts) table with non-unique index (a). The ts's are sorted "inside" each group, i.e., B.ix[x] is sorted for each x. Moreover, there is always a value in B.ix[x] that is greater than or equal to the values in A. B = pd.DataFrame( dict(a=list('aaaaabbcccccc'), ts=[1, 2, 4, 5, 7, 7, 8, 1, 2, 4, 5, 8, 9])).set_index('a') The semantics in this is that B contains observations of occurrences of an event of type indicated by the index. I would like to find from B the timestamp of the first occurrence of each event type after the timestamp specified in A for each value of b. In other words, I would like to get a table with the same shape of A, that instead of ts contains the "minimum value occurring after ts" as specified by table B. So, my goal would be: C: ('a', 'x') 4 ('a', 'y') 7 ('a', 'z') 5 ('b', 'x') 7 ('b', 'z') 7 ('c', 'y') 8 I have some working code, but is terribly slow. C = AA.apply(lambda row: ( row[0], row[1], B.ix[row[0]].irow(np.searchsorted(B.ts[row[0]], row[2]))), axis=1).set_index(['a', 'b']) Profiling shows the culprit is obviously B.ix[row[0]].irow(np.searchsorted(B.ts[row[0]], row[2]))). However, standard solutions using merge/join would take too much RAM in the long run. Consider that now I have 1000 a's, assume constant the average number of b's per a (probably 100-200), and consider that the number of observations per a is probably in the order of 300. In production I will have 1000 more a's. 1,000,000 x 200 x 300 = 60,000,000,000 rows may be a bit too much to keep in RAM, especially considering that the data I need is perfectly described by a C like the one I discussed above. How would I improve the performance?

    Read the article

  • Java HttpURLConnection bekommt keine cookies

    - by TeNNoX
    ich versuche über eine HttpURLConnection einen Login auf einer Webseite durchzuführen, und davon dann die cookies zu erhalten... Bei meinen Testseiten auf einem eigenen Server geht es problemlos, ich sende "a=3&b=5" und als cookie erhalte ich "8", also die Summe. Wenn ich dies allerdings auf der gewollten Seite anwende, kommt einfach nur die Seite, als ob ich gar nichts per POST gesendet hätte... :( Generelle Verbesserungsvorschläge sind auch erwünscht! :) Mein Code: HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setRequestMethod("POST"); conn.setRequestProperty("useragent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0"); conn.setRequestProperty("Connection", "keep-alive"); DataOutputStream out = new DataOutputStream(conn.getOutputStream()); out.writeBytes("USER=tennox&PASS=*****"); out.close(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; String response = new String(); while ((line = in.readLine()) != null) { response = response + line + "\n"; } in.close(); System.out.println("headers:"); int i = 0; String header; while ((header = conn.getHeaderField(i)) != null) { String key = conn.getHeaderFieldKey(i); System.out.println(((key == null) ? "" : key + ": ") + header); i++; } String cookies = conn.getHeaderField("Set-Cookie"); System.out.println("\nCookies: \"" + cookies + "\"");

    Read the article

  • Java exercise - display table with 2d array

    - by TheHacker66
    I'm struggling to finish a java exercise, it involves using 2d arrays to dinamically create and display a table based on a command line parameter. Example: java table 5 +-+-+-+-+-+ |1|2|3|4|5| +-+-+-+-+-+ |2|3|4|5|1| +-+-+-+-+-+ |3|4|5|1|2| +-+-+-+-+-+ |4|5|1|2|3| +-+-+-+-+-+ |5|1|2|3|4| +-+-+-+-+-+ What i have done so far: public static void main(String[] args) { int num = Integer.parseInt(args[0]); String[][] table = new String[num*2+1][num]; int[] numbers = new int[num]; int temp = 0; for(int i=0; i<numbers.length; i++) numbers[i] = i+1; // wrong for(int i=0; i<table.length; i++){ for(int j=0; j<num;j++){ if(i%2!=0){ temp=numbers[0]; for(int k=1; k<numbers.length; k++){ numbers[k-1]=numbers[k]; } numbers[numbers.length-1]=temp; for(int l=0; l<numbers.length; l++){ table[i][j] = "|"+numbers[l]; } } else table[i][j] = "+-"; } } for(int i=0; i<table.length; i++){ for(int j=0; j<num; j++) System.out.print(table[i][j]); if(i%2==0) System.out.print("+"); else System.out.print("|"); System.out.println();} } This doesn't work, since it prints 1|2|3|4 in every row, which isn't what i need. I found the issue, and it's because the first for loop changes the array order more times than needed and basically it returns as it was at the beginning. I know that probably there's a way to achieve this by writing more code, but i always tend to nest as much as possible to "optimize" the code while i write it, so that's why i tried solving this exercise by using less variables and loops as possible. Thanks in advance for your help!

    Read the article

  • How to update SQL Server database from multiple data sources for ASP.Net MVC 4 application

    - by shaz
    I have 10+ SQL Server databases, from where I would use one table from each database to display information using the application that I am creating. For instance, DB1, DB2....DB10. NewDB (Account, Country, Costcenter....etc.). I have started with creating a new database which would contain all the information from all those 10+ databases. However, I am confused in many cases. First of all what process should I follow? Shall I create a table (in new database) with the same structure as the actual data source and insert data from actual data source to new database? Should I be doing this on the DBMS? If so, is it some scripting? (hint expected since very new to this) I am creating a report generation application which has 10+ data sources. I need some hint which way should I proceed? Thanks for advice/help in advance.

    Read the article

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