Search Results

Search found 1409 results on 57 pages for 'bobby jack'.

Page 14/57 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • record output sound in python

    - by aaronstacy
    i want to programatically record sound coming out of my laptop in python. i found PyAudio and came up with the following program that accomplishes the task: import pyaudio, wave, sys chunk = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 44100 RECORD_SECONDS = 5 WAVE_OUTPUT_FILENAME = sys.argv[1] p = pyaudio.PyAudio() channel_map = (0, 1) stream_info = pyaudio.PaMacCoreStreamInfo( flags = pyaudio.PaMacCoreStreamInfo.paMacCorePlayNice, channel_map = channel_map) stream = p.open(format = FORMAT, rate = RATE, input = True, input_host_api_specific_stream_info = stream_info, channels = CHANNELS) all = [] for i in range(0, RATE / chunk * RECORD_SECONDS): data = stream.read(chunk) all.append(data) stream.close() p.terminate() data = ''.join(all) wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb') wf.setnchannels(CHANNELS) wf.setsampwidth(p.get_sample_size(FORMAT)) wf.setframerate(RATE) wf.writeframes(data) wf.close() the problem is i have to connect the headphone jack to the microphone jack. i tried replacing these lines: input = True, input_host_api_specific_stream_info = stream_info, with these: output = True, output_host_api_specific_stream_info = stream_info, but then i get this error: Traceback (most recent call last): File "./test.py", line 25, in data = stream.read(chunk) File "/Library/Python/2.5/site-packages/pyaudio.py", line 562, in read paCanNotReadFromAnOutputOnlyStream) IOError: [Errno Not input stream] -9975 is there a way to instantiate the PyAudio stream so that it inputs from the computer's output and i don't have to connect the headphone jack to the microphone? is there a better way to go about this? i'd prefer to stick w/ a python app and avoid cocoa.

    Read the article

  • CCSprite with actions crossing the screen boundaries (copy sprite problem)

    - by iostriz
    Let's say we have a CCSprite object that has an actions tied to it: -(void) moveJack { CCSpriteSheet *sheet = (CCSpriteSheet*)[self getChildByTag:kSheet]; CCSprite *jack = (CCSprite*)[sheet getChildByTag:kJack]; ... CCSequence *seq = [CCSequence actions: jump1, [jump1 reverse], jump2, nil]; [jack runAction:seq]; } If the sprite crosses over the screen boundary, I would like to display it at opposite side. So, original sprite is half displayed on the right side (for example), and half on the left side, because it has not fully crossed yet. Obviously (or is it), I need 2 sprites to achieve this. One on the right side (original), and one on the left side (a copy). The problem is - I don't know how to create exact copy of the original sprite, because tied actions have scaling and blending transformations (sprite is a bit distorted). I would like to have something like: CCSprite *copy = [[jack copy] autorelease]; so that I can add a copy to display it on the correct side (and kill it after transition is over). It should have all the actions tied to it... Any ideas?

    Read the article

  • Write data to an xml file.

    - by Bobby
    My aim is to write an XML file with few tags whose values are the regional language. I'm using Python to do this and using IDLE(Pythong GUI) for programming. While I try to write the words in an xmls file it gives the following error. UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128) For now, I'm not using any xml writer library instead I'm opening a file "test.xml" and writing the data into it. This error is encountered by the line: f.write("\t\" + data + "\"). If I replace the above write statement with print statement then it prints the data properly on Python Shell. I'm reading the data from an excel file which is not in the UTF8,16, or 32 encoding formats. Its in some other format. cp1252 is reading the data properly. Any help in getting this data writtent oan xml would be highly appreciated. Thanks in advance. Bob

    Read the article

  • getaddrinfo is not statically compiled

    - by bobby
    I have included the header netdb.h, where getaddrinfo is included, but gcc issues this warning: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking gcc -m32 -static -s -O2 -std=c99 -D_POSIX_C_SOURCE=200112L myprogram.c How can I statically compile whatever file is missing ?

    Read the article

  • How to debug EXC_BAD_ACCESS that occurs only on release target for an iPhone app?

    - by Bobby Moretti
    I'm developing an iPhone application. I have an EXC_BAD_ACCESS that occurs only in the release target; when I build the debug target the exception does not occur. However, when I set the NSZombieEnabled environment variable to YES, I still get the EXC_BAD_ACCESS with no further information. Is it even possible for NSZombieEnabled to work when executing the release target? I don't see why not, since gdb is running in both cases... Update: here is a printout of the top of the stack: #0 0x33369ebc in objc_msgSend () #1 0x3144f968 in -[EAInputStream _streamEventTrigger] () #2 0x3144fe78 in __streamEventTrigger () #3 0x338ae3a6 in CFRunLoopRunSpecific () #4 0x338adc1e in CFRunLoopRunInMode () #5 0x32ed6966 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] () #6 0x00005b06 in -[IOStreamDelegate removeMsg:] (self=0x142cc0, _cmd=<value temporarily unavailable, due to optimizations>, message=0x2fffe544) at /Users/robertmoretti/Documents/XXXXXXX/IOStreamDelegate.m:191 Here is a gdb session from inside the objc_msgSend call at the top: (gdb) p/x $r0 $6 = 0x3100000 (gdb) x/s $r1 0x32d7cff8: "release" (gdb) disassemble $pc Dump of assembler code for function objc_msgSend: 0x33369ea8 <objc_msgSend+0>: teq r0, #0 ; 0x0 0x33369eac <objc_msgSend+4>: moveq r1, #0 ; 0x0 0x33369eb0 <objc_msgSend+8>: bxeq lr 0x33369eb4 <objc_msgSend+12>: push {r3, r4, r5, r6} 0x33369eb8 <objc_msgSend+16>: ldr r4, [r0] 0x33369ebc <objc_msgSend+20>: ldr r5, [r4, #8] 0x33369ec0 <objc_msgSend+24>: ldr r6, [r5] 0x33369ec4 <objc_msgSend+28>: add r3, r5, #8 ; 0x8 0x33369ec8 <objc_msgSend+32>: and r5, r6, r1, lsr #2 0x33369ecc <objc_msgSend+36>: ldr r4, [r3, r5, lsl #2] 0x33369ed0 <objc_msgSend+40>: teq r4, #0 ; 0x0 0x33369ed4 <objc_msgSend+44>: add r5, r5, #1 ; 0x1 0x33369ed8 <objc_msgSend+48>: beq 0x33369efc <objc_msgSend+84> 0x33369edc <objc_msgSend+52>: ldr r12, [r4] 0x33369ee0 <objc_msgSend+56>: teq r1, r12 0x33369ee4 <objc_msgSend+60>: and r5, r5, r6 0x33369ee8 <objc_msgSend+64>: bne 0x33369ecc <objc_msgSend+36> 0x33369eec <objc_msgSend+68>: ldr r12, [r4, #8] 0x33369ef0 <objc_msgSend+72>: teq r4, r4 0x33369ef4 <objc_msgSend+76>: pop {r3, r4, r5, r6} 0x33369ef8 <objc_msgSend+80>: bx r12 0x33369efc <objc_msgSend+84>: pop {r3, r4, r5, r6} 0x33369f00 <objc_msgSend+88>: b 0x33369f04 <objc_msgSend_uncached> End of assembler dump. (gdb) p/x *$r0 $9 = 0x0 The exception occurs on the line 0x33369ebc <objc_msgSend+20>: ldr r5, [r4, #8]. r4 has just been given the value pointed to by r0, which happens to be 0. I am wondering what is supposed to be in the memory region of 0x3100000. Here's a memory dump of that area: (gdb) x/256w 0x3100000 0x3100000: 0x00000000 0x0000a293 0xaa650505 0x00000000 0x3100010: 0x0000a294 0xaa670505 0x00000000 0x0000a295 0x3100020: 0xaa690505 0x00000000 0x0000a296 0xaa6b0505 0x3100030: 0x00000000 0x0000a297 0xaa6d0505 0x00000000 0x3100040: 0x0000a298 0xaa6f0505 0x00000000 0x0000a299 0x3100050: 0xaa710505 0x00000000 0x0000a29a 0xaa730505 0x3100060: 0x00000000 0x0000a29b 0xaa750505 0x00000000 0x3100070: 0x0000a29c 0xaa770505 0x00000000 0x0000a29d 0x3100080: 0xaa790505 0x00000000 0x0000a29e 0xaa7b0505 0x3100090: 0x00000000 0x0000a29f 0xaa7d0505 0x00000000 0x31000a0: 0x0000a2a0 0xaa7f0505 0x00000000 0x0000a2a1 0x31000b0: 0xaa810505 0x00000000 0x0000a2a2 0xaa830505 0x31000c0: 0x00000000 0x0000a2a3 0xaa850505 0x00000000 0x31000d0: 0x0000a2a4 0xaa870505 0x00000000 0x0000a2a5 0x31000e0: 0xaa890505 0x00000000 0x0000a2a6 0xaa8b0505 0x31000f0: 0x00000000 0x0000a2a7 0xaa8d0505 0x00000000 0x3100100: 0x0000a2a8 0xaa8f0505 0x00000000 0x0000a2a9 0x3100110: 0xaa910505 0x00000000 0x0000a2aa 0xaa930505 0x3100120: 0x00000000 0x0000a2ab 0xaa950505 0x00000000 0x3100130: 0x0000a2ac 0xaa970505 0x00000000 0x0000a2ad 0x3100140: 0xaa990505 0x00000000 0x0000a2ae 0xaa9b0505 0x3100150: 0x00000000 0x0000a2af 0xaa9d0505 0x00000000 0x3100160: 0x0000a2b0 0xaa9f0505 0x00000000 0x0000a2b1 0x3100170: 0xaaa10505 0x00000000 0x0000a2b2 0xaaa30505 0x3100180: 0x00000000 0x0000a2b3 0xaaa50505 0x00000000 0x3100190: 0x0000a2b4 0xaaa70505 0x00000000 0x0000a2b5 0x31001a0: 0xaaa90505 0x00000000 0x0000a2b6 0xaaab0505 0x31001b0: 0x00000000 0x0000a2b7 0xaaad0505 0x00000000 0x31001c0: 0x0000a2b8 0xaaaf0505 0x00000000 0x0000a2b9 0x31001d0: 0xaab10505 0x00000000 0x0000a2ba 0xaab30505 0x31001e0: 0x00000000 0x0000a2bb 0xaab50505 0x00000000 0x31001f0: 0x0000a2bc 0xaab70505 0x00000000 0x0000a2bd 0x3100200: 0xaab90505 0x00000000 0x0000a2be 0xaabb0505 0x3100210: 0x00000000 0x0000a2bf 0xaabd0505 0x00000000 0x3100220: 0x0000a2c0 0xaabf0505 0x00000000 0x0000a2c1 0x3100230: 0xaac10505 0x00000000 0x0000a2c2 0xaac30505 0x3100240: 0x00000000 0x0000a2c3 0xaac50505 0x00000000 0x3100250: 0x0000a2c4 0xaac70505 0x00000000 0x0000a2c5 0x3100260: 0xaac90505 0x00000000 0x0000a2c6 0xaacb0505 0x3100270: 0x00000000 0x0000a2c7 0xaacd0505 0x00000000 0x3100280: 0x0000a2c8 0xaacf0505 0x00000000 0x0000a2c9 0x3100290: 0xaad10505 0x00000000 0x0000a2ca 0xaad30505 0x31002a0: 0x00000000 0x0000a2cb 0xaad50505 0x00000000 0x31002b0: 0x0000a2cc 0xaad70505 0x00000000 0x0000a2cd 0x31002c0: 0xaad90505 0x00000000 0x0000a2ce 0xaadb0505 0x31002d0: 0x00000000 0x0000a2cf 0xaadd0505 0x00000000 0x31002e0: 0x0000a2d0 0xaadf0505 0x00000000 0x0000a2d1 0x31002f0: 0xaae10505 0x00000000 0x0000a2d2 0xaae30505 0x3100300: 0x00000000 0x0000a2d3 0xaae50505 0x00000000 0x3100310: 0x0000a2d4 0xaae70505 0x00000000 0x0000a2d5 0x3100320: 0xaae90505 0x00000000 0x0000a2d6 0xaaeb0505 0x3100330: 0x00000000 0x0000a2d7 0xaaed0505 0x00000000 0x3100340: 0x0000a2d8 0xaaef0505 0x00000000 0x0000a2d9 0x3100350: 0xaaf10505 0x00000000 0x0000a2da 0xaaf30505 0x3100360: 0x00000000 0x0000a2db 0xaaf50505 0x00000000 0x3100370: 0x0000a2dc 0xaaf70505 0x00000000 0x0000a2dd 0x3100380: 0xaaf90505 0x00000000 0x0000a2de 0xaafb0505 0x3100390: 0x00000000 0x0000a2df 0xaafd0505 0x00000000 0x31003a0: 0x0000a2e0 0xab050505 0x00000000 0x0000a2e1 0x31003b0: 0xab070505 0x00000000 0x0000a2e2 0xab090505 0x31003c0: 0x00000000 0x0000a2e3 0xab0b0505 0x00000000 0x31003d0: 0x0000a2e4 0xab0d0505 0x00000000 0x0000a2e5 0x31003e0: 0xab0f0505 0x00000000 0x0000a2e6 0xab110505 0x31003f0: 0x00000000 0x0000a2e7 0xab130505 0x00000000 I don't really know what else to try; hopefully someone with more iphone experience will be able to recognize this memory as something meaningful.

    Read the article

  • how to set data into textfeild

    - by shishir.bobby
    hi all i have a table view containing some text. and an selecting a row, i hv to set text on another view's textfeild based on the selected index of row od table view. this is hoe it looks like -(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath { abc *abcController = [ [ abcController alloc] initWithNibName:@"abcController" bundle:[NSBundle mainBundle]]; [self.navigationController abcController animated:YES]; coffeeObj = [appdelegate.coffeeArray objectAtIndex:indexPath.row]; abcController.sender.text =[NSString stringWithFormat:@" to %@", coffeeObj.to]; abcController.mobileNumber.text = [NSString stringWithFormat:@" from %@", coffeeObj.from]; [abcController release]; } and this is how my textfeilds looks like, which is in table view if(indexPath.row == 0) textField.keyboardType = UIKeyboardTypeDefault; else textField.keyboardType = UIKeyboardTypePhonePad; textField.autocorrectionType = UITextAutocorrectionTypeNo; [cell.contentView addSubview:textField]; if(indexPath.row == 0) { self.sender = textField; cell.textLabel.text = NSLocalizedString(@"From :", @" "); NSLog(@"sender: %@", self.sender.text); } else { self.mobileNumber = textField; cell.textLabel.text = NSLocalizedString(@"To :" ,@" "); NSLog(@"mobile Number: %@", self.mobileNumber.text); } [textField release]; my problem is i am not abel to set text in these textfeilds from previous view..... plz let me knw where i am wrong..... w8ing for a quick reply.. regards shishir

    Read the article

  • First Letter Section Headers with Core Data

    - by Cory Imdieke
    I'm trying to create a list of people sorted in a tableView of sections with the first letter as the title for each section - a la Address Book. I've got it all working, though there is a bit of an issue with the sort order. Here is the way I'm doing it now: NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:[NSEntityDescription entityForName:@"Contact" inManagedObjectContext:context]]; NSSortDescriptor *fullName = [[NSSortDescriptor alloc] initWithKey:@"fullName" ascending:YES]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:fullName, nil]; [request setSortDescriptors:sortDescriptors]; [fullName release]; [sortDescriptors release]; NSError *error = nil; [resultController release]; resultController = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:context sectionNameKeyPath:@"firstLetter" cacheName:nil]; [resultController performFetch:&error]; [request release]; fullName is a standard property, and firstLetter is a transient property which returns - as you'd expect - the first letter of the fullName. 95% of the time, this works perfectly. The problem is the result controller expects these two "lists" (the sorted fullName list and the sorted firstLetter list) to match exactly. If I have 2 contacts like John and Jack, my fullName list would sort these as Jack, John every time but my firstLetter list might sort them as John, Jack sometimes as it's only sorting by the first letter and leaving the rest to chance. When these lists don't match up, I get a blank tableView with 0 items in it. I'm not really sure how I should go about fixing this issue, but it's very frustrating. Has anyone else run into this? What did you guys find out?

    Read the article

  • How to set NSZombieEnabled for debugging EXC_BAD_ACCESS on release target for an iPhone app?

    - by Bobby Moretti
    I'm developing an iPhone application. I have an EXC_BAD_ACCESS that occurs only in the release target; when I build the debug target the exception does not occur. However, when I set the NSZombieEnabled environment variable to YES, I still get the EXC_BAD_ACCESS with no further information. Is it even possible for NSZombieEnabled to work when executing the release target? I don't see why not, since gdb is running in both cases...

    Read the article

  • Interception with Unity in Prism v2 for WPF (not working for me)

    - by Bobby Chopra
    I cannot get interception to work with Prism v2 (Oct 2009). I am trying to intercept the Setter for any Public Properties and then fire the PropertyChanged event if the property has changed. I can see that the code gets executed (by stepping through with the debugger or adding a debug point). However, the WPF Window controls that are bound to these properties do not get updated. If I subscribe to these events and print to the console, I can print out the property change notifications. So, if the View has a textbox, which updates the property on the ViewModel, then the property in the ViewModel gets updated. However, if a button on the view (implemented as a DelegateCommand) causes the property to get updated, then the textbox (TwoWay Binding Mode) that is bound to that Property is not updated even though the event is triggered and the console has printed out the information about which property was updated. Has anyone encountered this issue? Here is the sample WPF Application that I have written. Wordpress doesn't allow uploads of zip files, so I renamed it to have a pdf extension (rename the file to have a zip extension). Please let me know what I am doing wrong. Thanks in advance.

    Read the article

  • How can I reset addAttributeToFilter in Magento searches

    - by Bobby
    I'm having problems getting the addAttributeToFilter function within a loop to behave in Magento. I have test data in my store to support searches for all of the following data; $attributeSelections=array( array('size' => 44, 'color' => 67, 'manufacturer' => 17), array('size' => 43, 'color' => 69, 'manufacturer' => 17), array('size' => 42, 'color' => 70, 'manufacturer' => 17)); And my code to search through these combinations; foreach ($attributeSelections as $selection) { $searcher = Mage::getSingleton('catalogsearch/advanced')->getProductCollection(); foreach ($selection as $k => $v) { $searcher->addAttributeToFilter("$k", array('eq' => "$v")); echo "$k: $v<br />"; } $result=$searcher->getData(); print_r($result); } This loop gives the following results (slightly sanitised for veiwing pleasure); size: 44 color: 67 manufacturer: 17 Array ( [0] => Array ( [entity_id] => 2965 [entity_type_id] => 4 [attribute_set_id] => 28 [type_id] => simple [sku] => 1006-0001 [size] => 44 [color] => 67 [manufacturer] => 17 ) ) size: 43 color: 69 manufacturer: 17 Array ( [0] => Array ( [entity_id] => 2965 [entity_type_id] => 4 [attribute_set_id] => 28 [type_id] => simple [sku] => 1006-0001 [size] => 44 [color] => 67 [manufacturer] => 17 ) ) size: 42 color: 70 manufacturer: 17 Array ( [0] => Array ( [entity_id] => 2965 [entity_type_id] => 4 [attribute_set_id] => 28 [type_id] => simple [sku] => 1006-0001 [size] => 44 [color] => 67 [manufacturer] => 17 ) ) So my loop is function and generating the search. However, the values fed into addAttributeToFilter on the first itteration of the loop seem to remain stored for each search. I've tried clearing my search object, for example, unset($searcher) and unset($result). I've also tried magento functions such as getNewEmptyItem(), resetData(), distinct() and clear() but none have the desired effect. Basically what I am trying to do is check for duplicate products before my script attempts to programatically create a product with these attribute combinations. The array of attribute selections may be of varying sizes hence the need for a loop. I would be very appreiciative if anyone might be able to shed some light on my problem.

    Read the article

  • copy array from one class to another class array

    - by shishir.bobby
    hi all, i hv an array ("array A", which contains 3 objects, fox ex, to,from,message) in class "A". and in class "B",i m having another array ("array B"),which fills tableview,of class "B" only. i need to fill tableview,with the values of class A's array (i.e array A,with the object values, to,from,message). how can i do it?? how to copy array from another class ? i hope i m clear with my question regards shishir

    Read the article

  • Testing system where App-level and Request-level IoC containers exist

    - by Bobby
    My team is in the process of developing a system where we're using Unity as our IoC container; and to provide NHibernate ISessions (Units of work) over each HTTP Request, we're using Unity's ChildContainer feature to create a child container for each request, and sticking the ISession in there. We arrived at this approach after trying others (including defining per-request lifetimes in the container, but there are issues there) and are now trying to decide on a unit testing strategy. Right now, the application-level container itself is living in the HttpApplication, and the Request container lives in the HttpContext.Current. Obviously, neither exist during testing. The pain increases when we decided to use Service Location from our Domain layer, to "lazily" resolve dependencies from the container. So now we have more components wanting to talk to the container. We are also using MSTest, which presents some concurrency dilemmas during testing as well. So we're wondering, what do the bright folks out there in the SO community do to tackle this predicament? How does one setup an application that, during "real" runtime, relies on HTTP objects to hold the containers, but during test has the flexibility to build-up and tear-down the containers consistently, and have the ServiceLocation bits get to those precise containers. I hope the question is clear, thanks!

    Read the article

  • xml parsing + tablew view tutorial needed

    - by shishir.bobby
    Hi all, i am working on live XML arsing, i am able to parse xml and pass into array,but i am not able to set those values into table view, so if any 1 can provide me some guideline or some tutorials to set array data into table view,with xml parsing,it will be a great heklp for me. regard shishir

    Read the article

  • Python: Networked IDLE/Redo IDLE front-end while using the same back-end?

    - by Rosarch
    Is there any existing web app that lets multiple users work with an interactive IDLE type session at once? Something like: IDLE 2.6.4 Morgan: >>> letters = list("abcdefg") Morgan: >>> # now, how would you iterate over letters? Jack: >>> for char in letters: print "char %s" % char char a char b char c char d char e char f char g Morgan: >>> # nice nice If not, I would like to create one. Is there some module I can use that simulates an interactive session? I'd want an interface like this: def class InteractiveSession(): ''' An interactive Python session ''' def putLine(line): ''' Evaluates line ''' pass def outputLines(): ''' A list of all lines that have been output by the session ''' pass def currentVars(): ''' A dictionary of currently defined variables and their values ''' pass (Although that last function would be more of an extra feature.) To formulate my problem another way: I'd like to create a new front end for IDLE. How can I do this? UPDATE: Or maybe I can simulate IDLE through eval()? UPDATE 2: What if I did something like this: I already have a simple GAE Python chat app set up, that allows users to sign in, make chat rooms, and chat with each other. Instead of just saving incoming messages to the datastore, I could do something like this: def putLine(line, user, chat_room): ''' Evaluates line for the session used by chat_room ''' # get the interactive session for this chat room curr_vars = InteractiveSession.objects.where("chatRoom = %s" % chat_room).get() result = eval(prepared_line, curr_vars.state, {}) curr_vars.state = curr_globals curr_vars.lines.append((user, line)) if result: curr_vars.lines.append(('SELF', result.__str__())) curr_vars.put() The InteractiveSession model: def class InteractiveSession(db.Model): # a dictionary mapping variables to values # it looks like GAE doesn't actually have a dictionary field, so what would be best to use here? state = db.DictionaryProperty() # a transcript of the session # # a list of tuples of the form (user, line_entered) # # looks something like: # # [('Morgan', '# hello'), # ('Jack', 'x = []'), # ('Morgan', 'x.append(1)'), # ('Jack', 'x'), # ('SELF', '[1]')] lines = db.ListProperty() Could this work, or am I way off/this approach is infeasible/I'm duplicating work when I should use something already built?

    Read the article

  • Creating a new nested resource

    - by Bobby B
    I'm working on a basic garden logging application which consists of gardens, plants and planted plants. Each user has one or many gardens, plants are master definitions, and a planted plant can be thought of as an instance of a plant in a specific user's garden. In my routes.rb file I have the following: map.resources :gardens do |gardens| gardens.resources :planted_plants, :has_many => :plant_log_entries, :collection => { :filter => :post, :choose_garden => :post} gardens.resources :garden_log_entries end map.resources :plants This makes sense to me when retrieving a list of planted_plants in a user's garden, but I'd like to create a planted_plant record from the index of plant. The problem is, a user can have multiple gardens. How can I create a new form for a planted_plant that allows the user to specify which garden should be used? The current route requires a garden_id - which makes sense for retrieval, but I'd like to supply that as a parameter for creation. Thanks in advance for any help!

    Read the article

  • disable Alert view button

    - by shishir.bobby
    HI all, i hv an alert view for twitter posting. Alert view has 2 button and a textfeild send and cancel i want to disable send button,until user fills the message box(i.e textfeild). like,empty field kind of validation. so,how can i disable send button?? regards shishir

    Read the article

  • .NET Application broken on one PC, unhandleable exception

    - by Bobby
    Hello people. I have a .NET 2.0 application with nothing fancy in it. It worked until yesterday on every PC I installed or copied it to, no matter if 2.0, 3.0, 3.5 or 3.5 SP1 was installed, no matter if it was Win2000, XP or even Win7 (in total 100+ machines). Yesterday I did my normal installation procedure and wanted to start it one time to check if everything is working...and it wasn't. The program crashed hard leaving me with the uninformative "Do you wanna report this error?" dialog. The problem is an exception in the Main(String[] args) routine of my application. The event viewer is showing the following entry: Event Type: ErrorEvent Source: .NET Runtime 2.0 Error Reporting Event Category: None Event ID: 5000 Date: 05/05/2010 Time: 16:09:09 User: N/A Computer: myClientPC Description: EventType clr20r3, P1 apomenu.exe, P2 1.4.90.53, P3 4bdedea4, P4 system.configuration, P5 2.0.0.0, P6 4889de74, P7 1a6, P8 136, P9 ioibmurhynrxkw0zxkyrvfn0boyyufow, P10 NIL. Well...great information. After a lot of searching I finally was able to get further information about this exception (by adding a handler for UnhandledExceptions directly in My.MyApplication.New(), Application.Designer.vb): System.Configuration.ConfigurationErrorsException Configuration system failed to initialize at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey) at System.Configuration.ClientConfigurationSystem.PrepareClientConfigSystem(String sectionName) at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName) at System.Configuration.ConfigurationManager.GetSection(String sectionName) at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName) at System.Net.Configuration.SettingsSectionInternal.get_Section() at System.Net.Sockets.Socket.InitializeSockets() at System.Net.Sockets.Socket.get_SupportsIPv4() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.get_HostName() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.RegisterChannel(Boolean SecureChannel) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at MyAppNameHere.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Line 81. And at this point I'm stuck...I'm out of ideas. I'm not using any kind of configuration system from the framework (no reference to System.Configuration, and there never was a MyAppnameHere.exe.config generated or distributed, nor have I seen this error before). I also found a bug report at Microsoft (Google Cache) about this bug (in another context, though). But as it seems, they won't even look at it. Every help is greatly appreciated! Edit: I'm using Visual Studio 2008 Prof.. Crash happens in Release- and Debug-Build on the client machine. Debugging the application directly on this machine is out of question I fear, 300+ Miles and they only have two computers to work with.

    Read the article

  • help with javamail api

    - by bobby
    import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.mail.*; import javax.mail.internet.*; import javax.mail.event.*; import java.net.*; import java.util.*; public class servletmail extends HttpServlet { public void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException { PrintWriter out=response.getWriter(); response.setContentType("text/html"); try { Properties props=new Properties(); props.put("mail.transport.protocol", "smtp"); props.put("mail.smtp.host","smtp.gmail.com"); props.put("mail.smtp.port", "25"); props.put("mail.smtp.auth", "true"); Authenticator authenticator = new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("user", "pass"); } }; Session sess=Session.getDefaultInstance(props,authenticator); Message msg=new MimeMessage(sess); msg.setFrom(new InternetAddress("[email protected]")); msg.addRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]")); msg.setSubject("Hello JavaMail"); msg.setText("Welcome to JavaMail"); Transport.send(msg); out.println("mail has been sent"); } catch(Exception e) { System.out.println("err"+e); } } } im working with above im gettin d following error servletmail.java:22: reference to Authenticator is ambiguous, both class java.ne t.Authenticator in java.net and class javax.mail.Authenticator in javax.mail mat ch Authenticator authenticator = new Authenticator() ^ servletmail.java:22: reference to Authenticator is ambiguous, both class java.ne t.Authenticator in java.net and class javax.mail.Authenticator in javax.mail mat ch Authenticator authenticator = new Authenticator() ^ 2 errors i have followed the example in http://java.sun.com/developer/onlineTraining/JavaMail/contents.html how should i get the output..will the above code...work what are the changes that need to be made..im using thunderbird smtp server

    Read the article

  • When should I implement IDisposable?

    - by Bobby
    What is the best practice for when to implement IDisposable? Is the best rule of thumb to implement it if you have one managed object in the class, or does it depend if the object was created in the class or just passed in? Should I also do it for classes with no managed objects at all?

    Read the article

  • In .NET, Why Can I Access Private Members of a Class Instance within the Class?

    - by AMissico
    While cleaning some code today written by someone else, I changed the access modifier from Public to Private on a class variable/member/field. I expected a long list of compiler errors that I use to "refactor/rework/review" the code that used this variable. Imagine my surprise when I didn't get any errors. After reviewing, it turns out that another instance of the Class can access the private members of another instance declared within the Class. Totally unexcepted. Is this normal? I been coding in .NET since the beginning and never ran into this issue, nor read about it. I may have stumbled onto it before, but only "vaguely noticed" and move on. Can anyone explain this behavoir to me? I would like to know the "why" I can do this. Please explain, don't just tell me the rule. Am I doing something wrong? I found this behavior in both C# and VB.NET. The code seems to take advantage of the ability to access private variables. Sincerely, Totally Confused Class Jack Private _int As Integer End Class Class Foo Public Property Value() As Integer Get Return _int End Get Set(ByVal value As Integer) _int = value * 2 End Set End Property Private _int As Integer Private _foo As Foo Private _jack As Jack Private _fred As Fred Public Sub SetPrivate() _foo = New Foo _foo.Value = 4 'what you would expect to do because _int is private _foo._int = 3 'TOTALLY UNEXPECTED _jack = New Jack '_jack._int = 3 'expected compile error _fred = New Fred '_fred._int = 3 'expected compile error End Sub Private Class Fred Private _int As Integer End Class End Class

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >