Posts

java - mediaplayer play sound too loud -

i've written code when event occurs, plays mp3, when happens, sound loud, , cannot made lower smartphone's buttons... i did mediaplayer mpok; mpok = mediaplayer.create(this, r.raw.ding); try { mpok.prepare(); } catch (illegalstateexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); }

java - 2D Array of letter number combination indexes -

i @ loss in creating 2d matrix combination of letters , numbers indexes. typically array accessed using array[0][1] or array[3][2 ]. how can achieve looking array using letters array[a][1] or array[d][2] ? should use many letters user desires. instance, user wants 10 rows , have array[j][1,2,etc.] . you can convert char index like: char x = ...; int index = x-'a'; array[index][3]

c - can't free memory correctly -

i'm working on pset6 of harvard's cs50 now, problem implement trie dictionary. managed make work small problem. when run valgrind check memory leak, tells me i've freed 1 more i've allocated, can't see problem in unload function. it warns me there uninitialized values, can't figure out although won't affect result. here entire code: /**************************************************************************** * dictionary.c * * computer science 50 * problem set 6 * * valgrind warn there uninitialized values, node struct, don't * know how initialize it, anyway, works @ last! * * implements dictionary's functionality. ***************************************************************************/ #include <stdbool.h> #include <ctype.h> #include "dictionary.h" #include <string.h> #include <stdio.h> #include <stdlib.h> #define hashtable_size 5000 int count = 0; // gloabal counter typ...

iphone - Implementing read/write characteristic in the CoreBluetooth.framework -

i working on corebluetooth framework have created peripheral writable , readable characteristic . working fine me . want create read- write peripheral .i have tried following : characteristic = [[cbmutablecharacteristic alloc] initwithtype:characteristicuuid properties:(cbcharacteristicpropertyread|cbcharacteristicpropertywrite) value:nil permissions:(cbattributepermissionswriteable|cbattributepermissionsreadable)]; but not working in above case property either readable or writable not both @ time .i think taking first 1 . missing ? a couple things should check: make sure when use method - (void)writevalue:(nsdata *)data forcharacteristic:(cbcharacteristic *)characteristic type:(cbcharacteristicwritetype)type , cbcharacteristicwritetype use should match cbcharacterist...

ios - ScrollView Prevents labels from working -

i have detailviewcontroller working fine. has labels , textview . added scrollview allow textview move when selected, after put scrollview under old labels, labels no longer display data. have been using storyboard ui. assumed drop scrollview in , place labels on top, figuring work. didn't. why this? update: for need code, here is: #import "detailviewcontroller.h" @interface detailviewcontroller () - (void)configureview; @end @implementation detailviewcontroller @synthesize comment; static const cgfloat keyboard_animation_duration = 0.3f; #pragma mark - managing detail item - (void)setdetailitem:(rootbeer*)newdetailitem { if (_detailitem != newdetailitem) { _detailitem = newdetailitem; // update view. [self configureview]; } } - (void)configureview { // update user interface detail item. [self.view addsubview:]; if (self.detailitem) { self.rootbeernamelabel.text = [[self.detailitem valueforkey:@...

Exporting CSV data from Rails -

i'm working export csv data rails. i'm following tutorial here: http://railscasts.com/episodes/362-exporting-csv-and-excel?view=asciicast in controller have: def show # @company being provided correctly. @groups = @company.groups render text: @groups.to_csv end in group.rb model: def self.to_csv rails.logger.info "hello world" csv.generate |csv| csv << column_names all.each |product| csv << product.attributes.values_at(*column_names) end end end the issue browser outputting following: #,#,#,#,#,#,#,#,#,#,#,#,#,#,#,#,#,#,#,#,#,#,# the model method appears being ignored, after rails restart. ideas what's wrong here? thanks the to_csv class method. meaning meant called group.to_csv . might want change method signature group.to_csv(groups) instead. def self.to_csv(groups) rails.logger.info "hello world" csv.generate |csv| csv << column_...

How to upload a file to WCF using jQuery by passing filePath as param and not using HTML File tag? -

i've seen pretty sample code using html5 have develop solution works browsers. found solutions use iframe , nice ajax plug in such ( https://github.com/blueimp/jquery-file-upload ) samples php or use html file tag (). i need create wcf service accepts stream , simple jquery ajax call pass file path such c:\test\file001.zip (instead of displaying file textbox browse... button user pick out file). something like: $.ajax( { async: false, cache: false, data: { "fileid" : "1234", "filename" : "c:\test\file001.zip" }, complete: function (jqxhr, textstatus) { }, error: function (jqxhr, textstatus, errorthrown) { alert("errorthrown: " + json.stringify(jqxhr) + ' ' + textstatus + ' ' + errorthrown ) }, success: function (data, textstatus, jqxhr) { }, type: "post", url: "svc/test.svc/uploadfile" }); how do that? closest forum thread found this: working example of aja...