Posts

Showing posts from January, 2013

d3.js - How to make pandas python render with d3 and leaflet.js -

i'm newbie desperately trying develop workflow between pandas in python , d3 improve visualisation skills. can explain how access columns of data in d3? my effort is: http://jsbin.com/pizakerove/edit?html,output i've managed munge pandas dataframe to_json method orient="index" shape need. i'm trying add lat/long points leaflet.js map using d3 using mike bostock's tutorial - http://bost.ocks.org/mike/leaflet/ excuse weakness javascript. understand need use accessor function access columns of data, i'm lost how this. i can see how once can access fields of data might able lever d3 create map , separate bar chart. can explain i've got wrong or @ least provide simple pathway me head around d3? i managed fix using 'orient' parameter of 'records' instead of 'index'. i used block http://bl.ocks.org/d3noob/9267535 working map.

spatial - Problems is projecting LON/LAT data in R -

Image
i have dataframe contains pm10 concentration in air on seoul(capital city) in korea. please, take look. want plot semivariogram data set. lat/lon data here, in degree have project data. have projected data in way: library(rgdal) seoul3112 <- read.csv("seoul3112.csv", row.name=1) seoul3112 <- na.omit(seoul3112) coordinates(seoul3112) <- ~lon+lat proj4string(seoul3112) <- "+proj=longlat +datum=wgs84" seoul3112 after projecting got seoul311 below coordinates pm10 1 (126.976, 37.56464) 42 2 (127.005, 37.57203) 37 3 (127.0051, 37.54031) 46 4 (127.0957, 37.54464) 47 5 (127.0411, 37.54311) 46 q1: found after projecting, value of lon/lat show same value previous data frame. question whats actual function of proj4string(seoul311) = "+proj=longlat +datum=wgs84" command. here, lon/lat(degree) transferred km/m or that? i tried write code using rgdal package below: proj4string(seoul3112) <- "+proj=

winsock - Sockets using GetQueuedCompletionStatus and ERROR_MORE_DATA -

i trying use getqueuedcompletionstatus winsocks, can't seem right. procedure follows: void foo() { ... socket sck = wsasocket(af_inet, sock_dgram, 0, null, 0, wsa_flag_overlapped); .... bind(sck,(struct sockaddr *)&addr,sizeof(struct sockaddr_in)); handle hport = createiocompletionport((handle)sck, null, 0, 0 ); overlapped poverlapped = {0,}; wsarecvfrom(sck,null,0,null,null,(struct sockaddr *)&laddr,&lsize,&poverlapped,0); bool breturn = getqueuedcompletionstatus( hport, &rbytes, (lpdword)&lpcontext, &poutoverlapped, infinite); ... } i send network data bound port external tool. getqueuedcompletionstatus returns false, , getlasterror() returns error_more_data, sounds correct, since hadn't provided buffer in wsarecvfrom. the question how can provide buffer data failed i/o operation? i tried issue wsarecvfrom original overlapped structu

r - Covariance matrix not positive definite -

i'm trying solve portfolio optimization problem quadprog library, solve.qp function returns this: matrix d in quadratic function not positive definite! but, i'm defining dmat as: dmat <- cov(diff(as.matrix(na.locf(prices)))) how can turn dmat in positive definite matrix? thanks help. discovered cov.shrink function corpcor library, , i'm defining dmat as: cov.shrink(diff(as.matrix(na.locf(precos_mes)))) which works positive definite matrix.

google cloud bigtable - Is there an upper limit for the length of row keys? -

i want know whether there's maximum length row key values in google's bigtable. i'm aware documentation recommends hashing potential solution create keys of same length, in scenario can group related data better if include file path in key. in cloud bigtable: the maximum length row keys 4kib. the maximum length column qualifiers 16 kib. we've added official documentation here: https://cloud.google.com/bigtable/docs/schema-design

How to change project build target in Android Gradle project -

Image
i have project needs ported in gradle build, have done of work not able change target sdk build, since application heavily dependent on third party sdk. present in addons directory of sdk manager. here eclipse project structure project build target in eclipse is the gradle project structure build.gradle in app directory apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.name.appname" minsdkversion 15 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) //compile 'com.android.support:appcompat-v7:22.2.1

big o - Big o notation work -

i new in time complexity using big-o notation have 3 examples , tries figure out big(o) first example sum = 0; for(i=0; i<m/3; i++){ system.out.println(“*”); for(j=0; j<n; j++) for(k=0; k<10; k=k+2) sum++; } i think 1 o(mn), first loop works m/3 times, second loop works n times, third loops works 10 times o(mn) second example sum = 100; for(i=0; i<n; i++){ sum++; } for(j=10; j<n; j++) for(k=1; k<m; k*=2) sum++; big-o = o(log(m)), number of operations executed being n + ( (n - 10) * log(m) ) third example sum = 0; for(i=2; i<n; i++){ for(j=3; j<n; j+=2){ sum++; }} for(k=1; k<m; k*=2) sum++; here think big-o = log(m)n^2 ??? is correct??? here is: o(m/3 * n * 5) = o(mn * c) = o(mn) o(n + (n - 10) * log(m)) = o(n*log(m)) o((n-2)*(n-3)/2 + log(m)) = o(n 2 + log(m)) = o(n 2 ) next time, please, format code blocks defined braces clearer. in 3. o(n 2 + log(m)) → o(n 2 ) because f(x) = x 2

javascript - get a variable from php using ajax/jquery -

this code doesn't work me ! want display variable $nom in notification using uikit . here php file (verif1.php) : <?php $imei = $_get['imei']; $region = $_get['region']; $numero = $_get['numero']; $nom = $_get['nom_client']; $servername = "localhost"; $username = "root"; $password = ""; $dbname = "test"; /* <input type="hidden" id="nom" value="valeurdemariable"> </input> */ try { $conn = new pdo("mysql:host=$servername;dbname=$dbname", $username, $password); // set pdo error mode exception $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception); $sql = "insert client ( nom_client,imei,numero ) values ('$nom',$imei,$numero)"; // use exec() because no results returned $conn->exec($sql); echo "new record created pour "."$nom"; echo json_encode(array('nom' =&g

mysql - How to update case of field with FK constraint to it -

i looking standardize fields in database. how following, field has fk constraint it: in django: platform.objects.filter(name='itunes').update(name='itunes') # gives fk error in mysql: update main_platform set name='itunes' name='itunes' # cannot delete or update parent row: foreign key constraint fails (`avails`.`main_credit`, constraint `main_credit_ibfk_3` foreign key (`platform_id`) references `main_platform` (`name`)) what solution this? please note i'm not looking add additional fields, such id field, fk never change, i'm interested in updating existing field. the current table have platform is: create table `main_platform` ( `name` varchar(20) not null, `guid` varchar(40) default null, primary key (`name`), key `guid` (`guid`) ) engine=innodb default charset=utf8; this looks more of sql problem anything. you have name primary key, if try update directly when there rows in linked tables referencing it,

broadcastreceiver - Holding music service during call Android Programmatically -

Image
i building music player , able play music in background through music service. problem arises when receive call service still running in background. want hold music service during call. reference stopping & starting music on incoming calls i try creating receiver got error phonereciever.java public class phonereceiver extends broadcastreceiver{ telephonymanager telmanager; context context; @override public void onreceive(context context, intent intent) { // todo auto-generated method stub this.context=context; telmanager = (telephonymanager)context.getsystemservice(context.telephony_service); telmanager.listen(phonelistener, phonestatelistener.listen_call_state); } private final phonestatelistener phonelistener = new phonestatelistener(){ @override public void oncallstatechanged(int state, string incomingnumber) { // todo auto-generated method stub try { switch (state) { case telephonymanager.ca

c++ - Algorithms for eye gaze (eye-direction) in OPENCV -

i need implement algorithm eye gaze know direction of eye using opencv , i have been struggling 1 month using viola-jones algorithm training classifiers provided opencv in first step based research starting facedetection.cpp xml's face , eye , can detect faces , eye < 1m haven't found method know eye direction now after research , i've found algorithms eye-gaze don't wich 1 chooose in term of simplicity (because i'm newbie) , efficiency : distance-threshold algorithm mean-shift algorithm edge detetction ==> hough transformation the longest line scanning occluded circular edge matching “one-circle” , "two-circle" algorithm neural network based approaches principal component analysis (pca). starburst algorithm kalman filter velocity threshold eye movement identification active appearence model (aam) ccl : connected component labeling algorithm cca : colonial competit

node.js - compile error for node-expat.cc (part of the thing system) -

i'm trying cross compile tts (which js application node.js) arm platform. have nodejs compiled , installed fine, however, when try compile tts system, following: ../node-expat.cc:54:34: error: 'arguments' not name type static handle<value> new(const arguments& args) i've googled , found posts suggestions (install older nodejs, update npm's bundled node-gyp), no 1 has bothered explain cause of problem is. regardless, suggestions not seem have effect. know arguments supposed come from, , why it's not showing on system?

go - Read multiple time a Reader -

i have 2 http handlers use same http.responsewriter , *http.request , read request body this: func method1 (w http.responsewriter, r *http.request){ var postdata database.user if err := json.newdecoder(r.body).decode(&postdata); err != nil { //return error } } func method2 (w http.responsewriter, r *http.request){ var postdata database.user //this read gives (of course) eof error if err := json.newdecoder(r.body).decode(&postdata); err != nil { //return error } } because of need keep these 2 methods separated, , both of them need read request body, best way (if it's possible) seek request body (which readcloser, not seeker?). actually, miku, i've found out best solution using teereader, changing method1 in way func method1 (w http.responsewriter, r *http.request){ b := bytes.newbuffer(make([]byte, 0)) reader := io.teereader(r.body, b) var postdata mystruct if err := json.newdecoder(reader).deco

html - Horizontally scrollable svg element? -

Image
i place svg image in middle of webpage: the image should shown partially horizontally - ex., 1/3 of image should shown initially, user should able scroll horizontally (to see remaining 2/3 part). how should achieve that? (it should work in mobile browsers also). just in case important - use material design lite framework. upd. should possible scroll mouse/tap , scroll bar should hidden. see demo @ jsfiddle.net/and7ey/plf5namm/embedded/result/. use overflow-x . svg { overflow-x: scroll; }

javascript - Getting This webpage is not available response when starting up node.js server -

i'm beginner @ node.js, , don't know i'm doing wrong when trying access server. here things wrote in cygwin start server: 1) npm install http-server -g 2) http-server now, access server @ http://0.0.0.0:8080 , isn't working; gives "this webpage not available" error. can tell me i'm doing wrong? please, don't hesitate ask more information if necessary. start http-server -a 127.0.0.1 , try accessing http://127.0.0.1:8080 or http://localhost:8080 0.0.0.0 not default , doesn't work on windows.

jmx - Negative count in ActiveMQ pending message -

i monitoring activemq using jmx . using below link activemq summary http://localhost:8161/api/jolokia/read/org.apache.activemq:type=broker,brokername=localhost/brokerid,totalenqueuecount,totaldequeuecount,totalconsumercount,totalmessagecount,totalconnectionscount,totalconsumercount,totalproducercount,memorylimit,memorypercentusage,storelimit,storepercentusage at time t1 i sending 100 message activemq didn't dequeue message.now summary likes below { "timestamp" : 1437996108, "status" : 200, "request" : { "mbean" : "org.apache.activemq:brokername=localhost,type=broker", "attribute" : ["brokerid", "totalenqueuecount", "totaldequeuecount", "totalconsumercount", "totalmessagecount", "totalconnectionscount", "totalconsumercount", "totalproducercount", "memorylimit", "memorypercentusage", &

c# - Why can't I use CapturePhotoToStreamAsync from a System.Threading.Timer call back in WPF? -

i have code in winforms application i'm using winrt mediacapture object take picture device's camera. code executed in system.threading.timer call back. i'm trying move code wpf i'm running problems. when try execute mediacapture.capturephototostreamasync timer's callback in wpf, receive following exception: a first chance exception of type 'system.exception' occurred in myassembly.dll additional information: request invalid in current state. started i can create loop execute method 1000 times , work, however, bombs if method called within timer callback. so clarify, code work in winforms in timer callback code bomb in wpf in timer callback code work in wpf if it's not executed in timer callback.. i suspect issue has thread it's executing on, however, i've tried use dispatcher no avail. here method called: public async task capturephoto(int width, int height) { thread.sleep(100); var jpgproperties = ima

sonatype - Nexus artifact delete command -

i have uploaded artifact sonatype nexus command line using maven/maven/bin/mvn -x -e deploy:deploy-file -durl= http://maven-nexus.com/nexus/content/repositories/xyz -drepositoryid=xyz -dgroupid=com.kumar -dartifactid=peshu -dversion=1.0.12 -dpackaging=war -dfile=right.war now delete version (1.0.12) command line can automate process, command can use instead of curl. short anwser: curl --request delete --write "%{http_code} %{url_effective}\\n" --user login:password --output /dev/null --silent http://maven-nexus.com/nexus/content/repositories/xyz/com.kumar/peshu/1.0.12 this delete hole gav nexus. note: the --write "%{http_code} %{url_effective}\\n option return http code , effective url used; idem --output /dev/null --silent hide verbose informations on output,... i not quite sure, think need user login admin rights on nexus.

jquery - Why do I get this error? TypeError: $popover.data(...) is undefined -

what causing error onhover? error is: typeerror: $popover.data(...) undefined. $(function () { var overpopup = false; $('[rel=popover]').popover({ trigger: 'manual', placement: 'bottom' // replacing hover mouseover , mouseout }).mouseover(function (e) { // when hovering on element has popover, hide // them except current 1 being hovered upon $('[rel=popover]').not('#' + $(this).attr('id')).popover('hide'); var $popover = $(this); $popover.popover('show'); // set flag when move button popover // dirty way think of prevent // closing popover when navigate across // white space between 2 $popover.data('popover').tip().mouseenter(function () { overpopup = true; }).mouseleave(function () { overpopup = false; $popover.popover('hide'); }

xaml - Can a XML namespace name be something other than an HTTP URI? -

the way understand it, xml namespace name can valid uri; however, seems they're always uris http:// scheme. rule, guideline, convention? can use urn:foo:bar instead? here's specific usage scenario: want define xml namespace library of mine, make usage easier in xaml. use url of github repository, if project's home ever changes, namespace name become obsolete url (and if change it, break existing code). i'm thinking of using uri urn:myname:myproject instead. is acceptable practice? if not, way handle fact project's home might change, making url obsolete? "can xml namespace name other http uri?" sure can. official documentation of 'namespaces in xml' mention criteria of namespace identifier, , in same place mention urn , url possible candidates task : the namespace name, serve intended purpose, should have characteristics of uniqueness , persistence . not goal directly usable retrieval of schema (if exists). example

c++ - How to get the accurate length of a std::string? -

i trimming long std::string fit in text container using code. std::string appdelegate::gettrimmedstringwithrange(std::string text, int range) { if (text.length() > range) { std::string str(text,0,range-3); return str.append("..."); } return text; } but in case of other languages hindi "हिन्दी" length of std::string wrong. my question how can retrieve accurate length of std::string in test cases. thanks assuming you're using utf-8, can convert string simple (hah!) unicode , count characters. grabbed example rosettacode . #include <iostream> #include <codecvt> int main() { std::string utf8 = "\x7a\xc3\x9f\xe6\xb0\xb4\xf0\x9d\x84\x8b"; // u+007a, u+00df, u+6c34, u+1d10b std::cout << "byte length: " << utf8.size() << '\n'; std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> conv; std::cout << "character

MongoDB aggregation $out step: store data in another database -

i'm building new big data project , using mongodb operational database. use pentaho kettle run etl processes , cleans de data. in step of etl make mongodb aggregation pipeline next operators in order: {$unwind: '$metrics'}, {$match:{'metrics.event.name': 'hover', 'observationtime':{ $gte:{ $date:"${data}" } } } }, { $project : { '_id': 0, 'remotelocation':1, "remoteip":1, "language" : 1, "observationtime" : 1, "device" : 1, "session_id" : 1, "user_id" : 1, "metrics" : 1, } }, { $out: "hover_tmp"} my problem query executed on replica database, cannot write there , that's $out in final step. a posible solution spe

javascript - See the values inside a object literal in chrome devtools . -

i playing around jbox.js , espically tooltip functionality of particular plugin , click on tooltip following code executed: this.pointer = { // "position" "bottom" in scenario. position: (this.options.pointto != 'target') ? this.options.pointto : this._getopp(this.outside), // "xy" "y" in scenario. xy: (this.options.pointto != 'target') ? this._getxy(this.options.pointto) : this._getxy(this.outside), align: 'center', offset: 0 }; (ofcourse alot more lines of code executed , interested in lines of code.) if check source in chrome , open jbox.js file above snippet on 575th line, link here . now if check object literal, when script gets executed , possible see in source tab in chrome actual values of position , xy ? 1 , question. i know possible function, i.e. if have function, can set breakpoint , line of code gets executed see in source values of parameter's . can same acheived snippet

php - FACEBOOK SDK v4 is returning blank email adress -

i'm using facebook sdk v4 , can't seem email address. here code. have searched each , every link on internet , tried every thing. tried different scripts still i'm getting null email. here code. /* inclusion of library files*/ require_once( 'lib/facebook/facebooksession.php'); require_once( 'lib/facebook/facebookrequest.php' ); require_once( 'lib/facebook/facebookresponse.php' ); require_once( 'lib/facebook/facebooksdkexception.php' ); require_once( 'lib/facebook/facebookrequestexception.php' ); require_once( 'lib/facebook/facebookredirectloginhelper.php'); require_once( 'lib/facebook/facebookauthorizationexception.php' ); require_once( 'lib/facebook/graphobject.php' ); require_once( 'lib/facebook/graphuser.php' ); require_once( 'lib/facebook/graphsessioninfo.php' ); require_once( 'lib/facebook/entities/accesstoken.php'); require_once

c# - GET table's description in SQL Server -

this question has answer here: c# - how ms_description field table schema? 4 answers i want ms_description table for have columns: select sc.name, sep.value [description] sys.tables st inner join sys.columns sc on st.object_id = sc.object_id left join sys.extended_properties sep on st.object_id = sep.major_id , sc.column_id = sep.minor_id , sep.name = 'ms_description' st.name =@tablename i have @tablename parameter there thanks try - use minor_id = 0 table's description (not columns): select t.name, sep.* sys.tables t inner join sys.extended_properties sep on t.object_id = sep.major_id sep.name = 'ms_description' , sep.minor_id = 0 -- not column - table's description

returning value item (not text item) in combobox.text [wpf C#] -

Image
i have created custom class comboboxitem takes text/value , function return string. public class comboboxitem { public string text { get; set; } public object value { get; set; } public override string tostring() { return text; } } i populate item , added combobox . comboboxitem item = new comboboxitem(); item.text = result.codealias + " | " + result.description; item.value = result.codealias; combobox.items.add(item); and combobox shows both codealias + description in each item. i'm trying return codealias in content of box once user selects item instead of whole text i tried following on selectionchanged of combobox . combobox.text = (combobox.selecteditem comboboxitem).value.tostring(); and combobox.selecteditem = (combobox.selecteditem comboboxitem).value.tostring(); and program crashes error: object reference not set instance of object. i put breakpoint , gets value doesn't set it. ideas ho

How to handle Android power button events? -

i want create android application opened in background when power button pressed twice. i want know how can handle power button , choose happens when user press power button? just have in safety apps sends sos messages on number of power key presses. first need add following permission manifest file : <uses-permission android:name="android.permission.prevent_power_key" /> it has 2 methods onkeydown() , onkeylongpress() @override these 2 methods performing actions.

node.js - Firebug identified xpath not working in protractor -

firebug identified xpath not working in protractor.i ahve cretaed xpath using firebug.when identify xpath using ide,it working fine.however when use same xpath in protractor,it not working.my element not have id or name.so here can use xpath option. please find below image reference. here need verify whether particular element has "irctc attractions" text. could please me? html code: //div style="width:100%;" class="g_hedtext">irctc attractions /div ok, looking @ error message (in comment): exception loading: syntaxerror: c:\users\xxxx\appdata\roaming\npm\tc_model2.js:7 var disclaimermessage = element(by.xpath('//[@id='disclaimer-message']')); ^^^^^^^^^^ unexpected identifier (i'm guessing carets before "unexpected identifier" aligned. right?) the problem you've used single quotes both delimit string 'disclaimer-message' , , delimit who

matlab - What does selecting the largest eigenvalues and eigenvectors in the covariance matrix mean in data analysis? -

Image
suppose there matrix b , size 500*1000 double (here, 500 represents number of observations , 1000 represents number of features). sigma covariance matrix of b , , d diagonal matrix diagonal elements eigenvalues of sigma . assume a eigenvectors of covariance matrix sigma . i have following questions: i need select first k = 800 eigenvectors corresponding eigenvalues largest magnitude rank selected features. final matrix named aq . how can in matlab? what meaning of these selected eigenvectors? it seems size of final matrix aq 1000*800 double once calculate aq . time points/observation information of 500 has disappeared. final matrix aq , value 1000 in matrix aq represent now? also, value 800 in matrix aq represent now? i'm assuming determined eigenvectors eig function. recommend in future use eigs function. not computes eigenvalues , eigenvectors you, compute k largest eigenvalues associated eigenvectors you. may save computational overhead

mysql - Formatting json to geojson via PHP -

Image
i trying data have called mysql database correctly display in geojson format. here's of php code: $data = array(); //setting empty php array data go if($result = mysqli_query($db,$query)) { while ($row = mysqli_fetch_assoc($result)) { $data[] = $row; } } $jsondata =json_encode($data); $original_data = json_decode($jsondata, true); $coordinates = array(); foreach($original_data $key => $value) { $coordinates[] = array($value['latitude'], $value['longitude']); } $new_data = array( 'type' => 'featurecollection', 'features' => array(array( 'type' => 'feature', 'properties' => array('time' => $value['time']), 'geometry' => array('type' => 'point', 'coordinates' => $coordinates), ), ), ); $final_data = json_encode($new_data, json_pretty_print); print_r($final_data); i've managed results far:

real time - gstreamer - How to reduce streaming delay? -

i developing video chat application , need realtime streaming audio , video in sync. did...... video encoding x264 encoder , decoding audio encoding lamemp3 encoder , decoding mpegts muxing , demuxing my sender command: gst-launch-1.0 -e mpegtsmux name="muxer" ! udpsink host=172.20.4.19 port=5000 v4l2src ! video/x-raw, width=640,height=480 ! x264enc tune=zerolatency byte-stream=true ! muxer. pulsesrc ! audioconvert ! lamemp3enc target=1 bitrate=64 cbr=true ! muxer. rtph264pay my reciever command: gst-launch-1.0 udpsrc port=5000 ! decodebin name=dec ! queue ! autovideosink dec. ! queue ! audioconvert ! audioresample ! autoaudiosink however getting delay of more 1 second. causing delay (assuming did enherintly wrong)? , how minimize it?

wcf - Trouble connecting to API -

i new wcf/apis , know little nothing security. let me know if need provide more information. i trying connect service using <system.servicemodel> <bindings> <basichttpbinding> <binding name="basichttpbinding_isalesorderservice"> <security mode="transport" > <transport clientcredentialtype="basic"></transport> </security> </binding> <binding name="basichttpbinding_idocumentationservice"> <security mode="transportcredentialonly" > <transport clientcredentialtype="basic"></transport> </security> </binding> </basichttpbinding> </bindings> <client> <endpoint address="address1" name="basichttpbinding_isalesorder

ios - Using Object Initializers in Swift to replace AllocWithZone -

i updated xcode xcode 7 beta 4 xcode 7 beta 5 , began have error wasn't present before. being: "allocwithzone unavailable in swift: use object initializers instead." here code error found: public func copywithzone(zone: nszone) -> anyobject { let copy = self.dynamictype.allocwithzone(zone) chartdataset copy.colors = colors copy.label = self.label return copy } what substitute in place of ".allocwithzone" utilizes object initializer instead of obj c component? i used this, , ios charts library works me: let copy=self.dynamictype.initialize() as! chartdataentry

performance - Symfony2: class to compile with OPcache -

in symfony2, in extension file of bundle, possible call: $this->addclassestocompile([class1, ....]) this adds given files cached file classes.php => can improve performances if put here used classes, because php process have find , process 1 file insteaf many. but 5.6 version of php, there opcache can cache files , precompile them. guess symfony part isn't necessary anymore? by using byte code cache php cache classes separately bootstrapped cache file. apc used years achieve this. php5.5 included opcache default handle opcache. apc enabled users add cache items itself, opcache not available users. because of that, apcu split original apc library traditional user caching becomes available > php5.4. more info symfony performance can found in the book's performance chapter . to answer question symfony bootstrap: if use both bootstrap caching , bytecode cache, adding files bootstrap result bigger bytecode cache file. if application has classes (like

php - cakephp Virtual Field in SQL query -

i trying work cakephp virtualfields in cakephp 1.3. sql query follows need day_index (my virtual fields) 'dayofweek(start_date)'. i need rewrite query $data = $this->calendar->query("select *, dayofweek(start_date) day_index, time(start_time) time calendars calendar_category_id =$cal order day_index, time"); into format: $sqlconditions = array("calendar.calendar_category_id"=>$cal); $sqlorderby = array("calendar.day_index", "calendar.time asc"); $sqlparams = array('conditions'=>$sqlconditions,'order'=>$sqlorderby); $data = $this->calendar->find('all',$sqlparams); $this->set('data',$data); so i'm not sure how to/where put or declare virtual field. $fields = $this->calendar->virtualfields['day_index'].'as 'dayofweek(start_date)'; found 2 ways this, not sure if 1 better other. controller edit method $sqlfields = array("

java - how to extract "value" from a table tag using class name with jsoup -

when try extract value of tag using class name within table tag, this: <input class="tgndateinput" type="text" name="txtdate" size="10" maxlength="10" value="2015/08/06"> using jsoup, how can extract date value ("2015/08/06")? here code: system.out.println(table.getelementsbyclass("criteriatext").get(1).getelementsbyattribute("value")); actual table on web page: <table border=0 width=40%> <tr> <td class=criteriatext>date:</td> <td class=criteriatext> <input class=dateinput type=text name=txtdate size=10 maxlength=10 value="2015/08/05"> &nbsp;<span class=textsmall>(yyyy/mm/dd)</span> </td> </tr> </table> you should directly using selector: element txtdateinput = document.select("input[name=txtdate]").first(); string txtdate = txtdateinput.attr("value");

ios - Cannot invoke" 'setViewController' with an argument list of type [AnyObject] -

"cannot invoke" 'setviewcontroller' argument list of type '([anyobject], direction: uipageviewcontrollernavigationdirection, animated: bool, completion: nil)'" i got error in xcode 7 beta 3 @ line of code: self.pageviewcontroller.setviewcontrollers(viewcontrollers [anyobject], direction: uipageviewcontrollernavigationdirection.forward, animated: true, completion: nil) this rest of code: pageimages = nsarray(objects:"screenshot01","screenshot02","screenshot03") self.pageviewcontroller = self.storyboard?.instantiateviewcontrollerwithidentifier("mypageviewcontroller") as! uipageviewcontroller self.pageviewcontroller.datasource = self var initialcontenviewcontroller = self.pagetutorialatindex(0) tutorialpagecontentholderviewcontroller var viewcontrollers = nsarray(object: initialcontenviewcontroller) self.pageviewcontroller.setviewcontrollers(viewcontrollers [any

javascript - Angular1.3: Access functions from standard controllers, inside a view which uses controllerAs? -

i have simple controller defined in main app.js file, controls opening/closing of navbar , visible on other views of app: app.js: .controller('maincontroller', ['$scope', function($scope){ $scope.menuactive = false; $scope.togglemenu = function(){ $scope.menuactive = !$scope.menuactive; } }]); index.html: <nav class="side-menu" ng-class="{ 'side-menu-open' : menuactive }"> <ul> <li>link1</li> <li>link2</li> </ul> </nav> <!--other views::.....--> <div ui-view></div> all other views(which use controlleras), have button ng-click using access above $scope.togglemenu() function , ng-class, not work, , don't errors either: view1.html : <span class="btn btn-default" ng-click="togglemenu()"> menu </span> view1.js: angular .module('myapp.view1', []) .controller('view1ctr

tfs - Wix in TFSBuild: SourceCodeControlRoot -

i following recommendations integrate wix tfs ( http://wixtoolset.org/documentation/manual/v3/msbuild/daily_builds.html ) (without having install on build server) in wixproj file, have line: $(sourcecodecontrolroot)\wix\3.9\ this has been checked in of prerequisite files - , can build on dev box. but when run build, tfs complains can't find wix.targets file. the error states: *c:\builds\8\appname\dailybuild\sources\setup\case tracking setup\wix case tracking.wixproj (73): imported project "c:\wix\3.9\wix.targets" not found. confirm path in declaration correct, , file exists on disk. so i'm using wrong reference couldn't find other examples , place sourcecodecontrolroot appears related wix. any ideas? thanks the article intends define or replace $(sourcecodecontrolroot) such $(sourcecodecontrolroot) folder tfs exports during build. in case, i'm guessing "c:\builds\8\appname\dailybuild\". of course, don't want hardc

browser - How do #hashes work in URL schemes if they're not part of URL request? -

i'm trying figure out how browsers handle hashes in url requests , page rendering. for example, let's go www.example.com/#footer . when request url browser makes get request www.example.com doesn't have #footer in request. when page loads, browser knows asked #footer , jumps location. what happens in more complex situations when redirect? example, let's 301 redirect www.example.com/birds/#middle . how browser know can jump #middle if hash not part of request url? also how web server know i'm jump particular anchor #hash can serve content #hash ? (like facebook when go 1 section another. #hash anchor tag changes.) they called anchors here definition , examples . once page loaded browser looking "anchor" , moves page there if finds it.

c# - Google Calendar API Targets Incorrect .NET Framework -

i installed latest google api package via nuget package manager in vs2015 using install-package google.apis.calendar.v3 . however, application refuses build properly: the primary reference "google.apis.calendar.v3, version=1.9.2.133, culture=neutral, publickeytoken=4b01fa6e34db77ab, processorarchitecture=msil" not resolved because has indirect dependency on assembly "newtonsoft.json, version=7.0.0.0, culture=neutral, publickeytoken=30ad4fe6b2a6aeed" built against ".netframework,version=v4.5" framework. higher version targeted framework ".netframework,version=v4.0". according using google calendar api v3 .net framework 3.5 , install-package google.apis.calendar.v3 command should automatically instruct package adapt .net framework v4.0 , c# 3.0. why fail here? the calendar api targeted 4.0, its dependency still targeting 4.5. you try use binding redirect target older version of newtonsoft.json still uses .n

javascript - Recursive deferred Filesystem search for images -

i'm trying loop through android file system images. wrote below recursive method, not working. tried use same defer through out recursion i'm unable find condition can recognize end of recursion , return results. getentries: function(path, def, deepcount, results) { var self = this; var deferred = def || $q.defer(); var deepcount = deepcount || 0; var results = results || []; // $cordovadialogs.alert("inside entries"); window.resolvelocalfilesystemurl(path, function(filesystem) { var directoryreader = filesystem.createreader(); directoryreader.readentries(function(entries) { var arraylength = entries.length; // var log = []; // angular.foreach(entries, function(value, key) { // if(key.isdirectory ) // }); // $cordovadialogs.alert("got entries"); (var = 0; < arraylen

c# - Converting docx to html with dotnet-mammoth fails at deploy server -

i'm using dotnet-mammoth ( mammoth.js edge.js ) convert docx document html in .net added project via nuget package . i'm using code provided sample, working correctly in development enviroment (running iis express): var documentconverter = new mammoth.documentconverter(); var result = documentconverter.converttohtml(server.mappath("~/files/document.docx")); // problem here @ production enviroment string theresult = result.value however, once deploy production server, when executed code reaches documentconverter.converttohtml() method, it's redirecting me login page. without displaying error messages, without saving on iis log file. if remove line, else executes normally. assume issue related permissions don't know be. ideas? the latest version of mammoth on nuget no longer uses edge.js, , .net code, should work more reliably.

numbers - How to store pow(10,n) integer values in c where n can be <200? -

#include<stdio.h> #include<math.h> int main(void) { long int n; scanf("%d",&n); n=pow(10,n); printf("%ld\n",n); solve(n); return 0; } you need use double , not long (since 10 80 won't fit in 64 bits long can express numbers below 9223372036854775807 ). read the floating point guide , since difficult subject (notice floating point numbers not same mathematical real numbers ). you might try: #include <stdio.h> #include <stdlib.h> #include <math.h> int main(void) { int n = 0; if (scanf("%d",&n)<1) { perror("scanf"); exit(exit_failure); }; if (n < -256 || n > 256) { fprintf(stderr, "wrong exponent %d\n", n); exit(exit_failure); }; double x = pow(10.0,(double)n); printf("ten power %d %g\n", n, x); return 0; } (i removed call solve did not define; tested success of scanf , range of n ) for la

windows runtime - C#/XAML - DispatcherTimer resolution -

i'm writing windows 10 universal app in c#/xaml. i make use of dispatchertimer class, , i'm wondering what's resolution. i'm doing tests in desktop environment - when set set interval property value less 33 milliseconds seems not affect timer - tick event still fires if interval set 33 miliseconds (around 33 times per second). is behaviour design (you can't fire dispatchertimer more 33 times per second) or depend on app's working environment - device/processor/memory etc. - , environment doesn't support higher timer resolution? although cannot find official documentation anywhere, observing seems make sense. 33 times per second around 30 fps default windows phone 8.1. great know why need such high resolution? check: wpf timer problem… cannot correct millisecond tick