Search Results

Search found 1904 results on 77 pages for 'ben johnson'.

Page 59/77 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • Use LINQ to count the number of combinations existing in two lists

    - by Ben McCormack
    I'm trying to create a LINQ query (or queries) that count the total number of occurences of a combinations of items in one list that exist in a different list. For example, take the following lists: CartItems DiscountItems ========= ============= AAA AAA AAA BBB AAA BBB BBB CCC CCC DDD The result of the query operation should be 2 since I can find two combinations of AAA and BBB (from DiscountItems) within the contents of CartItems. My thinking in approaching the query is to join the lists together to shorten CartItems to only include items from DiscountItems. The solution would be to find the CartItem in the resulting query that occurs the least amount of times, thus indicating how many combinations of items exist in CartItems. How can this be done? Here's the query I already have, but it's not working. query results in an enumeration with 100 items, far more than I expected. Dim query = From cartItem In Cart.CartItems Group Join discountItem In DiscountGroup.DiscountItems On cartItem.SKU Equals discountItem.SKU Into Group Select SKU = cartItem.SKU, CartItems = Group Return query.Min(Function(x) x.CartItems.Sum(Function(y) y.Quantity))

    Read the article

  • SNMP in Java, specifically to be JMX adapter.

    - by Ben
    Hi, I have a few JAVA application that I monitor using JMX. I would like to write an SNMP client for these applications that wraps the JMX interface and by discovery exposes the same attributes that are exposed in JMX, through SNMP. I have no problem writing the client if I just figure out how to write SNMP clients in JAVA. Is there a free SNMP library for JAVA that I can use? Is there a good free SNMP adapter for JMX? (Tried "WebNMS SNMP Adapter for JMX" trial unsuccessfully) Thank you!

    Read the article

  • Any way to animate new elements in a GridView being added?

    - by Ben L.
    My app polls a server every 15 seconds to see if there are any new items to display, then downloads the new items and disposes of the old items so that there are always exactly 100 items in the GridView. Unfortunately, this process can be confusing to the user if they see a page of images change without knowing where the items went. My idea is that there could be some kind of animation (such as the new items being inserted at the top and pushing the older ones down the list) to show what action is happening. Unfortunately, I have no clue how to make this animation happen. Is my idea even possible? How would I accomplish this?

    Read the article

  • Interesting LinqToSql behaviour

    - by Ben Robinson
    We have a database table that stores the location of some wave files plus related meta data. There is a foreign key (employeeid) on the table that links to an employee table. However not all wav files relate to an employee, for these records employeeid is null. We are using LinqToSQl to access the database, the query to pull out all non employee related wav file records is as follows: var results = from Wavs in db.WaveFiles where Wavs.employeeid == null; Except this returns no records, despite the fact that there are records where employeeid is null. On profiling sql server i discovered the reason no records are returned is because LinqToSQl is turning it into SQL that looks very much like: SELECT Field1, Field2 //etc FROM WaveFiles WHERE 1=0 Obviously this returns no rows. However if I go into the DBML designer and remove the association and save. All of a sudden the exact same LINQ query turns into SELECT Field1, Field2 //etc FROM WaveFiles WHERE EmployeeID IS NULL I.e. if there is an association then LinqToSql assumes that all records have a value for the foreign key (even though it is nullable and the property appears as a nullable int on the WaveFile entity) and as such deliverately constructs a where clause that will return no records. Does anyone know if there is a way to keep the association in LinqToSQL but stop this behaviour. A workaround i can think of quickly is to have a calculated field called IsSystemFile and set it to 1 if employeeid is null and 0 otherwise. However this seems like a bit of a hack to work around strange behaviour of LinqToSQl and i would rather do something in the DBML file or define something on the foreign key constraint that will prevent this behaviour.

    Read the article

  • Specify only the second parameter in a javascript function

    - by Ben McCormack
    The spec for the jQuery ajax.error function is: error(XMLHttpRequest, textStatus, errorThrown)Function I'm trying to catch the error and display the textStatus, but I can't figure out how to specify only the textStatus without having to put in a variable name for XMLHttpRequest and errorThrown. My code currently looks like this: $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: hbAddressValidation.webServiceUrl, data: this.jsonRequest, dataType: "json", timeout: 5, success: function (msgd) { //... }, error: function (a,textStatus,b) { $("#txtAjaxError").val("There was an error in the AJAX call: " + textStatus); } }); You can see in my code that I'm putting variables a and b as placeholders for the first and last variables in the error function. I know that in my success function, I'm only providing one parameter and it works fine, but in that case data is the first parameter. In the case of error, textStatus is the second parameter, but that's the only one I want to specify. Is this possible?

    Read the article

  • Seamlessly use large background images on webpages

    - by Ben Shelock
    I want to have huge background images on my site but without giving the user a hard time downloading them and the site looking ugly as the background loads. They would be no bigger than 1920 X 1080 in size, however it's hard to say in terms of kilobytes/megabytes. What are my options here and which are most effective? I'm not too bothered about bandwidth, just want to user to think everything looks nice ;)

    Read the article

  • django url matching

    - by ben
    can anyone see why this wouldn't be working. Fairly new to django so any help would be much appreciated actual url: http://127.0.0.1:8000/2010/may/12/my-second-blog-post/ urls.py: (r'(?P<year>d{4})/(?P<month>[a-z]{3})/(?P<day>w{1,2})/(?P<slug>[-w]+)/$', 'object_detail', dict(info_dict, slug_field='slug',template_name='blog/detail.html')),

    Read the article

  • Accessing an RSS feed in Flex, works when run from Flash Builder 4, but not when the project is onli

    - by ben
    Hey guys, In my Flex 4 app, I access an RSS feed (I'm using http://news.ycombinator.com/rss as a dummy). It works okay when I run it from Flash Builder 4, but if I export the project and upload it, I get the following error when it tries to load the RSS feed: Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: my_website_url cannot load data from http://news.ycombinator.com/rss. What could be causing this error? Shouldn't RSS be able to be accessed from anywhere? Thanks for reading.

    Read the article

  • Is there a Java equivalent for Ruby on Rails "url_for"?

    - by Oren Ben-Kiki
    I have written something like this pretty easily in C# (string GetUrl(new { controller = "foo", action = "bar", baz = "fnord" }), based on the existing capabilities of the XmlRouteCollection class provided by the ASP.NET MVC framework (why it isn't there out of the box is beyond me; the additional required code was trivial). I am now faced with a JSP project, and I need the same ability: centralize the logic for generating all URLs in one place, based on a list of routing rules. Is there some code somewhere I could reuse/adapt to do this in Java? It seems like a common enough requirement, but google proved surprisingly unhelpful in finding something like this.

    Read the article

  • Querying Active Directory in ruby app on Windows box

    - by Ben
    I have a small ruby app in which I'm trying to query some information from Active Directory. The app will be run by a Windows user who is already logged in. It looks like the ruby-net-ldap gem wants me to connect to an LDAP server using an IP address, port and then pass my username and password. Is there a way to achieve this (with a different gem, say) so that I don't have to pass this information (I don't have the current user's password for example, so that's not going to work)? I'm also hosting a Trac website on our intranet (which is written in Python if I remember correctly and that seems to know the current Windows username and domain. If it can do it, surely my little ruby app can access this information too?

    Read the article

  • Calculate angle of moving ball after collision with angled or sloped wall that is a 2D line segment

    - by Ben Mc
    If you have a "ball" inside a 2D polygon, made up of say, 4 line segments that act as bounding walls, how do you calculate the angle of the ball after the collision with the irregularly sloped wall? I know how to make the ball bounce if the wall is horizontal, vertical, or at a 45 degree angle. I also have my code setup to detect a collision with the wall. I've read about dot products and normals, but I cannot figure out how to implement these in Java / Android. I'm completely stumped and feel like I've looked up everything 10 pages deep in Google 10 times now. I'm burned out trying to figure this out, I hope someone can help.

    Read the article

  • page sends file to curl i want to get download link insted

    - by Ben
    there is a page that i need to post a password to it and then i get a file to download. the post goes to the same page address its loads again and pop up the download manager. now i want to do the same but in curl, i posted the data to the url and then its sends me the file back but i dont want my script to download the whole file i want only to get a link to download it by myself. how can i do that?

    Read the article

  • Removing object from NSMutableArray

    - by Ben Packard
    Just a small query... I stumbled across the following shortcut in setting up a for loop (shortcut compared to the textbook examples I have been using): for (Item *i in items){ ... } As opposed to the longer format: for (NSInteger i = 0; i < [items count]; i++){ ... } //think that's right If I'm using the shorter version, is there a way to remove the item currently being iterated over (ie 'i')? Or do I need to use the longer format?

    Read the article

  • Creating a unique URL safe hash

    - by Ben Foster
    I want to hash/encode a unique integer (database ID) to create a similarly unique string. It needs to meet the following requirements: Must start with a letter or number, and can contain only letters and numbers. All letters in a container name must be lowercase. Must be from 3 through 63 characters long (although the shorter the better) The result does not need to be reversible, just repeatable - so a 1-way hash would be fine.

    Read the article

  • C# Linq: Restructuring object

    - by Ben
    I'd like to take an object like this: SortedList<string, SortedList<int, SortedList<DateTime, double>>> Data and, for a given 'int' value (key of first nested sorted list), restructure it like this: SortedList<DateTime, SortedList<string, double>> or, better yet, this: SortedList<DateTime, double[]> where each 'double[]' has as many elements as there are KeyValue pairs in the SortedList. I'm guessing Linq is the way to go, but can't figure it out. Thanks for any suggestions.

    Read the article

  • Setting default values for inherited property without using accessor in Objective-C?

    - by Ben Stock
    I always see people debating whether or not to use a property's setter in the -init method. I don't know enough about the Objective-C language yet to have an opinion one way or the other. With that said, lately I've been sticking to ivars exclusively. It seems cleaner in a way. I don't know. I digress. Anyway, here's my problem … Say we have a class called Dude with an interface that looks like this: @interface Dude : NSObject { @private NSUInteger _numberOfGirlfriends; } @property (nonatomic, assign) NSUInteger numberOfGirlfriends; @end And an implementation that looks like this: @implementation Dude - (instancetype)init { self = [super init]; if (self) { _numberOfGirlfriends = 0; } } @end Now let's say I want to extend Dude. My subclass will be called Playa. And since a playa should have mad girlfriends, when Playa gets initialized, I don't want him to start with 0; I want him to have 10. Here's Playa.m: @implementation Playa - (instancetype)init { self = [super init]; if (self) { // Attempting to set the ivar directly will result in the compiler saying, // "Instance variable `_numberOfGirlfriends` is private." // _numberOfGirlfriends = 10; <- Can't do this. // Thus, the only way to set it is with the mutator: self.numberOfGirlfriends = 10; // Or: [self setNumberOfGirlfriends:10]; } } @end So what's a Objective-C newcomer to do? Well, I mean, there's only one thing I can do, and that's set the property. Unless there's something I'm missing. Any ideas, suggestions, tips, or tricks? Sidenote: The other thing that bugs me about setting the ivar directly — and what a lot of ivar-proponents say is a "plus" — is that there are no KVC notifications. A lot of times, I want the KVC magic to happen. 50% of my setters end in [self setNeedsDisplay:YES], so without the notification, my UI doesn't update unless I remember to manually add -setNeedsDisplay. That's a bad example, but the point stands. I utilize KVC all over the place, so without notifications, things can act wonky. Anyway, any info is much appreciated. Thanks!

    Read the article

  • Is there a tool to build and test a local change on multiple platforms

    - by Ben
    A company I used to work for was plagued with build breakages. So they made a tool that would zip up a developers local changes (which it detected from SCM) and send them to a remote server for a test build. The remote server would update its copy of the source with the repository and then apply the changes it received from the developer. It would then build and test the changes. We actually targeted multiple platforms so it would do the above for each of those platforms. When it was done, if everything was green, the developer was reasonable confident they could submit the change without breaking the "real" build. Are there any tools out there that do something similar?

    Read the article

  • Addding Custom Controls to Toolbox in visual studio

    - by Ben
    Hi, I am trying to add a dll that contains some custom 3rd party conrtols and some in house user controls and am getting the following error - "The Assembly "MyASsembly.dll" could not be loaded. Check that any dependencies the file requires are installed" I am using Visual Studio 2003 and the 3rd part controls are C1. Does anyone know what is wrong? Thanks

    Read the article

  • How do I add a WSDL to a Visual Studio 2005 project?

    - by Ben McCormack
    One of our vendors provides a web service API to allow their customers to validate data in a database. As part of their SDK, they provide a WSDL (Web Service Definition Language) file that, according to their documentation, can "be read by software applications and application development tools. An application tool such as Microsoft's Visual Studio can import a WSDL document and automatically generate software classes that access the Web Services the WSDL defines." I'm currently using Visual Studio 2005. What do I need to do to get Visual Studio to do the magic code generation for me?

    Read the article

  • ASP.NET profile deletion

    - by Ben Aston
    We use the ASP.NET profile subsystem to associate key-value pairs of information with users. I am implementing functionality for the deletion of users. I have been using the ProfileManager.DeleteProfile(string userName) method, but I have noticed that this leaves a row in the aspnet_Users table in the aspnetdb database we use to store the profile information. Clearly, I could manipulate the database directly, but I am reluctant to do so. What is the best way to ensure all information assocaited with a user is deleted from the aspnetdb? PS: there is a tantalising Membership.DeleteUser(string userName, bool deleteEverything) method, but this returns a database connection error. A web.config issue?

    Read the article

  • Giant online image gallery - How do I avoid OutOfMemoryError?

    - by Ben L.
    For anyone who's wondering, the gallery is http://www.spore.com/sporepedia. My app uses the Spore API to get the 100 newest creations, then displays them in a GridView. The text data about the creations is easy to store, but the images present a problem. As far as I know, I can either keep the images in a Hashtable or grab them every time they are viewed. Neither of these will work - the Hashtable quickly presents an OutOfMemoryError, and the constant reloading causes a lot of load on the server and a lot of lag on the client. Is there a better way to store the images?

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >