Search Results

Search found 349 results on 14 pages for 'kristian roger'.

Page 7/14 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • Encrypting a file in win API

    - by Kristian
    hi I have to write a windows api code that encrypts a file by adding three to each character. so I wrote this now its not doing anything ... where i go wronge #include "stdafx.h" #include <windows.h> int _tmain(int argc, _TCHAR* argv[]) { HANDLE filein,fileout; filein=CreateFile (L"d:\\test.txt",GENERIC_READ,0,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); fileout=CreateFile (L"d:\\test.txt",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); DWORD really; //later this will be used to store how many bytes I succeed to read do { BYTE x[1024]; //the buffer the thing Im using to read in ReadFile(filein,x,1024,&really,NULL); for(int i=0 ; i<really ; i++) { x[i]= (x[i]+3) % 256; } DWORD really2; WriteFile(fileout,x,really,&really2,NULL); }while(really==1024); CloseHandle(filein); CloseHandle(fileout); return 0; } and if Im right how can i know its ok

    Read the article

  • Custom deleters for std::shared_ptrs

    - by Kristian D'Amato
    Is it possible to use a custom deleter after creating a std::shared_ptr without using new? My problem is that object creation is handled by a factory class and its constructors & destructors are protected, which gives a compile error, and I don't want to use new because of its drawbacks. To elaborate: I prefer to create shared pointers like this, which doesn't let you set a custom deleter (I think): auto sp1 = make_shared<Song>(L"The Beatles", L"Im Happy Just to Dance With You"); Or I can create them like this, which does let met set a deleter through an argument: auto sp2(new Song, MyDeleterFunc); But the second one uses new, which AFAIK isn't as efficient as the top sort of allocation. Maybe this is clearer: is it possible to get the benefits of make_shared<> as well as a custom deleter? Would that mean having to write an allocator?

    Read the article

  • How do I search for an array of values in a many to many relation?

    - by Kristian Gudal
    Hey I have a problem with my LINQ to Entity model many to mant relation. I am new to both C# and LINQ, so bear with me. I have a model containing pictures and tags, where each picture can have many tags, and each tag can be on many pictures. In the db there is a normal relation table, but in the object model I see it as picture.tags (as a list) and tag.pictures (as a list). A search query contains several tags, and the result of the search is to contain all pictures that are tagged with all the tags (but maybe more) I have searched for. The number of tags to search for is not fixed. How can this best be done?

    Read the article

  • MatLab plot part of surface

    - by Kristian
    Say I have the following script: u = -5:.2:5; [X,Y] = meshgrid(u, u); Z = cos(X).*cos(Y).*exp(-sqrt(X.^2 + Y.^2)/4); surf(X,Y,Z); Is there anyway that I can make MatLab plot only parts of the surface? Say, for instance, I just want to plot a single point, or a single grid, what can I do? I thought perhaps to plot a single point I could use: surf(X(1,1), Y(1,1), Z(1,1)) But then I get the error message: ??? Error using ==> surf at 78 Data dimensions must agree. I would really appreciate some input/help here. Thanks in advance :)

    Read the article

  • If-Modified-Since vs If-None-Match

    - by Roger
    This question is based on this article response header HTTP/1.1 200 OK Last-Modified: Tue, 12 Dec 2006 03:03:59 GMT ETag: "10c24bc-4ab-457e1c1f" Content-Length: 12195 request header GET /i/yahoo.gif HTTP/1.1 Host: us.yimg.com If-Modified-Since: Tue, 12 Dec 2006 03:03:59 GMT If-None-Match: "10c24bc-4ab-457e1c1f" HTTP/1.1 304 Not Modified In this case browser is sending both If-None-Match and If-Modified-Since. My question is on the server side do I need to match BOTH etag and If-Modified-Since before I send 304. Or Should I just look at etag and send 304 if etag is a match. In this case I am ignoring If-Modified-Since .

    Read the article

  • No sound on Debian unstable Intel Corporation 82801JD/DO (ICH10 Family) HD Audio Controller

    - by Dave Roger
    I have no sound on my Debian unstable. # cat /etc/issue Debian GNU/Linux squeeze/sid # lspci |grep -i audio 00:1b.0 Audio device: Intel Corporation 82801JD/DO (ICH10 Family) HD Audio Controller (rev 02) # lsmod | grep -i snd snd_hda_codec_realtek 235506 1 snd_hda_intel 19907 0 snd_hda_codec 54244 2 snd_hda_codec_realtek,snd_hda_intel snd_hwdep 5380 1 snd_hda_codec snd_pcm_oss 32591 0 snd_mixer_oss 12606 1 snd_pcm_oss snd_pcm 60471 3 snd_hda_intel,snd_hda_codec,snd_pcm_oss snd_seq_midi 4400 0 snd_rawmidi 15515 1 snd_seq_midi snd_seq_midi_event 4628 1 snd_seq_midi snd_seq 42881 2 snd_seq_midi,snd_seq_midi_event snd_timer 15582 2 snd_pcm,snd_seq snd_seq_device 4493 3 snd_seq_midi,snd_rawmidi,snd_seq snd 46446 11 snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device soundcore 4598 1 snd snd_page_alloc 6249 2 snd_hda_intel,snd_pcm # cat /proc/asound/version Advanced Linux Sound Architecture Driver Version 1.0.21. # uname -r 2.6.32-5-amd64

    Read the article

  • NGINX: strip querystring in rewrite

    - by Roger
    I'd like to make a 301 rewrite to the sites's index without any querystring. Like this: http://example.com/anypage.asp?anyvar=anyvalue To: http://example.com/ Here's a real example: http://atipico.com.br/conteudo.asp?P_categ=23 I am trying to follow this: http://wiki.nginx.org/NginxHttpRewriteModule#rewrite (The commented are my attempts): location ~ /conteudo\.asp(.*)$ { #rewrite ^ / permanent; #rewrite ^ /? permanent; #return 301 /; #return 301 /?; #if ($args) { return 301 /; } } It always rewrites to http://atipico.com.br/?P_categ=23 Any ideas?

    Read the article

  • Best way to convert episodic DVDs for Windows Media Center?

    - by Roger Lipscombe
    I'm archiving my DVD collection. My goal is to be able to play them back in Windows Media Center. For feature-length DVDs, I'm using AnyDVD and CloneDVD, which is working well. For playing back TV shows (and other episodic content), I'm using Media Browser, which doesn't support a VIDEO_TS folder per episode. It expects the shows to be broken up into one file per episode (e.g. "Willo the Wisp - S01E12.avi"). For this, I'm attempting to use Handbrake, which, for extracting the episodes from DVD (or already-ripped VIDEO_TS folder), is working pretty well. The problem that I have is that the default x264 encoder over-compresses the resulting video stream, which results in hideous artifacts in animated shows. The aforementioned Willo the Wisp is a particularly bad example, because the original DVD is particularly "noisy". If I switch to using the ffmpeg encoder, the artifacts are gone in Windows Media Player, but I can't get the resulting files to play back in Windows Media Center. I see the first frame, and then there's an error message. I've installed the CCCP codec collection, but it doesn't seem to have made any difference. So: what's the best way to convert VIDEO_TS to individual episode files for playback in Windows Media Center?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >