Search Results

Search found 122 results on 5 pages for 'niels kristian'.

Page 4/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Getting the median of 3 values using scheme's car & cdr

    - by kristian Roger
    The problem this time is to get the median of three values (easy) I did this: (define (med x y z) (car(cdr(x y z))) and it was accepted but when testing it: (med 3 4 5) I get this error: Error: attempt to call a non-procedure (2 3 4) And when entering letters instead of number i get: (md x y z) Error: undefined varia y (package user) Using something besides x y z I get: (md d l m) Error: undefined variable d (package user) the question was deleted dont know how anyway write a function that return the median of 3 values

    Read the article

  • Hashtable with int array as key in java

    - by Niels Hansen
    Hey! I'm trying to make a hashtable in java where the keys are int[], but it dosen't work. I have made a little test program to show my problem: public class test{ public static void main(String[] args){ int[] test0 = {1,1}; int[] test1 = {1,1}; Hashtable<int[], String> ht = new Hashtable<int[], String>(); String s0 = "foo"; ht.put(test0, s0); System.out.println("the result from ht.get(test1)"); System.out.println(ht.get(test1)); System.out.println("the result from ht.get(test0)"); System.out.println(ht.get(test0)); } } My intention is that both ht.get calles should return the same result, since the two arrays are equal, but they dont. Here is the result from running the code: the result from ht.get(test1) null the result from ht.get(test0) foo Am I missing something here or is it just impossible to use int[] as keys in a hastable?

    Read the article

  • Interpolating data points in Excel

    - by Niels Basjes
    Hi, I'm sure this is the kind of problem other have solved many times before. A group of people are going to do measurements (Home energy usage to be exact). All of them will do that at different times and in different intervals. So what I'll get from each person is a set of {date, value} pairs where there are dates missing in the set. What I need is a complete set of {date, value} pairs where for each date withing the range a value is known (either measured or calculated). I expect that a simple linear interpolation would suffice for this project. If I assume that it must be done in Excel. What is the best way to interpolate in such a dataset (so I have a value for every day) ? Thanks. NOTE: When these datasets are complete I'll determine the slope (i.e. usage per day) and from that we can start doing home-to-home comparisons. ADDITIONAL INFO After first few suggestions: I do not want to manually figure out where the holes are in my measurement set (too many incomplete measurement sets!!). I'm looking for something (existing) automatic to do that for me. So if my input is {2009-06-01, 10} {2009-06-03, 20} {2009-06-06, 110} Then I expect to automatically get {2009-06-01, 10} {2009-06-02, 15} {2009-06-03, 20} {2009-06-04, 50} {2009-06-05, 80} {2009-06-06, 110} Yes, I can write software that does this. I am just hoping that someone already has a "ready to run" software (Excel) feature for this (rather generic) problem.

    Read the article

  • ASP.Net:Best way to run scheduled tasks

    - by Niels Bosma
    Today we have built an console application for running scheduled tasks for our ASP.NET website. But I think this appoach is a bit error prone and difficult to maintain. How do you execute you scheduled task (in an windows/IIS/ASP.NET env.) Update: Examples of tasks: Sending email from an emial-queue in the database Removing utdated objects from the database Retreiving stats from google adwords and fill a table in the database.

    Read the article

  • WPF - Transparency - Stream Desktop Content

    - by Niels Willems
    Greetings I'm in the process of making a Scoreboard for a game (Starcraft II). This scoreboard is being made as a WPF Application with a C# code-behind. I already have a version which works for 90% in WinForms but I lacked the support to easily make it look a lot nicer which are available in WPF. The point of this application will be to form a kind of overlay on top of a running game. This game is in Fulscreen(Windowed Mode) so when in WinForms I coded it so that it should always be on top. It would do so and that was no problem. Since the main look of the app in WPF is based on an image with a transparent background I have set most Background values to Transparent. However when I do this the entire application does not get registered by streaming software. For example it just shows my Desktop or the game I'm playing but not my application even though it IS there. I can see it with my own eyes but the audience on the stream cannot. Does anyone have any experience with this matter because it's really doing my head in. My entire application will be useless if it is not visible on streams. If I have to put the background on a color rather than transparent the UI will be completely demolished as well in terms of looks. I'm basically trying to make a game-overlay in C# & WPF. I have read you can do this on different ways as well but I have little to no knowledge of C++ nor do I know anything about DirectX Thank you for your time reading and your possible insights. Edit: The best solution would be an overlay similar to that one of Steam/Xfire/Dolby Axon. Edit 2: I've had no luck with all the suggestions so I basically made the transparent bits of my image non transparent and let the user decide which one to use depending on what streaming software they would be using.

    Read the article

  • Which Hadoop API version should I use?

    - by Niels Basjes
    In the latest Hadoop Studio the 0.18 API of Hadoop is called "Stable" and the 0.20 API of Hadoop is called "Unstable". The distribution that comes from Yahoo is a 0.20 (with yahoo patches), which is apparently "the way to go". From cloudera they state the 0.20 (with cloudera patches) is also stable. Now given the fact that we'll start coding a new Hadoop project in the next few weeks; which API should we use and which Hadoop distribution (Apache, Cloudera, Yahoo, ...) should we use? Thanks for your insights.

    Read the article

  • CUDA & VS2010 problem

    - by Kristian D'Amato
    I have scoured the internets looking for an answer to this one, but couldn't find any. I've installed the CUDA 3.2 SDK (and, just now, CUDA 4.0 RC) and everything seems to work fine after long hours of fooling around with include directories, NSight, and all the rest. Well, except this one thing: it keeps highlighting the <<< >>> operator as a mistake. Only on VS2010--not on VS2008. On VS2010 I also get several warnings of the following sort: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\xdebug(109): warning C4251: 'std::_String_val<_Ty,_Alloc>::_Alval' : class 'std::_DebugHeapAllocator<_Ty>' needs to have dll-interface to be used by clients of class 'std::_String_val<_Ty,_Alloc>' Anyone know how this can be fixed?

    Read the article

  • Problem with LINQ query

    - by Niels Bosma
    The following works fine: (from e in db.EnquiryAreas from w in db.WorkTypes where w.HumanId != null && w.SeoPriority > 0 && e.HumanId != null && e.SeoPriority > 0 && db.Enquiries.Where(f => f.WhereId == e.Id && f.WhatId == w.Id && f.EnquiryPublished != null && f.StatusId != EnquiryMethods.STATUS_INACTIVE && f.StatusId != EnquiryMethods.STATUS_REMOVED && f.StatusId != EnquiryMethods.STATUS_REJECTED && f.StatusId != EnquiryMethods.STATUS_ATTEND ).Any() select new { EnquiryArea = e, WorkType = w }); But: (from e in db.EnquiryAreas from w in db.WorkTypes where w.HumanId != null && w.SeoPriority > 0 && e.HumanId != null && e.SeoPriority > 0 && EnquiryMethods.BlockOnSite(db.Enquiries.Where(f => f.WhereId == e.Id && f.WhatId == w.Id)).Any() select new { EnquiryArea = e, WorkType = w }); + public static IQueryable<Enquiry> BlockOnSite(IQueryable<Enquiry> linq) { return linq.Where(e => e.EnquiryPublished != null && e.StatusId != STATUS_INACTIVE && e.StatusId != STATUS_REMOVED && e.StatusId != STATUS_REJECTED && e.StatusId != STATUS_ATTEND ); } I get the following error: base {System.SystemException}: {"Method 'System.Linq.IQueryable1[X.Enquiry] BlockOnSite(System.Linq.IQueryable1[X.Enquiry])' has no supported translation to SQL."}

    Read the article

  • Rails will_paginate custom route

    - by kristian nissen
    How can I use will_paginate with a custom route? I have the following in my routes: map.connect 'human-readable/:name', :controller => :tags, :action => 'show' but will_paginate uses url_for as far as I can tell, but I want to use 'human-readable' instead of url_for, but how?

    Read the article

  • Drag/Drop movieclip event in JSFL? (Flash IDE)

    - by niels
    Lately im trying to do some experimental things with JSFL, and i was wondering if it is possible to listener for an event when a component (that i have made) or movieclip is dragged from library on the stage. i want to create something that i'll get a component and drop it on a mc. when the component is dropped on the mc the component will save the mc as a reference in some var. maybe with events isnt the way to go but i have no clue if this is possible or how to do it another way. i hope someone can help me get started thx in advance

    Read the article

  • Getting a CFG form the CFL

    - by Kristian
    Can Any One explain this Language how we converted to CFG Give a CFG for the CFL: {ai bj ck | i ? j or j ? k } //ai mean a^i I have the answer but I need an explaination (Step By Step) The answer : S --> S1|S2 S1 --> A Eab|Eab B|S1 c A --> a|aA B--> b|bB Eab --> Q|a Eab b S2 --> Eac C|A Eac C --> c|cC Eac --> Q|B|a Eac c

    Read the article

  • Drupal 6 hook_form_FORM_ID_alter adding upload file field

    - by kristian nissen
    I'm trying to extend a form and add an upload file field from within a module, I can see the file field just fine, but it's empty when I submit the form, the enctype is set. $form['#attributes'] = array( 'enctype' => "multipart/form-data" ); $form['file_upload'] = array( '#type' => 'file', '#title' => 'Attach Image' ); custom form submit hook: $form['#submit'][] = 'user_images_handler'; is being called, but when I dump the form, the file field is empty, and when I try to access it, it's empty as well.

    Read the article

  • Correct use of boost lambda

    - by Niels P.
    Consider the following piece of C++0x code: a_signal.connect([](int i) { if(boost::any_cast<std::string>(_buffer[i]) == "foo") { base_class<>* an_object = new derived_class(); an_object->a_method(_buffer[i]); }}); How would it correctly look in Boost Lambda (since this C++0x feature can't be used yet)?

    Read the article

  • Nested model form with collection in Rails 2.3

    - by kristian nissen
    How can I make this work in Rails 2.3? class Magazine < ActiveRecord::Base has_many :magazinepages end class Magazinepage < ActiveRecord::Base belongs_to :magazine end and then in the controller: def new @magazine = Magazine.new @magazinepages = @magazine.magazinepages.build end and then the form: <% form_for(@magazine) do |f| %> <%= error_messages_for :magazine %> <%= error_messages_for :magazinepages %> <fieldset> <legend><%= t('new_magazine') %></legend> <p> <%= f.label :title %> <%= f.text_field :title %> </p> <fieldset> <legend><%= t('new_magazine_pages') %> <% f.fields_for :magazinepages do |p| %> <p> <%= p.label :name %> <%= p.text_field :name %> </p> <p> <%= p.file_field :filepath %> </p> <% end %> </fieldset> <p> <%= f.submit :save %> </p> </fieldset> <% end %> problem is, if I want to submit a collection of magazinepages, activerecord complaints because it's expected a model and not an array. create action: def create @magazine = Magazine.new params[:magazine] @magazine.save ? redirect_to(@magazine) : render(:action => 'new') end

    Read the article

  • searching for hidden files using winapi

    - by Kristian
    HI i want to search for a hidden files and directories in a specefic given path but I don't know how to do it for hidden files i do know how to search for normal files and dir i did this code but im stuck can't make it search for only hidden files #include "stdafx.h" #include <windows.h> int _tmain(int argc, _TCHAR* argv[]) { TCHAR *fn; fn=L"d:\\*"; HANDLE f; WIN32_FIND_DATA data; { FILE_ATTRIBUTE_HIDDEN; } f=FindFirstFile(fn,&data); if(f==INVALID_HANDLE_VALUE){ printf("not found\n"); return 0; } else{ _tprintf(L"found this file: %s\n",data.cFileName); while(FindNextFile(f,&data)){ _tprintf(L"found this file: %s\n",data.cFileName); } } FindClose(f); return 0; }

    Read the article

  • Is there a more memory efficient way to search through a Core Data database?

    - by Kristian K
    I need to see if an object that I have obtained from a CSV file with a unique identifier exists in my Core Data Database, and this is the code I deemed suitable for this task: NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity; entity = [NSEntityDescription entityForName:@"ICD9" inManagedObjectContext:passedContext]; [fetchRequest setEntity:entity]; NSPredicate *pred = [NSPredicate predicateWithFormat:@"uniqueID like %@", uniqueIdentifier]; [fetchRequest setPredicate:pred]; NSError *err; NSArray* icd9s = [passedContext executeFetchRequest:fetchRequest error:&err]; [fetchRequest release]; if ([icd9s count] > 0) { for (int i = 0; i < [icd9s count]; i++) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init]; NSString *name = [[icd9s objectAtIndex:i] valueForKey:@"uniqueID"]; if ([name caseInsensitiveCompare:uniqueIdentifier] == NSOrderedSame && name != nil) { [pool release]; return [icd9s objectAtIndex:i]; } [pool release]; } } return nil; After more thorough testing it appears that this code is responsible for a huge amount of leaking in the app I'm writing (it crashes on a 3GS before making it 20 percent through the 1459 items). I feel like this isn't the most efficient way to do this, any suggestions for a more memory efficient way? Thanks in advance!

    Read the article

  • subscript requires array or pointer ERROR

    - by Kristian
    Hi, I know what is my mistake can't figer how to solve it. Im writing an winAPI that counts how many 'a' characters are found is a givien file. Im still getting the error " subscript requires array or pointer " (please find the comment in the code) #include "stdafx.h" #include <windows.h> int _tmain(int argc, _TCHAR* argv[]) { WCHAR str=L'a'; HANDLE A; TCHAR *fn; fn=L"d:\\test.txt"; A= CreateFile(fn,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); if(A==INVALID_HANDLE_VALUE) { _tprintf(L"cannot open file \n"); } else { DWORD really; int countletter; int stringsize; do { BYTE x[1024]; ReadFile(A,x,1024,&really,NULL); stringsize = sizeof(really); for(int i =0;i<stringsize;i++) { if(really[i]==str) //here Im getting the error countletter++; } }while(really==1024); CloseHandle(A); _tprintf(L"NUmbers of A's found is %d \n",countletter); } return 0; } now I know I can't make comparesion between array and a WCHAR but hw to fix it ?

    Read the article

  • Java Save Object to File

    - by Kristian Matthews
    I've tried implementing various methods from around the internet, all seem to be providing the same solution. But it just won't work and I'm unsure why, it creates the file, however, it's blank and if I try loading that file, it has an error. Main.java contains the code to save and load the file: 190-224. Rooms.java contains the object. Code Any help is greatly appreciated, I've been trying for almost a week now! Thanks in advanced!

    Read the article

  • ASP.NET: Using Session to store authentication?

    - by Niels Bosma
    I'm having a lot of problems with FormsAuthentication (http://stackoverflow.com/questions/2964342/problem-with-asp-net-authentication) and as as potential work around I'm thinking about storing the login in the Session? Login: Session["Auth.ClientId"] = clientId; IsAuthenticated: Session["Auth.ClientId"] != null; Logout; Session["Auth.ClientId"] == null; I'm not really using most of the bells and whistles of FormsAuthentication anyway. Is this a bad idea?

    Read the article

  • Magento - How to link the Configurable Product image to the Simple Product image?

    - by Niels
    This is the case: I have a configurable product with several simple products. These simple products need to have the same product image as the configurable product. Now I have to upload the same image to each simple product over and over again. Is there a way to link the product image of the configurable product to the simple products? Some of my products have 30 simple products in 1 configurable product and it is kinda irrelevant to upload the same image 30 times. I hope someone can help me with this problem! Thanks in advance!

    Read the article

  • Dynamically showing TableView or DetailView

    - by Niels
    From my TableView I dynamically want to show either a TableView or a DetailView (new segue), based on the cell's content. I setup two segues from the TableView to different DetailViews and one segue from the TableViewCell to the TableView. I have almost completed the implementation using performSegueWithIdentifier: (see below), but there is one struggling issue remaining: after I call [self dismissModalViewControllerAnimated:YES]; on the DetailView it returns to an empty TableView . I assume because the Storyboard segue from the UITableViewCell is performed. By clicking the back button I return to my original (parent) TableView data. Any suggestions for this work? - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSLog(@"%s", __PRETTY_FUNCTION__); NSString *type = [[self.dataController objectInListAtIndex:[self.tableView indexPathForSelectedRow].row] valueForKey:@"cell_type"]; NSLog(@"cell_type: %@", type); if([[segue identifier] isEqualToString:@"DetailSegue"]) { UIViewController *detailViewController = [segue destinationViewController]; detailViewController.game = [self.dataController objectInListAtIndex:[self.tableView indexPathForSelectedRow].row]; } else if ... } else if([[segue identifier] isEqualToString:@"TableViewSegue"]){ if([type isEqualToString:@"TableView"]){ //Create child ViewController, a custom ViewController with custom initWithId:Title: CategoryViewController *categoryViewController = [[segue destinationViewController] initWithId:categoryId Title:categoryTitle]; } } }

    Read the article

  • delete,copy,rename files and directories in WINAPI ..?

    - by Kristian
    hi I made a code that search in a givin path for a certain file name or folder and print the value BUT now how can i modify it to instead of printing its name perform on of the operations ( delete,copy,rename ) I searched on google and found nothin. #include "stdafx.h" #include <windows.h> int _tmain(int argc, _TCHAR* argv[]) { TCHAR *fn; fn=L"d:\\*"; HANDLE f; WIN32_FIND_DATA data; f=FindFirstFile(fn,&data); if(f==INVALID_HANDLE_VALUE){ printf("not found\n"); return 0; } else{ _tprintf(L"found this file: %s\n",data.cFileName); } while(FindNextFile(f,&data)){ { _tprintf(L"found this file: %s\n",data.cFileName); } } } FindClose(f); return 0; }

    Read the article

  • LINQ - joining multiple lists

    - by kristian
    I've looked at the 101 Linq Samples here but I can't see anything like this in that list. If I'm just not seeing a relevant example there, please link to it. If I have these 3 classes: class Student { int id; string name } class Course { int id, string name } class Enrolment { int studentId; int courseId; } How would I use LINQ to get a list of courses a student is enrolled on? (assume I have an IList of all three classes)

    Read the article

  • .net - invoke methods from classes from a certain namespace via reflection

    - by Kristian Hildebrandt
    SPL and PHP allows you to create objects on the fly from classes, that fulfill certain conditions, such as implementing certain interfaces and stuff like that. However, I would like to do something similar in c# and automatically create objects from all classes in a namespace and invoke a particular method from those classes that implement a certain interface. My experience developing desktop apps is very limited. I am not quite sure if I should use delegates to archive this or if reflection is really the way to go.

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >