Daily Archives

Articles indexed Wednesday June 16 2010

Page 17/119 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Extract <name> attribute from KML

    - by Ozaki
    I am using OpenLayers for a mapping service. In which I have several KML layers that are using KML feeds from server to populate data on the map. It currently plots: images / points / vector lines & shapes. But on these points it will not add a label with the value of the for the placemark in the KML. What I have currently tried is: ////////////////////KML Feed for * Layer// var surveylinelayer = new OpenLayers.Layer.Vector("First KML Layer", { projection: new OpenLayers.Projection("EPSG:4326"), strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: firstKMLURL, format: new OpenLayers.Format.KML({ extractStyles: true, extractAttributes: true }) }), styleMap: new OpenLayers.StyleMap({ "default": KMLStyle }) }); then the Style as follows: var KMLStyle = new OpenLayers.Style({ //label: "${name}", // This method will display nothing fillOpacity: 1, pointRadius: 10, fontColor: "#7E3C1C", fontSize: "13px", fontFamily: "Courier New, monospace", fontWeight: "strong", labelXOffset: "0", labelYOffset: "-15" }, { //dynamic label context: { label: function(feature) { return "Feature Name: " + feature.attributes.name; // also displays nothing } } }); Example of the KML: <Placemark> <name>POI1</name> <Style> <LabelStyle> <color>ffffffff</color> </LabelStyle> </Style> <Point> <coordinates>0.000,0.000</coordinates> </Point> </Placemark> When debugging I just hit "feature is undefined" and am unsure why it would be undefined in this instance?

    Read the article

  • Gem::Install Error

    - by Tian
    When I try to cleanup my rails versions with sudo gem cleanup rails I get the following error: Cleaning up installed gems... Attempting to uninstall rails-2.3.5 Unable to uninstall rails-2.3.5: Gem::InstallError: cannot uninstall, check `gem list -d rails` Attempting to uninstall rails-1.2.6 Unable to uninstall rails-1.2.6: Gem::InstallError: cannot uninstall, check `gem list -d rails` gem list -d rails results in: rails (2.3.8, 2.3.5, 1.2.6) Author: David Heinemeier Hansson Rubyforge: http://rubyforge.org/projects/rails Homepage: http://www.rubyonrails.org Installed at (2.3.8): /Library/Ruby/Gems/1.8 (2.3.5): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 (1.2.6): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 Web-application framework with template engine, control-flow layer, and ORM. Any one know what's wrong?

    Read the article

  • Most efficient way to check for DBNull and then assign to a variable?

    - by ilitirit
    This question comes up occasionally but I haven't seen a satisfactory answer. A typical pattern is (row is a DataRow): if (row["value"] != DBNull.Value) { someObject.Member = row["value"]; } My first question is which is more efficient (I've flipped the condition): row["value"] == DBNull.Value; // Or row["value"] is DBNull; // Or row["value"].GetType() == typeof(DBNull) // Or... any suggestions? This indicates that .GetType() should be faster, but maybe the compiler knows a few tricks I don't? Second question, is it worth caching the value of row["value"] or does the compiler optimize the indexer away anyway? eg. object valueHolder; if (DBNull.Value == (valueHolder = row["value"])) {} Disclaimers: row["value"] exists. I don't know the column index of the column (hence the column name lookup) I'm asking specifically about checking for DBNull and then assignment (not about premature optimization etc). Edit: I benchmarked a few scenarios (time in seconds, 10000000 trials): row["value"] == DBNull.Value: 00:00:01.5478995 row["value"] is DBNull: 00:00:01.6306578 row["value"].GetType() == typeof(DBNull): 00:00:02.0138757 Object.ReferenceEquals has the same performance as "==" The most interesting result? If you mismatch the name of the column by case (eg. "Value" instead of "value", it takes roughly ten times longer (for a string): row["Value"] == DBNull.Value: 00:00:12.2792374 The moral of the story seems to be that if you can't look up a column by it's index, then ensure that the column name you feed to the indexer matches the DataColumn's name exactly. Caching the value also appears to be nearly twice as fast: No Caching: 00:00:03.0996622 With Caching: 00:00:01.5659920 So the most efficient method seems to be: object temp; string variable; if (DBNull.Value != (temp = row["value"]) { variable = temp.ToString(); } This was a good learning experience.

    Read the article

  • Passion to learn

    - by rajivpradeep
    Hi, I want to learn C , UNIX and LINUX, and more about embedded systems. Very much interested in them. Are there any online courses or websites which can guide me. And please suggest books to read in learning them. Thanks for your time.

    Read the article

  • Station ID - more than IP

    - by bensiu
    Hello I am working on internal PHP application where users login only from our network (we are on dedicated IP and application is checking $_SERVER['REMOTE_ADDR'] and if is match our IP go thru if not - Bye However how I can identify from which station user is login ? Using cookie not gonna work - those are windows station working under control MS StedyState and all cookies are deleted every login I don't need nothing fancy like full MAC address just any unique ID (can not be application username - because users use different stations) Any ideas ? Maybe Javascript is able to grab some Unique detail from station's browser (IE 8) and pass this as hidden input? bensiu

    Read the article

  • Practical non-Turing-complete languages?

    - by Kyle Cronin
    Nearly all programming languages used are Turing Complete, and while this affords the language to represent any computable algorithm, it also comes with its own set of problems. Seeing as all the algorithms I write are intended to halt, I would like to be able to represent them in a language that guarantees they will halt. Regular expressions used for matching strings and finite state machines are used when lexing, but I'm wondering if there's a more general, broadly language that's not Turing complete? edit: I should clarify, by 'general purpose' I don't necessarily want to be able to write all halting algorithms in the language (I don't think that such a language would exist) but I suspect that there are common threads in halting proofs that can be generalized to produce a language in which all algorithms are guaranteed to halt. There's also another way to tackle this problem - eliminate the need for theoretically infinite memory. Once you limit the amount of memory the machine is allowed, the number of states the machine is in is finite and countable, and therefore you can determine if the algorithm will halt (by not allowing the machine to move into a state it's been in before).

    Read the article

  • Can we build websites in Java

    - by Mirage
    IF some says to me to build webisite in java. What does that mean. That means building in core java, java servlets , jsp , java beans , j2ee or what. What thing i need to learn if some tells me to make webiste in java. Just like there are ready made login scripts in php , are those available in java as well thanks

    Read the article

  • voice recognition in android

    - by jaymin
    Hi, I am an android application developer. I was curious as to how does voice recognition could be implemented using android. There is inbuilt support for speech recognition in android, but how can it be used to implement voice recognition...Are there any links which would help me in learning on this topic.. Thanks

    Read the article

  • Passing null as a param for replace() in javascript behaving weird?

    - by Babiker
    I have the follwing jQuery: $("#textArea").keyup(function(){ var textAreaValue = $("textArea"); if(!textArea.value.indexOf("some string")){ textArea.value = textArea.value.replace("some string",null); alert("It was there!"); } }); Is it normal for element.value.replace("some string",null); to replace "some string" with "null"as a string? And if normal can you please explain why? I have tested it with element.value.replace("some string",""), and that works fine, so what would be the difference between null and ""? Thanks in advance.

    Read the article

  • WCF Endpoint routing

    - by Dmitriy Sosunov
    Hi, Guys, how to route inbound message between different endpoints. I need to expose the single endpoint that could accept different credentials. I guess, solve this by intercept the incoming message and based on message header then do forward message to appropriate endpoint. Thanks.

    Read the article

  • How do I fix my VM's network connection if it seems to be running ok from the host?

    - by AndreiC
    I have a virtual machine (made with vmware) with a linux ubuntu os installed on it (i have a series of them), with NAT network connection - i am running vmware on Windows XP (my host system); the virtual machine can't connect to the internet. All the vmware services seem to be working fine from windows point of view, but inside the machine i can't connect to the internet. What is strange is that the virtual machine was able to use the internet some time ago, but all of a sudden, i just can't use my internet on the virtual machine - i have made no changes to the settings, nor in windows, nor in the virtual machine - so i don't understand.

    Read the article

  • .htaccess to restrict access to only select files

    - by Bryan Ward
    I have a directory in my webserver for which I would like to serve up only pdf files. I found I can restrict access using the .htaccess, and using something like <FilesMatch "\.(text,doc)"> Order allow,deny Deny from all Satisfy All </FilesMatch> to serve up everything except a regular expression. Is it possible to instead restrict access to only files which meet some regular expression?

    Read the article

  • Activerecord-PostgreSQL Adapter Error

    - by Tian
    When running "rake db:migrate", i receive the following error: Please install the postgresql adapter: gem install activerecord-postgresql-adapter (dlopen(/Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle, 9): no suitable image found. Did find: /Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/1.8/gems/pg-0.9.0/lib/pg_ext.bundle) Postgres 8.4.4 installed using the pre-built image file. Then ran sudo gem install pg to install pg-0.9.0 Config/database.yml: development: adapter: postgresql Does anyone know what the problem is?

    Read the article

  • Convert SQL server datetime fields to compare date parts only, with indexed lookups

    - by Caveatrob
    I've been doing a convert(varchar,datefield,112) on each date field that I'm using in 'between' queries in SQL server to ensure that I'm only accounting for dates and not missing any based on the time part of datetime fields. Now, I'm hearing that the converts aren't indexable and that there are better methods, in SQL Server 2005, to compare the date part of datetimes in a query to determine if dates fall in a range. What is the optimal, indexable, method of doing something like this: select * from appointments where appointmentDate='08-01-2008' and appointmentDate<'08-15-2008'

    Read the article

  • Exporting WPF DataGrid to a text file in a nice looking format. Text file must be easy to read.

    - by Andrew
    Hi, Is there a simple way to export a WPF DataGrid to a text file and a .csv file? I've done some searching and can't see that there is a simple DataGrid method to do so. I have got something working (barely) by making use of the ItemsSource of the DataGrid. In my case, this is an array of structs. I do something with StreamWriters and StringBuilders (details available) and basically have: StringBuilder destination = new StringBuilder(); destination.Append(row.CreationDate); destination.Append(seperator); // seperator is '\t' or ',' for csv file destination.Append(row.ProcId); destination.Append(seperator); destination.Append(row.PartNumber); destination.Append(seperator); I do this for each struct in the array (in a loop). This works fine. The problem is that it's not easy to read the text file. The data can be of different lengths within the same column. I'd like to see something like: 2007-03-03 234238423823 823829923 2007-03-03 66 99 And of course, I get something like: 2007-03-03 234238423823 823829923 2007-03-03 66 99 It's not surprising giving that I'm using Tab delimiters, but I hope to do better. It certainly is easy to read in the DataGrid! I could of course have some logic to pad short values with spaces, but that seems quite messy. I thought there might be a better way. I also have a feeling that this is a common problem and one that has probably been solved before (hopefully within the .NET classes themselves). Thanks.

    Read the article

  • How to allow certain HTML tags in a form field in Symfony 1.2

    - by camomileCase
    I'm playing around with Symfony and have encountered a road block. I created a model "CmsPage" which has a field called "content" which is stored as a clob (this is specific to doctrine I believe). When I created the app I set "--escaping-strategy=on" so if I enter any html when editing a CmsPage that gets encoded with html entities or something along those lines. I would like to allow html in this field and a quick googling hasn't helped much. Maybe I'm searching for the wrong terms. Anywho I would like to disable character escaping for this field and possibly only allow a small selection of html tags. What is the correct way to do this in Symfony?

    Read the article

  • SVN do unnecessary chmod on .svn/tempfiles

    - by ???
    My working dir is on an TrueCrypt NTFS volume, with umask 000. So I can read/write on any files with no problem. But I can't do svn command on it, for example `svn update' shows error: svn: Can't set permissions on '.svn/tempfile.8.tmp': strace svn up gives: ... chmod("sbin/.svn/tempfile.2.tmp", 0770) = -1 EPERM (Operation not permitted) fcntl64(3, F_GETFL) = 0x2 (flags O_RDWR) fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 write(3, "( failure ( ( 1 76:Can't set per"..., 172) = 172 fcntl64(3, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK) fcntl64(3, F_SETFL, O_RDWR) = 0 read(3, "( abort-edit ( ) ) ( failure ( ("..., 4096) = 191 gettimeofday({1276661368, 382789}, NULL) = 0 lstat64("sbin", {st_mode=S_IFDIR|0770, st_size=0, ...}) = 0 select(0, NULL, NULL, NULL, {0, 1000}) = 0 (Timeout) write(2, "svn: Can't set permissions on 's"..., 82svn: Can't set permissions on 'sbin/.svn/tempfile.2.tmp': Operation not permitted) = 82 close(3) = 0 So, the error occurred when svn chmod on some tmp files. But this is disallowed in the TrueCrypt volumes, and it's just unnecessary. Can I bypass the chmod lib calls when launch svn on TrueCrypt volumes?

    Read the article

  • UIButton addTarget:action:forControlEvents: results in [NSObject doesNotRecognizeSelector:]

    - by Teodor
    Hi. I tried a lot of stuff, still no result. So I have the following button created programatically in a subclass of UIViewController: rightButton = [UIButton buttonWithType:UIButtonTypeCustom]; rightButton.frame = CGRectMake(0.0, 0.0, 110.0, 40.0); rightButton.titleLabel.font = [UIFont fontWithName:GAME_FONT_NAME_STRING size:20.0]; [rightButton setTitle:@"MyTitle" forState:UIControlStateNormal]; rightButton.backgroundColor = [UIColor clearColor]; [rightButton setTitleColor:[UIColor greenColor] forState:UIControlStateNormal]; [rightButton setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted]; [rightButton setBackgroundImage:normalImage forState:UIControlStateNormal]; [rightButton setBackgroundImage:highlightedImage forState:UIControlStateHighlighted]; [rightButton addTarget:self action:@selector(myButton) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:rightButton]; where the selector is: - (void)myButton; I tried everything: - (void)myButton; - (void)myButton:(id)sender; - (void)myButton:(id)sender forEvent:(UIEvent *)event; - (IBAction)myButton; - (IBAction)myButton:(id)sender; - (IBAction)myButton:(id)sender forEvent:(UIEvent *)event; and the corresponding selectors, of course: [rightButton addTarget:self action:@selector(myButton) forControlEvents:UIControlEventTouchUpInside]; [rightButton addTarget:self action:@selector(myButton:) forControlEvents:UIControlEventTouchUpInside]; [rightButton addTarget:self action:@selector(myButton:forEvent:) forControlEvents:UIControlEventTouchUpInside]; [rightButton addTarget:self action:@selector(myButton) forControlEvents:UIControlEventTouchUpInside]; [rightButton addTarget:self action:@selector(myButton:) forControlEvents:UIControlEventTouchUpInside]; [rightButton addTarget:self action:@selector(myButton:forEvent:) forControlEvents:UIControlEventTouchUpInside]; The result is always an uncaught exception - [NSObject doesNotRecognizeSelector:]. However, the usual backtrace of the program is: #0 0x92a6bedb in objc_msgSend () #1 0x03b0a430 in ?? () #2 0x00306b4e in -[UIControl sendAction:to:forEvent:] () #3 0x00308d6f in -[UIControl(Internal) _sendActionsForEvents:withEvent:] () #4 0x00307abb in -[UIControl touchesEnded:withEvent:] () #5 0x002bcddf in -[UIWindow _sendTouchesForEvent:] () #6 0x002a67c8 in -[UIApplication sendEvent:] () #7 0x002ad061 in _UIApplicationHandleEvent () #8 0x02498d59 in PurpleEventCallback () #9 0x01cabb80 in CFRunLoopRunSpecific () #10 0x01caac48 in CFRunLoopRunInMode () #11 0x02497615 in GSEventRunModal () #12 0x024976da in GSEventRun () #13 0x002adfaf in UIApplicationMain () So what is the problem with that button? PS: I am using the iPhone SDK 3.1.3 Update! The following code in the AppDelegate (no declarations in the interface): - (void)applicationDidFinishLaunching:(UIApplication *)application { UIButton *test = [[UIButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 100.0)]; [test setTitle:@"Title" forState:UIControlStateNormal]; UIImage *bg = [UIImage imageNamed:...]; [test setBackgroundImage:bg forState:UIControlStateNormal]; [test addTarget:self action:@selector(testAction) forControlEvents:UIControlEventTouchUpInside]; [window addSubview:test]; [test release]; [window makeKeyAndVisible]; } - (void)testAction { NSLog(@"Write something..."); } works perfectly! But if I create an empty UIViewController with the same code: - (void)viewDidLoad { UIButton *test = [[UIButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 100.0)]; [test setTitle:@"Title" forState:UIControlStateNormal]; UIImage *bg = [UIImage imageNamed:...]; [test setBackgroundImage:bg forState:UIControlStateNormal]; [test addTarget:self action:@selector(testAction) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:test]; [test release]; [window makeKeyAndVisible]; } - (void)testAction { NSLog(@"Write something..."); } I get this mysterious error. :-( Help!

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >