Daily Archives

Articles indexed Monday December 17 2012

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

  • Convenient practice for where to place images?

    - by Baumr
    A lot of developers place all image files inside a central directory, for example: /i/img/ /images/ /img/ Isn't it better (e.g. content architecture, on-page SEO, code maintainability, filename maintainability, etc.) to place them inside the relevant directories in which they are used? For example: example.com/logo.jpg example.com/about/photo-of-me.jpg example.com/contact/map.png example.com/products/category1-square.png example.com/products/category2-square.png example.com/products/category1/product1-thumb.jpg example.com/products/category1/product2-thumb.jpg example.com/products/category1/product1/product1-large.jpg example.com/products/category1/product1/product2-large.jpg example.com/products/category1/product1/product3-large.jpg What is the best practice here regarding all possible considerations (for static non-CMS websites)? N.B. The names product1-large and product1-thumb are just examples in this context to illustrate what kind of images they are. It is advised to use descriptive filenames for SEO benefit.

    Read the article

  • Google Stats, how to get More info?

    - by Ant's
    I have created a blog very recently and i'm seeing my traffic and audience using Google Stats that is in built in google blogger. I have few question on google stats: 1) Is number of visitor shown by stat is rough or accurate? 2) How i do find whether people have visited my site or search engines? 3) Is google stats is best for beginners like me? or any other tool? Correct me if am wrong.

    Read the article

  • How to find the exact font used by the browser

    - by sreekanth
    I have used the css style sheet as font-family:arial,helvicta,sans-serif,etc... in a php file when i checked it in browser i dont know which font it is using from the font-family . i wanted to know the exact font used by the browser to display. i.e whether it is using arial or helvicta or sans-serif for the text i have displayed. please any one let me know to find this. i have checked by putting this in wordpad but it is taking my default system font. Thanks in advance

    Read the article

  • How do engines avoid "Phase Lock" (multiple objects in same location) in a Physics Engine?

    - by C0M37
    Let me explain Phase Lock first: When two objects of non zero mass occupy the same space but have zero energy (no velocity). Do they bump forever with zero velocity resolution vectors or do they just stay locked together until an outside force interacts? In my home brewed engine, I realized that if I loaded a character into a tree and moved them, they would signal a collision and hop back to their original spot. I suppose I could fix this by implementing impulses in the event of a collision instead of just jumping back to the last spot I was in (my implementation kind of sucks). But while I make my engine more robust, I'm just curious on how most other physics engines handle this case. Do objects that start in the same spot with no movement speed just shoot out from each other in a random direction? Or do they sit there until something happens? Which option is generally the best approach?

    Read the article

  • Impulsioned jumping

    - by Mutoh
    There's one thing that has been puzzling me, and that is how to implement a 'faux-impulsed' jump in a platformer. If you don't know what I'm talking about, then think of the jumps of Mario, Kirby, and Quote from Cave Story. What do they have in common? Well, the height of your jump is determined by how long you keep the jump button pressed. Knowing that these character's 'impulses' are built not before their jump, as in actual physics, but rather while in mid-air - that is, you can very well lift your finger midway of the max height and it will stop, even if with desacceleration between it and the full stop; which is why you can simply tap for a hop and hold it for a long jump -, I am mesmerized by how they keep their trajetories as arcs. My current implementation works as following: While the jump button is pressed, gravity is turned off and the avatar's Y coordenate is decremented by the constant value of the gravity. For example, if things fall at Z units per tick, it will rise Z units per tick. Once the button is released or the limit is reached, the avatar desaccelerates in an amount that would make it cover X units until its speed reaches 0; once it does, it accelerates up until its speed matches gravity - sticking to the example, I could say it accelerates from 0 to Z units/tick while still covering X units. This implementation, however, makes jumps too diagonal, and unless the avatar's speed is faster than the gravity, which would make it way too fast in my current project (it moves at about 4 pixels per tick and gravity is 10 pixels per tick, at a framerate of 40FPS), it also makes it more vertical than horizontal. Those familiar with platformers would notice that the character's arc'd jump almost always allows them to jump further even if they aren't as fast as the game's gravity, and when it doesn't, if not played right, would prove itself to be very counter-intuitive. I know this because I could attest that my implementation is very annoying. Has anyone ever attempted at similar mechanics, and maybe even succeeded? I'd like to know what's behind this kind of platformer jumping. If you haven't ever had any experience with this beforehand and want to give it a go, then please, don't try to correct or enhance my explained implementation, unless I was on the right way - try to make up your solution from scratch. I don't care if you use gravity, physics or whatnot, as long as it shows how these pseudo-impulses work, it does the job. Also, I'd like its presentation to avoid a language-specific coding; like, sharing us a C++ example, or Delphi... As much as I'm using the XNA framework for my project and wouldn't mind C# stuff, I don't have much patience to read other's code, and I'm certain game developers of other languages would be interested in what we achieve here, so don't mind sticking to pseudo-code. Thank you beforehand.

    Read the article

  • How can I implement collision detection for these tiles?

    - by Fiona
    I am wondering how this would be possible, if at all. In the image below: http://i.stack.imgur.com/d8cO3.png The light brows tiles are ground, while the dark brown is background, so the player can pass over those tiles. Here's the for loops that draws the level: float scale = 1f; for (row = 0; row < currentLevel.Rows; row++) { for (column = 0; column < currentLevel.Columns; column++) { Tile tile = (Tile)currentLevel.GetTile(row, column); if (tile == null) { continue; } Texture2D texture = tile.Texture; spriteBatch.Draw(texture, new Microsoft.Xna.Framework.Rectangle( (int)(column * currentLevel.CellSize.X * scale), (int)(row * currentLevel.CellSize.Y * scale), (int)(currentLevel.CellSize.X * scale), (int)(currentLevel.CellSize.Y * scale)), Microsoft.Xna.Framework.Color.White); } } Here's what I have so far to determine where to create a Rectangle: Microsoft.Xna.Framework.Rectangle[,,,] groundBounds = new Microsoft.Xna.Framework.Rectangle[?, ?, ?, ?]; int tileSize = 20; int screenSizeInTiles = 30; var tilePositions = new System.Drawing.Point[screenSizeInTiles, screenSizeInTiles]; for (int x = 0; x < screenSizeInTiles; x++) { for (int y = 0; y < screenSizeInTiles; y++) { tilePositions[x, y] = new System.Drawing.Point(x * tileSize, y * tileSize); groundBounds[x, y, tileSize, tileSize] = new Microsoft.Xna.Framework.Rectangle(x, y, 20, 20); } } First off, I'm not sure how to initialize the array groundBounds (I don't know how big to make it). Also, I'm not entirely sure how to go about adding information to groundBounds. I want to add a Rectangle for each tile in the level. Preferably I'd only make a Rectangle for those tiles accessible by the player, and not background tiles, but that's for a different day. FYI, the map was made with a freeware program called Realm Factory.

    Read the article

  • Cocos3d lighting problem

    - by Parasithe
    I'm currently working on a cocos3d project, but I'm having some trouble with lighting and I have no idea how to solve it. I've tried everything and the lighting is always as bad in the game. The first picture is from 3ds max (the software we used for 3d) and the second is from my iphone app. http://prntscr.com/ly378 http://prntscr.com/ly2io As you can see, the lighting is really bad in the app. I manually add my spots and the ambiant light. Here is all my lighting code : _spot = [CC3Light lightWithName: @"Spot" withLightIndex: 0]; // Set the ambient scene lighting. ccColor4F ambientColor = { 0.9, 0.9, 0.9, 1 }; self.ambientLight = ambientColor; //Positioning _spot.target = [self getNodeNamed:kCharacterName]; _spot.location = cc3v( 400, 400, -600 ); // Adjust the relative ambient and diffuse lighting of the main light to // improve realisim, particularly on shadow effects. _spot.diffuseColor = CCC4FMake(0.8, 0.8, 0.8, 1.0); _spot.specularColor = CCC4FMake(0, 0, 0, 1); [_spot setAttenuationCoefficients:CC3AttenuationCoefficientsMake(0, 0, 1)]; // Another mechansim for adjusting shadow intensities is shadowIntensityFactor. // For better effect, set here to a value less than one to lighten the shadows // cast by the main light. _spot.shadowIntensityFactor = 0.75; [self addChild:_spot]; _spot2 = [CC3Light lightWithName: @"Spot2" withLightIndex: 1]; //Positioning _spot2.target = [self getNodeNamed:kCharacterName]; _spot2.location = cc3v( -550, 400, -800 ); _spot2.diffuseColor = CCC4FMake(0.8, 0.8, 0.8, 1.0); _spot2.specularColor = CCC4FMake(0, 0, 0, 1); [_spot2 setAttenuationCoefficients:CC3AttenuationCoefficientsMake(0, 0, 1)]; _spot2.shadowIntensityFactor = 0.75; [self addChild:_spot2]; I'd really appreciate if anyone would have some tip on how to fix the lighting. Maybe my spots are bad? maybe it's the material? I really have no idea. Any help would be welcomed. I already ask some help on cocos2d forums. I had some answers but I need more help.

    Read the article

  • How can I get penetration depth from Minkowski Portal Refinement / Xenocollide?

    - by Raven Dreamer
    I recently got an implementation of Minkowski Portal Refinement (MPR) successfully detecting collision. Even better, my implementation returns a good estimate (local minimum) direction for the minimum penetration depth. So I took a stab at adjusting the algorithm to return the penetration depth in an arbitrary direction, and was modestly successful - my altered method works splendidly for face-edge collision resolution! What it doesn't currently do, is correctly provide the minimum penetration depth for edge-edge scenarios, such as the case on the right: What I perceive to be happening, is that my current method returns the minimum penetration depth to the nearest vertex - which works fine when the collision is actually occurring on the plane of that vertex, but not when the collision happens along an edge. Is there a way I can alter my method to return the penetration depth to the point of collision, rather than the nearest vertex? Here's the method that's supposed to return the minimum penetration distance along a specific direction: public static Vector3 CalcMinDistance(List<Vector3> shape1, List<Vector3> shape2, Vector3 dir) { //holding variables Vector3 n = Vector3.zero; Vector3 swap = Vector3.zero; // v0 = center of Minkowski sum v0 = Vector3.zero; // Avoid case where centers overlap -- any direction is fine in this case //if (v0 == Vector3.zero) return Vector3.zero; //always pass in a valid direction. // v1 = support in direction of origin n = -dir; //get the differnce of the minkowski sum Vector3 v11 = GetSupport(shape1, -n); Vector3 v12 = GetSupport(shape2, n); v1 = v12 - v11; //if the support point is not in the direction of the origin if (v1.Dot(n) <= 0) { //Debug.Log("Could find no points this direction"); return Vector3.zero; } // v2 - support perpendicular to v1,v0 n = v1.Cross(v0); if (n == Vector3.zero) { //v1 and v0 are parallel, which means //the direction leads directly to an endpoint n = v1 - v0; //shortest distance is just n //Debug.Log("2 point return"); return n; } //get the new support point Vector3 v21 = GetSupport(shape1, -n); Vector3 v22 = GetSupport(shape2, n); v2 = v22 - v21; if (v2.Dot(n) <= 0) { //can't reach the origin in this direction, ergo, no collision //Debug.Log("Could not reach edge?"); return Vector2.zero; } // Determine whether origin is on + or - side of plane (v1,v0,v2) //tests linesegments v0v1 and v0v2 n = (v1 - v0).Cross(v2 - v0); float dist = n.Dot(v0); // If the origin is on the - side of the plane, reverse the direction of the plane if (dist > 0) { //swap the winding order of v1 and v2 swap = v1; v1 = v2; v2 = swap; //swap the winding order of v11 and v12 swap = v12; v12 = v11; v11 = swap; //swap the winding order of v11 and v12 swap = v22; v22 = v21; v21 = swap; //and swap the plane normal n = -n; } /// // Phase One: Identify a portal while (true) { // Obtain the support point in a direction perpendicular to the existing plane // Note: This point is guaranteed to lie off the plane Vector3 v31 = GetSupport(shape1, -n); Vector3 v32 = GetSupport(shape2, n); v3 = v32 - v31; if (v3.Dot(n) <= 0) { //can't enclose the origin within our tetrahedron //Debug.Log("Could not reach edge after portal?"); return Vector3.zero; } // If origin is outside (v1,v0,v3), then eliminate v2 and loop if (v1.Cross(v3).Dot(v0) < 0) { //failed to enclose the origin, adjust points; v2 = v3; v21 = v31; v22 = v32; n = (v1 - v0).Cross(v3 - v0); continue; } // If origin is outside (v3,v0,v2), then eliminate v1 and loop if (v3.Cross(v2).Dot(v0) < 0) { //failed to enclose the origin, adjust points; v1 = v3; v11 = v31; v12 = v32; n = (v3 - v0).Cross(v2 - v0); continue; } bool hit = false; /// // Phase Two: Refine the portal int phase2 = 0; // We are now inside of a wedge... while (phase2 < 20) { phase2++; // Compute normal of the wedge face n = (v2 - v1).Cross(v3 - v1); n.Normalize(); // Compute distance from origin to wedge face float d = n.Dot(v1); // If the origin is inside the wedge, we have a hit if (d > 0 ) { //Debug.Log("Do plane test here"); float T = n.Dot(v2) / n.Dot(dir); Vector3 pointInPlane = (dir * T); return pointInPlane; } // Find the support point in the direction of the wedge face Vector3 v41 = GetSupport(shape1, -n); Vector3 v42 = GetSupport(shape2, n); v4 = v42 - v41; float delta = (v4 - v3).Dot(n); float separation = -(v4.Dot(n)); if (delta <= kCollideEpsilon || separation >= 0) { //Debug.Log("Non-convergance detected"); //Debug.Log("Do plane test here"); return Vector3.zero; } // Compute the tetrahedron dividing face (v4,v0,v1) float d1 = v4.Cross(v1).Dot(v0); // Compute the tetrahedron dividing face (v4,v0,v2) float d2 = v4.Cross(v2).Dot(v0); // Compute the tetrahedron dividing face (v4,v0,v3) float d3 = v4.Cross(v3).Dot(v0); if (d1 < 0) { if (d2 < 0) { // Inside d1 & inside d2 ==> eliminate v1 v1 = v4; v11 = v41; v12 = v42; } else { // Inside d1 & outside d2 ==> eliminate v3 v3 = v4; v31 = v41; v32 = v42; } } else { if (d3 < 0) { // Outside d1 & inside d3 ==> eliminate v2 v2 = v4; v21 = v41; v22 = v42; } else { // Outside d1 & outside d3 ==> eliminate v1 v1 = v4; v11 = v41; v12 = v42; } } } return Vector3.zero; } }

    Read the article

  • Quaternion Camera

    - by Alex_Hyzer_Kenoyer
    Can someone help me figure out how to use a Quaternion with the PerspectiveCamera in libGDX or in general? I am trying to rotate my camera around a sphere that is being drawn at (0,0,0). I am not sure how to go about setting up the quaternion correctly, manipulating it, and then applying it to the camera. Edit: Here is what I have tried to do so far. // This is how I set it up Quaternion orientation = new Quaternion(); orientation.setFromAxis(Vector3.Y, 45); // This is how I am trying to update the rotations public void rotateX(float amount) { Quaternion temp = new Quaternion(); temp.set(Vector3.X, amount); orientation.mul(temp); } public void rotateY(float amount) { Quaternion temp = new Quaternion(); temp.set(Vector3.Y, amount); orientation.mul(temp); } public void updateCamera() { // This is where I am unsure how to apply the rotations to the camera // I think I should update the view and projection matrices? camera.view.mul(orientation); ... }

    Read the article

  • Empty R environment becomes large file when saved

    - by user1052019
    I'm getting behaviour I don't understand when saving environments. The code below demonstrates the problem. I would have expected the two files (far-too-big.RData, and right-size.RData) to be the same size, and also very small because the environments they contain are empty. In fact, far-too-big.R ends up the same size as bigfile.RData. I get the same results using 2.14.1 and 2.15.2, both on WinXP 5.1 SP3. Can anyone explain why this is happening? Thanks. a <- matrix(runif(1000000, 0, 1), ncol=1000) save(a, file="c:/temp/bigfile.RData") test <- function() { load("c:/temp/bigfile.RData") test <- new.env() save(test, file="c:/temp/far-too-big.RData") test1 <- new.env(parent=globalenv()) save(test1, file="c:/temp/right-size.RData") } test()

    Read the article

  • Error while storing to a shared network drive when running website on IIS

    - by vini
    System.UnauthorizedAccessException: Access to the path '\\192.168.0.99\c$\DTA\DTA564348.64U20121217161754.dta' is denied. When i store the file by running on my local asp.net website it works fine and gets stored on the shared network drive However when i run this through IIS i get the above error C# Code StrPath = FilePhypath.ToString(); Web.Config <location allowOverride="true"> <appSettings> <add key="FilephyPath" value="\\192.168.0.99\c$\DTA\"/> </appSettings> </location>

    Read the article

  • Create facebook object each and every time?

    - by oshirowanen
    I have a login page which will log a user into my webapp based on their facebook login details. I then create a session to remember who they are. What I want to know is, should I be creating and/or checking the facebook credential on every single page of my webapp, or should I simply use the session I create at the beginning to login? For example, once they have logged in, I would like to allow them to post a message onto their own facebook wall from my app. Should I check the login credentials before they can post by recreating the facebook object, or should I simply use the stored login details already in my session and use that to post to their facebook wall?

    Read the article

  • Highcharts removing elements

    - by Kevin Jolan
    I'm working on a new website using highchart. But i have a little issue with how it looks / is setup. I'm wondering if its possible to remove the "Tokyo, New York, Berlin, London" on the right side of the image? I would like to add a discription my self, and remove the exsisting one. Any Suggestions on how i can remove them? (But i want to keep the lines in the graph) is there any way i can modify or hide this? (it also take up unnecessary space on the website)

    Read the article

  • Best way to laod a large file into arraylist in java

    - by user1730833
    I have a file whose size is about 300mb i want to read the contents line by line and then add it into arraylist. So i have made an object of array list a1 , then reading the file using bufferedreader , after that when i add the lines from file into arraylist it gives an error Exception in thread "main" java.lang.OutOfMemoryError: Java heap space. Please tell me what should be the solution for this.

    Read the article

  • MySQL PHP SELECT throwing up an error?

    - by user1909695
    I am trying to make a comment section on my hand made site, using PHP and MySQL. I have got the comments stored in my database, but when I try to SELECT them my site throws up this error, mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 9 in /home/a9210109/public_html/comments.php on line 16 My code so far is below <?php $comment = $_POST['comment']; $mysql_host = ""; $mysql_database = ""; $mysql_user = ""; $mysql_password = ""; mysql_connect($mysql_host,$mysql_user,$mysql_password); @mysql_select_db($mysql_database) or die( "Unable to select database"); $CreateTable = "CREATE TABLE comments (comment VARCHAR(255), time VARCHAR(255));"; mysql_query($CreateTable); $UseComment = "INSERT INTO comments VALUES ('$comment')"; mysql_query($UseComment); $SelectComments = "SELECT * FROM comments"; $comments = mysql_query($SelectComments); $num=mysql_numrows($comments); $variable=mysql_result($comments,$i,"comment"); mysql_close(); ?> <a href="#" onclick="toggle_visibility('hidden');">Show/Hide Comments</a> <?php $i=0; while ($i < $num) { $comment=mysql_result($comments,$i,"comment"); echo "<div id='hidden' style='display:none'><h3>$comment</h3></div>"; $i++; } ?>

    Read the article

  • Displaying Plist data into UItableview

    - by Christien
    I have a plist with Dictionary and numbers of strings per dictionary.show into the url below.and this list of items is in thousands in the plist. I need to display these plist data into the UItableview . How to do this? My Code: - (void)viewWillAppear:(BOOL)animated { // get paths from root direcory NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [documentPaths objectAtIndex:0]; NSString *documentPlistPath = [documentsDirectory stringByAppendingPathComponent:@"p.plist"]; NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:documentPlistPath]; valueArray = [dict objectForKey:@"title"]; self.mySections=[valueArray copy]; NSLog(@"value array %@",self.mySections); } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [self.mySections count]; } -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { NSString *key = [[self.mySections objectAtIndex:section]objectForKey:@"pass"]; return [NSString stringWithFormat:@"%@", key]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 5; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier]; } // Configure the cell... NSUInteger section = [indexPath section]; NSUInteger row = [indexPath row]; cell.textLabel.text = [[self.mySections objectAtIndex:row] objectForKey:@"title"]; cell.detailTextLabel.text=[[self.mySections objectAtIndex:section] objectForKey:[allKeys objectAtIndex:1]]; return cell; } Error is 2012-12-17 16:21:07.372 Project[2076:11603] * Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFArray objectAtIndex:]: index (4) beyond bounds (4)' * First throw call stack: (0x1703052 0x1523d0a 0x16aba78 0x16ab9e9 0x16fcc60 0x1d03a 0x391e0f 0x392589 0x37ddfd 0x38c851 0x337301 0x1704e72 0x277592d 0x277f827 0x2705fa7 0x2707ea6 0x2707580 0x16d79ce 0x166e670 0x163a4f6 0x1639db4 0x1639ccb 0x1505879 0x150593e 0x2f8a9b 0x2158 0x20b5) terminate called throwing an exceptionkill

    Read the article

  • values not equal in sqlite and json array in android

    - by Venkat
    I am trying to compare the value in sqlite table and id of the webservice what i have done so far is if(data_exist!=bookProduct.length()){ Log.i("in update","m here"); Cursor cursors = getRawEvents("select id from bcuk_book"); try{ for (int i = 0; i < bookProduct.length(); i++) { JSONObject c = bookProduct.getJSONObject(i); String Bid = c.getString(TAG_ID); ArrayList<String> mapId = new ArrayList<String>(); while(cursors.moveToNext()) { Log.e("cursors",cursors.getString(0)); Log.i(Bid,Bid); if(cursors.getString(0)!=c.getString(TAG_ID)){ Log.e("fas",Bid); } } mapId.add(TAG_ID); Log.e(Bid,Bid); } } My issue is i am getting same values in logs.. if(cursors.getString(0)!=c.getString(TAG_ID)){ this condition says if they are not equal then print the log..But the issue is i am entering into that block even i am getting same values from sqlite and TAG_ID i.e from json webservice..How to solve this.Where i done wrong?

    Read the article

  • Can I set JFrame's normal size while it is maximized?

    - by icza
    I'd like to set the normal size of a visible JFrame while it is in Frame.MAXIMIZED_BOTH state (by normal size i mean the size of frame when it is in Frame.NORMAL state) . The reason I want to do this is so that when the user un-maximizes the frame, it will have the proper size I want it to be. But if I do so, the window will switch to normal state. If I set the size first, then switch to MAXIMIZED_BOTH state, then I will see a disturbing blink or resize (which I don't want to). I've also tried setting the size first, then changing state to MAXIMIZED_BOTH, and then making it visible, but the state change is deferred if the window is not visible (and will only be executed once it is made visible, also resulting in a visual resize). So what can I do if I want my frame to have a predefined normal size, but I want it to appear maximized?

    Read the article

  • C++ cin returns 0 for integer no matter what the user inputs

    - by kevin dappah
    No matter the cin it continues to to output 0 for score. Why is that? I tried returning the "return 0;" but still no go :/ #include "stdafx.h" #include <iostream> using namespace std; // Variables int enemiesKilled; const int KILLS = 150; int score = enemiesKilled * KILLS; int main() { cout << "How many enemies did you kill?" << endl; cin >> enemiesKilled; cout << "Your score: " << score << endl; return 0; }

    Read the article

  • Add opening and closing balance columns

    - by user1862899
    i have a table like this: StockNumber|InventoryName|Year|Month|Adj|iss|piss|Tsfr|return|rdj|rpo|xefr alb001 clinic1 2010 1 4 5 5 5 6 5 4 10 alb001 Clinic1 2010 2 10 2 2 3 3 4 4 4 alb001 Clinic1 2010 4 11 3 5 77 90 78 9 6 alb001 Clinic1 2010 5 10 2 2 3 3 4 4 4 i want to add a closing balance column which will be sum(return+rdj+rpo+xefr) - sum(adj+iss+piss+tsfr) i also want to add the opening balance column which will be the be the closing balance of the previous month. i will then calculate the current months balance as OpeningBalance + sum(return+rdj+rpo+xefr) - sum(adj+iss+piss+tsfr) = ClosingBalance NB.The Year and Month columns are floats and also want to change them to date format. i am newbie to sql and crystal reports....i want a query to help me achieve the tasks of developing a report that has the opening and closing balance columns,the opening balance being the previous closing balance.....thank you for your help....

    Read the article

  • How to implement Google Maps new version of API v2

    - by bapatla
    Hi every one I came to know that google maps has deprecated its previous version API v1 and introduced a new version of google maps API v2. I tried out one example by following some links in google any how i am pretty sure that i got the api key correctly by providing the exact hash key code and managed to get the correct api key. Now i managed to write some code as well but when i tried to execute the code i am getting the errors please help me to solve this here is my code and i even tried the sample codes provided by google play services an i got the same problem this is the sample that i have done by referring some links in google main activity package com.example.apv; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import android.os.Bundle; import android.app.Activity; import android.app.FragmentManager; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); FragmentManager fragmentManager = getFragmentManager(); MapFragment mapFragment = (MapFragment) fragmentManager.findFragmentById(R.id.map); GoogleMap googleMap = mapFragment.getMap(); LatLng sfLatLng = new LatLng(37.7750, -122.4183); googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL); googleMap.addMarker(new MarkerOptions() .position(sfLatLng) .title("San Francisco") .snippet("Population: 776733") .icon(BitmapDescriptorFactory.defaultMarker( BitmapDescriptorFactory.HUE_AZURE))); googleMap.getUiSettings().setCompassEnabled(true); googleMap.getUiSettings().setZoomControlsEnabled(true); googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(sfLatLng, 10)); } } main.xml <?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.MapFragment"/> and finally my manifest file <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.apv" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/> <permission android:name="com.codebybrian.mapsample.permission.MAPS_RECEIVE" android:protectionLevel="signature"/> <!--Required permissions--> permission oid:name="com.codebybrian.mapsample.permission.MAPS_RECEIVE"/> <!--Used by the API to download map tiles from Google Maps servers: --> <uses-permission android:name="android.permission.INTERNET"/> <!--Allows the API to access Google web-based services: --> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <!--Optional permissions--> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <!--Version 2 of the Google Maps Android API requires OpenGL ES version 2 --> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> application android:label="@string/app_name" android:icon="@drawable/ic_launcher"> <activity android:name=".MyMapActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AZzaSSsBmhi4dXoKSylGGmjkQ5Jev9UdAJBjk"/> </application> </manifest> i run my application in emulator of version 4.2 and api level of 17 i got following error 12-17 10:06:52.590: E/Trace(826): error opening trace file: No such file or directory (2) 12-17 10:06:52.590: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.590: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.590: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.680: I/ActivityThread(826): Pub com.google.android.gms.plus;com.google.android.gms.plus.action: com.google.android.gms.plus.provider.PlusProvider 12-17 10:06:52.740: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.740: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 12-17 10:06:52.760: W/Trace(826): Unexpected value from nativeGetEnabledTags: 0 later i came to know that these version cant execute in emulator so i tried executing it with two devices one is Sony xperia u of android version 2.3.7 and Samsung galaxy tab of android version 4.1.1 and these are my outputs 12-17 14:37:02.468: D/AndroidRuntime(7636): Shutting down VM 12-17 14:37:02.468: W/dalvikvm(7636): threadid=1: thread exiting with uncaught exception (group=0x41f672a0) 12-17 14:37:02.476: E/AndroidRuntime(7636): FATAL EXCEPTION: main 12-17 14:37:02.476: E/AndroidRuntime(7636): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.apv/com.example.apv.MyMapActivity}: java.lang.ClassNotFoundException: com.example.apv.MyMapActivity 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2021) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.access$600(ActivityThread.java:140) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.os.Handler.dispatchMessage(Handler.java:99) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.os.Looper.loop(Looper.java:137) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.main(ActivityThread.java:4895) 12-17 14:37:02.476: E/AndroidRuntime(7636): at java.lang.reflect.Method.invokeNative(Native Method) 12-17 14:37:02.476: E/AndroidRuntime(7636): at java.lang.reflect.Method.invoke(Method.java:511) 12-17 14:37:02.476: E/AndroidRuntime(7636): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller .run(ZygoteInit.java:994) 12-17 14:37:02.476: E/AndroidRuntime(7636): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761) 12-17 14:37:02.476: E/AndroidRuntime(7636): at dalvik.system.NativeStart.main(Native Method) 12-17 14:37:02.476: E/AndroidRuntime(7636): Caused by: java.lang.ClassNotFoundException: com.example.apv.MyMapActivity 12-17 14:37:02.476: E/AndroidRuntime(7636): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 12-17 14:37:02.476: E/AndroidRuntime(7636): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 12-17 14:37:02.476: E/AndroidRuntime(7636): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.Instrumentation.newActivity(Instrumentation.java:1068) 12-17 14:37:02.476: E/AndroidRuntime(7636): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2012) 12-17 14:37:02.476: E/AndroidRuntime(7636): ... 11 more could any one please suggest me to how to get this done and give me some links of new version API v2 tutorials of google maps and some examples links please help me

    Read the article

  • How to approach copying objects with smart pointers as class attributes?

    - by tomislav-maric
    From the boost library documentation I read this: Conceptually, smart pointers are seen as owning the object pointed to, and thus responsible for deletion of the object when it is no longer needed. I have a very simple problem: I want to use RAII for pointer attributes of a class that is Copyable and Assignable. The copy and assignment operations should be deep: every object should have its own copy of the actual data. Also, RTTI needs to be available for the attributes (their type may also be determined at runtime). Should I be searching for an implementation of a Copyable smart pointer (the data are small, so I don't need Copy on Write pointers), or do I delegate the copy operation to the copy constructors of my objects as shown in this answer? Which smart pointer do I choose for simple RAII of a class that is copyable and assignable? (I'm thinking that the unique_ptr with delegated copy/assignment operations to the class copy constructor and assignment operator would make a proper choice, but I am not sure) Here's a pseudocode for the problem using raw pointers, it's just a problem description, not a running C++ code: // Operation interface class ModelOperation { public: virtual void operate = (); }; // Implementation of an operation called Special class SpecialModelOperation : public ModelOperation { private: // Private attributes are present here in a real implementation. public: // Implement operation void operate () {}; }; // All operations conform to ModelOperation interface // These are possible operation names: // class MoreSpecialOperation; // class DifferentOperation; // Concrete model with different operations class MyModel { private: ModelOperation* firstOperation_; ModelOperation* secondOperation_; public: MyModel() : firstOperation_(0), secondOperation_(0) { // Forgetting about run-time type definition from input files here. firstOperation_ = new MoreSpecialOperation(); secondOperation_ = new DifferentOperation(); } void operate() { firstOperation_->operate(); secondOperation_->operate(); } ~MyModel() { delete firstOperation_; firstOperation_ = 0; delete secondOperation_; secondOperation_ = 0; } }; int main() { MyModel modelOne; // Some internal scope { // I want modelTwo to have its own set of copied, not referenced // operations, and at the same time I need RAII to work for it, // as soon as it goes out of scope. MyModel modelTwo (modelOne); } return 0; }

    Read the article

  • jQuery: Convert to a single tag

    - by user1909565
    I want to convert the below HTML to single tag: Before : <div class="Parent1"> <div class="Child1"> <a href="#">Child1</a> </div> <div class="Child2"> <a href="#">Child2</a> </div> </div> <div class="Parent2"> <div class="Child1"> <a href="#">Child1</a> </div> <div class="Child2"> <a href="#">Child2</a> </div> </div> After : <div class="Parent1"> <button>Child1</button> <button>Child2</button> </div> <div class="Parent2"> <button>Child1</button> <button>Child2</button> </div> i tried with wrapping/unwrapping. But it does not work. This I want to be generic.

    Read the article

  • Set a dropdown option to selected based on get variable in url in Razor MVC

    - by Mason240
    I have a dropdown menu in a GET form. When the user hits submit, they are directed to the same page and shown the form again. I would like to have the dropdown option the user displayed in the last page already selected. So for example: @Html.DropDownList("Type", null, "Type", new { @class = "sbox-input" } ) website.com/Search?Type="Beef" <select name="Type"> <option value="Fish" >Fish</option> <option value="Chicken" >Chicken</option> <option value="Beef" selected="selected">Beef</option> </select> A jQuery solution would work just as well.

    Read the article

  • Cairo / GTK example code crashes when window is too big or maximized

    - by user1890673
    I have copied and compiled the source code available in the section titled "Full Source". http://cairographics.org/threaded_animation_with_cairo/ I adapted this code to a project that I'm working on only to find that the app would crash when I made the window too big. Going back to the original example code, it too crashes when the window is too big ( 1000x1000 or so). I narrowed down in the example that this line appears to be responsible: pixmap = gdk_pixmap_new(window-window,500,500,-1); Where pixmap is of type GdkPixmap*. Resizing the window overwrites pixmap with a new pixmap that is the size of the window. I am doing this in Eclipse Juno in Windows Vista, 32-bit. My compiler is MinGW version 0.5-beta-20120426-1. My GTK+ version is 2.24.10 and apparently Cairo is 1.10.2 I added all of the includes and libraries for GTK and also added compiler switch -mms-bitfields. Is there a limit to the size of a pixmap or something? I'm just starting with GTK with examples so I'm not sure where to go if this example doesn't work.

    Read the article

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