Posts

Showing posts from August, 2013

c - unable to use library build with gobject-introspection in python -

it's first question on stackoverflow. before start i'm sorry poor english i'm developing library "pocketvox". it's aim provide easy way use pocketsphinx (voice recognition) on linux system control it. the main project stored here https://github.com/benoitfragit/pocketvox i've coded in c , want give developers access in python. i've generated .gir , .typelib files. library name pocketvox , every files present i tried load if failed: from gi.repository import pocketvox i've set gi_typelib_path variable in order point folder containing typelib file nothing changed if has knowledge in gobject-introspection c/python, need resolve problem i found myself, ld_library_path not good

asp.net - Cannot Update Entity Using EF 6 - ObjectStateManager Error -

i'm trying update entity using entity framework version 6. i'm selecting entity database so... public t find<t>(object id) t : class { return this._dbcontext.set<t>().find(id); } and updating entity so.. public t update<t>(t entity) t : class { // primary key of entity object id = this.getprimarykeyvalue(entity); // original entry t original = this._dbcontext.set<t>().find(id); if (original != null) { // automatic stuff here (taken out example) // overwrite original property values new values this._dbcontext.entry(original).currentvalues.setvalues(entity); this._dbcontext.entry(original).state = entitystate.modified; // commit changes database this.save(); // return entity new property values return entity; } return default(t); } the getprimarykeyval...

mod rewrite - .htaccess error 500 on RewriteRule -

this line cause 500 error in apache : rewriterule ^(.*)$ /frontend/artist/artist.php?seo=$1 [qsa,l] here htaccess : <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{http_host} ^test\.fr [nc] rewriterule ^(.*)$ http://www.test.fr/$1 [l,r=301] rewriterule ^(.*)$ /frontend/artist/artist.php?seo=$1 [qsa,l] </ifmodule> any ideas why ? that's because you're creating infinite loop error. your rule match , execute on , on. example: http://www.test.fr/this/url/is/cool will rewritten to /frontend/artist/artist.php?seo=this/url/is/cool which rewritten because rule matches without exception. and on... solution to avoid behaviour, can add simple condition (check if it's existing file or not) <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{http_host} !^www\. [nc] rewriterule ^(.*)$ http://www.%{http_host}/$1 [l,r=301] rewritecond %{request_filename} !-f rewriterule ^(.*)$ /frontend/artist/artist.php?seo=$1 [qs...

javascript - Node Jquery Scraping Issue -

i trying run simple scrape on webpage, issue running can't seem bee selecting html elements scraper correctly. thought grabbing attributes correctly <li> , i'm getting undefined value each of object properties. i'm looking grab data-name , data-address , data-url values. scrape.js var request = require('request'); var cheerio = require('cheerio'); request('http://personalsite.com', function (error, response, html) { if (!error && response.statuscode == 200) { var $ = cheerio.load(html); $('li').each(function(i, element){ var li = $(this).contents(); var name = li.attr('name'); var address = li.attr('address'); var url = li.attr('url'); var metadata = { name : name, address : address, url : url }; console.log(metadata); }); } }); html: <li id="v1065" data-name=...

Matrix multiplication in C++ gives Runtime Error -

i'm using following c++ code matrix multiplication , runs fine size = 500. when size = 600 or above code fails. (runtime error) i ran on ideone.com ouputs "runtime error time: 0 memory: 3292 signal:11" and in local machine giving me error #include <cstdlib> #include<iostream> #include <stdio.h> #include <sys/time.h> using namespace std; class timer { private: timeval starttime; public: void start(){ gettimeofday(&starttime, null); } double stop(){ timeval endtime; long seconds, useconds; double duration; gettimeofday(&endtime, null); seconds = endtime.tv_sec - starttime.tv_sec; useconds = endtime.tv_usec - starttime.tv_usec; duration = seconds + useconds/1000000.0; return duration; } static void printtime(double duration){ printf("%5.6f seconds\n", duration); } }; using namespace std; const int size = 600; // size*size matrix void multiplymatricessequential(double a[...

php - Symfony2, difference between isValid() and $this->get('validator') -

i'm new in symfony2 , wish know what's difference of validate form between: $form->isvalid() and $this->get('validator')->validate($form->getdata()) using validation rules in validations.yml thank you! the validator, in case, checks object form bound. form::isvalid() method, besides, checks form status (whether form submitted, whether disabled).

cordova - Phonegap run android gives error -

i trying run basic hello-world app. totally frustrated can't find solution this. wrong? have tried these solutions still no luck. please me :'( c:\apps>phonegap create app3 [phonegap] create called options c:\apps\app3 com.phonegap.helloworld helloworld [phonegap] customizing default config.xml file [phonegap] created project @ c:\apps\app3 c:\apps>cd app3 c:\apps\app3>phonegap local run android [phonegap] adding android platform... creating cordova project android platform: path: platforms\android package: com.phonegap.helloworld name: helloworld android target: android-19 copying template files... running: android update project --subprojects --path "platforms\android" --target android-19 --library "cordovalib" resolved location of library project to: c:\apps\app3\platforms\android\cordovalib updated , renamed default.properties project.prope...

c# - Command - binding from DataGridTemplateColumn -

<datagrid itemssource="{binding occerences}" autogeneratecolumns="false" isreadonly="true"> <datagrid.columns> <datagridtextcolumn header="start index" binding="{binding start}" /> <datagridtextcolumn header="end index" /> <datagridtextcolumn header="length" /> <datagridtextcolumn header="pattern" /> <datagridtemplatecolumn header="sequence"> <datagridtemplatecolumn.celltemplate> <datatemplate> <button content="sequence" command="{binding sequencecommand}" /> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn> <datagridtemplatecolumn header="export"> <datagridtemplatecolumn.celltem...

gcc - Bloomberg python api blpapi3.5.5 install error about missing blpapi_types.h -

attempting install bloomberg python api blpapi3.5.5 results in error: blpapi/internals_wrap.cxx:3110:26: fatal error: blpapi_types.h: no such file or directory compilation terminated. full install log: root@najeeb:/home/najeeb/desktop/pyqt1/blpapi-3.5.5# python setup.py install running install running build running build_py running build_ext building 'blpapi._internals' extension gcc -pthread -fno-strict-aliasing -dndebug -g -fwrapv -o2 -wall -wstrict-prototypes - fpic -i/home/najeeb/desktop/pyqt1/blpapi-3.5.5/include -i/usr/include/python2.7 -c blpapi/internals_wrap.cxx -o build/temp.linux-i686-2.7/blpapi/internals_wrap.o cc1plus: warning: command line option ‘-wstrict-prototypes’ valid ada/c/objc not c++ [enabled default] blpapi/internals_wrap.cxx:3110:26: fatal error: blpapi_types.h: no such file or directory compilation terminated. error: command 'gcc' failed exit status 1 how can fix this? if macos user. try see solution: link . i t...

Straighten image in HTML5 canvas by rotating from the center of the image and zoom -

Image
instagram has great straighten feature https://help.instagram.com/135826209959819 where if straighten image rotate center of image , zoom. rotating in canvas rotates not center(i think 0,0) and zoom zooms towards 0,0 context.rotate(.01) context.scale(2.2, 2.2) do know way force canvas rotate center, zoom towards center? cheers to answer question...you can set desired rotation point using: context.translate(desiredrotationx,desiredrotationy) this causes context.rotate rotate around desired rotation point. but note: proper rotation point of unstraightened image might/might not center of image. depends on original rotation point of original image. perhaps better way of straightening image to: find top-left , top-right corner points of image. determine angle of line connecting 2 points. rotate image negative of angle. example code , demo: var canvas1=document.getelementbyid("canvas1"); var ctx1=canvas1.getcontext("2d");...

encoding - How to use base 64 data with android? -

i try debug android application need decode data. the webview of application http request , receive base64 data. how can decode data ? that base64 encoded data. can decode atob function. assuming encodeddata holds base64 encoded data: var decodeddata = window.atob(encodeddata); atob supported major browsers;

css - Background image no longer filling screen -

this question asked on @ wordpress development concerns more generic css issue asked post here instead. thread, , initial explanation, can seen here . i have background-size: cover image set header of single posts used fill screen, content beginning below. reason, no longer this. background image is scaling fit screen, content below (the text of post) beginning after overlaid text. you can see mean in fiddle . if set #hero-header position:absolute; min-height: 100%; min-width:100%; image fill screen when load page. problem content below runs on top, rather beginning off screen. can suggest solution? to clarify mean 'fill screen', following response below: the div contains background image should fill entire screen when load it. @ moment background image scaling fit screen, #hero-header not forcing content below off page – falling after text element, .hero-text , within instead. this has fixed problem: background image moved html , #hero-head...

math - Saving float as it is using Javascript -

is there anyway save float , preserving decimal place @ same time ? e.g. 1.50 saved 1.50 instead of 1.5. i've tried solution such tofixed, returning me variable of typeof string. i don't think that's possible, have turn string if want preserve zeros.

memory - JBoss 7.1 - Constant heap increase -

i've been tasked analyzing memory consumption issues 1 of our web apps. i'd made myself passibly familiar tools mission control , visualvm , used them resolve number of leaks, in doing came across behavior can't account. setup jboss 7.1.1 as java 1.7.0_67 specifically, i've found when run jboss 7 (that is, turn off deployer , let server run) can see regular allocations (followed garbage collection) of 1mb/3 seconds or so. on whim, took heap dumps after doing gc , once allocations had been going on. seems majority of objects i'm seeing have modules, either xerces activity (reading module xml, guess?) or objects associated moduleloader. majority of objects see have 'references' this: http://i.stack.imgur.com/llumv.png (sorry, can't mark images) my thinking (which may entirely off base) jboss scans new modules support hot deploys? thing though, use case isn't 1 ever use: new deployments involve shutting down server, dynamically scann...

c# - WPF - How to Backup / Restore LocalDB Programmatically - ClickOnce -

i have application uses ef , localdb it's database, published clickonce. it's first time using localdb , don't know how can add feature application backup/restore database programmatically. my app path installed clickonce : c:\users\mahdi rashidi\appdata\local\apps\2.0\nol11tlw.9xg\czm702aq.lpp\basu..tion_939730333fb6fcc8_0001.0002_fd707bbb3c97f8d3 and location database files installed : c:\users\mahdi rashidi\appdata\local\apps\2.0\nol11tlw.9xg\czm702aq.lpp\basu...exe_939730333fb6fcc8_0001.0002_none_8c555c3966727e7f how should backup/restore database? how can keep database safe clickonce further updates? thanks alot :) this did backup , restore of localdb public void backupdatabase(string filepath) { using (tvend2014entities dbentities = new tvend2014entities(basedata.connectionstring)) { string backupquery = @"backup database ""{0}"" disk = n'{1}'"; backupquery ...

Tableau after refresh of data- datatype gets changed everytime -

i'm applying abs (absolute) function number coming in database. once apply report works fine. but, on next refresh- goes showing no values. time i'm required change abs function round. else won't recognize. anyone else has faced same issue? so, happening me that, everytime have refresh make- forced manually change type abs round , vice versa.

multiple values for a filter query as a string type in apache solr -

friends i indexed mysql data apache solr propertyname, id , , location set, when quered shows like { "locality": "mg road - residency rd", "id": "212473", "propertyname": [ "vivanta taj - m g road" ] }, { "locality": "indiranagar - old airport rd", "id": "198732", "propertyname": [ "the leela palace bangalore" ] }, { "locality": "sankey road - palace road - race course", "id": "198402", "propertyname": [ "taj west end" ] }, { "locality": "indiranagar - old airport rd", "id": "366878", "propertyname": [ "matthan hotel" ] }, here locali...

xcode - Why does `ionic run ios` error with "No matching provisioning profile found"? -

Image
my goal run ionic app on iphone. don't figure out reason explaining exception: myionicapp$ sudo ionic run ios check dependencies === build target wealcome of project wealcome configuration debug === check dependencies code sign error: no matching provisioning profile found: build settings specify provisioning profile uuid “dabcc352-0b59-415a-bcd1-6f6ea1d1fbe6”, however, no such provisioning profile found. codesign error: code signing required product type 'application' in sdk 'ios 7.1' i have build settings: the organizer: as mik378 said on comment right destination path of provisioning profiles seems /library/mobiledevice have copy need folder: sudo cp -r ~/library/mobiledevice/ /library/mobiledevice/

javascript - is it possible to execute functions of background page on chrome tabs? -

i'm working on chrome extension needs execute functions on each tabs works on, content security policy in html5 prevents extension append needed scripts websites pinterest . because of update issues, load script website, how load script source " http://mywebsite.com/loader-script.js " , execute on each tab? loading external scripts possible through 2 ways: loading external javascript in google chrome extension this answer question. regards, benedikt

javascript - Do I need to call removeEventListener before removing DOM elements? -

this question has answer here: does javascript remove event handlers of deleted dom elements? 1 answer say, have following html: <div id="mydiv"> </div> where dynamically added child html own click event handler such: document.getelementbyid("mydiv").innerhtml = '<input type="button" id="idbtn" value="+">'; document.getelementbyid("idbtn").addeventlistener("click", onclick); and upon user action on page change removing elements within div such: document.getelementbyid("mydiv").innerhtml = ""; do need call removeeventlistener() on idbtn before that? ps. may recurring operation on single page. insert var element = document.getelementbyid('idbtn'); element.parentnode.removechild(element); before document.gete...

java - how to deploy resource adapter in jboss -

i trying deploy rar packed inside ear. have ra.xml packed inside rar. trying deploy in jboss eap 6.x , below error { "jbas014671: failed services" => {"jboss.deployment.subunit.\"jca-ear-0.0.1-snapshot.ear\".\"shm-jca-file-adapter-0.0.1-snapshot.rar\".install" => "org.jboss.msc.ser vice.startexception in service jboss.deployment.subunit.\"jca-ear-0.0.1-snapshot.ear\".\"shm-jca-file-adapter-0.0.1-snapshot.rar\".install: jbas018733: failed process phase install of subdeployment \"shm-jca-file-adapter-0.0.1-snapshot.rar\" of deployment \"jca-ear-0.0.1-snapshot.ear\" caused by: org.jboss.as.server.deployment.deploymentunitprocessingexception: java.lang.nullpointerexception caused by: java.lang.nullpointerexception"}, "jbas014771: services missing/unavailable dependencies" => ["jboss.deployment.unit.\"jca-ear-0.0.1-snapshot.ear\".d...

jquery - load dialog box before page loads -

when click on 1 of links, dialog box should open shown data should not removed page. please find code here: http://jsfiddle.net/ssly3/50/ please check sample code below: $(document).ready(function () { $('a').click(function (e) { e.preventdefault(); $("#content1").load($(this).attr('href')); }); }); $(function () { $("#dialog").dialog(); }); when click on page3 link, dialog box should open content on , shown data when clicked on home/page1/page2 should not removed page, please suggest. you need put on 3rd "about" link know not process it. e.g. class <li><a href="page4.html" class="about">page 3</a> then code becomes like: $(document).ready(function () { $('a').click(function (e) { e.preventdefault(); if ($(this).is('.about')) { $("#dialog").dialog(); } else { $("#cont...

vmware - Unable to return info on hosts in multiple clusters in PowerShell using PowerCLI -

i have powershell script used return information each host on user specified cluster. user provides vcenter , cluster in parameters , script works expected. i trying modify script user needs pass in vcenter parameter , return information hosts on clusters. here original script have works: param( $vc, $clustername ) add-pssnapin vmware.vimautomation.core connect-viserver $vc $vmhosts = get-cluster $clustername | get-vmhost | ? { $_.connectionstate -eq "connected" } | sort-object -property name foreach ($vmhost in $vmhosts) { get-vmhoststorage -rescanallhba -vmhost $vmhost | out-null $esx = get-vmhost $vmhost foreach($hba in (get-vmhosthba -vmhost $esx -type "fibrechannel")){ $target = ((get-view $hba.vmhost).config.storagedevice.scsitopology.adapter | {$_.adapter -eq $hba.key}).target $luns = get-scsilun -hba $hba -luntype "disk" $nrpaths = ($target | %{$_.lun.count} | measure-object -sum).sum $deadpaths = $l...

matplotlib FuncAnimation frame interval -

i experimenting matplotbib funcanimation , try exmaples. everthing runs fine, however, produce videos via ffmpeg anim.save(...) , don't animation play faster/slower. neither changing funcanimation(...,interval=x,...) nor anim.save(...,fps=x.) had effect on video output. difference between 2 ('frames'/'fps' should 'interval', no?)? here reduced code: import numpy np import matplotlib.animation animation import matplotlib.pyplot plt class ball: def __init__(self,initpos,initvel,radius,m): self.pos=initpos self.vel=initvel self.radius=radius self.m=m def step(self,dt): self.pos += self.vel*dt self.vel[2] += -9.81*dt*self.m initpos=np.array([5.0,5.0,10.0]) initvel=np.array([0.0,0.0,0.0]) radius=0.25 m=1 test_ball = ball(initpos,initvel,radius,m) dt=1./10 fig = plt.figure() ax = fig.add_axes([0, 0, 1, 1], projection='3d') pts = [] pts += ax.plot([], [], [], 'bo', c=...

angularjs - Incorrect ng-class output Jasmine Test Angular -

i'm testing angular directive use $compile create instance of directive in dom. markup element directive attached uses ng-class expression inside. special characters expression being turned "safe" equivalents. <article my-directive ng-class="(selecteditems.length > 1 && asset.selected === true) ? 'class1' : 'class2'"> </article> looking @ html output $compile in test: 'ng-class="(selecteditems.length &gt 1 &amp&amp asset.selected === true) ? class1: class2"' this valid html :) when $compile() or angular.element() string this <article my-directive ng-class="(selecteditems.length > 1 &amp;&amp; asset.selected === true) ? 'class1' : 'class2'"></article> yo proper html. some play-around issue: http://jsfiddle.net/ulfryk/vzz3x6py/

ASP.NET C# listing directory structure into a listbox -

i want list folders , subfolders , theirs till reaching deepest folder. i have written method this: public void scanfolders(string path) { foreach (var dir in new directoryinfo(path).getdirectories("*", searchoption.alldirectories)) { listbox_folders.items.add(dir.name); } } this brings me folders , subfolders. ok but need little different solution. want list subfolders of folder beneath parent starting hyphen (-). it should <select> <option>folder1</option> <option>-subfolder11</option> <option>folder2</option> <option>-subfolder21</option> <option>-subfolder22</option> </select> what have <select> <option>folder1</option> <option>folder2</option> <option>subfolder11</option> <option>subfolder21</option> <option>subfolder22</option> </select> you...

Is it possible to click on Windows UAC dialog using java.awt.Robot? -

i'm working on custom remote desktop in java using java.awt.robot on windows 7. works apart running command prompt administrator. uac dialog appears, button clicks not accepted on yes button using mousepress() / mouserelease() , neither key presses keypress() / keyrelease() . application launched via launch4j launcher in launcher rather wrap mode. things i've done far disabled secure desktop uac. allowed screen grabber part of application @ least 'see' prompt changed group policy disable promptonsecuredesktop uac group policy settings , registry key settings followed security considerations assistive technologies - has allowed remote desktop interact command prompt once launched not allowed pressing yes button. added manifest launch4j specifying uiaccess=true signed .exe using signtool.exe using self signed certificate generated makecert.exe installed certificate trusted root certificate verified .exe marked trusted via right click properties, di...

java - Android application sends a file to a remote server -

i need in first android application, developed eclipse, upload file in android remote server. to use web service in asp net. the code android developed below, have alert "please select image" when have selected image gallery in smartphone, why? i appreciate can give me in working problem. thank in advance. mainactivity.java import java.io.file; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.io.outputstream; import android.app.activity; import android.app.alertdialog; import android.app.progressdialog; import android.content.dialoginterface; import android.content.intent; import android.database.cursor; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.net.uri; import android.os.bundle; import android.os.environment; import android.provider.mediastore; import android.util.log; import android.view.view; import android.widget.button; import android.widget.imagevi...

arrays - Issue with count() in php -

i have following code block in controller $reportpostcountarray = $this->objusermodel->findduplicatereportpost($payloaddata['user_id'], $payloaddata['post_id']); var_dump($reportpostcountarray); count($reportpostcountarray); var_dump(is_array($reportpostcountarray)); and output above code following: array(1) { [0]=> object(stdclass)#179 (1) { ["post_count"]=> int(1) } } bool(true) please me correct why not getting count value though return array size 1. that want do: var_dump($count($reportpostcountarray)); you not printing count value var_dump() array , return value of is_array() indeed boolean, in case true.

ios8 - Writing/reading to paths with interleaved double dots fails on iOS 8 -

this code fails on ios 8, although work on ios 7 uiimage *imagetest = ... nsstring *file = @"../documents/test.png"; nsstring *fullpath = [[[nsbundle mainbundle] bundlepath] stringbyappendingpathcomponent: file]; [uiimagepngrepresentation(imagetest) writetofile: fullpath atomically: yes]; uiimage *image = [uiimage imagenamed: file]; on ios 8 need use instead nsstring *file = [[nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) objectatindex:0] stringbyappendingpathcomponent:@"test.png"]; [uiimagepngrepresentation(imagetest) writetofile:file atomically:yes]; uiimage *image = [[uiimage alloc] initwithcontentsoffile: file]; ...but have refactor project , third party library works paths relative main bundle. it seems me paths "/pathtomainbundle/myapp.app/../documents/something" either not resolved, or not allowed @ ios 8 that path should same "/pathtomainbundle/documents/something" in ios8, ...

I want to copy data from multiple .xml to a current excel -

i have problem, new vba programming , in dilema. i have folder 20-50 xml files containing test results. want create macro select folder, open each .xml file , copy specific value(s). example in column z have @namerecord , in column aa have data itself. each .xml file has 1 or more data , want copy each data each xml new column in base workbook. want first column have name of file succeded in doing. for record each .xml file when open have choose "open file without applying stylesheet" "ok" press , after have select "as read-only workbook" , press "ok". my code far looks got error 438 "object doesn't support property or method" , shows present " selection.pastespecial paste:=xlpasteall, operation:=xlnone, skipblanks:=true, transpose:=true" i have word 2003. hope can , thank in advance. function lastrow(sh worksheet) on error resume next lastrow = sh.cells.find(what:="*", _ ...

php - Mod rewrite redirect folder to root and use folder as root -

i've move mi site files subfolder , redirect .htaccess need denied direct access folder or subfolder. got in .htaccess: <ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewritecond %{https} !=on rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^ http://%1%{request_uri} [r=301,l] # block access hidden files , directories. # includes directories used version control systems such git , svn. rewritecond %{script_filename} -d [or] rewritecond %{script_filename} -f rewriterule "(^|/)\." - [f] # deny direct access directory or sub-directory rewriterule ^site/(.*)$ / [r=301,nc,l] # not apply redirection these folders/files compatibility rewriterule ^(subdir1|subdir2)(/|$) - [l,nc] rewriterule ^robots.txt - [l,nc] # root sub-directory rewriterule ^(.*)$ site/live/$1 [l,qsa] </ifmodule> when go to: htt://domain.com/site -> htt://domain.com (correct redirecting) htt://do...

Initial orientation of UICollectionView (iOS 8) -

i have ios 8 project (no autolayout) uicollectionview 4 items in arranged horizontally. when start app in landscape mode, collection view still in portrait mode. when device rotated, collection view correctly rotates. willrotatetointerfaceorientation , didrotatefrominterfaceorientation not called initial display. viewdidload , viewwilllayoutsubviews called.

php - Facebook comments count incorrect -

we're using facebook comments on wordpress blog , comment count returned following tag not match actual number of comments on page. <fb:comments-count href=http://example.com/></fb:comments-count> you can see example here comment count returned 168 though there 2 comments on page. the facebook graph api returns correct number of comments url seen here unfortunately using count returned graph api demonstrated in post below disallowed our host wpengine since php.ini setting allow_url_include must set off. <fb:comments-count> not working on wordpress powered blog any ideas on might going wrong or alternative returning correct comment count? the example url mentioned http://www.civilbeat.com/2014/02/21257-gene-park-the-debate-over-race-history-and-racism-in-hawaii/ , whereas code count points to <fb:comments-count href='http://www.civilbeat.com/posts/2014/02/21/21257-gene- park-the-debate-over-race-history-and-racism-in-hawaii/...

What is this word on top of my character vector in R and how do I get rid of it -

i want isolate value in summary of data frame, wrote: > summary(pf$mobile_likes > 0)[2] false "35056" the response command character vector, , can convert integer > typeof(summary(pf$mobile_likes > 0)[2]) [1] "character" > strtoi(summary(pf$mobile_likes > 0)[2]) [1] 35056 still, don't understand why false header shows on top. it, , how can isolate character vector it? your summary vector, , you're seeing there element name. you can wrap call in unname rid of names. > x <- 1:5 > (summ <- summary(x > 2)[2:3]) # false true # "2" "3" > names(summ) # [1] "false" "true" > unname(summ) # [1] "2" "3"

How to test Zend framework2 form which implements CSRF element? -

i have created login form using zend/form , contains input elements csrf element. <!-- sample login.phtml code snippet --> <form method="post" action="/xyz"> <?php echo $this->formelement($form->get('email')); echo $this->formelement($form->get('password')); echo $this->formelement($form->get('csrf')); echo $this->formelement($form->get('submit')); ?> </form> the following testcase fails because of validation against csrf element. public function testlogin() { //code goes here $params = array('email' => 'example@test.com', 'password' => 'example@test.com'); $this->dispatch($url, $method, $params); //if given username , password correct login page redirected default home page $this->assertresponsestatuscode(302); } in above testcase set email , password values don't know how set csrf element. how test form im...

Javascript function defining -

i got script debugging , have no idea following section means. var qns = () => site + status + "\ " let status = "true"; the variable status has not defined before. this javascript 1.7, available on firefox, not on other browsers. var qns = () => site + status + "\ " is equivalent, shorter than: var qns = function() { return site + status + "\n"; } (not sure if newline valid or not). arrow functions on mdn let status = true same var status = true aside scope: declared containing block. example, if (true) { var x = 1; let y = 2; console.log(x); // => 1 console.log(y); // => 2 } console.log(x); // => 1 console.log(y); // => undefined by way, variable status not need declared before line; enough if declared before qns() invoked later. let statement on mdn

r - How can I divide a dataframe on the basis of values in its columns? -

so, have dataframe this, 1 2 110 10 na na 2 3 101 100 na na 3 4 10 na na na 3 2 110 100 101 na ................. now, want divide dataframe individual files 110,10,101,100,10,101.. , each file contains first 2 columns present in it. example, file 110 contain, 1 2 3 2 and file, 10 contain, 1 2 3 4 like this, want divide it. know how divide on basis of column value, since file contains multiple columns, don't know how it? appreciated. the code able make single column , create text files was, x <- split(myfile, myfile[, 4]) invisible(lapply(names(x), function(y) write.table(x[[y]], file = paste0(y, ".txt")))) make dataset in long rather wide form, split it: vals <- apply(dat[3:6], 1, function(x) x[!is.na(x)] ) df <- cbind(dat[1:2][rep(rownames(dat), sapply(vals,length)),], val=unlist(vals)) split(df, intm$val) #$`10` # v1 v2 val #1.1 1 2 10 #3 3 4 10 # #$`100` # v1 v2 val #2.1 2 3 100 #4.1 3 2 100 # #$`1...

Jquery flot - zero value exceeds grid when changing axes direction -

i have problem jquery flot , jquery.flot.symbol usage. render flot using jquery.flot , using additional plugin (jquery.flot.symbol make rectangles on graph). the problem when reverse axes (ox starting right left , oy position right). part generated of jquery.flot.symbol exceeds grid , 0 values somehow outside graph (with other words values moved right) http://jsfiddle.net/5l3eyafn/2/ and relevant part of code var data1 = [ { data: graphdata, bars: { show: true, linewidth: 3, horizontal: false, fillcolor: "#f8e7b3" }, color: "#ffffff" }, { data: trenddata, points: { show: true, line...

An infinite loop while using Scanner - java -

i want ask user whether wants create file named file.elt or not. i'm trying switch statement using scanner class. here code: system.out.println("do want create file.elt? (y/n)"); stroption=sc.nextline(); outer: while (sc.hasnext()) { switch (stroption) { case "y": case "y": elements.createelements(file); break outer; case "n": case "n": system.out.println("there no file.elt created! ."); break outer; default: system.out.println("please, type y or n."); stroption=sc.nextline(); break; } } sc.close(); the sc object declared @ beginning of program, ask name of file. the sc declaration is: st...