Posts

Showing posts from September, 2011

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...

ibm mobilefirst - worklight server authentication with Ldap -

i want authenticate users using apacheds ldap , integrate worklight server(liberty profile). modified server.xml following code after http endpoint element. <ldapregistry id=”ldap” > realm=”ldapregistry” host=”localhost” port=”10389” ignorecase=”true” basedn=”dc=partition1,dc=com” binddn=”uid=admin,ou=system” userfilter=”(&(uid=%v)(objectclass=inetorgperson))” bindpassword=”secret” ldaptype="apacheds 2.0.0" </ldapregistry> in authenticationconfig.xml "<securitytests> <customsecuritytest name="ldapsecuritytest"> <test isinternaluserid="true" realm="ldaprealm"/> </customsecuritytest> <customsecuritytest name="ldapsecuritytestforwlconsole"> <test isinternaluserid="true" realm="worklightconsole"/> </customsecuritytest> </securitytests> <realms> <realm loginmodul...

How to get branching strategy for each item in changeset TFS 2010 C# -

i have changeset. changed items , server paths associatedchangeset.changes[x].item.serveritem. want branch , folder hierarchy of item. not wish go spliting serveritem value branching. api can me branch names each item in changeset? not directly. quickest way send query server parent items in server paths determine closest branch folder , query branch hierarchy of that. doing query efficiently client side require quite bit of work on side.

Java Object reference -

this regarding usage of arraylist returned class instance variable. class { //assigned list of string it. private list < string > newal; //returns list public list < string > getlist() { return newa1; } } class test { public void go() { list < string > list = a.getlist(); list.add(""); } } in test class when retreive list , manipulate list.because of reference ,class list got manipulated.if part of third party code.how correct code in test class original object wouldnt affected? the arraylist constructor takes collection can use that: list<string> list = new arraylist(a.getlist()); i think it's better this, depending on you're doing, may want construct new list in getter. helps type hiding.

asp.net mvc - Website logout time issue -

my website automatically logout after 15 mins . want set timeout in 2 hours or 1 day . see below webconfig code <authentication mode="forms"> <forms loginurl="~/account/login" defaulturl="~/account/login" protection="all" slidingexpiration="false" timeout="3600"/> </authentication> <sessionstate mode="inproc" cookieless="false" timeout="3600"></sessionstate> i search more answers in google , put lot of minutes in timeout property . it's not working. time logout after 15 mins . can me ? how ca solve issue ? may application recycled , new machine key assigned automatically. may need assign machine key in web.config. may generate machine key here <system.web> <machinekey validationkey="machinekey" decryptionkey="decrypt key here" validation="sha1" de...

Android Google Maps fails after updating Google Play services from Rev. 6 to 7 -

ever since updated google play services rev. 6 rev. 7 android sdk manager (i'm using eclipse 4.2.2), app crash whenever navigate tab map. app working fine before update. here line of error log found: 05-21 13:08:56.603: e/androidruntime(11981): fatal exception: main 05-21 13:08:56.603: e/androidruntime(11981): java.lang.exceptionininitializererror 05-21 13:08:56.603: e/androidruntime(11981): @ java.lang.class.newinstanceimpl(native method) 05-21 13:08:56.603: e/androidruntime(11981): @ java.lang.class.newinstance(class.java:1319) 05-21 13:08:56.603: e/androidruntime(11981): @ android.app.fragment.instantiate(fragment.java:577) 05-21 13:08:56.603: e/androidruntime(11981): @ android.app.fragment.instantiate(fragment.java:552) 05-21 13:08:56.603: e/androidruntime(11981): @ com.projectswiminsg.amkactivity$tablistener.ontabselected(amkactivity.java:67) 05-21 13:08:56.603: e/androidruntime(11981): @ com.android.internal.app.actionbarimpl.selecttab(actionbarimpl....

vi - 256 colors in vim and How to install new color scheme -

i'm under ubuntu 64 bit 13.04, i'm starting vim , don't understand error i'm getting error detected while processing distinguished.vim: line 16: distinguished color scheme requires gvim or 256-color terminal press enter or type command continue as can guess i'm trying use new colorscheme downloaded here , saved under ~/.vim/colors/ , it's understanding .vimrc fine i'm trying do: colorscheme distinguished obiviously have more 256 colors available on system , have millions of colors display, it's , how can make correct use of colorscheme ? you need terminal application supports 256 colors, , term environment variable points 256-color terminfo. number of colors available terminal has nothing rest of setup :) try in console: export term=xterm-256color vim it might not work terminal program, recent versions of xterm, does. terminals vary lot in capabilities; terminals dumb (think of keyboard line printer); narrow, ...

haskell - Listen on TCP and UDP on the same port -

how can haskell listen udp , tcp on same port? here code have far (based on acme-http): listenon portm = prototcp <- getprotocolnumber "tcp" e.bracketonerror (socket af_inet stream prototcp) sclose (\sock -> setsocketoption sock reuseaddr 1 setsocketoption sock nodelay 1 bindsocket sock (sockaddrinet (fromintegral portm) inaddr_any) listen sock (max 1024 maxlistenqueue) return sock ) ...

php - Banner Serving Optimization -

like of pages, website have multiple banners in single page. we have internal banner system.for calling banner, web request made /bannersystem/?page=home&subpage=top&userid=1 /bannersystem/?page=home&subpage=bottom&userid=1 /bannersystem/?page=home&subpage=center&userid=1 /bannersystem/?page=home&subpage=left&userid=1 all these request goes different(internal) server, handled me. for optimizing: planned call request /bannersystem/?page=home&subpage=top,bottom,center,left&userid=1 and page getting called, manuplate resuls. hence http requests go down. questions: any other approach better ? should create wrapper accepts request /bannersystem/?page=home&subpage=top,bottom,center,left&userid=1 , wrapper calling old url internally avoid code changes first of all, remember: premature optimization root of evil . sure need optimize? did measure current performances? let's did. :) what kind of optimization...

python - Solar_noon function - having date/time calc issues -

non-programmer type here attempting construct python solar noon calculation. believe code there having difficulty obtaining solar_noon time. using formula http://www.esrl.noaa.gov/gmd/grad/solcalc/solareqns.pdf i have used online calculator, http://www.esrl.noaa.gov/gmd/grad/solcalc/ verify eqtime pretty close. calculation error? believe related time conversions. #!/usr/local/bin/python import sys datetime import datetime, time, timedelta math import pi, cos, sin def solar_time(dt, longitude): return ha def main(): if len(sys.argv) != 4: print 'usage: hour_angle.py [yyyy/mm/dd] [hh:mm:ss] [longitude]' sys.exit() else: #dt = datetime.strptime(sys.argv[1] + ' ' + sys.argv[2], '%y/%m/%d %h:%m:%s') #longitude = float(sys.argv[3]) """ set date/time, longitude ease coding troubleshooting """ longitude = -71.96 # montauk, ny dt = datetime...

Allow for a jekyll post to have no day only year and month -

sometimes have projects launch , takes month of work , they're launched within month have no specific date associated them. save post 2011-05-00noday.md jekyll not allow it. there way , have permalink reflect /2011/05/noday.html ? check setting yaml config file: #for pages permalink: pretty #for posts defaults: - scope: path: "" type: "posts" values: #this looks prettier permalink: /blog/:title #for needs permalink: /:year/:month/:title

c# - Alternative to standard Windows Phone 8 Map Control -

does know of alternatives windows 8 microsoft.phone.maps.controls.map control? the standard control doesn't allow me override bing basemap own custom tiles. i understand windows phone 7 control allows override basemap it's marked depreciated. any ideas appreciated. even though it's marked depreciated, i've gone wp7 microsoft.phone.controls.maps.map has functionality require. i've encapsulated control , functionality within usercontrol it's easy swap out once new microsoft.phone.maps.controls.map control has caught functionality wise.

SED command in UNIX -

i want remove below string file in unix: <?xml version='1.0' encoding='utf-8'?> the file content this: <?xml version='1.0' encoding='utf-8'?>hello world in 1 single continuous line. i using following command achieve same: sed s'/<?xml version='1.0' encoding='utf-8'?>//g' myfile > myfile1 however, resultant file myfile1 still having string. how achieve ? use double quotes outer quotes avoid escape issue: sed "s/<?xml version='1.0' encoding='utf-8'?>//g" myfile > myfile1

opensuse - Create ghost dvd or image of linux suse -

i stuck in problem of linux suse , need on same. problem mentioned below. as per client requirement, have create ghost dvd or image dvd of linux suse 11 operating system softwares installed , configuration in it. so, when user enter cd there machine, first system load suse , configure softwares without human intervention. so, whats process create same? thanks in advance there instructions on suse wiki: http://en.opensuse.org/sdb:live_usb_stick

java - Issue with jOOQ custom Type conversion -

my application working fine before included custom type converter. need convert jooq uinteger integer, included type converter achieve this. post change, getting mysql syntax error on limit , offset. then while debugging, found integer values being supplied(including limit , offset values) converting uinteger(because of type converter) , in turn string since uinteger not default type. i solve solution provided link jooq issue limit , offset want understand details. if use settings.setstatementtype(statementtype.static_statement) cannot prepared statement , might miss advantages of preparedstatement. if use factory.inline bind integer inline values, have on complete application , if miss something, result in serious issue. kindly me out solve issue or give me suggestions on same. i think you're looking way disable generation of unsigned integer types. relevant code generation flag documented here: http://www.jooq.org/doc/3.0/manual/code-generation/codeg...

algorithm - Shortest Bit Sequence Logic -

i trying understand how shortest bit sequence work. mean logic. need create program don't know shortest bit sequence. tried google in vain. came across question on cant understand it. can explain me or guide me somewhere can understand logic behind this? as jan dvorak pointed out in comments, it's number written in base -2 . consider example [0, 1, 1, 1, 1, 1, 1] . the exponents of -2 same 2, with alternating signs : (-2)^0 = 1 (-2)^1 = -2 (-2)^2 = 4 (-2)^3 = -8 (-2)^4 = 16 (-2)^5 = -32 (-2)^6 = 64 ... in bit sequence notation lowest exponents come first, order reversed compared ordinary binary numbers. [0, 1, 1, 1, 1, 1, 1] = 0 * (-2)^0 + 1 * (-2)^1 + 1 * (-2)^2 + 1 * (-2)^3 + 1 * (-2)^4 + 1 * (-2)^5 + 1 * (-2)^6 which gives (from bottom up) [0, 1, 1, 1, 1, 1, 1] = 64 - 32 + 16 - 8 + 4 - 2 = ...

Howto download file from Drive API using Python script -

i'm working on simple script in python download , export files google apps domain drive service. able create drive session using service account , i'm getting json output list query. defined download function according article: https://developers.google.com/drive/manage-downloads the problem function return json output called content, can't figure out how store file locally on hdd. looking curl if can used inside python script , found urllib/urllib2 should used curl. if try use urllib2 read remote file by: remote_file = urllib2.urlopen(download_url).read() i 401 error unathorized . so looks urllib2 working doesn't use stored credentials. so how can create authorized query using urllib/2? or right way store file locally within script? there other other python or google specific library can me store files locally? thanks in advance. edit: using google apis client library. problem function download_file returning json output i'm not able save file l...

ruby on rails - Zeus fails when testing with Rspec -

when run command: rspec spec/controllers/messages_controller_spec.rb i this: finished in 0.54446 seconds 2 examples, 0 failures randomized seed 6226 it's good. however when run command: zeus rspec spec/controllers/messages_controller_spec.rb i this: finished in 0.5356 seconds 2 examples, 0 failures randomized seed 0 this not problem, this: f. failures: 1) messagescontroller post #create create message http 200 status code failure/error: post :create, message: "test message" nameerror: undefined method `post' #<rspec::core::examplegroup::nested_2::nested_1:0xb0085d8> # ./spec/controllers/messages_controller_spec.rb:10:in `block (3 levels) in <top (required)>' # -e:1:in `<main>' finished in 0.10724 seconds 2 examples, 1 failure failed examples: rspec ./spec/controllers/messages_controller_spec.rb:9 # messagescontroller post #create create message h...

php - Retrieve Data from 3 tables and finding intersections -

i retrieve 3 datasets query1:to find new products,query2:products in sale,query3:popular products , need find if products new , in sale , popular or if products new or in sale etc. since limit queries 5 there possibility of not getting same id's @ same time.i added php code logically wrong mentioned.what best of way doing that,i need help.thanks in advance query1: select p.`productid`,`typeid`,c.companyid cid,c.`name` cn,p.`name`,`picture`,`price`,s.`saleprice`,count(l.productid) likes,'1' popular `product` p inner join company c on c.companyid=p.companyid inner join likes l on l.productid=p.productid left outer join sale s on s.productid=p.productid l.ts>date_sub(now(), interval 7 day) , c.companyid in(1,2,3) group p.`productid`,`typeid`,c.`name`,p.`name`,`picture`,`price` order likes desc limit 0,5 query2: select p.`productid`,`typeid`,c.companyid cid,c.`name` cn,p.`name`,`picture`,`price`,s.`saleprice`,s.endtime,s.begintime,'1' sale `product` p i...

Paypal /Permissions/GetBasicPersonalData fails randomly with "Authentication failed. API credentials are incorrect." -

i'm using paypal permissions api authenticate user through paypal , permissions. the problem /permissions/getbasicpersonaldata call returns "authentication failed. api credentials incorrect." though got token , secret successful call /permissions/getaccesstoken the weird thing though is unpredictable. fails , work sandbox, fails on production (live paypal). when works seems work every time, when fails starts failing every time, until changes. paypal doing custom encoding , string manipulations while generating oauth signature, example, encode . %2e first , later on converted lowercase string %2e . if writing own paypal oauth signature generation function , missed the steps, signature invalid. "random" thing described because special characters not guaranteed show in token / token secret . when not there, success , vice versa. i made work translating bit-to-bit paypal's official ruby sdk. ( https://github.com/paypal/sdk-core-ruby/blo...

error when writing a ResultScanner to a file in java (serialization issue) -

when want write resultscanner object disk, face error: exception in thread "main" java.io.writeabortedexception: writing aborted; java.io.notserializableexception: org.apache.hadoop.hbase.client.clientscanner @ java.io.objectinputstream.readobject0(objectinputstream.java:1351) @ java.io.objectinputstream.defaultreadfields(objectinputstream.java:1988) @ java.io.objectinputstream.readserialdata(objectinputstream.java:1912) @ java.io.objectinputstream.readordinaryobject(objectinputstream.java:1795) @ java.io.objectinputstream.readobject0(objectinputstream.java:1347) @ java.io.objectinputstream.readobject(objectinputstream.java:369) @ cache1.cachemanager.getcache(cachemanager.java:112) @ cache1.cache1.main(cache1.java:43) caused by: java.io.notserializableexception: org.apache.hadoop.hbase.client.clientscanner @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1180) @ java.io.objectoutputstream.defaultwritefields(object...

jboss7.x - Is it possible to initialize Seam 2.3 component if the class is located in different EAR on JBoss 7.1.1? -

i have 2 ears, ear actual application, ear b used debugging , testing. ear contains jar seam component classes, annotated @name. ear contains war seam 2.3 webapp , defines components in components.xml. works fine. ear b contains war b, stripped version of war ear a. ear b correctly defines dependency on subdeployment "jar a" in jboss-deployment-structure.xml. war b defines few components jar a, fail initialize during webapp deployment. caused by: java.lang.illegalargumentexception: component class must have @name annotation or name must specified in components.xml: [name of class] when debug initialization , set breakpoint in seam class org.jboss.seam.init.initialization:488 if ( !clazz.isannotationpresent(name.class) ) { throw new illegalargumentexception( "component class must have @name annotation or name must specified in components.xml: " + clazz.getname()); } name...

entity framework - EF6 - Code First - Are property mappings needed? -

i have been reading on code first approach entity framework. unfortunately can't find documentation relates ef4 on this. docs have read (scott gu's blog on ef4) indicate don't need mappings. so generated code files existing database using ef6 power tools generates model classes , mappings folder. automatically looked @ mappings files in there using fluent api (i think correct) , describe details tables. now reading makes sense possibly wouldn't know primary key, required properties, relationships thing don't property column mappings blog post these not needed why need them? i can understand needing them if column name can't represented in code naming conventions don't allow this. my main reason asking maintainability question rather have code particular property in 1 place , these lines this.property(t => t.id).hascolumnname("id"); seem redundant me. any 1 helpful links on ef6 code first approach appreciated google failing :...

c# - Exception in page with Radedit -

i've got problem in web-app. user click element exception throws. tried reproduce user's actions, didn't appear. error: message: input string not in correct format. original url: /jobs/edit.aspx/en on us.rightrjo.com:80 user address: 10.0.20.54 useragent: mozilla/5.0 (compatible; msie 10.0; windows nt 6.2; wow64; trident/6.0; touch; mddcjs) stack trace: error source: mscorlib inner exception: error stack trace: @ system.number.stringtonumber(string str, numberstyles options, numberbuffer& number, numberformatinfo info, boolean parsedecimal) @ system.number.parseint32(string s, numberstyles style, numberformatinfo info) @ system.web.ui.htmlcontrols.htmlinputimage.loadpostdata(string postdatakey, namevaluecollection postcollection) @ system.web.ui.htmlcontrols.htmlinputimage.system.web.ui.ipostbackdatahandler.loadpostdata(string postdatakey, namevaluecollection postcollection) @ system.web.ui.page.processpostdata(namevaluecollection postdata, ...

visual studio 2010 - How do I know the project is targeted for Windows Phone Emulator when it is being built? -

Image
in windows phone project sdk 7.1 want conditionally include file: <content include="myfile.jpg" condition="'$(configuration)' == 'debug'" /> all good, condition not perfect. want file included when project being built windows phone emulator. target selected dropdown in visual studio: i've looked through this msdn document , can't find suitable variable populated target name. which build variable use detect project being targeted windows phone emulator? i think emulator this property equal "emulator" or (you may check exact value launching app on emulator , use value).

javascript - Special character validation -

i have javascript written validate string alphanumeric wondering how add code include hyphens(-) , slash's(/) acceptable inputs. here current code: function validateaddress() { var address = document.getelementbyid('address'); if (address.value == "") { alert("address must filled out"); return false; } else if (document.getelementbyid('address').value.length > 150) { alert("address cannot more 150 characters"); return false; } else if (/[^a-za-z0-9\-\/]/.test(address)) { alert('address can contain alphanumeric characters, hyphens(-) , slashs(\)'); return false; } } simply add them character group. of course, because both - , / special characters in context ( / ends regexp, - expresses range), you'll need escape them preceding \ : function validateaddress(){ var tcode = document.getelementbyid('address').value; if( /[^a-za-z0-9\-\/]/.test( tcode ) ) {...

windows 8 - WinRT c# - Text Block scroll auto to the end -

i scroll auto end of textblock if add text it. try lot of thing, failed hard. anybody has idea on winrt application ? thanks time, regards. step 1 - winrt xaml toolkit nuget step 2 - add following using code using winrtxamltoolkit.controls.extensions; step 3 - make following call after add (replace really) text in textbox var scrollviewer = textblock.getfirstdescendantoftype<scrollviewer>(); scrollviewer.scrolltoverticaloffset(scrollviewer.scrollableheight);

perl - After update of the JSON module i get the following warning -

after update of json module version 1.54 2.07 following warning in logs: prototype mismatch: sub modperl::root::modperl::perlrun::mypath_myfile_2epl::from_json: none vs ($@) @ mypath_myfile.pl line 6. prototype mismatch: sub modperl::root::modperl::perlrun::mypath_myfile_2epl::to_json: none vs ($@) @ mypath_myfile.pl line 6. prototype mismatch: sub modperl::root::modperl::perlrun::mypath_myfile_2epl::encode_json: none vs ($) @ mypath_myfile.pl line 6. prototype mismatch: sub modperl::root::modperl::perlrun::mypath_myfile_2epl::decode_json: none vs ($) @ mypath_myfile.pl line 6. in line 6 of myfile.pl use json; called any ideas what's going wrong here or how solve issue? check incompabilities between json 1 .x , 2.x @ cpan . include before json? modperl version running?

r - venneuler subset not correctly plotted -

Image
i try plot venn 1 set subset of set. reason it's not plotted in set little bit outside set. doing wrong? file <- read.csv(file="c:\\test.csv",head=true,sep=",") lists <- list(file$a,file$b,file$c) items <- sort(unique(unlist(lists))) mat <- matrix(rep(0,length(items)*length(lists)), ncol=3) colnames(mat) <- c("a","b","c") rownames(mat) <- items lapply(seq_along(lists), function(i){ mat[items %in% lists[[i]],i] <<- table(lists[[i]]) }) library(venneuler) v <- venneuler(mat>0) the csv file example, c subset of b a b c 37 16 16 38 25 25 58 35 35 103 36 36 106 37 37 108 48 66 117 52 80 196 58 90 206 66 97 240 74 251 80 266 90 269 97 325 226 346 266 353 298 428 429 575 514 524

Possible to do an iOS app distribution via the web without knowing the device's UDID? -

is possible use ad-hoc distribution without knowing authorized devices' udids? i've come across this , installs ios app on ios device, without them knowing device's udid in advance. is new functionality on ios i've missed or exploiting vulnerability? no not possible, ad-hoc distribution need know udid of device on installed. the link provide uses enterprise distribution distribute app. not supposed have download of app publicly available, breach of contract apple , mean wil revoke account. enterprise account can on distribute app employees of company account registered.

java - webdriver, catching @Test(timeout = 10000) -

my webdriver tests annotated @test(timeout = 10000) force test end after 10000ms. prevents tests hanging night if there error. however, tests writing additional info file, , if test times out in way, line not written file. possible catch type of timeout? @test(timeout = 100000) public void testsomething() throws exception { //do stuff //if times out, line below never called. //print file } i'd suggest implementing junit rule . extend testwatcher class , override succeeded method.

android override toast background from style -

i tying override toast background using "android:toastframebackground" attribute in styles.xml. but it's giving me error stating : no resource found matches given name: attr 'android:toastframebackground'. what can reason ?

c++ - Rotating left is rotating right -

in c++ want rotate array of 4 characters once left using assembly instruction rol. thought i'd interpret array dword , rotate dword once left , wanted. instead, whenever rotate dword once left it's rotating once right. asm code: shiftrow proc ; copy array eax mov eax, dword ptr [rcx] rol eax, 8 mov dword ptr [rdx], eax ret shiftrow endp and how c++ code looks like: #include <iostream> using namespace std; extern "c" void __fastcall rotatearray(const char* array, char* outputarray); int main() { char input_array[] = {0x10, 0x20, 0x30, 0x40}; char output_array[4] = {}; rotatearray(input_array, output_array); for(int = 0; < 4; i++) std::cout << std::hex << (unsigned int)output_array[i] << " "; cin.get(); } strangely enough (to me) output 40 10 20 30 though shifting left. can explain me why happening? have endianness? yes, due endianness, , machine little-endian machine. happening: ...

mongodb - ElasticSearch architecture and hosting -

i looking use elastic search mongodb support our full text search requirements. struggling find information on architecture , hosting , help. planning host es on premise rather in cloud. have mongodb running in replica set 3 nodes. how many servers required run elasticsearch high availability? what recommended server specification. thoughts 2 x cpu, 4gb ram, c drive: 40gb , d drive: 40gb how es support failover thanks tariq how many servers required run elasticsearch high availability? at least 2 what recommended server specification. thoughts 2 x cpu, 4gb ram, c drive: 40gb , d drive: 40gb it depends on amount of data you're indexing, amount of ram , (i'm assuming decent dual core cpu) should enough started how es support failover you set clustering multiple nodes in such way each node has replica of so in simple example cluster consist of 2 servers, each 1 node on them. you'd set replicas 1 shards in node, have back...

c# - Bind to subset of bindinglist -

i have datagridviewcomboboxcolumn. want each of cells have possible values subset of bindinglist (let's call "master" bindinglist). 1 suggestion found online this: https://stackoverflow.com/a/14820929 but items in original bindinglist changing (new items added, old ones removed). there way make cells' items automatically updated when "master" binding list changed? you see if filteredobservablecollection fits needs. it's wpf take concept , adapt bindinglists. you can have many filtered wrappers want around single master list , each 1 acts separate list, operating (and notifiying) on subset matches filter supply.

c++ - Explanation of the UB while changing data -

i trying demonstrate work pal can change value of constant-qualified variable if wants (and knows how to) using trickery, during demostration, i've discovered exists 2 "flavours" of constant values: ones cannot change whatever do, , ones can change using dirty tricks. a constant value unchangeable when compiler uses literal value instead of value stored on stack (readed here ), here piece of code shows mean: // test 1 #define log(index, cv, ncv) std::cout \ << std::dec << index << ".- address = " \ << std::hex << &cv << "\tvalue = " << cv << '\n' \ << std::dec << index << ".- address = " \ << std::hex << &ncv << "\tvalue = " << ncv << '\n' const unsigned int const_value = 0xcafe01e; // try no-const reference unsigned int &no_const_ref = const_cast<unsigned int &>(const_valu...

Is it possible to access original function which has been overwritten in python -

this question has answer here: naming conflict built-in function 7 answers i asked add feature code written other guys. there python code defines function overwrites build in open function def open(xxx): ... i access original open function in same python file. the best way change name of self defined open . prefer not change since hug system may have many other files access method. so, there way access build in open if has been overwritten? python 2: >>> import __builtin__ >>> __builtin__.open <built-in function open> python 3: >>> import builtins >>> builtins.open <built-in function open> don't use __builtins__ : from docs : cpython implementation detail: users should not touch __builtins__ ; strictly implementation detail. users wanting override values in builtins namesp...

r - why is chart.CumReturns diff to cumsum? -

i have matrix of returns x assets. i can plot cumulative performance this: pnls.cum<-apply(pnls.allin , 2 , cumsum) plot(pnls.cum[,1],type="l") or chart.cumreturns(pnls.allin[,1]) but graphs subtly different (highs/lows etc) . there reason why? chart.cumreturns uses geometric chaining (a product) default, not arithmetic chaining (a sum). set geometric=false : chart.cumreturns(pnls.allin[,1], geometric=false)

python - grid search cross-validation on SVC probability output in sci-kit learn -

i'd run grid search cross-validation on probability outputs of svc classifier. in particular i'd minimize negative log likelihood. documentation seems gridsearchcv calls predict() method of estimator passed , predict() method of svc returns class predictions not probabilities ( predict_proba() returns class probabilities). 1) need subclass svc , give predict() method returns probabilities rather classes accomplish log likelihood cross validation? guess need write own score_func or loss_func ? 2) cross-validating on negative log likelihood dumb? i'm doing b/c dataset is: a) imbalanced 5:1 , b) not @ separable i.e. "worst" observations have > 50% chance of being in "good" class. (will post 2nd question on stats q&a) yes, would, on both accounts. class probsvc(svc): def predict(self, x): return super(probsvc, self).predict_proba(x) i'm not sure if work since majority class may still dominate log-like...

c# - OleDb return Date Column value with time -

Image
i have excel file(.xls) contain date column without time value. trying read file , put in datatable connection string below: provider=microsoft.jet.oledb.4.0;data source=c:\users\test\desktop\1.xls; extended properties="excel 8.0;hdr=yes;imex=1;importmixedtypes=text" excel file data oledb return datem value time. 7/20/1995 12:00:00 am datatable data but want datem column value without time. have idea have solve problem. thanks. .net framework's datetime consist of date , time. can't separate time part datetime , instead can use custom format displaying records. string str = datetime.today.tostring("mm/dd/yyyy");

delphi - How do i detect new columns added to a list-view control? -

i writing component descends tlistview, , want know when developer using component adds column can react. how can detect when new column added? there event? there no such event, since component writer, events off-limits anyway. events developers using component. columns added sending control lvm_insertcolumn messages. override message handler in descendant control: procedure lvminsertcolumn(var msg: tmessage); message lvm_insertcolumn; implement call inherited handler, , whatever want. procedure tlistviewdescendant.lvminsertcolumn(var msg: tmessage); begin inherited; // todo: custom handling end;

donations - Paypal how can I know which user donated? -

in site added donate button, generated paypal. when clicked, user redirected paypal. then, might or might not donate me. however, if does, want add him , amount donated database. there way can that? you use ipn trigger post database information.

c# - App Domain Refresh Solution: AppFabric, how is the performance -

we facing problems due high amount of cached objects. cache data erp system (for online shop) , iis refresh webpage reaches maximum amount of memory , loose cashed objects. makes idea of caching little bit problematic searching solution cache objects different solution. i have found appfabric microsoft included our windows server licenses pretty neat solution. how ever still fear have enormous performance problems when using appfabric velocity instead of memorycache class (our current solution caching). so question now, solution our problem or over-thinking here , performance of appfabric fast enough? grid dynamics did great report on using appfabric here . while don't know numbers specific cache operations, report showed great numbers performance wise appfabric. in 1 test, wanted see how size of cache impacted cache operations performance. when reading data, had little no impact on cache operations performance. when updating, there impact on cache operations per...

php - Query doesn't insert medium/large text -

i have pretty awkward problem query won't insert medium/large texts. when try example insert/update database records tester works, when try insert/update 4 lines of text, doesn't (won't give me error either). strange part process 2 'lorem ipsum' paragraphs. my query looks (for insert): $ncp_id = $defaults->query("insert ".$table[0]." (p_id, p_title, p_date, p_desc) values ('','".$_post['p_title']."','".$_post['p_date']."','".$_post['p_desc']."')"); $defaults->query("insert ".$table[2]." (ncp_id, ncp_client_id, ncp_project_id) values ('','".$_post['c_name']."','".$ncp_id."')"); my database field text type. all post data legit. when print these, see texts should inserted i don't have more information, or code. i'm hoping heard of simular problem before. ...

java - Issues to get end DayLight Saving time -

i trying check daylight saving time, using timezone. dst start on 10 march 2013 @ 2:00am , end on 3 november 2013 @ 2:00am. have forward clock 1 hour @ 2:00am , when end have clock 1 hour @ 2:00am. wanted check how time actual time @ 2:00am when dst end. working fine start of dst end of dst not working. here sample of code have tried: timezone.setdefault(timezone.gettimezone("america/los_angeles")); calendar cal =calendar.getinstance(); if (timezone.getdefault().usedaylighttime()) { for(int = 0; i< 5 ; ++i) { cal.set(2013,10,03,1,57+i,60); long timemillis = cal.gettimeinmillis(); setcurrenttimeinmills(timemillis); string formattime = dateformated(timemillis); system.out.println(formattime); } } output like: 03-11-2013 01:58:00 pst 03-11-2013 01:59:00 pst 03-11-2013 02:00:00 pst 03-11-2013 02:01:00 pst 03-11-2013 02:02:00 pst my java version :1.6.0_16. here datformated() user-define function view time in readable format , setcurrent...

ggplot2 - R Shiny multiple tabPanel in tabsetPanel not loading -

i have used tabsetpanel in ui.r , each tabpanel there specific plot. plots not require user input rendered. first tab loaded. when switch tabs, blank, , have click on submit button graph load. want load graph when switch tabs. how do that? below server.r code server.r library(shiny) library(ggplot2) anc_data <- read.csv("anc_indicator.csv", header = true) shinyserver(function(input, output) { output$pieplot <- renderplot({ # generate pie chart totals grouping of each indicator totals<-tapply(anc_data$total,anc_data$indicator,sum) graphdatapie <- as.data.frame(totals) indicators <-rownames(graphdatapie) c <- ggplot(graphdatapie, aes(x=indicators,y=totals,fill = totals),environment=environment()) + geom_bar(width = 1,stat="identity") print(c + coord_polar(theta = "y")) }) output$histplot <- renderplot({ # generate histogram totals grouping of each indicator indicatortotals <- ta...

Installing GitHub for Windows -

i'm trying install github windows. tried installing normal way , got error: application installation did not succeed. cannot locate application files on server. contact application vendor or administrator assistance. clicking on details... gave me this: platform version info windows : 6.1.7601.65536 (win32nt) common language runtime : 4.0.30319.18034 system.deployment.dll : 4.0.30319.17929 built by: fx45rtmrel clr.dll : 4.0.30319.18034 built by: fx45rtmgdr dfdll.dll : 4.0.30319.17929 built by: fx45rtmrel dfshim.dll : 4.0.41209.0 (main.041209-0000) sources deployment url : http://github-windows.s3.amazonaws.com/github.application server : amazons3 application url : http://github-windows.s3.amazonaws.com/application%20files/github_1_0_47_0/github.exe.manifest server : amazons3 identities deployment identity...