Search Results

Search found 10804 results on 433 pages for 'attribute keys'.

Page 148/433 | < Previous Page | 144 145 146 147 148 149 150 151 152 153 154 155  | Next Page >

  • Using boost unordered map

    - by Amrish
    Guys, I am using dynamic programming approach to solve a problem. Here is a brief overview of the approach Each value generated is identified using 25 unique keys. I use the boost::hash_combine to generate the seed for the hash table using these 25 keys. I store the values in a hash table declared as boost::unordered_map<Key_Object, Data_Object, HashFunction> hashState; I did a time profiling on my algorithm and found that nearly 95% of the run time is spent towards retrieving/inserting data into the hash table. These were the details of my hash table hashState.size() 1880 hashState.load_factor() 0.610588 hashState.bucket_count() 3079 hashState.max_size() 805306456 hashState.max_load_factor() 1 hashState.max_bucket_count() 805306457 I have the following two questions Is there anything which I can do to improve the performance of the Hash Table's insert/retrieve operations? C++ STL has hash_multimap which would also suit my requirement. How does boost libraries unordered_map compare with hash_multimap in terms of insert/retrieve performance.

    Read the article

  • Render tooltip on disabled HTML Button.

    - by giulio
    I have a HTML button. I have tried to render a tooltip on it based on the "title" attribute of the button and it doesn't render. Mainly because it's disabled. I then tried wrapping the button in a span and setting the "title" attribute of the span. Hovering over the button that is wrapped in the span still has no effect. The tooltip will render on any other part of the span that is not part of the button tag. Like if i put some text in the span as well as the button, hovering over the text produces the tooltip, but if you hover over the button it will not render. So: how can I display a tooltip for a disabled button?

    Read the article

  • How do I invoke my custom settings provider?

    - by joebeazelman
    I need to specify a different location for my settings file. After many long hours of searching, I found out that I have to write my own SettingsProvider. I succeeded in creating one which allows me to specify a path for settings file via its constructor. Programatically, I can contruct it like this: var mycustomprovider = new CustomSettingsProvider(path); The problem I am having is that there's no way to invoke my custom provider. I can decorate the VS 2008 generated setting file with the following attribute: [SettingsProvider(typeof(CustomSettingProviders.CustomSettingsProvider))] internal sealed partial class Settings { } However, the attribute doesn't allow me to construct the object with a path. Also, I want to be able to set the SettingsProvider programmatically so that I can pass in any path I want at runtime and save my settings. The examples I've seen on the net have never mentioned how to use a invoke a SettingsProvider programmatically.

    Read the article

  • integriting facebook login button with Facebooker (rails plugin)

    - by dexterdeng
    I was integriting login-button with Facebooker, as I wanted to use facepile and customise the facebook login button, so I have to use facebook js sdk. I used the facebooker to connect facebook. now I found a issue. window.fbAsyncInit = function() { FB.init({ appId: '<%=Facebooker.api_key%>', status: true, cookie: true, xfbml: true }); }; (function() { var e = document.createElement('script'); e.type = 'text/javascript'; e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; e.async = true; document.getElementById('fb-root').appendChild(e); }()); function fblogin(){ var pearms = "email,user_birthday,friends_location,offline_access,publish_stream,read_friendlists,user_birthday,user_location"; FB.getLoginStatus(function(response) { if (response.session) { // logged in and connected user, someone you know window.location = "http://domain/account/link_user_accounts"; return true; } else { // no user session available, someone you dont know FB.login(function(response) { if (response.session) { if (response.perms) { // after logged in the facebook account. $.inspect(response.perms);//return all these perms I expected. it should be fine there. window.location = "http://domain/account/link_user_accounts"; } return true; } else { return false; } },"email,user_birthday,friends_location,offline_access,publish_stream,read_friendlists"); } }) }; Let's say if the api_key is "1111111111". take a look at this line: " ` if (response.session) { if (response.perms) { $.inspect(response.perms); " now I was trying to login , call fblogin() , I'm sure that the response.perms equal to the perms I expected. (btw, at that time, I have a facebook plugin named facepile works too, it showed my friends after I called fblogin() and connected to facebook by typing my email and password ). so now it should run window.location = "http://domain/account/link_user_accounts"; yes, this line run. but the facebook_session can't build successfully. after digging the facebooker's code, I found this from the rails plugin facebooker: def create_facebook_session secure_with_facebook_params! || secure_with_cookies! || secure_with_token! end mostly, it would run secure_with_cookies! , and if the cookies with keys as "fbs_#{Facebooker.api_key}","#{Facebooker.api_key}_ss", "#{Facebooker.api_key}_session_key",.. created, then the facebook_session can be created. but these cookies can't be created after I logged in facebook until I refresh the current page by hand . I noticed if I refresh the page, the cookies with these keys added to the browser. but why they can't be added after I logged in facebook at once? I need these keys to create facebook_session. did I forgot something excepted these code I pasted? anybody help? thank you very much!

    Read the article

  • Generate reasonable length license key with asymmetric encryption?

    - by starkos
    I've been looking at this all day. I probably should have walked away from it hours ago; I might be missing something obvious at this point. Short version: Is there a way to generate and boil down an asymmetrically encrypted hash to a reasonable number of unambiguous, human readable characters? Long version: I want to generate license keys for my software. I would like these keys to be of a reasonable length (25-36 characters) and easily read and entered by a human (so avoid ambiguous characters like the number 0 and the capital letter O). Finally--and this seems to be the kicker--I'd really like to use asymmetric encryption to make it more difficult to generate new keys. I've got the general approach: concatenate my information (user name, product version, a salt) into a string and generate a SHA1() hash from that, then encrypt the hash with my private key. On the client, build the SHA1() hash from the same information, then decrypt the license with the public key and see if I've got a match. Since this is a Mac app, I looked at AquaticPrime, but that generates a relatively large license file rather than a string. I can work with that if I must, but as a user I really like the convenience of a license key that I can read and print. I also looked at CocoaFob which does generate a key, but it is so long that I'd want to deliver it as a file anyway. I fooled around with OpenSSL for a while but couldn't come up with anything of a reasonable length. So...am I missing something obvious here? Is there a way to generate and boil down an asymmetrically encrypted hash to a reasonable number of unambiguous, human readable characters? I'm open to buying a solution. But I work on a number of different of platforms, so I'd want something portable. Everything I've looked at so far has been platform specific. Many, many thanks for a solution! PS - Yes, I know it will still be cracked. I'm trying to come up with something reasonable that, as a user, I would still find friendly.

    Read the article

  • Get CoreLocation Update before TableView population?

    - by Clemens
    hi, i have the corelocation stuff in an uitableview controller. i actually want to get a distance from two locations and print that distance in a tableview cell. the problem is, that the tableview is filled before all the corelocation stuff happens. how can i make corelocation makes all updates before the table is filled? heres my class: // // EntriesListViewController.m // OEAW_App // // Created by Clemens on 6/6/10. // Copyright 2010 MyCompanyName. All rights reserved. // import "EntriesListViewController.h" import "EntryDetailController.h" @implementation EntriesListViewController @synthesize locationManager; @synthesize delegate; NSMutableDictionary *entries; NSMutableDictionary *dictionary; CLLocation *coords; /- (id) init { self = [super init]; if (self != nil) { self.locationManager = [[[CLLocationManager alloc] init] autorelease]; self.locationManager.delegate = self; } return self; }/ (CLLocationManager *)locationManager { if (locationManager != nil) { return locationManager; } locationManager = [[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; locationManager.delegate = self; return locationManager; } (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { //coords.longitude = newLocation.coordinate.longitude; //coords.latitude = newLocation.coordinate.latitude; coords = newLocation; NSLog(@"Location: %@", [newLocation description]); } (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { NSLog(@"Error: %@", [error description]); } (void)viewDidLoad { //[[MyCLController alloc] init]; //[locationManager startUpdatingLocation]; [[self locationManager] startUpdatingLocation]; //---initialize the array--- //entries = [[NSMutableArray alloc] init]; //---add items--- //NSString *Path = [[NSBundle mainBundle] bundlePath]; //NSString *DataPath = [Path stringByAppendingPathComponent:@"Memorials.plist"]; dictionary = [[NSDictionary alloc] initWithContentsOfURL:[NSURL URLWithString: @"http://akm.madison.at/memorials.xml"]]; /*NSDictionary *dssItem = [dictionary objectForKey:@"1"]; NSString *text = [dssItem objectForKey:@"text"]; */ //entries = [[NSMutableDictionary alloc] init]; NSLog(@"%@", dictionary); //Path get the path to MyTestList.plist NSString *path=[[NSBundle mainBundle] pathForResource:@"Memorials" ofType:@"plist"]; //Next create the dictionary from the contents of the file. NSDictionary *dict=[NSDictionary dictionaryWithContentsOfFile:path]; //now we can use the items in the file. // self.name.text = [dict valueForKey:@"Name"] ; NSLog(@"%@",[dict valueForKey:@"Name"]); //---set the title--- self.navigationItem.title = @"Türkendenkmäler"; [super viewDidLoad]; } (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return 1; } (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [dictionary count]; } // Customize the appearance of table view cells. - (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] autorelease]; } // Configure the cell... NSArray *keys = [dictionary allKeys]; id key = [keys objectAtIndex:indexPath.row]; NSDictionary *tmp = [dictionary objectForKey:key]; NSString *name = [tmp objectForKey:@"name"]; cell.textLabel.text = name; cell.font = [UIFont fontWithName:@"Helvetica" size:12.0]; CLLocation *location = [[CLLocation alloc] initWithLatitude:[[tmp valueForKey:@"coords_x"] floatValue] longitude:[[tmp valueForKey:@"coords_y"] floatValue]]; /*CLLocation *newLoc = [[CLLocation alloc] initWithLatitude:coords.latitude longitude:coords.longitude];*/ //locationController = [[MyCLController alloc] init]; int distance = [coords distanceFromLocation:location]; NSLog(@"%@",distance); cell.detailTextLabel.text = [NSString stringWithFormat:@"%@m",distance]; //NSLog(@"%@", [getLocation newLoc]); return cell; } (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { EntryDetailController *detailViewController = [[EntryDetailController alloc] initWithNibName:@"EntryDetailController" bundle:nil]; //detailViewController.entrySelected = [dictionary objectAtIndex:indexPath.row]; NSArray *keys = [dictionary allKeys]; id key = [keys objectAtIndex:indexPath.row]; NSDictionary *tmp = [dictionary objectForKey:key]; NSString *name = [tmp objectForKey:@"name"]; detailViewController.entrySelected_name = name; NSString *location = [tmp objectForKey:@"location"]; detailViewController.entrySelected_location = location; NSString *type = [tmp objectForKey:@"type"]; detailViewController.entrySelected_type = type; NSString *slug = [tmp objectForKey:@"slug"]; detailViewController.entrySelected_slug = slug; [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; } (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } (void)dealloc { [entries release]; [super dealloc]; } @end

    Read the article

  • How can I access the bookmarks toolbar using only shortcuts in Firefox 3

    - by driekken
    I am not interested in accessing the bookmarks menu or sidebar. The specific goal that I'm trying to accomplish is to be able to easily navigate (using only the keyboard) through the live bookmarks loaded from stack overflow by means of a feed reader and located on my bookmarks toolbar. Notes: I have found an add-on that supposedly does exactly what I need: Bookmark Keys, but unfortunately it doesn't work in firefox 3), and is not being currently maintained. I'm using WinXP at work and Ubuntu 8.04 at home. Edit: changed bookmark keys "not compatible" with firefox 3 to "not working" in firefox 3

    Read the article

  • Setting the background colour/highlight colour for a given string range using Core Text

    - by Jasarien
    I have some text laid out using Core Text in my iPhone app. I'm using NSAttributedString to set certain styles within the text for given ranges. I can't seem to find an attribute for setting a background / highlight colour, though it would seem it is possible. I couldn't find an attribute name constant that sounded relevant and the documentation only lists: kCTCharacterShapeAttributeName kCTFontAttributeName kCTKernAttributeName kCTLigatureAttributeName kCTForegroundColorAttributeName kCTForegroundColorFromContextAttributeName kCTParagraphStyleAttributeName kCTStrokeWidthAttributeName kCTStrokeColorAttributeName kCTSuperscriptAttributeName kCTUnderlineColorAttributeName kCTUnderlineStyleAttributeName kCTVerticalFormsAttributeName kCTGlyphInfoAttributeName kCTRunDelegateAttributeName Craig Hockenberry, developer of Twitterrific has said publicly on Twitter that he uses Core Text to render the tweets, and Twitterrific has this background / highlight that I'm talking about when you touch a link. Any help or pointers in the right direction would be fantastic, thanks. Edit: Here's a link to the tweet Craig posted mentioning "Core text, attributed strings and a lot of hard work", and the follow up that mentioned using CTFrameSetter metrics to work out if touches intersect with links.

    Read the article

  • Retrieving part of a string using jQuery / JavaScript

    - by ILMV
    I know how I would achieve this using PHP, but with jQuery / JavaScript I'm not sure how to, here's the string I'm dealing with (It's the name attribute from a input element): Field[0][some_random_text] I want to retrieve the value some_random_text and slap it in a variable, I guess I would usually use regex to accomplish this task but not sure how this is done in JavaScript. Here are some characteristics of this name attribute. It will always be in this format string[string][string] Each of the strings can be any length How would I get the some_random_text string? I'd like to stick to the standard set of functions if possible.

    Read the article

  • Decompressing a very large serialized object and managing memory

    - by Mike_G
    I have an object that contains tons of data used for reports. In order to get this object from the server to the client I first serialize the object in a memory stream, then compress it using the Gzip stream of .NET. I then send the compressed object as a byte[] to the client. The problem is on some clients, when they get the byte[] and try to decompress and deserialize the object, a System.OutOfMemory exception is thrown. Ive read that this exception can be caused by new() a bunch of objects, or holding on to a bunch of strings. Both of these are happening during the deserialization process. So my question is: How do I prevent the exception (any good strategies)? The client needs all of the data, and ive trimmed down the number of strings as much as i can. edit: here is the code i am using to serialize/compress (implemented as extension methods) public static byte[] SerializeObject<T>(this object obj, T serializer) where T: XmlObjectSerializer { Type t = obj.GetType(); if (!Attribute.IsDefined(t, typeof(DataContractAttribute))) return null; byte[] initialBytes; using (MemoryStream stream = new MemoryStream()) { serializer.WriteObject(stream, obj); initialBytes = stream.ToArray(); } return initialBytes; } public static byte[] CompressObject<T>(this object obj, T serializer) where T : XmlObjectSerializer { Type t = obj.GetType(); if(!Attribute.IsDefined(t, typeof(DataContractAttribute))) return null; byte[] initialBytes = obj.SerializeObject(serializer); byte[] compressedBytes; using (MemoryStream stream = new MemoryStream(initialBytes)) { using (MemoryStream output = new MemoryStream()) { using (GZipStream zipper = new GZipStream(output, CompressionMode.Compress)) { Pump(stream, zipper); } compressedBytes = output.ToArray(); } } return compressedBytes; } internal static void Pump(Stream input, Stream output) { byte[] bytes = new byte[4096]; int n; while ((n = input.Read(bytes, 0, bytes.Length)) != 0) { output.Write(bytes, 0, n); } } And here is my code for decompress/deserialize: public static T DeSerializeObject<T,TU>(this byte[] serializedObject, TU deserializer) where TU: XmlObjectSerializer { using (MemoryStream stream = new MemoryStream(serializedObject)) { return (T)deserializer.ReadObject(stream); } } public static T DecompressObject<T, TU>(this byte[] compressedBytes, TU deserializer) where TU: XmlObjectSerializer { byte[] decompressedBytes; using(MemoryStream stream = new MemoryStream(compressedBytes)) { using(MemoryStream output = new MemoryStream()) { using(GZipStream zipper = new GZipStream(stream, CompressionMode.Decompress)) { ObjectExtensions.Pump(zipper, output); } decompressedBytes = output.ToArray(); } } return decompressedBytes.DeSerializeObject<T, TU>(deserializer); } The object that I am passing is a wrapper object, it just contains all the relevant objects that hold the data. The number of objects can be a lot (depending on the reports date range), but ive seen as many as 25k strings. One thing i did forget to mention is I am using WCF, and since the inner objects are passed individually through other WCF calls, I am using the DataContract serializer, and all my objects are marked with the DataContract attribute.

    Read the article

  • Confusion on using django socialauth

    - by Fedor
    http://github.com/uswaretech/Django-Socialauth/tree/master/socialauth/ I'm a bit confused on how I should use this. Of course, I read the notes at the bottom but I'm a Django novice so I'll need a little hand holding. The structure of this looks like a project structure since it contains a urls.py but I'm also aware that applications can also have that. It also has a manage.py which leads me to believe it's a project ( plus the subdirectories ). So should I just be integrating portions of this into my existing project? This isn't an application, right? The README also mentions grabbing API Keys. So if I want a standard interface where you click on a google/yahoo logo and it forwards itself via Javascript to the authentication page where you login if you already aren't logged in, kicks you back to your own page, would I need API keys? Any other special tips are appreciated.

    Read the article

  • Is there any way, short of "copy and paste inheritence" to share a .net class with a Silverlight app

    - by Jekke
    I have a project in two parts: a Silverlight front end and a WCF duplex service. Ideally, I would like to pass a message of a custom type (call it TradeOffer) from the WCF service to be consumed by the Silverlight application. When I try to, I get an error that indicates I can't pass an object of an unknown type across the wire like that and that, maybe, I could do so if I used the InternalsVisibleTo attribute on the server component. I'm not sure if that would work in this environment and know it would be messy in development. I originally put the message definition in a library to be used by both the service and the client, but couldn't add a reference to the library from the Silverlight client (because it's not a Silverlight assembly.) Is there some way I can access the definition of a message class from both the Silverlight client that consumes it and the service that publishes it without using the InternalsVisibleTo attribute or should I write the application another way?

    Read the article

  • What add-in/workbench framework is the best .NET alternative to Eclipse RCP?

    - by Winston Fassett
    I'm looking for a plugin-based application framework that is comparable to the Eclipse Plugin Framework, which to my simple mind consists of: a core plugin management framework (Equinox / OSGI), which provides the ability to declare extension endpoints and then discover and load plugins that service those endpoints. (this is different than Dependency Injection, but admittedly the difference is subtle - configuration is highly de-centralized, there are versioning concerns, it might involve an online plugin repository, and most importantly to me, it should be easy for the user to add plugins without needing to know anything about the underlying architecture / config files) many layers of plugins that provide a basic workbench shell with concurrency support, commands, preference sheets, menus, toolbars, key bindings, etc. That is just scratching the surface of the RCP, which itself is meant to serve as the foundation of your application, which you build by writing / assembling even more plugins. Here's what I've gleaned from the internet in the past couple of days... As far as I can tell, there is nothing in the .NET world that remotely approaches the robustness and maturity of the Eclipse RCP for Java but there are several contenders that do either #1 or #2 pretty well. (I should also mention that I have not made a final decision on WinForms vs WPF, so I'm also trying to understand the level of UI coupling in any candidate framework. I'm also wondering about platform coupling and source code licensing) I must say that the open-source stuff is generally less-documented but easier to understand, while the MS stuff typically has more documentation but is less accessible, so that with many of the MS technologies, I'm left wondering what they actually do, in a practical sense. These are the libraries I have found: SharpDevelop The first thing I looked at was SharpDevelop, which does both #1 and also #2 in a basic way (no insult to SharpDevelop, which is admirable - I just mean more basic than Eclipse RCP). However, SharpDevelop is an application more than a framework, and there are basic assumptions and limitations there (i.e. being somewhat coupled to WinForms). Still, there are some articles on CodeProject explaining how to use it as the foundation for an application. System.Addins It appears that System.Addins is meant to provide a robust add-in loading framework, with some sophisticated options for loading assemblies with varying levels of trusts and even running the out of process. It appears to be primarily code-based, and pretty code-heavy, with lots of assemblies that serve to insulate against versioning issues., using Guidance Automation to generate a good deal of code. So far I haven't found many System.AddIns articles that illustrate how it could be used to build something like an Eclipse RCP, and many people seem to be wringing their hands about its complexity. Mono.Addins It appears that Mono.Addins was influenced by System.Addins, SharpDevelop, and MonoDevelop. It seems to provide the basics from System.Addins, with less sophisticated options for plugin loading, but more simplicity, with attribute-based registration, XML manifests, and the infrastructure for online plugin repositories. It has a pretty good FAQ and documentation, as well as a fairly robust set of examples that really help paint a picture of how to develop an architecture like that of SharpDevelop or Eclipse. The examples use GTK for UI, but the framework itself is not coupled to GTK. So it appears to do #1 (add-in loading) pretty well and points the way to #2 (workbench framework). It appears that Mono.Addins was derived from MonoDevelop, but I haven't actually looked at whether MonoDevelop provides a good core workbench framework. Managed Extensibility Framework This is what everyone's talking about at the moment, and it's slowly getting clearer what it does, but I'm still pretty fuzzy, even after reading several posts on SO. The official word is that it "can live side-by-side" with System.Addins. However, it doesn't reference it and it appears to reproduce some of its functionality. It seems to me, then, that it is a simpler, more accessible alternative to System.Addins. It appears to be more like Mono.Addins in that it provides attribute-based wiring. It provides "catalogs" that can be attribute-based or directory-based. It does not seem to provide any XML or manifest-based wiring. So far I haven't found much documentation and the examples seem to be kind of "magical" and more reminiscent of attribute-based DI, despite the clarifications that MEF is not a DI container. Its license just got opened up, but it does reference WindowsBase -- not sure if that means it's coupled to Windows. Acropolis I'm not sure what this is. Is it MEF, or something that is still coming? Composite Application Blocks There are WPF and Winforms Composite Application blocks that seem to provide much more of a workbench framework. I have very little experience with these but they appear to rely on Guidance Automation quite a bit are obviously coupled with the UI layers. There are a few examples of combining MEF with these application blocks. I've done the best I could to answer my own question here, but I'm really only scratching the surface, and I don't have experience with any of these frameworks. Hopefully some of you can add more detail about the frameworks you have experience with. It would be great if we could end up with some sort of comparison matrix.

    Read the article

  • Alternative of custom attrbutes for tags to store some information in HTML 4

    - by Ashwani K
    Hello All: Can some body tell me any alternative to store some information for a particular tag in HTML 4. For example If I have a drop down like <select> <option value="0" regionId="1">Test1</option> <option value="1" regionId="2">Test2</option> </select> Here regionId is a custom attribute, I am able to access the attribute but the W3C HTML validation is failing. Any suggestion on this?

    Read the article

  • Help with linq to sql compiled query

    - by stackoverflowuser
    Hi I am trying to use compiled query for one of my linq to sql queries. This query contains 5 to 6 joins. I was able to create the compiled query but the issue I am facing is my query needs to check if the key is within a collection of keys passed as input. But compiled queries do not allow passing of collection (since collection can have varying number of items hence not allowed). For instance input to the function is a collection of keys. Say: List<Guid> InputKeys List<SomeClass> output = null; var compiledQuery = CompiledQueries.Compile<DataContext, IQueryable<SomeClass>>( (context) => from a in context.GetTable<A>() where InputKeys.Contains(a.Key) select a); using(var dataContext = new DataContext()) { output = compiledQuery(dataContext).ToList(); } return output; Is there any work around or better way to do the above?

    Read the article

  • null != null - any ideas on how to re-arrange the code or prevent this?

    - by Alex
    Currently debugging, and found an if-statement which for no (I thought...) reason gave me an NPE, obviously for a reason. Which seemed to be that the statement turned out to be if(false && (null != null || null != Color)). if(destination != null && (destination.getPiece() != null || destination.getPiece().getColour() != pieceColour)) - the if-statement Both destination can be null and piece can be. The getColour() method returns an attribute of type Color from piece, which must be null if the piece is null. The piece at destination has a different pieceColour attribute then the one in the if-statement. Specifically, how do I re-arrange (destination.getPiece() != null) ?

    Read the article

  • asp.net MVC - how to get complete local and global resources

    - by Buthrakaur
    I'm localizing application and need to provide JSON representation of local and global resources for JS part of application for all views. My current idea is I'd implement HtmlHelper extension methods like GetLocalResourcesJSON/GetGlobalResourcesJSON which should encode all resource keys+values and return them JSON encoded as string (I'd implement caching as well). At the moment I'm able to retrieve single specific key from global or local resource belonging to current view (using httpContext.GetGlobalResourceObject/GetLocalResourceObject), but I'm not able to find out how to retrieve whole resource object and iterate all its keys+values. Is there any method how to achieve this? it looks like ResourceProviderFactory could be the the key to this problem, but it's not accessible publicly anywhere. I could instantiate ResourceExpressionBuilder and use reflection to retrieve the provider using GetLocal/GlobalResourceProvider() methods, but I don't like using reflection here at all...

    Read the article

  • Reinstalling Applications after Win 7 installation [closed]

    - by Don Oxley
    I'm preparing to upgrade to Win 7 and am trying to ensure that I will be able to reinstall all the relevant applications. Since most applications require product keys, I'm curious if the installation process for Win 7 preserves those keys in any way (say for Office 2007,...) or do I have to locate and reenter every key? Second, for appications that require a key and then check with their home server (Norton Internet Security, for example). Even if I have the key, how do I convince the server that I'm not trying to reuse an application that has a single use license? Thanks, --Don

    Read the article

  • Drupal 5: CCK fields in custom content type

    - by Kuroki Kaze
    I have module that implements custom content type via NodeAPI hooks (hook_insert, hook_update etc). I want to add CCK field to this content type and populate it via hook_nodeapi calls like create or update (to show content nodes in Views). Problem is, I cannot access CCK fields for this content type. Sure, it's enabled on "Manage Fields" page, but when I load any node of this type with Devel module, I cannot see field attribute (field_flag) in node object. I can see it under "Dev Render" tab as part of "content" attribute, like $node-content['field_flag']['#value'], but if I assign value to $node-field_flag or $node-content['field_flag']['#value'] and call node_save, CCK fields are not saved. Maybe I must call some other function to save CCK fields? Or what may be wrong with this setup?

    Read the article

  • C#/Resharper 5 structural search, detect and warn if any non-virtual public methods on classes with

    - by chillitom
    Hi All, I'm using LinFu's dynamic proxy to add some advice to some classes. The problem is that the proxied objects can only intercept virtual methods and will return the return type's default value for non-virtual methods. I can tell whether a class is proxied or not based whether the class or any of it's method has an interception attribute, e.g. [Transaction] Is it possible to write a ReSharper 5 structural search that would warn if any non-virtual public methods are defined on a class with an interception attribute. E.g. Ok public class InterceptedClass { [Transaction] public virtual void TransactionalMethod() { ... } public virtual void AnotherMethod() { ... } } Bad public class InterceptedClass { [Transaction] public virtual void TransactionalMethod() { ... } public void AnotherMethod() // non-virtual method will not be called by proxy { ... } } Many Thanks.

    Read the article

  • html.checkbox - explicit value to hidden field value

    - by Tassadaque
    Hi I am creating list of checkboxes in partial view by follwoing http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/ code and Rendered HTML for checkboxes is as follows <%=Html.CheckBox("EmployeeID", new { value = user.EmployeeID, @class = "ccboxes", title = user.Designation + "(" + user.EmployeeName + ")" })%> <INPUT id=MemoUsers_a29f82e4-ebbc-47b0-8cdd-7d54f94143be__EmployeeID class=boxes title=Programmer(Zia) value=6 type=checkbox name=MemoUsers[a29f82e4-ebbc-47b0-8cdd-7d54f94143be].EmployeeID jQuery1276681299292="27"> <INPUT value=false type=hidden name=MemoUsers[a29f82e4-ebbc-47b0-8cdd-7d54f94143be].EmployeeID> In rendered html it can be seen that value attribute of hidden field is false. i want to assign explicit value(same as checkbox value) to this value. Is this possible using html.checkbox or html.checkboxfor. one way is recommended in http://stackoverflow.com/questions/626901/asp-net-mvc-rc2-checkboxes-with-explicit-values. Is there any other better way i want to do this as ModelState.IsValid is returning false because of hidden field value attribute Regards

    Read the article

  • Is perl's each function worth using?

    - by eugene y
    From perldoc -f each we read: There is a single iterator for each hash, shared by all each, keys, and values function calls in the program; it can be reset by reading all the elements from the hash, or by evaluating keys HASH or values HASH. The iterator is not reset when you leave the scope containing the each(), and this can lead to bugs: my %h = map { $_, 1 } qw(1 2 3); while (my $k = each %h) { print "1: $k\n"; last } while (my $k = each %h) { print "2: $k\n" } Output: 1: 1 2: 3 2: 2 What are the common workarounds for this behavior? And is it worth using each in general?

    Read the article

  • Is perl's each function worth using?

    - by eugene y
    From perldoc -f each we read: There is a single iterator for each hash, shared by all each, keys, and values function calls in the program; it can be reset by reading all the elements from the hash, or by evaluating keys HASH or values HASH. The iterator is not reset when you leave the scope containing the each(), and this can lead to bugs: my %h = map { $_, 1 } qw(1 2 3); while (my $k = each %h) { print "1: $k\n"; last } while (my $k = each %h) { print "2: $k\n" } Output: 1: 1 2: 3 2: 2 What are the common workarounds for this behavior? And is it worth using each in general?

    Read the article

  • Strange Exception on getGeneratedKeys() with JDBC for MySQL 5.1

    - by sweeney
    Hello, I'm using JDBC to insert a row into a MYSQL database. I build a parameterized command, execute it and attempt to retrieve the auto generated keys as follows: String sql = "INSERT IGNORE INTO `users` (`email`, `pass-hash`) VALUES (?, ?)"; Connection conn = SQLAccess.getConnection(); PreparedStatement ps = conn.prepareStatement(sql); ps.setString(1, login); ps.setString(2, passHash); int count = ps.executeUpdate(); if (count == 1) { ResultSet rs = ps.getGeneratedKeys(); rs.next(); //some more stuff... } For some reason, I get the following SQLException on the line containing ResultSet rs = ps.getGeneratedKeys();: !Statement.Generated Keys Not Requested! Any thoughts? When I run the same query, as generated by running the app through the debugger, in a MySQL browser it executes without incident. Thanks, brian

    Read the article

< Previous Page | 144 145 146 147 148 149 150 151 152 153 154 155  | Next Page >