Daily Archives

Articles indexed Sunday July 1 2012

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

  • How do I print the Images?

    - by user1477539
    I want to print the images of the 30 nba teams drafting in the first round. However when I tell it to print it prints out the link instead of the image. How do I get it to print out the image instead of giving me the image link. Here's my code: import urllib2 from BeautifulSoup import BeautifulSoup # or if your're using BeautifulSoup4: # from bs4 import BeautifulSoup soup = BeautifulSoup(urllib2.urlopen('http://www.cbssports.com/nba/draft/mock-draft').read()) rows = soup.findAll("table", attrs = {'class': 'data borderTop'})[0].tbody.findAll("tr")[2:] for row in rows: fields = row.findAll("td") if len(fields) >= 3: anchor = row.findAll("td")[1].find("a") if anchor: print anchor

    Read the article

  • Moving from MySQL to MySQLi? I have the code here but I don't get it

    - by MuqMan
    I have posted the code there, please help me out as I am a newbie, I don't know much in terms of deprecation and stuff. <?php session_start(); include('settings.php'); $issub = $_POST['issub']; if($issub == "yes") { require('settings.php'); $dbcon = mysql_connect($dbhost, $dbuser, $dbpword); if(!dbcon) { die('Could not connect'.mysql_error()); } $selectdb = mysql_select_db($db, $dbcon); $formset = 'yes'; $val = 0; $user = trim($_POST['username'], ' '); $luser = mysql_real_escape_string($user); $password = $_POST['password']; $lpassword = mysql_real_escape_string($password); $selectdb; $userq = mysql_query("SELECT user FROM users WHERE user='".$luser."'"); $userresult = @mysql_result($userq, 0); //echo $userresult; if($userresult == $user) { $val = $val + 1; $usercorrect = 'yes'; } else { $usercorrect = 'no'; } $dbselect; $passwordq = mysql_query("SELECT password FROM users where user='".$luser."'"); $passresult = @mysql_result($passwordq, 0); if($passresult == sha1($password)) { $val = $val + 1; $passcorrect = 'yes'; } else { $passcorrect = 'no'; } if ($val == 2) { $_SESSION['loggedin'] = 'yes'; $_SESSION['uloggedin'] = $user; header('location: logged.php'); } }?> <?php ini_set('display_errors', 1); require('testinclude.php'); ?> <body> <div id="loginform"> <form action="/login.php" method="post" > <input type="hidden" name="issub" value="yes" /> <?php if($usercorrect == 'no') { echo '<span class="required"><i><small>The email address or password you entered is incorrect, please try again.</a></small></i></span>'; } ?> <br /> email: <?php if ($issub == 'yes') { if($user == null){ echo '<br /><span class="required"><i><small>Please enter your email address</a></small></i></span>'; } } ?> <br /><input type="text" name="username" id="usename" /> <br /> password: <br /><input type="password" name="password" id="password" /> <br /> <input type="submit" value="login" /> </form> <div> </body>

    Read the article

  • ViewController Navigating

    - by Kobe.o4
    I have 4 ViewControllers, startViewController as the initial View Controller. This contains my intro. After its finish, it will [self presentViewController:vc animated:YES completion:NULL]; into my menuViewController. startViewController ------> menuViewController ------> C1ViewController \ \ ------> ImportantViewController In my menuViewController are buttons for the two ViewController like the above illustration. Also I presented them in the View with this: [self presentViewController:vc animated:YES completion:NULL]; I return tomenuViewController with this [self dismissModalViewControllerAnimated:YES]; What I wanted is to make the ImportantViewController to be the like the parent view or the mainVIew even if I go to other Views. What I need is when ImportantViewController is presented when I go to either C1ViewController or menuViewController it wont be deallocated, or its content there will still be retained. Is it possible? And How? I don't know much about what parent and child view controllers for so I dont know what to implement in my problem. Thank you. BTW, Im using Storyboard.

    Read the article

  • How to run AWS sample JAVA code on an EC2

    - by SeaPlusPlus
    I just started with Amazon web services, and I have an EC2 instance. I downloaded the JAVA SDK and the Eclipse toolbox. I am able to run a sample program locally on my PC and connect to the Amazon databases, etc. My question is, what do I need to do to get this working on my EC2 instance? This may not even be specific to AWS. On Eclipse, I can just "Run as Application" and run any code. On the server side, what do I need to do? Should I ftp over my .java files? Should I export it to a jar and upload that? Do I need to install anything special to actually run it? I'm just trying to run the basic DynamoDB example that connects to the database and adds a new table and row

    Read the article

  • How to select number of lines from large text files?

    - by MiNdFrEaK
    I was wondering how to select number of lines from a certain text file. As an example: I have a text file containing the following lines: branch 27 : rect id 23400 rect: -115.475609 -115.474907 31.393650 31.411301 branch 28 : rect id 23398 rect: -115.474907 -115.472282 31.411301 31.417351 branch 29 : rect id 23396 rect: -115.472282 -115.468033 31.417351 31.427151 branch 30 : rect id 23394 rect: -115.468033 -115.458733 31.427151 31.438181 Non-Leaf Node: level=1 count=31 address=53 branch 0 : rect id 42 rect: -115.768539 -106.251556 31.425039 31.717550 branch 1 : rect id 50 rect: -109.559479 -106.009361 31.296721 31.775299 branch 2 : rect id 51 rect: -110.937401 -106.226143 31.285870 31.771971 branch 3 : rect id 54 rect: -109.584412 -106.069092 31.285240 31.775230 branch 4 : rect id 56 rect: -109.570961 -106.000954 31.296721 31.780769 branch 5 : rect id 58 rect: -115.806213 -106.366188 31.400450 31.687519 branch 6 : rect id 59 rect: -113.173859 -106.244057 31.297440 31.627750 branch 7 : rect id 60 rect: -115.811478 -106.278252 31.400450 31.679470 branch 8 : rect id 61 rect: -109.953888 -106.020111 31.325319 31.775270 branch 9 : rect id 64 rect: -113.070969 -106.015968 31.331841 31.704750 branch 10 : rect id 68 rect: -113.065689 -107.034576 31.326300 31.770809 branch 11 : rect id 71 rect: -112.333344 -106.059860 31.284081 31.662920 branch 12 : rect id 73 rect: -115.071083 -106.309677 31.267879 31.466850 branch 13 : rect id 74 rect: -116.094414 -106.286308 31.236290 31.424770 branch 14 : rect id 75 rect: -115.423264 -106.286308 31.229691 31.415510 branch 15 : rect id 76 rect: -116.111656 -106.313110 31.259390 31.478300 branch 16 : rect id 77 rect: -116.247467 -106.309677 31.240231 31.451799 branch 17 : rect id 78 rect: -116.170792 -106.094543 31.156429 31.391781 branch 18 : rect id 79 rect: -116.225723 -106.292709 31.239960 31.442850 branch 19 : rect id 80 rect: -116.268013 -105.769913 31.157240 31.378111 branch 20 : rect id 82 rect: -116.215424 -105.827202 31.198441 31.383421 branch 21 : rect id 83 rect: -116.095734 -105.826439 31.197460 31.373819 branch 22 : rect id 84 rect: -115.423264 -105.815018 31.182640 31.368891 branch 23 : rect id 85 rect: -116.221527 -105.776512 31.160931 31.389830 branch 24 : rect id 86 rect: -116.203369 -106.473831 31.168350 31.367611 branch 25 : rect id 87 rect: -115.727631 -106.501587 31.189100 31.395941 branch 26 : rect id 88 rect: -116.237289 -105.790756 31.164780 31.358959 branch 27 : rect id 89 rect: -115.791344 -105.990044 31.072620 31.349529 branch 28 : rect id 90 rect: -115.736847 -106.495079 31.187969 31.376900 branch 29 : rect id 91 rect: -115.721710 -106.000130 31.160351 31.354601 branch 30 : rect id 92 rect: -115.792236 -106.000793 31.166620 31.378811 Leaf Node: level=0 count=21 address=42 branch 0 : rect id 18312 rect: -106.412270 -106.401367 31.704750 31.717550 branch 1 : rect id 18288 rect: -106.278252 -106.253387 31.520321 31.548361 I just want those lines which are in between Non-Leaf Node level=1 to Leaf Node Level=0 and also there are a lot of segments like this and I need them all.

    Read the article

  • Planning a skillset for a fallback career [closed]

    - by Davy Kavanagh
    I'm not too certain this is a SO question, but I didn't think it belonged in meta either. Long story short, I am bioinformatics researcher. I like to code, it's my favourite part of the job. I have been thinking for a while that if academia is not kind to me, I might seek a career in software development. My current contract is for three years and I would like to spend some time over the next 3 three years learning and practicing software development as possible. Python seems like a popular language and it what I mostly use to do things for me, but I am also in heavy use of R. So my main question is: Are python and R good things to be learning with a sotfware dev goal in mind, and if so, is there any particular type of programming or software that might be useful to have experience with. Hard questions to answer I know, but I thought I would get the answer from people who are in the know. Cheers, Davy.

    Read the article

  • How to find a string on document and then echo the string?

    - by henrymb67
    How do you find a string on document and then echo the string? For example, The document: blah blah result.php?whatiwanttoecho blah or: blahhh result.php?whatiwanttoecho blah blah blah There will always be 'result.php?' before what I want to echo. The end result I'm looking for: $doc = "./doc.txt"; $doccontents = file_get_contents($file); Then the code that I need help that has the end result of: $result = 'whatiwanttoecho'; echo $result; Hope this makes sense. Thanks (:

    Read the article

  • sql query returns incorrect result

    - by reza saberi
    I have a mysql database that stores quotation documents with some products that are clearly defining the price of each product in them, and a table for contracts storing contract details as well as customer code and quotation code to which it belongs. I have the following query to see how much is the total price of the quotation to write it in the invoice: select sum(sqproducts.price * sqproducts.quantity) as 'total-price', squotations.currency as 'currency' from sqproducts, ccontracts, squotations where sqproducts.contracted=1 AND squotations.code=sqproducts.quotation_code AND sqproducts.quotation_code=ccontracts.squotation_code AND sqproducts.quotation_code='QUOT/2012/1' group by currency

    Read the article

  • Is it possible to access raw iphone audio output?

    - by Peter Hall
    Is it possible access raw PCM data from the iphone audio output? I know I can embed an MP3 and use AudioUnit. But if the user is playing music in the background from their itunes library, is it possible to access that audio data? This is for an app that shows visual effects, which react to the music. From what I can tell, it isn't possible, but that's just from lack of finding any information at all, rather than actual confirmation that it can't be done. If it isn't possible to access the audio stream from the ipod, is it possible to access raw audio output from the Media Player inside an app, or is pretty much not permitted to access raw audio data from the itunes library at all? EDIT: I found this question: iOS - Access output audio from background program, which say I can't access the audio from a background app. But is it possible to get the audio data from the itunes library if I play it inside the app?

    Read the article

  • Play 2.0 javaToDo tutorial doesn't compile

    - by chsn
    I'm trying to follow the Play2.0 JavaToDO tutorial and for some reason it just doesn't want to work. Have looked through stackoverflow and other online resources, but haven't find an answer to this and it's driving me crazy. Attached code of the Application.java package controllers; import models.Task; import play.data.Form; import play.mvc.Controller; import play.mvc.Result; public class Application extends Controller { static Form<Task> taskForm = form(Task.class); public static Result index() { return redirect(routes.Application.tasks()); } public static Result tasks() { return ok( views.html.index.render(Task.all(), taskForm)); } public static Result newTask() { return TODO; } public static Result deleteTask(Long id) { return TODO; } } Attached code of the Task java package models; import java.util.List; import javax.persistence.Entity; import play.data.Form; import play.data.validation.Constraints.Required; import play.db.ebean.Model.Finder; import play.mvc.Result; import controllers.routes; @Entity public class Task { public Long id; @Required public String label; // search public static Finder<Long,Task> find = new Finder( Long.class, Task.class); // display tasks public static List<Task> all() { return find.all(); } // create task public static void create(Task task) { task.create(task); } // delete task public static void delete(Long id) { find.ref(id).delete(id); // find.ref(id).delete(); } // create new task public static Result newTask() { Form<Task> filledForm = taskForm.bindFromRequest(); if(filledForm.hasErrors()) { return badRequest( views.html.index.render(Task.all(), filledForm) ); } else { Task.create(filledForm.get()); return redirect(routes.Application.tasks()); } } } I get a compile error on Task.java on the line static Form<Task> taskForm = form(Task.class); As I'm working on eclipse (the project is eclipsified before import), it's telling me that taskForm cannot be resolved and it also underlines every play 2 command e.g. "render(), redirect(), bindFromRequest()" asking me to create a method for it. Any ideas how to solve the compilations error and also how to get Eclipse to recognize the play2 commands? EDIT: updated Application.java package controllers; import models.Task; import play.data.Form; import play.mvc.Controller; import play.mvc.Result; public class Application extends Controller { // create new task public static Result newTask() { Form<Task> filledForm = form(Task.class).bindFromRequest(); if(filledForm.hasErrors()) { return badRequest( views.html.index.render(Task.all(), filledForm) ); } else { Task.newTask(filledForm.get()); return redirect(routes.Application.tasks()); } } public static Result index() { return redirect(routes.Application.tasks()); } public static Result tasks() { return ok( views.html.index.render(Task.all(), taskForm)); } public static Result deleteTask(Long id) { return TODO; } } Updated task.java package models; import java.util.List; import javax.persistence.Entity; import play.data.Form; import play.data.validation.Constraints.Required; import play.db.ebean.Model; import play.db.ebean.Model.Finder; import play.mvc.Result; import controllers.routes; @Entity public class Task extends Model { public Long id; @Required public String label; // Define a taskForm static Form<Task> taskForm = form(Task.class); // search public static Finder<Long,Task> find = new Finder( Long.class, Task.class); // display tasks public static List<Task> all() { return find.all(); } // create new task public static Result newTask(Task newTask) { save(task); } // delete task public static void delete(Long id) { find.ref(id).delete(id); // find.ref(id).delete(); } }

    Read the article

  • Why one loop is performing better than other memory wise as well as performance wise?

    - by Mohit
    I have following two loops in C#, and I am running these loops for a collection with 10,000 records being downloaded with paging using "yield return" First foreach(var k in collection) { repo.Save(k); } Second var collectionEnum = collection.GetEnumerator(); while (collectionEnum.MoveNext()) { var k = collectionEnum.Current; repo.Save(k); k = null; } Seems like that the second loop consumes less memory and it faster than the first loop. Memory I understand may be because of k being set to null(Even though I am not sure). But how come it is faster than for each. Following is the actual code [Test] public void BechmarkForEach_Test() { bool isFirstTimeSync = true; Func<Contact, bool> afterProcessing = contactItem => { return true; }; var contactService = CreateSerivce("/administrator/components/com_civicrm"); var contactRepo = new ContactRepository(new Mock<ILogger>().Object); contactRepo.Drop(); contactRepo = new ContactRepository(new Mock<ILogger>().Object); Profile("For Each Profiling",1,()=>{ var localenumertaor=contactService.Download(); foreach (var item in localenumertaor) { if (isFirstTimeSync) item.StateFlag = 1; item.ClientTimeStamp = DateTime.UtcNow; if (item.StateFlag == 1) contactRepo.Insert(item); else contactRepo.Update(item); afterProcessing(item); } contactRepo.DeleteAll(); }); } [Test] public void BechmarkWhile_Test() { bool isFirstTimeSync = true; Func<Contact, bool> afterProcessing = contactItem => { return true; }; var contactService = CreateSerivce("/administrator/components/com_civicrm"); var contactRepo = new ContactRepository(new Mock<ILogger>().Object); contactRepo.Drop(); contactRepo = new ContactRepository(new Mock<ILogger>().Object); var itemsCollection = contactService.Download().GetEnumerator(); Profile("While Profiling", 1, () => { while (itemsCollection.MoveNext()) { var item = itemsCollection.Current; //if First time sync then ignore and overwrite the stateflag if (isFirstTimeSync) item.StateFlag = 1; item.ClientTimeStamp = DateTime.UtcNow; if (item.StateFlag == 1) contactRepo.Insert(item); else contactRepo.Update(item); afterProcessing(item); item = null; } contactRepo.DeleteAll(); }); } static void Profile(string description, int iterations, Action func) { // clean up GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); // warm up func(); var watch = Stopwatch.StartNew(); for (int i = 0; i < iterations; i++) { func(); } watch.Stop(); Console.Write(description); Console.WriteLine(" Time Elapsed {0} ms", watch.ElapsedMilliseconds); } I m using the micro bench marking, from a stackoverflow question itself benchmarking-small-code The time taken is For Each Profiling Time Elapsed 5249 ms While Profiling Time Elapsed 116 ms

    Read the article

  • Function to get a string and return same after processing in C

    - by C0de_Hard
    I am working on a code which requires a function. This function gets a string as input and returns a string. What I have planned so far is to get a str[], remove all $'s and spaces, and store this in another string which is returned later: char *getstring(char str[]) { int i=0; char rtn[255]; while (i<strlen(str)) { if (str[i] != " " || str[i] != "$" ) rtn[i] = str[i]; else rtn[i] = ''; } return str; } I dont feel like this will work. Any ideas?? :-S

    Read the article

  • Which is the correct design pattern for my PHP application?

    - by user1487141
    I've been struggling to find good way to implement my system which essentially matches the season and episode number of a show from a string, you can see the current working code here: https://github.com/huddy/tvfilename I'm currently rewriting this library and want a nicer way to implement how the the match happens, currently essentially the way it works is: There's a folder with classes in it (called handlers), every handler is a class that implements an interface to ensure a method called match(); exists, this match method uses the regex stored in a property of that handler class (of which there are many) to try and match a season and episode. The class loads all of these handlers by instantiating each one into a array stored in a property, when I want to try and match some strings the method iterates over these objects calling match(); and the first one that returns true is then returned in a result set with the season and episode it matched. I don't really like this way of doing it, it's kind of hacky to me, and I'm hoping a design pattern can help, my ultimate goal is to do this using best practices and I wondered which one I should use? The other problems that exist are: More than one handler could match a string, so they have to be in an order to prevent the more greedy ones matching first, not sure if this is solvable as some of the regex patterns have to be greedy, but possibly a score system, something that shows a percentage of how likely the match is correct, i'd have no idea how to actually implement this though. I'm not if instantiating all those handlers is a good way of doing it, speed is important, but using best practices and sticking to design patterns to create good, extensible and maintainable code is my ultimate priority. It's worth noting the handler classes sometimes do other things than just regex matching, they sometimes prep the string to be matched by removing common words etc. Cheers for any help Billy

    Read the article

  • Android map performance with > 800 overlays of KML data

    - by span
    I have some a shape file which I have converted to a KML file that I wish to read coordinates from and then draw paths between the coordinates on a MapView. With the help of this great post: How to draw a path on a map using kml file? I have been able to read the the KML into an ArrayList of "Placemarks". This great blog post then showed how to take a list of GeoPoints and draw a path: http://djsolid.net/blog/android---draw-a-path-array-of-points-in-mapview The example in the above post only draws one path between some points however and since I have many more paths than that I am running into some performance problems. I'm currently adding a new RouteOverlay for each of the separate paths. This results in me having over 800 overlays when they have all been added. This has a performance hit and I would love some input on what I can do to improve it. Here are some options I have considered: Try to add all the points to a List which then can be passed into a class that will extend Overlay. In that new class perhaps it would be possible to add and draw the paths in a single Overlay layer? I'm not sure on how to implement this though since the paths are not always intersecting and they have different start and end points. At the moment I'm adding each path which has several points to it's own list and then I add that to an Overlay. That results in over 700 overlays... Simplify the KML or SHP. Instead of having over 700 different paths, perhaps there is someway to merge them into perhaps 100 paths or less? Since alot of paths are intersected at some point it should be possible to modify the original SHP file so that it merges all intersections. Since I have never worked with these kinds of files before I have not been able to find a way to do this in GQIS. If someone knows how to do this I would love for some input on that. Here is a link to the group of shape files if you are interested: http://danielkvist.net/cprg_bef_cbana_polyline.shp http://danielkvist.net/cprg_bef_cbana_polyline.shx http://danielkvist.net/cprg_bef_cbana_polyline.dbf http://danielkvist.net/cprg_bef_cbana_polyline.prj Anyway, here is the code I'm using to add the Overlays. Many thanks in advance. RoutePathOverlay.java package net.danielkvist; import java.util.List; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Point; import android.graphics.RectF; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; import com.google.android.maps.Projection; public class RoutePathOverlay extends Overlay { private int _pathColor; private final List<GeoPoint> _points; private boolean _drawStartEnd; public RoutePathOverlay(List<GeoPoint> points) { this(points, Color.RED, false); } public RoutePathOverlay(List<GeoPoint> points, int pathColor, boolean drawStartEnd) { _points = points; _pathColor = pathColor; _drawStartEnd = drawStartEnd; } private void drawOval(Canvas canvas, Paint paint, Point point) { Paint ovalPaint = new Paint(paint); ovalPaint.setStyle(Paint.Style.FILL_AND_STROKE); ovalPaint.setStrokeWidth(2); int _radius = 6; RectF oval = new RectF(point.x - _radius, point.y - _radius, point.x + _radius, point.y + _radius); canvas.drawOval(oval, ovalPaint); } public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) { Projection projection = mapView.getProjection(); if (shadow == false && _points != null) { Point startPoint = null, endPoint = null; Path path = new Path(); // We are creating the path for (int i = 0; i < _points.size(); i++) { GeoPoint gPointA = _points.get(i); Point pointA = new Point(); projection.toPixels(gPointA, pointA); if (i == 0) { // This is the start point startPoint = pointA; path.moveTo(pointA.x, pointA.y); } else { if (i == _points.size() - 1)// This is the end point endPoint = pointA; path.lineTo(pointA.x, pointA.y); } } Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(_pathColor); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(3); paint.setAlpha(90); if (getDrawStartEnd()) { if (startPoint != null) { drawOval(canvas, paint, startPoint); } if (endPoint != null) { drawOval(canvas, paint, endPoint); } } if (!path.isEmpty()) canvas.drawPath(path, paint); } return super.draw(canvas, mapView, shadow, when); } public boolean getDrawStartEnd() { return _drawStartEnd; } public void setDrawStartEnd(boolean markStartEnd) { _drawStartEnd = markStartEnd; } } MyMapActivity package net.danielkvist; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; public class MyMapActivity extends MapActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MapView mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); String url = "http://danielkvist.net/cprg_bef_cbana_polyline_simp1600.kml"; NavigationDataSet set = MapService.getNavigationDataSet(url); drawPath(set, Color.parseColor("#6C8715"), mapView); } /** * Does the actual drawing of the route, based on the geo points provided in * the nav set * * @param navSet * Navigation set bean that holds the route information, incl. * geo pos * @param color * Color in which to draw the lines * @param mMapView01 * Map view to draw onto */ public void drawPath(NavigationDataSet navSet, int color, MapView mMapView01) { ArrayList<GeoPoint> geoPoints = new ArrayList<GeoPoint>(); Collection overlaysToAddAgain = new ArrayList(); for (Iterator iter = mMapView01.getOverlays().iterator(); iter.hasNext();) { Object o = iter.next(); Log.d(BikeApp.APP, "overlay type: " + o.getClass().getName()); if (!RouteOverlay.class.getName().equals(o.getClass().getName())) { overlaysToAddAgain.add(o); } } mMapView01.getOverlays().clear(); mMapView01.getOverlays().addAll(overlaysToAddAgain); int totalNumberOfOverlaysAdded = 0; for(Placemark placemark : navSet.getPlacemarks()) { String path = placemark.getCoordinates(); if (path != null && path.trim().length() > 0) { String[] pairs = path.trim().split(" "); String[] lngLat = pairs[0].split(","); // lngLat[0]=longitude // lngLat[1]=latitude // lngLat[2]=height try { if(lngLat.length > 1 && !lngLat[0].equals("") && !lngLat[1].equals("")) { GeoPoint startGP = new GeoPoint( (int) (Double.parseDouble(lngLat[1]) * 1E6), (int) (Double.parseDouble(lngLat[0]) * 1E6)); GeoPoint gp1; GeoPoint gp2 = startGP; geoPoints = new ArrayList<GeoPoint>(); geoPoints.add(startGP); for (int i = 1; i < pairs.length; i++) { lngLat = pairs[i].split(","); gp1 = gp2; if (lngLat.length >= 2 && gp1.getLatitudeE6() > 0 && gp1.getLongitudeE6() > 0 && gp2.getLatitudeE6() > 0 && gp2.getLongitudeE6() > 0) { // for GeoPoint, first:latitude, second:longitude gp2 = new GeoPoint( (int) (Double.parseDouble(lngLat[1]) * 1E6), (int) (Double.parseDouble(lngLat[0]) * 1E6)); if (gp2.getLatitudeE6() != 22200000) { geoPoints.add(gp2); } } } totalNumberOfOverlaysAdded++; mMapView01.getOverlays().add(new RoutePathOverlay(geoPoints)); } } catch (NumberFormatException e) { Log.e(BikeApp.APP, "Cannot draw route.", e); } } } Log.d(BikeApp.APP, "Total overlays: " + totalNumberOfOverlaysAdded); mMapView01.setEnabled(true); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } } Edit: There are of course some more files I'm using but that I have not posted. You can download the complete Eclipse project here: http://danielkvist.net/se.zip

    Read the article

  • Mixing Objective-C and C++

    - by helixed
    I'm trying to mix together some Objective-C code with C++. I've always heard it was possible, but I've never actually tried it before. When I try to compile the code, I get a bunch of errors. Here's a simple example I've created which illustrates my problems: AView.h #import <Cocoa/Cocoa.h> #include "B.h" @interface AView : NSView { B *b; } -(void) setB: (B *) theB; @end AView.m #import "AView.h" @implementation AView - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code here. } return self; } - (void)drawRect:(NSRect)dirtyRect { // Drawing code here. } -(void) setB: (B *) theB { b = theB; } @end B.h #include <iostream> class B { B() { std::cout << "Hello from C++"; } }; Here's the list of errors I get when I try to compile this: /Users/helixed/Desktop/Example/B.h:1:0 /Users/helixed/Desktop/Example/B.h:1:20: error: iostream: No such file or directory /Users/helixed/Desktop/Example/B.h:3:0 /Users/helixed/Desktop/Example/B.h:3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'B' /Users/helixed/Desktop/Example/AView.h:5:0 /Users/helixed/Desktop/Example/AView.h:5: error: expected specifier-qualifier-list before 'B' /Users/helixed/Desktop/Example/AView.h:8:0 /Users/helixed/Desktop/Example/AView.h:8: error: expected ')' before 'B' /Users/helixed/Desktop/Example/AView.m:26:0 /Users/helixed/Desktop/Example/AView.m:26: error: expected ')' before 'B' /Users/helixed/Desktop/Example/AView.m:27:0 /Users/helixed/Desktop/Example/AView.m:27: error: 'b' undeclared (first use in this function) All I'm doing to compile this right now is using the default compiler built into Xcode. I didn't edit the Cocoa Application template in any way other than adding the two files I created and chaing the NSView to AView in the xib file. Could somebody please tell me what I'm doing wrong? Thanks, helixed

    Read the article

  • Google I/O 2012 - New Low-Level Media APIs in Android

    Google I/O 2012 - New Low-Level Media APIs in Android Dave Burke Jellybean introduces a new set of powerful low-level media APIs that provide developers with the ability to access hardware codecs directly from Java. This session introduces the new APIs with examples. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 470 15 ratings Time: 01:05:50 More in Science & Technology

    Read the article

  • Google I/O 2012 - Making Good Apps Great: More Advanced Topics for Expert Android Developers

    Google I/O 2012 - Making Good Apps Great: More Advanced Topics for Expert Android Developers Reto Meier In a follow-up to last year's session, I'll demonstrate how to use advanced Android techniques to take a good app and transform it into a polished product, without being a resource hog. Features advanced coding tips and tricks, bandwidth-saving techniques, implementation patterns, exposure to some of the lesser-known API features, and insight into how to minimize battery drain by ensuring your app is a good citizen on the carrier network. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 2193 69 ratings Time: 58:35 More in Science & Technology

    Read the article

  • Google I/O 2012 - New YouTube Android Player Tools

    Google I/O 2012 - New YouTube Android Player Tools Ross McIlroy, Anton Hansson If you are building Android smartphone, tablet or Google TV applications and want to incorporate high-quality YouTube video playback in your product this session will rock your world. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 1719 24 ratings Time: 51:10 More in Science & Technology

    Read the article

  • Google I/O 2012 - What's Next for Chrome Extensions?

    Google I/O 2012 - What's Next for Chrome Extensions? Mike West Chrome's extension system offers developers more opportunities than ever to customize and enhance users' experience on the web. New APIs are landing on a regular basis that provide new functionality and deeper hooks into Chrome itself. Join us for a walk through bleeding edge changes to Chrome's extension framework that increase security, improve performance, and make it easier than ever for users to get up and running with the product of your hard work. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 1372 29 ratings Time: 51:36 More in Science & Technology

    Read the article

  • Google I/O 2012 - Computing Map Tiles with Go on App Engine

    Google I/O 2012 - Computing Map Tiles with Go on App Engine Chris Broadfoot, Andrew Gerrand In this talk we use the Maps API and Go on App Engine to build an app to build custom tile sets for Google Maps. The app demonstrates using Go's suitability for computation in the cloud and App Engine's key scalability features, such as Task Queues and Backends. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 1170 21 ratings Time: 47:22 More in Science & Technology

    Read the article

  • Google I/O 2012 - Get your Content on Google TV

    Google I/O 2012 - Get your Content on Google TV Christian Kurzke , Andrew Jeon, Mark Lindner Google TV devices are typically the largest screen in the house, which makes them a prime platform for developers who want to distribute high quality, long form content right to the living room. We will talk about different options for hosting, streaming and securing your content on Google TV, and how to ensure your audience has a great experience viewing your content. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 1562 26 ratings Time: 01:01:00 More in Science & Technology

    Read the article

  • Google I/O 2012 - The Sensitive Side of Android

    Google I/O 2012 - The Sensitive Side of Android Tony Chan, Ankur Kotwal , Tim Bray, Tony Chan Android has a sensitive side. In this session, we will call out all the Android sensors: accelerometer, gyroscope, light, and more. We'll cover best practices for handling sensor data, with special focus on balancing battery life and usability. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 2157 35 ratings Time: 56:06 More in Science & Technology

    Read the article

  • Google I/O 2012 - How to Build Apps that Love Each Other with Web Intents

    Google I/O 2012 - How to Build Apps that Love Each Other with Web Intents Paul Kinlan, James Hawkins Web Intents allows you to build applications that integrate with one another with an ease that has never been seen on the web before. In this session we will show you how to connect applications using Web Intents and how to best integrate with the many actions available in Web Intents such as editing, saving and sharing. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 1394 15 ratings Time: 57:48 More in Science & Technology

    Read the article

  • Google I/O 2012 - Building Mobile App Engine Backends for Android, iOS and the Web

    Google I/O 2012 - Building Mobile App Engine Backends for Android, iOS and the Web Dan Holevoet, Christina Ilvento Mobile application development is growing at explosive rates and the best of those applications have a backend server. Find out how you can use App Engine's new feature to build powerful APIs to support mobile applications running on Android, iOS, and mobile browsers. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 1783 43 ratings Time: 48:38 More in Science & Technology

    Read the article

  • Google I/O 2012 - Chrome Developer Tools Evolution

    Google I/O 2012 - Chrome Developer Tools Evolution Sam Dutton, Pavel Feldman Web app development moves fast and Chrome Developer Tools is still keeping you one step ahead. If you know your way around the Dev Tools and would like to take your skills to a higher level, this session will kick your productivity into overdrive. Since last year's installment, we've added a whole slew of features that empower developers to make rich web apps, so in this demo-rich session we'll explain how to use those tools to develop and debug on mobile and desktop. We'll take you jank hunting with the new timeline, delve into minified JavaScript via Source Maps, debug Web Workers, and much more. Join us and learn what Chrome Developer Tools can do for you. For all I/O 2012 sessions, go to developers.google.com From: GoogleDevelopers Views: 1722 36 ratings Time: 59:41 More in Science & Technology

    Read the article

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