Search Results

Search found 1042 results on 42 pages for 'jon ramirez'.

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

  • Purely functional equivalent of weakhashmap?

    - by Jon Harrop
    Weak hash tables like Java's weak hash map use weak references to track the collection of unreachable keys by the garbage collector and remove bindings with that key from the collection. Weak hash tables are typically used to implement indirections from one vertex or edge in a graph to another because they allow the garbage collector to collect unreachable portions of the graph. Is there a purely functional equivalent of this data structure? If not, how might one be created? This seems like an interesting challenge. The internal implementation cannot be pure because it must collect (i.e. mutate) the data structure in order to remove unreachable parts but I believe it could present a pure interface to the user, who could never observe the impurities because they only affect portions of the data structure that the user can, by definition, no longer reach.

    Read the article

  • Working with Japanese filenames in PHP 5.3 and Windows Vista?

    - by Jon
    I'm currently trying to write a simple script that looks in a folder, and returns a list of all the file names in an RSS feed. However I've hit a major wall... Whenever I try to read filenames with Japanese characters in them, it shows them as ?'s. I've tried the solutions mentioned here: http://stackoverflow.com/questions/482342/php-readdir-problem-with-japanese-language-file-name - however they do not work for some reason, even with: header('Content-Type: text/html; charset=UTF-8'); setlocale(LC_ALL, 'en_US.UTF8'); mb_internal_encoding("UTF-8"); At the top (Exporting as plain text until I can sort this out). What can I do? I need this to work and I don't have much time.

    Read the article

  • How do I display core data on second view controller?

    - by jon
    I am working on my first core data iPhone application. I am using a navigation controller, and the root view controller displays 4 rows. Clicking the first row takes me to a second table view controller. However, when I click the back button, repeat the row tap, click the back button again, and tap the row a third time, I get an error. I have been researching this for a week with no success. I can reproduce the error easily: Create a new Navigation-based Application, use Core Data for storage, call it MyTest which creates MyTestAppDelegate and RootViewController. Add new UIViewController subclass, with UITableViewController and xib, call it ListViewController. Copy code from RootViewController.h and .m to ListViewController.h and .m., changing the file names appropriately. To simplify the code, I removed the trailing “_” from all variables. In RootViewController, I added #import ListViewController.h, set up an array to display 4 rows and navigate to ListViewController when clicking the first row. In ListViewController.m, I added #import MyTestAppDelegate.h” and the following code: - (void)viewDidLoad { [super viewDidLoad]; if (managedObjectContext == nil) { managedObjectContext = [(MyTestAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext]; } .. } The sequence that causes the error is tap row, return, tap row, return, tap row - error. managedObjectContext is synthesized for the third time. I appreciate your patience and your help, as this makes no sense to me. ADDENDUM: I may have a partial solution. http://www.iphonedevsdk.com/forum/iphone-sdk-development/41688-accessing-app-delegates-managed-object-context.html If I do not release the managedObjectContext in the .m file, the error goes away. Is that ok or will that cause me issues? - (void)dealloc { [fetchedResultsController release]; // [managedObjectContext release]; [super dealloc]; } ADDENDUM 2: See solution below. Sorry for the formatting issues - this was my first post.

    Read the article

  • What's the simplest way to extract the last section of an IP address?

    - by Jon Cage
    I have an IP address which I want to grab the last chunk of as an integer. So from "192.168.1.150" I'd get 150. This is the code I'd concocted (I'm using C++/CLI), but somehow it feels rather clunky: String^ ipString = "192.168.1.150"; int lastDot = ipString->LastIndexOf('.'); int lastSection = int::Parse(ipString->Substring(lastDot, ipString->Length-lastDot)); Is there a simpler way of doing this?

    Read the article

  • Make All Types Constant by Default in C++

    - by Jon Purdy
    What is the simplest and least obtrusive way to indicate to the compiler, whether by means of compiler options, #defines, typedefs, or templates, that every time I say T, I really mean T const? I would prefer not to make use of an external preprocessor. Since I don't use the mutable keyword, that would be acceptable to repurpose to indicate mutable state. Potential (suboptimal) solutions so far: // I presume redefinition of keywords is implementation-defined or illegal. #define int int const #define ptr * const int i(0); int ptr j(&i); typedef int const Int; typedef int const* const Intp; Int i(0); Intp j(&i); template<class T> struct C { typedef T const type; typedef T const* const ptr; }; C<int>::type i(0); C<int>::ptr j(&i);

    Read the article

  • C# Check for missing number in sequence

    - by Jon
    I have an List<int> which contains 1,2,4,7,9 for example. I have a range from 0 to 10. Is there a way to determine what numbers are missing in that sequence? I thought LINQ might provide an option but I can't see one In the real world my List could contain 100,000 items so performance is key

    Read the article

  • is this possible: c# collection of Type with constrains, or collection of generic type?

    - by Jon
    I'm trying to store types in a collection, so that i can later instantiate objects of the types in the collection. But I'm not sure how to do this the best way. What i have so far: List<Type> list = new List<Type>(); list.Add(typeof(MyClass)); var obj = (MyClass)Activator.CreateInstance(list[0]); I would like to have some constrains on the Type, or better yet, just a generic type in the collection instead of an instantiated Type object. Is this possible?

    Read the article

  • How to check dates don't overlap in a table using TSQL.

    - by Jon
    I have a table with start and finish datetimes that I need to determine if any overlap and not quite sure the best way to go. Initially I was thinking of using a nested cursor as shown below which does work, however I'm checking the same records against each other twice and I'm sure it is not very efficient. eg: this table would result in an overlap. id start end ------------------------------------------------------- 1 2009-10-22 10:19:00.000 2009-10-22 11:40:00.000 2 2009-10-22 10:31:00.000 2009-10-22 13:34:00.000 3 2009-10-22 16:31:00.000 2009-10-22 17:34:00.000 Declare @Start datetime, @End datetime, @OtherStart datetime, @OtherEnd datetime, @id int, @endCheck bit Set @endCheck = 0 DECLARE Cur1 CURSOR FOR select id, start, end from table1 OPEN Cur1 FETCH NEXT FROM Cur1 INTO @id, @Start, @End WHILE @@FETCH_STATUS = 0 AND @endCheck = 0 BEGIN -- Get a cursor on all the other records DECLARE Cur2 CURSOR FOR select start, end from table1 and id != @id OPEN Cur2 FETCH NEXT FROM Cur2 INTO @OtherStart, @OtherEnd WHILE @@FETCH_STATUS = 0 AND @endCheck = 0 BEGIN if ( @Start > @OtherStart AND @Start < @OtherEnd OR @End > @OtherStart AND @End < @OtherEnd ) or ( @OtherStart > @Start AND @OtherStart < @End OR @OtherEnd > @Start AND @OtherEnd < @End ) BEGIN SET @endCheck = 1 END FETCH NEXT FROM Cur2 INTO @OtherStart, @OtherEnd END CLOSE Cur2 DEALLOCATE Cur2 FETCH NEXT FROM Cur1 INTO @id, @Start, @End END CLOSE Cur1 DEALLOCATE Cur1

    Read the article

  • What good programming practices will change with C++0x?

    - by Jon
    For example, "Don't return objects by value if they are expensive to copy" (RVO can't always be used). This advice might change because of rvalue references. The same might be said about storing collections of pointers to objects, because copying them by value into the collection was too expensive; this reason might no longer be valid. Or the use of enums might be discouraged in favour of "enum class". What other practices or tips will change?

    Read the article

  • PHP mySQL query's and PHP Variables

    - by jon
    I'm trying to make an OO Login system for a project I'm working on, and am having trouble with inserting variables into the query strings. In the code below, if I replace "$TBL_NAME" with the actual table name it works. Why isn't $TBL_NAME translating to the value of $TBL_NAME? class UserDB { private $TBL_NAME = "users"; public static function CheckLogin($username, $password) { Database::Connect(); $username = stripslashes($username); $password = stripslashes($password); $username = mysql_real_escape_string($username); $password = mysql_real_escape_string($password); $sql="SELECT uid FROM $TBL_NAME WHERE username='$username' AND password='$password' "; $result =mysql_query($sql); $count=mysql_num_rows($result); if ($count==1) return true; else return false; } The Query is returning false.

    Read the article

  • jQuery - Show id, based on selected items class?

    - by Jon Hadley
    I have a layout roughly as follows: <div id="foo"> <!-- a bunch of content --> </div> <div id="thumbnails"> <div class="thumb-content1"></div> <div class="thumb-content2"></div> <div class="thumb-content3"></div> </div> <div id="content-1"> <!-- some text and pictures, including large-pic1 --> </div> <div id="content-2"> <!-- some text and pictures, including large-pic2 --> </div> <div id="content-3"> <!-- some text and pictures, including large-pic3 --> </div> etc .... On page load I want to show 'foo' and 'thumbnails' and hide the three content divs. As the user clicks each thumbnail, I want to hide foo, and replace it with the matching 'content-x'. I can get my head round jQuery show, hide and replace (although, bonus points if you want to include that in your example!). But how would I extract and construct the appropriate content id, from the thumbnail class, then pass it to the show hide code?

    Read the article

  • Firewall configuration. (Windows server 2008)

    - by Jon
    Hello. I'm having a little problem with configuring the firewall on my server. I only want a specific range of IPs to be able to access specific ports. For example, I'm having alot of password attempts to some of my servers, so I want to make it more safe by only allowing incoming connections from a specific range of domain. Example: My IP is usually adsl-324-4.somecompany.com so I want to allow *.somecpompany.com to connect, as my IP is dynamic. That would get rid of alot of attempts to hack into my servers. But I have no idea how to mask a domain like that for the firewall. How could I for example allow all incoming connections from *.is? Thanks.

    Read the article

  • Why can't these generic type parameters be inferred?

    - by Jon M
    Given the following interfaces/classes: public interface IRequest<TResponse> { } public interface IHandler<TRequest, TResponse> where TRequest : IRequest<TResponse> { TResponse Handle(TRequest request); } public class HandlingService { public TResponse Handle<TRequest, TResponse>(TRequest request) where TRequest : IRequest<TResponse> { var handler = container.GetInstance<IHandler<TRequest, TResponse>>(); return handler.Handle(request); } } public class CustomerResponse { public Customer Customer { get; set; } } public class GetCustomerByIdRequest : IRequest<CustomerResponse> { public int CustomerId { get; set; } } Why can't the compiler infer the correct types, if I try and write something like the following: var service = new HandlingService(); var request = new GetCustomerByIdRequest { CustomerId = 1234 }; var response = service.Handle(request); // Shouldn't this know that response is going to be CustomerResponse? I just get the 'type arguments cannot be inferred' message. Is this a limitation with generic type inference in general, or is there a way to make this work?

    Read the article

  • Detecting video playing in browser from a screenshot -- OpenCV

    - by Jon
    I would like to draw a rectangle around a video playing on my screen. For example, I am watching a YouTube video in my browser. I would like to be able to take a screenshot, analyze that screenshot, and then draw a rectangle around where the YouTube video is playing. I have just started looking into how I might be able to to this. I came across OpenCV. I understand that OpenCV covers many computer vision techniques. Would any of them be particularly well suited for this task? Also, is this something that can be done in real time? Finally, is there a technique that would work for both in browser and full screen? Thanks!

    Read the article

  • Decrement all int values in Dictionary

    - by Jon
    I have a Dictionary<string,int> and I simply want to decrement the value in my dictionary by one. I have this but not sure if its best practice. foreach (KeyValuePair<string, int> i in EPCs) { EPCs[i.Key] = i.Value - 1; }

    Read the article

  • Is it possible to have file filters for multiple extension types?

    - by Jon Cage
    I'm using a standard Windows FileDialog to allow the user to select some files. I'd like to filter out only the file types I'm interested in though (lets call them *.a and *.b). Is there any way to do this without using *.*? I've tried the following but it fails to match any files at all: this->openFileDialog1->DefaultExt = L"*.a,*.b"; this->openFileDialog1->FileName = L"openFileDialog1"; this->openFileDialog1->Filter = L"My Data Files (*.a,*.b)|*.a,*.b";

    Read the article

  • Rails view error "invalid byte sequence in US-ASCII" error after upgrading Ruby to 1.9.2

    - by Jon
    Running Rails 2.3.9 and just upgraded to Ruby 1.9.2p0. I have been putting: # encoding: utf-8 in a bunch of my .rb files where ever "£" character is used, and this seems to be working. But i just got my first view error: invalid byte sequence in US-ASCI for this line of code: <%= number_to_currency(product.price, :unit => "£", :precision => 0) %> I don't think its a coincidence that the "£" character is involved again. Any ideas on how to solve this please? Thanks

    Read the article

  • How do I get Nunit to run selenium tests against different servers?

    - by Jon
    I have an Nunit test which uses selenium RC to run tests against our UI. I want to run the tests against 2 different servers, which means having the call to selenium.open() with 2 different servers. However, I don't want to have 2 different Nunit test suites that do the same thing but against different servers. I need a way of passing parameters from Nant or the Nunit driver program to specific which server to test against. Is there anyway to do this?

    Read the article

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