Search Results

Search found 2579 results on 104 pages for 'mike peshka'.

Page 75/104 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • Perl, time efficient hash

    - by Mike
    Is it possible to use a Perl hash in a manner that has O(log(n)) lookup and insertion? By default, I assume the lookup is O(n) since it's represented by an unsorted list. I know I could create a data structure to satisfy this (ie, a tree, etc) however, it would be nicer if it was built in and could be used as a normal hash (ie, with %)

    Read the article

  • Client Side Only Cookies

    - by Mike Jones
    I need something like a cookie, but I specifically don't want it going back to the server. I call it a "client side session cookie" but any reasonable mechanism would be great. Basically, I want to store some data encrypted on the server, and have the user type a password into the browser. The browser decrypts the data with the password (or creates and encrypts the data with the password) and the server stores only encrypted data. To keep the data secure on the server, the server should not store and should never receive the password. Ideally there should be a cookie session expiration to clean up. Of course I need it be available on multiple pages as the user walks through the web site. The best I can come up with is some sort of iframe mechanism to store the data in javascript variables, but that is ugly. Does anyone have any ideas how to implement something like this? FWIW, the platform is ASP.NET, but I don't suppose that matters. It needs to support a broad range of browsers, including mobile. In response to one answer below, let me clarify. My question is not how to achieve the crypto, that isn't a problem. The question is where to store the password so that it is persistent from page to page, but not beyond a session, and in such a way that the server doesn't see it.

    Read the article

  • Rails 3 Nested Forms

    - by Mike
    I have a Person model and an Address Model: class Person < ActiveRecord::Base has_one :address accepts_nested_attributes_for :address end class Address < ActiveRecord::Base belongs_to :person end In my people controller I have @person.build_address in my new action. My forms builds correctly. The problem is that when I submit the form, a person record and an address record is created but they aren't linked via the address_id column in the Person table. Am I missing a step in the controller? Thanks! New Action UPDATE def new @person = Person.new @person.build_address respond_to do |format| format.html # new.html.erb format.xml { render :xml => @person } end end Form Code UPDATE <%= form_for(@person) do |f| %> <% if @person.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:</h2> <ul> <% @person.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <div class="field"> <%= f.label :first_name %><br /> <%= f.text_field :first_name %> </div> <div class="field"> <%= f.label :last_name %><br /> <%= f.text_field :last_name %> </div> <div class="field"> <%= f.label :email %><br /> <%= f.text_field :email %> </div> <div class="field"> <%= f.label :telephone %><br /> <%= f.text_field :telephone %> </div> <div class="field"> <%= f.label :mobile_phone %><br /> <%= f.text_field :mobile_phone %> </div> <div class="field"> <%= f.label :date_of_birth %><br /> <%= f.date_select :date_of_birth %> </div> <div class="field"> <%= f.label :gender %><br /> <%= f.select(:gender, Person::GENDER_TYPES) %> </div> <div class="field"> <%= f.label :notes %><br /> <%= f.text_area :notes %> </div> <div class="field"> <%= f.label :person_type %><br /> <%= f.select(:person_type, Person::PERSON_TYPES) %> </div> <%= f.fields_for :address do |address_fields| %> <div class="field"> <%= address_fields.label :street_1 %><br /> <%= address_fields.text_field :street_1 %> </div> <div class="field"> <%= address_fields.label :street_2 %><br /> <%= address_fields.text_field :street_2 %> </div> <div class="field"> <%= address_fields.label :city %><br /> <%= address_fields.text_field :city %> </div> <div class="field"> <%= address_fields.label :state %><br /> <%= address_fields.select(:state, Address::STATES) %> </div> <div class="field"> <%= address_fields.label :zip_code %><br /> <%= address_fields.text_field :zip_code %> </div> <% end %> <div class="actions"> <%= f.submit %> </div> <% end %>

    Read the article

  • Adding Controls Programatically

    - by Mike Keller
    I have a page I need to build out where depending on the selection the user made on a form on the page prior it displays a different set of questions for them to answer. So say the user selects Reason A from the form on page edit, then it needs to display Questions 1 and 2 on page edit_confirmation. But if they select Reason B then it needs to display Questions 3 and 4. I'm grabbing the reason code from the query string and have a switch statement set up, but I can't find anywhere how to output different controls. If Questions 1 and 2 are supposed to show up, one could be a text box and the other a checkbox, but if questions 3 and 4 are supposed to show up one may need to be a dropdown list and a checkbox.

    Read the article

  • How does Python store lists internally?

    - by Mike Cooper
    How are lists in python stored internally? Is it an array? A linked list? Something else? Or does the interpreter guess at the right structure for each instance based on length, etc. If the question is implementation dependent, what about the classic CPython?

    Read the article

  • WAS Non-HTTP activation - hooking application startup

    - by Mike Tours
    I'm trying to integrate a netTcpBinding based application that is hosted inside WAS with an IoC container (autofac/spring). Unfortunately, when it starts inside WAS and due to the fact that it is not an Http based application, no events are fired inside the Global application class. I need to catch the application domain startup so that I can configure the IoC container. Is there any way to do this when hosting in WAS? I've seen horrible things involving using static classes inside App_Code folders, but I'd like something somewhat more testable and not quite as dirty.

    Read the article

  • Custom Section Name Crashing NSFetchedResultsController

    - by Mike H.
    I have a managed object with a dueDate attribute. Instead of displaying using some ugly date string as the section headers of my UITableView I created a transient attribute called "category" and defined it like so: - (NSString*)category { [self willAccessValueForKey:@"category"]; NSString* categoryName; if ([self isOverdue]) { categoryName = @"Overdue"; } else if ([self.finishedDate != nil]) { categoryName = @"Done"; } else { categoryName = @"In Progress"; } [self didAccessValueForKey:@"category"]; return categoryName; } Here is the NSFetchedResultsController set up: NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Task" inManagedObjectContext:managedObjectContext]; [fetchRequest setEntity:entity]; NSMutableArray* descriptors = [[NSMutableArray alloc] init]; NSSortDescriptor *dueDateDescriptor = [[NSSortDescriptor alloc] initWithKey:@"dueDate" ascending:YES]; [descriptors addObject:dueDateDescriptor]; [dueDateDescriptor release]; [fetchRequest setSortDescriptors:descriptors]; fetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:managedObjectContext sectionNameKeyPath:@"category" cacheName:@"Root"]; The table initially displays fine, showing the unfinished items whose dueDate has not passed in a section titled "In Progress". Now, the user can tap a row in the table view which pushes a new details view onto the navigation stack. In this new view the user can tap a button to indicate that the item is now "Done". Here is the handler for the button (self.task is the managed object): - (void)taskDoneButtonTapped { self.task.finishedDate = [NSDate date]; } As soon as the value of the "finishedDate" attribute changes I'm hit with this exception: 2010-03-18 23:29:52.476 MyApp[1637:207] Serious application error. Exception was caught during Core Data change processing: no section named 'Done' found with userInfo (null) 2010-03-18 23:29:52.477 MyApp[1637:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no section named 'Done' found' I've managed to figure out that the UITableView that is currently hidden by the new details view is trying to update its rows and sections because the NSFetchedResultsController was notified that something changed in the data set. Here's my table update code (copied from either the Core Data Recipes sample or the CoreBooks sample -- I can't remember which): - (void)controllerWillChangeContent:(NSFetchedResultsController *)controller { [self.tableView beginUpdates]; } - (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath { switch(type) { case NSFetchedResultsChangeInsert: [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade]; break; case NSFetchedResultsChangeDelete: [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; break; case NSFetchedResultsChangeUpdate: [self configureCell:[self.tableView cellForRowAtIndexPath:indexPath] atIndexPath:indexPath]; break; case NSFetchedResultsChangeMove: [self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; // Reloading the section inserts a new row and ensures that titles are updated appropriately. [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:newIndexPath.section] withRowAnimation:UITableViewRowAnimationFade]; break; } } - (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type { switch(type) { case NSFetchedResultsChangeInsert: [self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade]; break; case NSFetchedResultsChangeDelete: [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade]; break; } } - (void)controllerDidChangeContent:(NSFetchedResultsController *)controller { [self.tableView endUpdates]; } I put breakpoints in each of these functions and found that only controllerWillChange is called. The exception is thrown before either controller:didChangeObject:atIndexPath:forChangeType:newIndex or controller:didChangeSection:atIndex:forChangeType are called. At this point I'm stuck. If I change my sectionNameKeyPath to just "dueDate" then everything works fine. I think that's because the dueDate attribute never changes whereas the category will be different when read back after the finishedDate attribute changes. Please help! UPDATE: Here is my UITableViewDataSource code: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return [[self.fetchedResultsController sections] count]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section]; return [sectionInfo numberOfObjects]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } [self configureCell:cell atIndexPath:indexPath]; return cell; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { id <NSFetchedResultsSectionInfo> sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:section]; return [sectionInfo name]; }

    Read the article

  • cocoa - referencing a method on the parent

    - by Mike
    I had a method on my main view controller named "calculateThis". This method was run, obviously, as int newValue = [self calculateThis:myVariable]; when I run it from inside the view controller. Then I created a static class and I need to run this method from there. How do I reference this method from that class using just relative references, as super, superview, delegate, etc. I cannot use the class name defined on the delegate because this static class is used in several apps of mine.

    Read the article

  • How do I access the ASP.NET Configuration Tool when a site is live? This is ASP.NET MVC.

    - by Mike Marks
    I was wondering if it's possible to access the ASP.NET Configuration Tool once a site is live. To be able to create and edit users and roles is obviously very important, and from what I've been reading, once a site is deployed, the Configuration Tool is no longer accessible. If this is the case, HOW do I add users, etc.? By the way, I found a User Management plugin which brings a lot of the Configuration Tool's capabilities to the front end of a User Management section of the deployed website, but it DOES NOT offer the capability to add a new user. Help??? Thanks!!

    Read the article

  • How do I wait for all other threads to finish their tasks?

    - by Mike
    I have several threads consuming tasks from a queue using something similar to the code below. The problem is that there is one type of task which cannot run while any other tasks are being processed. Here is what I have: while (true) // Threaded code { while (true) { lock(locker) { if (close_thread) return; task = GetNextTask(); // Get the next task from the queue } if (task != null) break; wh.WaitOne(); // Wait until a task is added to the queue } task.Run(); } And this is kind of what I need: while (true) { while (true) { lock(locker) { if (close_thread) return; if (disable_new_tasks) { task = null; } else { task = GetNextTask(); } } if (task != null) break; wh.WaitOne(); } if(!task.IsThreadSafe()) { // I would set this to false inside task.Run() at // the end of the non-thread safe task disable_new_tasks = true; Wait_for_all_threads_to_finish_their_current_tasks(); } task.Run(); } The problem is I don't know how to achive this without creating a mess.

    Read the article

  • Logging out of Facebook invalidates offline_access token

    - by Mike Pateras
    I'm getting an offline access token like this: https://graph.facebook.com/oauth/access_token?scope=offline_access&client_id=MYCLIENTID&redirect_uri=MYREDIRECTURI&client_secret=MYSECRET&code=MYCODE obviously the MYCLIENTID and stuff have been changed for the sake of this post. Anyway, as soon as the user logs out of facebook, the key seems to no longer be valid. Am I not requesting offline_access properly (there's still an "expires" value on it, should there be if it is actually getting offline access), or is that just how it works? If it's the latter, how can I get a key that will persist, regardless of if the user logs out of facebook? I'm sure this is possible, because Tweetdeck can still write to Facebook, even though I'm currently logged out.

    Read the article

  • CodeIgniter Active Record Queries W/ Sub Queries

    - by Mike
    Question: I really am trying to stick to using ActiveRecord and not using straight SQL.. can someone help me convert this to activerecord? Trying to get the email address and contact name from another table. map_userfields table is a one to many, multiple rows per p.id. one row per p.id per uf.fieldid. see this screenshot for a reference to the map_userfields table: Current Non active record query SELECT p.id, (SELECT uf.fieldvalue FROM map_userfields uf WHERE uf.pointid = p.id AND uf.fieldid = 20) As ContactName, (SELECT uf.fieldvalue FROM map_userfields uf WHERE uf.pointid = p.id AND uf.fieldid = 31) As ContactEmail FROM map_points p WHERE /** $pointCategory is an array of categories to look for **/ p.type IN($pointCategory) Note: I am using CodeIgniter 2.1.x, MySQL 5.x, php 5.3

    Read the article

  • Why am I losing precision when populating an NSDecimalNumber with a double?

    - by Mike
    Here is a simple code that shows what I think is a bug when dealing with double numbers... double wtf = 36.76662445068359375000; id xxx = [NSDecimalNumber numberWithDouble: wtf]; NSString *myBug = [xxx stringValue]; NSLog(@"%.20f", wtf); NSLog(@"%@", myBug); NSLog(@"-------\n"); the terminal will show two different numbers 36.76662445068359375000 and 36.76662445068359168 Is this a bug or am I missing something? if the second number is being rounded, it is a very strange rounding btw...

    Read the article

  • C# comparing two files regex problem.

    - by Mike
    Hi everyone, what I'm trying to do is open a huge list of files (about 40k records, and match them on a line in a file that contains 2 millions records. And if my line from file A matches a line in file B write out that line. File A contains a bunch of files without extensions and file B contains full file paths including extensions. i'm using this but i cant get it to go... string alphaFilePath = (@"C:\Documents and Settings\g\Desktop\Arrp\Find\natst_ready.txt"); List<string> alphaFileContent = new List<string>(); using (FileStream fs = new FileStream(alphaFilePath, FileMode.Open)) using (StreamReader rdr = new StreamReader(fs)) { while (!rdr.EndOfStream) { alphaFileContent.Add(rdr.ReadLine()); } } string betaFilePath = @"C:\Documents and Settings\g\Desktop\Arryup\Find\eble.txt"; StringBuilder sb = new StringBuilder(); using (FileStream fs = new FileStream(betaFilePath, FileMode.Open)) using (StreamReader rdr = new StreamReader(fs)) { while (!rdr.EndOfStream) { string betaFileLine = rdr.ReadLine(); string matchup = Regex.Match(alphaFileContent, @"(\\)(\\)(\\)(\\)(\\)(\\)(\\)(\\)(.*)(\.)").Groups[9].Value; if (alphaFileContent.Equals(matchup)) { File.AppendAllText(@"C:\array_tech.txt", betaFileLine); } } } This doesnt work because the alphafilecontent is a single line only and i'm having a hard time figuring out how to get my regex to work on the file that contains all the file paths (Betafilepath) here is a sample of the beta file path. C:\arres_i\Grn\Ora\SEC\DBZ_EX1\Nes\001\DZO-EX00001.txt Here is the line i'm trying to compare from my alpha DZO-EX00001

    Read the article

  • Zend Studio 7.1 PHPUnit Test Case wizard does not populate "Element to Test"

    - by Mike
    When I follow the instructions in ZS documentation to create a phpunit test case, the wizard returns no objects to select on the "Element to Test" line. Selecting "browse" provides an empty dialog box. The PHPUnit path in my preferences shows "/Applications/zend/zs710/plugins/com.zend.php.phpunit_7.1.0.v20091120-0900/resources/library/". What else can I check to see why I cannot create a test case? I'm new to ZS and PHP, so I have no idea how to troubleshoot this. Thanks.

    Read the article

  • How Best to Replace Ugly Queries and Dynamic PL/SQL with C#?

    - by Mike
    Hi, I write a lot of one-off Oracle SQL queries (in Toad), and sometimes they can get complex, involving lots of unions, joins, and subqueries, and sometimes requiring dynamic SQL. That is, sometimes SQL queries require set based processing along with significant procedural processing. This is what PL/SQL is custom made for, but as a language it does not begin to compare to C#. Now and then I convert a PL/SQL procedure to C#, and am always amazed at how much cleaner and easier to both read and write the C# version is. The C# program might for example construct a SQL query string piece by piece and/or run several queries and process them as needed. The C# version is usually much faster as well, which must mean that I'm not very good at PL/SQL either. I do not currently have access to LINQ. My question is, how best to package all these little C# programs, which are really just mini reports, that is, replacements for ugly SQL queries? Right now I'm actually using NUnit to hold them, and calling each report a [Test], even though they aren't really tests. NUnit just happens to provide a convenient packaging framework.

    Read the article

  • Proper color names from colordialog

    - by Mike
    Whenever I run this, and open the color dialog, there are many colors that do not having a proper name, the listbox will show something like "ffff8000"(Orange-Yellow). Is there another way of pushing the proper name? Is there a proper Color Name library I can reference in code? colorDialog1.ShowDialog(); cl.Add(colorDialog1.Color.Name); listBox1.Items.AddRange(cl.ToArray());

    Read the article

  • Where to include business logic in a domain driven architecture

    - by Mike C.
    I'm trying to learn effective DDD practices as I go, but had a fundamental question I wanted to get some clarity on. I am using ASP.NET WebForms and I am creating a situation where a user places an order. Upon order submission, the code-behind retrieves the user, builds the order from the inputs on the form, calls the User.PlaceOrder() method to perform add the order object to the user's order collection, and calls the repository to save the record to the database. That is fairly simply and straightforward. Now I need to add logic to send an order confirmation email, and I'm not really sure the proper place to put this code or where to call it. In the olden days I would simply put that code in the code-behind and call it at the same time I was building the order, but I want to get a step closer to solid proper architecture so I wanted to get some information. Thanks for your help!

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >