Search Results

Search found 1489 results on 60 pages for 'peter becich'.

Page 35/60 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • Last words of a ??? programmer

    - by Peter
    What will the last words of some kind of programmer be? Like: LW of a Perl programmer: I don't have to write documentation. The source is formatted so well, I can read it anytime later... or Im just going to write a regular expression to find this, then I'm done...

    Read the article

  • 0xDEADBEEF equivalent for 64-bit development?

    - by Peter Mortensen
    For C++ development for 32-bit systems (be it Linux, Mac OS or Windows, PowerPC or x86) I have initialised pointers that would otherwise be undefined (e.g. they can not immediately get a proper value) like so: int *pInt = reinterpret_cast<int *>(0xDEADBEEF); (To save typing and being DRY the right-hand side would normally be in a constant, e.g. BAD_PTR.) If pInt is dereferenced before it gets a proper value then it will crash immediately on most systems (instead of crashing much later when some memory is overwritten or going into a very long loop). Of course the behavior is dependent on the underlying hardware (getting a 4 byte integer from the odd address 0xDEADBEEF from a user process may be perfectly valid), but the crashing has been 100% reliable for all the systems I have developed for so far (Mac OS 68xxx, Mac OS PowerPC, Linux Redhat Pentium, Windows GUI Pentium, Windows console Pentium). For instance on PowerPC it is illegal (bus fault) to fetch a 4 byte integer from an odd address. What is a good value for this on 64-bit systems?

    Read the article

  • How can developers use a similar tracking link to Google's results page?

    - by Peter Jones
    I've read heaps of pages of people trying to implement some kind of tracking system similar to the way Google reroutes search link. Eg: Search "Facebook" in Google, open in a new window, and the link changes to something like: "http://www.google.com.au/url?sa=t&source=web&cd=1&ved=0CBkQFjAA&url=http%3A%2F%2Fwww.facebook.com%2F&rct=j&q=Facebook&ei=sksZTZexJobJccXnxZYK&usg=AFQjCNHTTNi-O4Qgrg6kvGVfKJuRqbuOKw&cad=rja" I'm guessing Google tracks that click and then redirects to the actual site by reading the url parameter. What I wanted to know is if there was a simple way that you can make this kind of functionality work using an onclick event - just change the link href after being clicked to redirect? There's a few threads, but from what I could find, nobody has actually succeeded without problems or limitations. Thanks in advance.

    Read the article

  • How can web form content be preserved for the back button

    - by Peter Howe
    When a web form is submitted and takes the user to another page, it is quite often the case that the user will click the Back button in order to submit the form again (the form is an advanced search in my case.) How can I reliably preserve the form options selected by the user when they click Back (so they don't have to start from scratch with filling the form in again if they are only changing one of many form elements?) Do I have to go down the route of storing the form options in session data (cookies or server-side) or is there a way to get the browser to handle this for me? (Environment is PHP/JavaScript - and the site must work on IE6+ and Firefox2+)

    Read the article

  • Which SHA-256 is correct? The Java SHA-256 digest or the Linux commandline tool

    - by Peter Tillemans
    When I calculate in Java an SHA-256 of a string with the following method I get : 5e884898da2847151d0e56f8dc6292773603dd6aabbdd62a11ef721d1542d8 on the commandline I do : echo "password" | sha256sum and get 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 if we compare these more closely I find 2 subtle differences 5e884898da2847151d0e56f8dc6292773603dd6aabbdd62a11ef721d1542d8 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 or : 5e884898da28 47151d0e56f8dc6292773603d d6aabbdd62a11ef721d1542d8 5e884898da28 0 47151d0e56f8dc6292773603d 0 d6aabbdd62a11ef721d1542d8 Which of the 2 is correct here?

    Read the article

  • Mysql adapter for Zend_Translate

    - by Peter
    Hi everybody, I'm currently in the planning phase of a rather large project that I'll develop in the Zend Framework. One of the problems I'm facing is that the customers will want to translate not only the content but also the interface. I'm currently using gettext and poedit to manage my language files but this is not an option for the customer as they, for one, want have FTP access to the site. Hence, I'm thinking of a mysql back end with an interface in the front end for the customer to manage his own translations of the interface. There is however still no mysql adapater for Zend_Translate. So, does anybody now of an adapter script for Zend_Translate so it can work with a mysql table? Or any arguments against using mysql and possible other solutions for this problem?

    Read the article

  • string extension method - Not available through WebMethod

    - by Peter Bridger
    I've written a simple extension method for a web project, it sits in a class file called StringExtensions.cs which contains the following code: using System; using System.Collections.Generic; using System.Linq; using System.Web; /// <summary> /// Useful extensions for string /// </summary> static class StringExtensions { /// <summary> /// Is string empty /// </summary> /// <param name="value"></param> /// <returns></returns> public static bool IsEmpty(this string value) { return value.Trim().Length == 0; } } I can access this extension method from all the classes I have within the App_Code directory. However I have a web page called JSON.aspx that contains a series of [WebMethods] - within these I cannot see the extension method - I must be missing something very obvious!

    Read the article

  • Ordering the calling of asynchronous methods in c#

    - by Peter Kelly
    Hi, Say I have 4 classes ControllerClass MethodClass1 MethodClass2 MethodClass3 and each MethodClass has an asynchronous method DoStuff() and each has a CompletedEvent. The ControllerClass is responsible for invoking the 3 asynchronous methods on the 3 MethodClasses in a particular order. So ControllerClass invokes MethodClass1.DoStuff() and subscribes to MethodClass1.CompletedEvent. When that event is fired, ControllerClass invokes MethodClass2.DoStuff() and subscribes to MethodClass2.CompletedEvent. When that event is fired, the ControllerClass invokes MethodClass3.DoStuff() Is there a best practice for a situation like this? Is this bad design? I believe it is because I am finding it hard to unit test (a sure sign) It is not easy to change the order I have an uneasy, code-smell feeling about it What are the alternatives in a situation like this?

    Read the article

  • How to Store State in Silverlight WCF RIA Services

    - by peter
    Hi All, I am developing a silverlight 3 application using WCF RIA services. I am using the AuthenticationBase class to handle my authentication. As I understand it under the hood this uses the ASP .NET authentication libraries. When I log into the site the authentication service handles login state so that if I close the site and open it straight away I am still logged in according to the server. When the webpage is refreshed or closed and reloaded I can call the method, WebContextBase.Current.Authentication.LoadUser() And it goes back to the authentication service (running on the server) and figures out whether I am still logged into the site. If a timeout has occured the answer will be no. If that is the case I can show a login dialog. The problem I want to solve is that the authentication service consumes the password, and there is no way I can ever retrieve that password again. If the user logs into the site I want to store the password on the server, and return a token to the client side to match up with that password. I have some other services on the server side that need that password. So where should I store that password on the server? How can that be done? How does the WCF authentication store state?

    Read the article

  • Could you please provide me with comments on a Java game of mine?

    - by Peter Perhác
    Hello there. I have marked this question as community wiki, so no rep points are thrown around. I made this game, Forest Defender, a proof-of-feasibility little project, which I would like to share with you and collect your constructive comments, first impressions, etc. It is a the first playable (and enjoyable) game I have released to the public, so I am, naturally, very eager to get some recognition by you, as my peers. I read in a StackOverflow blog, that One of the major reasons we created Stack Overflow to give every programmer a chance to be recognized by their peers. Recognized for their knowledge, their passion, [...] It comes in the form of a Java applet, I used an animation framework called PulpCore and I must say that it's been extremely enjoyable to work with it. I do recommend to people interested in Java game development. Since the product is free, fun, entirely commercial-free and I am willing to share the code to it (on request), I thought it would be OK to post this as a topic here. Moderators, please feel free to move this to another place if you deem the other place more appropriate. EDIT: I am ever so stupid to forget to include a link :-) http://www.perhac.com/shared/forest-defender/index.html

    Read the article

  • transition of x-axis results in overflow

    - by peter
    First of all, no: this question is not about the (yet) ugly transition of the lines (I might open another one for that, though..). I'm displaying data in line charts and the user can select the time horizon. The x-axis then correspondingly transitions so as to fit to the changed time horizon. In attached image, e.g., the time horizon was 1 week and then I switched to 4 weeks. The number of ticks on the x-axis increases from 7 to 28, correspondingly. Question: How can I prevent the x-axis animation to display outside the svg container? As you can see, the additional dates fly in from the left and they are being animated far far outside the container. Any ideas? Right now, the transition works probably in the most simple way it could: // format for x-axis var xAxis = d3.svg.axis() .scale(x) .orient("bottom") .tickFormat(d3.time.format("%d.%m")) .ticks(d3.time.days, 1) .tickSubdivide(0); // Update x-axis svg.select(".x") .transition() .duration(500) .call(xAxis);

    Read the article

  • HttpURLConnection does not read the whole respnse

    - by Peter Szanto
    I use HttpURLConnection to do HTTP POST but I dont always get back the full response. I wanted to debug the problem, but when I step through each line it worked. I thought it must be a timing issue so I added Thread.sleep and it really made my code work, but this is only a temporary workaround. I wonder why is this happening and how to solve. Here is my code: URL u = new URL(url); URLConnection c = u.openConnection(); InputStream in = null; String mediaType = null; if (c instanceof HttpURLConnection) { //c.setConnectTimeout(1000000); //c.setReadTimeout(1000000); HttpURLConnection h = (HttpURLConnection)c; h.setRequestMethod("POST"); //h.setChunkedStreamingMode(-1); setAccept(h, expectedMimeType); h.setRequestProperty("Content-Type", inputMimeType); for(String key: httpHeaders.keySet()) { h.setRequestProperty(key, httpHeaders.get(key)); if (logger.isDebugEnabled()) { logger.debug("Request property key : " + key + " / value : " + httpHeaders.get(key)); } } h.setDoOutput(true); h.connect(); OutputStream out = h.getOutputStream(); out.write(input.getBytes()); out.close(); mediaType = h.getContentType(); logger.debug(" ------------------ sleep ------------------ START"); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } logger.debug(" ------------------ sleep ------------------ END"); if (h.getResponseCode() < 400) { in = h.getInputStream(); } else { in = h.getErrorStream(); } It genearates the following HTTP headers POST /emailauthentication/ HTTP/1.1 Accept: application/xml Content-Type: application/xml Authorization: OAuth oauth_consumer_key="b465472b-d872-42b9-030e-4e74b9b60e39",oauth_nonce="YnDb5eepuLm%2Fbs",oauth_signature="dbN%2FWeWs2G00mk%2BX6uIi3thJxlM%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1276524919", oauth_token="", oauth_version="1.0" User-Agent: Java/1.6.0_20 Host: test:6580 Connection: keep-alive Content-Length: 1107 In other posts it was suggested to turn off keep-alive by using the http.keepAlive=false system property, I tried that and the headers changed to POST /emailauthentication/ HTTP/1.1 Accept: application/xml Content-Type: application/xml Authorization: OAuth oauth_consumer_key="b465472b-d872-42b9-030e-4e74b9b60e39", oauth_nonce="Eaiezrj6X4Ttt0", oauth_signature="ND9fAdZMqbYPR2j%2FXUCZmI90rSI%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1276526608", oauth_token="", oauth_version="1.0" User-Agent: Java/1.6.0_20 Host: test:6580 Connection: close Content-Length: 1107 the Connection header is "close" but I still cannot read the whole response. Any idea what do I do wrong?

    Read the article

  • iPhone Setting ViewController nested in NSMutableArray

    - by Peter George
    Hello I'm trying to set attributes for a viewcontroller nested inside a NSMutableArray, for example I have 3 ViewController inside this array: FirstViewController *firstViewController = [FirstViewController alloc]; SecondViewController *secondViewController = [SecondViewController alloc]; ThirdViewController *thirdViewController = [ThirdViewController alloc]; NSMutableArray *viewControllerClasses = [[NSMutableArray alloc] initWithObjects: firstViewController, secondViewController, thirdViewController, nil]; for (int x=0; x<[viewControllerClasses count]; x++) { // as an example to set managedObjectContext I otherwise would set firstViewController.managedObjectContext = context; [viewControllerClasses objectAtIndex:x].managedObjectContext = context; } But this results in an error: Request for member "managedObjectContext" in something not a structure or union. Shouldn't be "firstViewController" be the same as [viewControllerClasses objectAtIndex:0]?

    Read the article

  • Make subfolder the root folder for everything in subfolder

    - by Illes Peter
    Hi there. I am working on a project that i host on my server. My server is mydomain.com and i want my project to run in mydomain.com/project. I wish to put an htaccess file in the project subfolder, so that in every file of the project, / will point to mydomain.com/project instead of mydomain.com So / will be mydomain/project, /lib/img will be mydomain/project/lib/img, etc. Any help will be greatly appreciated.

    Read the article

  • What ways can I put images in a grid-like format?

    - by Peter
    I have about 12-15 images that I want to align together in a grid, with text under each image. I thought about using a table, but I hear that tables aren't the best way to go these days. I tried a few other things, but nothing seemed to work the way I wanted it to. An example of what I want it to look like would be something like this: [-----Image-----] [-----Image-----] [-----Image-----] [-----Image-----] --- Row 1 (--Description-) (-Description-) (-Description-) (-Description-) [-----Image-----] [-----Image-----] [-----Image-----] [-----Image-----] --- Row 2 (--Description-) (-Description-) (-Description-) (-Description-) and so on... What are some other methods, besides tables, that I should look into using? Any suggestions or references would be helpful.

    Read the article

  • Using Application Settings and reading defaults from app.config

    - by Peter Goras
    Hi, I need to deploy a Windows Forms application using ClickOnce deployment. (VS2008, .NET 3.5) And I need to provide a configuration file for this app that any user can modify. For this reason, I am using Application Settings instead of standard appSetttings in app.config so I can separate the the user config from app config. see http://msdn.microsoft.com/en-us/library/ms228995(VS.80).aspx Creating a Settings.settings file using VS generated a class with hard-coded default values like this: [global::System.Configuration.DefaultSettingValueAttribute("blahblah")] public string MyProperty ... WTF? I want to read the default values from the app.config! So I created my own class deriving from ApplicationSettingsBase but I cannot get this to read values from the app.config. Any ideas?

    Read the article

  • How can I get a list of licenses from intalled RPMs?

    - by Peter
    We've been asked to list all the software and licenses used in our organization. Without deciding the value of this request, I'd like to get my Fedora laptop to answer the question easily. rpm -qa Gives me a list of packages, but no license data. My next step is to take that output and write a script to query each package's license. Anyone got an easier idea?

    Read the article

  • MySQL: Creating table with FK error (errno 150)

    - by Peter Bailey
    I've tried searching on this error and nothing I've found helps me, so I apologize in advance if this is a duplicate and I'm just too dumb to find it. I've created a model with MySQL Workbench and am now attempting to install it to a mysql server. Using File Export Forward Engineer SQL CREATE Script... it outputs a nice big file for me, with all the settings I ask for. I switch over to MySQL GUI Tools (the Query Browser specifically) and load up this script (note that I'm going form one official MySQL tool to another). However, when I try to actually execute this file, I get the same error over and over SQLSTATE[HY000]: General error: 1005 Can't create table './srs_dev/location.frm' (errno: 150) "OK", I say to myself, something is wrong with the location table. So I check out the definition in the output file. SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; -- ----------------------------------------------------- -- Table `state` -- ----------------------------------------------------- DROP TABLE IF EXISTS `state` ; CREATE TABLE IF NOT EXISTS `state` ( `state_id` INT NOT NULL AUTO_INCREMENT , `iso_3166_2_code` VARCHAR(2) NOT NULL , `name` VARCHAR(60) NOT NULL , PRIMARY KEY (`state_id`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `brand` -- ----------------------------------------------------- DROP TABLE IF EXISTS `brand` ; CREATE TABLE IF NOT EXISTS `brand` ( `brand_id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) NOT NULL , `domain` VARCHAR(45) NOT NULL , `manager_name` VARCHAR(100) NULL , `manager_email` VARCHAR(255) NULL , PRIMARY KEY (`brand_id`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `location` -- ----------------------------------------------------- DROP TABLE IF EXISTS `location` ; CREATE TABLE IF NOT EXISTS `location` ( `location_id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `address_line_1` VARCHAR(255) NULL , `address_line_2` VARCHAR(255) NULL , `city` VARCHAR(100) NULL , `state_id` TINYINT UNSIGNED NULL DEFAULT NULL , `postal_code` VARCHAR(10) NULL , `phone_number` VARCHAR(20) NULL , `fax_number` VARCHAR(20) NULL , `lat` DECIMAL(9,6) NOT NULL , `lng` DECIMAL(9,6) NOT NULL , `contact_url` VARCHAR(255) NULL , `brand_id` TINYINT UNSIGNED NOT NULL , `summer_hours` VARCHAR(255) NULL , `winter_hours` VARCHAR(255) NULL , `after_hours_emergency` VARCHAR(255) NULL , `image_file_name` VARCHAR(100) NULL , `manager_name` VARCHAR(100) NULL , `manager_email` VARCHAR(255) NULL , `created_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`location_id`) , CONSTRAINT `fk_location_state` FOREIGN KEY (`state_id` ) REFERENCES `state` (`state_id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_location_brand` FOREIGN KEY (`brand_id` ) REFERENCES `brand` (`brand_id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_location_state` ON `location` (`state_id` ASC) ; CREATE INDEX `fk_location_brand` ON `location` (`brand_id` ASC) ; CREATE INDEX `idx_lat` ON `location` (`lat` ASC) ; CREATE INDEX `idx_lng` ON `location` (`lng` ASC) ; Looks ok to me. I surmise that maybe something is wrong with the Query Browser, so I put this file on the server and try to load it this way ] mysql -u admin -p -D dbname < path/to/create_file.sql And I get the same error. So I start to Google this issue and find all kinds of accounts that talk about an error with InnoDB style tables that fail with foreign keys, and the fix is to add "SET FOREIGN_KEY_CHECKS=0;" to the SQL script. Well, as you can see, that's already part of the file that MySQL Workbench spat out. So, my question is then, why is this not working when I'm doing what I think I'm supposed to be doing? Version Info: # MySQL: 5.0.45 GUI Tools: 1.2.17 Workbench: 5.0.30

    Read the article

  • UML tool required for C#

    - by Peter Morris
    I need some help - here are my requirements. 1: I should be able to modify the UML model without affecting the code, and then later apply the changes. This is because I need to print the changes, get them confirmed, and then develop them. 2: I should be able to reuse parts of the model. For example I would create one project which outputs A.dll assembly, and then another UML project would use the classes in the first to crate B.dll 3: Project stored as text so I can see changes in version control history. 4: Together is too expensive :-)

    Read the article

  • How do I assign selected WPF datagrid row columns to variables. (VB.NET)

    - by Peter
    Hi, I have a datagrid with customer data such as ID, name, email, phone etc. When I select a row (with a button or selectionchanged) I want to store that row's columns in variables like dim email as string dim name as string email = dgCustomers.theselectedrow.theselectedcell name = dgCustomers.theselectedrow.theselectedcell If I have a datatable with only one row I know I can get column data with: dim email as string = CustomerDataTableInstance.rows(0).Item("Email") I don't know how to get the selected row number though when I have several rows and the user clicks one/uses the keyboard. The datagrid is bound to a datatable, not a class with object collections. Any help is appreciated!

    Read the article

  • How can I limit the cache used by copying so there is still memory available for other cache?

    - by Peter
    Basic situation: I am copying some NTFS disks in openSuSE. Each one is 2TB. When I do this, the system runs slow. My guesses: I believe it is likely due to caching. Linux decides to discard useful cache (eg. kde4 bloat, virtual machine disks, LibreOffice binaries, Thunderbird binaries, etc.) and instead fill all available memory (24 GB total) with stuff from the copying disks, which will be read only once, then written and never used again. So then any time I use these apps (or kde4), the disk needs to be read again, and reading the bloat off the disk again makes things freeze/hiccup. Due to the cache being gone and the fact that these bloated applications need lots of cache, this makes the system horribly slow. Since it is USB,the disk and disk controller are not the bottleneck, so using ionice does not make it faster. I believe it is the cache rather than just the motherboard going too slow, because if I stop everything copying, it still runs choppy for a while until it recaches everything. And if I restart the copying, it takes a minute before it is choppy again. But also, I can limit it to around 40 MB/s, and it runs faster again (not because it has the right things cached, but because the motherboard busses have lots of extra bandwidth for the system disks). I can fully accept a performance loss from my motherboard's IO capability being completely consumed (which is 100% used, meaning 0% wasted power which makes me happy), but I can't accept that this caching mechanism performs so terribly in this specific use case. # free total used free shared buffers cached Mem: 24731556 24531876 199680 0 8834056 12998916 -/+ buffers/cache: 2698904 22032652 Swap: 4194300 24764 4169536 I also tried the same thing on Ubuntu, which causes a total system hang instead. ;) And to clarify, I am not asking how to leave memory free for the "system", but for "cache". I know that cache memory is automatically given back to the system when needed, but my problem is that it is not reserved for caching of specific things. Question: Is there some way to tell these copy operations to limit memory usage so some important things remain cached, and therefore any slowdowns are a result of normal disk usage and not rereading the same commonly used files? For example, is there a setting of max memory per process/user/file system allowed to be used as cache/buffers?

    Read the article

  • ASP.Net MVC ActionLink's and Shared Hosting Aliased Domains

    - by Peter Meyer
    So, I've read this and I've got a similar issue: I have a shared hosting account (with GoDaddy, though that's not exactly relevant, I believe) and I've got an MVC (RC1) site deployed to a sub-folder which where I have another domain name mapped (or aliased). The sub-folder is also setup as an application root as well. The site works without issue, the problem is that I don't like the links that are being generated using Html.ActionLink and Ajax.ActionLink. It's inserting the sub folder name as part of the URL as described in this other question. Thing is, the site works fine, but I'd like to make the links generated relative to the domain name. To use an example: http://my.abc.com "primary" domain; maps to \ on file system http://my.xyz.com setup to map to \_xyz.com folder on file system My generated links on xyz.com look like this: Intended Generated -------- --------- http://my.xyz.com/Ctrller/Action/52 http://my.xyz.com/_xyz.com/Ctrller/Action/52 and, FWIW, the site works. So, the question: Is there something I can do to get rid of that folder name in the links being generated? I have a couple of brute force ideas, but they aren't too elegant.

    Read the article

  • Flash and Google Maps - Only Last Icon showing

    - by Peter
    I have a simple Map and geocoding sample in Flash using CS4 The problem is simple - I can retrieve a short list from the google search api, but when I try to generate the icons on the map using a loop, only the last icon is displayed. (ignore the house icon, it is generated earlier) I feel I am missing something or made a stupid AS3 mistake (like treating it as if it was c#) - or even a stupid wood-for-the-trees mistake. The problem is in the last line of the code. I have added all my code just in case somebody else can find a use for it - lord knows it took me a great while to figure this out :) It runs here (also, if anybody has an idea why the icon is slightly in the wrong place on render, but corrects if you move the map - please let me know) Any help would be great. Thanks. P import com.google.maps.services.ClientGeocoder; import com.google.maps.services.GeocodingEvent; import com.google.maps.LatLng; import com.google.maps.Map; import com.google.maps.MapEvent; import com.google.maps.MapType; import com.google.maps.overlays.Marker; import com.google.maps.overlays.MarkerOptions; import com.google.maps.styles.FillStyle; import com.google.maps.styles.StrokeStyle; import com.google.maps.controls.* import com.google.maps.overlays.* import flash.display.Bitmap; import flash.display.BitmapData; import com.adobe.utils.StringUtil; import be.boulevart.google.ajaxapi.search.GoogleSearchResult; import be.boulevart.google.events.GoogleApiEvent; import be.boulevart.google.ajaxapi.search.local.GoogleLocalSearch; import be.boulevart.google.ajaxapi.search.local.data.GoogleLocalSearchItem; var strZip:String = new String(); strZip="60661"; var strAddress:String = new String(); strAddress ="100 W. Jackson Blvd, chicago, IL 60661"; var IconArray:Array = new Array; var SearchArray:Array = new Array; /*-------------------------------------------------------------- // The returned search data gets placed into this array ---------------------------------------------------------------*/ var LocalInfo:Array = new Array(); var intCount:int = new int; var intMapReady:int=0; /*=================================================================================== We load the map first and then get the search criteria - this will keep the order of operation clean. The ====================================================================================*/ var map:Map = new Map(); map.key = "ABQIAAAAHwSPp7Lhew456ffD6qa2WmxT_VwdLJEfmcCgytxKjcH1jLKkiihQtfC- TbcwryvBQYhRwHWa8F_Gp9Q"; map.setSize(new Point(600, 550)); map.addEventListener(MapEvent.MAP_READY, onMapReady); //Places the map on the page this.addChild(map); map.x=5; map.y=5; function onMapReady(event:Event):void { //Center the map and place the house marker doGeocode(); } /*========================================================================== Goecode to return the LAT and LONG for the specific address, center the map and add the house icon ===========================================================================*/ function doGeocode() { var geocoder:ClientGeocoder = new ClientGeocoder(); geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS, function(event:GeocodingEvent):void { var objPlacemarks:Array = event.response.placemarks; if (objPlacemarks.length > 0) { map.setCenter(objPlacemarks[0].point, 14, MapType.NORMAL_MAP_TYPE); var request:URLRequest = new URLRequest("house.png"); var imageLoader:Loader = new Loader(); imageLoader.load(request); var objMarkerOptions:MarkerOptions = new MarkerOptions(); objMarkerOptions.icon=imageLoader; objMarkerOptions.icon.scaleX=.15; objMarkerOptions.icon.scaleY=.15; objMarkerOptions.iconAlignment = MarkerOptions.ALIGN_HORIZONTAL_CENTER + MarkerOptions.ALIGN_VERTICAL_CENTER; var objMarker:Marker = new Marker(objPlacemarks[0].point, objMarkerOptions); map.addOverlay(objMarker); doLoadSearch() } }); //Failure code - good practice, really geocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE, function(event:GeocodingEvent):void { txtResult.appendText("Geocoding failed"); }); // generate geocode geocoder.geocode(strAddress); } /*=============================================================== XML Loader - loads icon file and search text pair from xml file =================================================================*/ function doLoadSearch() { var xmlLoader:URLLoader = new URLLoader(); var xmlData:XML = new XML(); xmlLoader.addEventListener(Event.COMPLETE, LoadXML); xmlLoader.load(new URLRequest("config.xml")); function LoadXML(e:Event):void { xmlData = new XML(e.target.data); RetrieveSearch(); } function RetrieveSearch() { //extract the MapData subset var xmlSearch = xmlData.MapData; // push this to an xml list object var xmlChildren:XMLList = xmlSearch.children(); //loop the list and extract the data into an //array of formatted search criteria for each (var Search:XML in xmlChildren) { txtResult.appendText("Searching For: "+Search.Criteria+" Icon=" + Search.Icon+ "Zip=" + strZip +"\r\n\r\n"); //retrieve search criteria loadLocalInfo(Search.Criteria,Search.Icon,strZip); } } } /*================================================================================== Search Functionality - does a google API search and loads the lats and longs required to place the icons on the map - THIS WILL NOT RUN LOCALLY ===================================================================================*/ function loadLocalInfo(strSearch,strIcon,strZip) { var objLocal:GoogleLocalSearch=new GoogleLocalSearch() objLocal.search(strSearch+" "+strZip,0,"0,0","","") objLocal.addEventListener(GoogleApiEvent.LOCAL_SEARCH_RESULT,onSearchComplete) function onSearchComplete(e:GoogleApiEvent):void { var resulta:GoogleSearchResult=e.data as GoogleSearchResult; //------------------------------------------------ // Load the icon for this particular search //------------------------------------------------ var request:URLRequest = new URLRequest(strIcon); var imageLoader:Loader = new Loader(); imageLoader.load(request); //------------------------------------------------------------- // For test purposes txtResult.appendText("Result Count for "+strSearch+" = "+e.data.results.length+"\r\n\r\n"); for each (var result:GoogleLocalSearchItem in e.data.results as Array) { LocalInfo[intCount]=[String(result.title),strIcon,String(result.latitude),String(result.longitude)]; //--------------------------------------- // Pop the icon onto the map //--------------------------------------- var objLatLng:LatLng = new LatLng(parseFloat(result.latitude), parseFloat(result.longitude)); var objMarkerOptions:MarkerOptions = new MarkerOptions(); objMarkerOptions.icon=imageLoader; objMarkerOptions.hasShadow=false; objMarkerOptions.iconAlignment = MarkerOptions.ALIGN_HORIZONTAL_CENTER + MarkerOptions.ALIGN_VERTICAL_CENTER; var objMarker:Marker = new Marker(objLatLng, objMarkerOptions); /********************************************************** *Everything* works to here - I have traced out execution and all variables. It only works on the last item in the array :( ***********************************************************/ map.addOverlay(objMarker); } } }

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >