Posts

Showing posts from March, 2015

javascript - can a JSON feed be filtered to just show time from timestamp string? -

i remotely retrieving external json feed via jsonp. json feed contains data including start_time , end_time variables in array have time data encoded in "javascript built-in json object , iso8601" this: 2016-01-21t13:00:00+10:00 i want put data in preformatted table (there reason why) , want remove date data , leave time on value (i.e. 13:00). is possible filter/parse entire json data object , convert these timestamp data strings show time before start using data (like preformat run directly on api feed)? example snippet of json data: var response={ "bookings": { "group_id": 12306, "name": "public meeting rooms", "url": "http:theurlfeed.from.libcal", "timeslots": [{ "room_id": "36615", "room_name": "meeting room 2a", "booking_label": "mahjong", "booking_start": "2016-01-20t10:00...

ios - Button won't hide before loop -

i have button attached ibaction supposed hide before loop, never hides. - (ibaction)method:(id)sender { button.hidden = yes; while(...) //button should hidden while control in loop never happens. { } } not sure why isn't working appreciated. you've set hidden property, view doesn't draw right then. must go through iteration of run loop redraw contents. if have long running synchronous task in method, control never returns run loop until method exits, don't see effect of setting hidden property. consider doing task asynchronously. like button.hidden = yes; dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ while (...) { // work here } });

Perl "unlink" function usge with "glob" -

i want delete files "1.1.1.1" ip address in /tmp folder: # ls -1 /tmp 1.1.1.1_reboot.xml 1.1.1.1_roll.xml 1.1.1.1_setup.xml 1.1.1.2_reboot.xml 1.1.1.2_roll.xml 1.1.1.2_setup.xml i referring: unlink , glob here code: #!/usr/bin/perl -w use strict; $dir = "/tmp"; $ip = '1.1.1.1'; unlink glob $dir."/".$ip."*"; however, not deleting files. suspicion on glob function , guess not using in right fashion. could help. thanks. update: if replace $ip ip address itself, deleting files. unlink glob $dir."/"."1.1.1.1"."*"; so, looks unlink statement not able evaluate value of variable $ip . not know why behaving way. need make work $ip , not explicit value. it may retated path. print error more information. try this: #!/usr/bin/perl -w use strict; $dir = "/tmp"; $ip = '1.1.1.1'; chdir $dir; @goners = glob $ip . "*"; foreach $file (...

apache - Any way to find number of times PHP file was used by server? -

i'm working on older server (php 5.2 zend server 5.0.4) previous developer sent boss csv file of files used server (during browser requests) ordered count, i'm unable find in code or server config or stores or generates it, , not seeing documentation it. does php/apache track info anywhere?

Index Error with python code and numpy matrix using spyder -

code used error in indexing import numpy np def generate_y(phi,sigma,y_,t,epsilon): generates math: y_t following :math: y_t = \phi_0+\phi_1y_{t-1}+\phi_2 y_{t-2} + \sigma \epsilon_t inputs ----------- * phi (list or array) : [phi_0,phi_1,phi_2] sigma (float) : :math: \sigma y_ (list or array) : :math: [y_{-1},y_{-2}] t (int) : number of periods simulate epsilon (length t+1 numpy array) : >:math: [\epsilon_0,\epsilon_1,...,\epsilon_t] returns ----------- * y(length t+1 numpy array) : :math:`[y_0,y_1,...,y_t]` ret = np.ones(t+1) ret[0] = phi[0]+(phi[1]*y_[0])+(phi[2]*y_[1])+(sigma*epsilon[0]) ret[1] = phi[0]+(phi[1]*ret[0])+(phi[2]*y_[0])+(sigma*epsilon[1]) in range(2,t+1): ret[i] = phi[0]+(phi[1]*ret[i-1])+(phi[2]*ret[i-2])+(sigma*epsilon[i]) return ret def generate_n_y(phi,sigma,y_,n,t): '''r generates n realizations of y^i_t following :math:`y^i_t = \phi_0+\phi_1y^i_{t-1}+\phi_2 y...

ios - Complex PFQuery -

i'm working on app users can follow each other. on app there leaderboard show users sorted popularity , date. popularity how many people followed each user recently. this list of 10 people i have pfobject called follow. has relationship person , date created. i'm little perplexed how can create query sorts follow object date. example, need sort had followers today. if there one, next person need person new followers yesterday. after may person had votes last week. , on... any suggestions appreciated. read part called query constraints here: https://parse.com/docs/ios/guide#queries it describes how sort queries multiple criteria. if doesn't quite work, store objects in arrays , find highest counts way.

SQL design: many attributes for each row -

i've seen couple of other questions asking similar (notable this one ), i'm after more focused advice on pros/cons of 2 options. i'd find useful if has had experience situation , through experience found 1 of these solutions better other. i'm trying store data on set of events , attributes, each event has multiple attributes, , set of attributes open increase time goes on. we're talking 100+ attributes here. see 2 options here: 1) single table many columns an 'eventtable' 1 column each attribute. example, columns be: eventid, eventname; , attribute columns example waseventgood, dideventfinish, peopleatevent, etc. if add attributes can add columns table. pros: nice view of event , attributes on 1 row. simpler? cons: i've read having many columns in table sign of bad design. insert statement many columns awkward? 2) 'tree' type design multiple tables linked so example: eventtable columns: eventid, eventname attributetable colu...

C# How to I escape 2 lines of loops -

this code: while(true){ for(int x = 0; x < 10; x++){ stringarray[x] = new string(); if(isdead){ break; //break out of while loop } } } how should please, sorry if english good,i still learning. you create bool example: bool leaveloop; and if isdead true set leaveloop true, in while loop check if leaveloop true break it.

ruby on rails - Can .each have different GC impacts compared to .map? -

does 1 of these 2 garbage collect differently, or @ same? array_of_strings.each |str| mailerclass.some_template(str).deliver_later end vs. array_of_strings.map |str| mailerclass.some_template(str).deliver_later end i've formatted question mailer objects , task-queue stuff because it's have been working on recently, if unduly complicate answers can reword more generic. context, relevant: i considered .map return object pointed each object created, , .each not. [this seems not case] i have worker machine leaks memory until crashing — happening in 1 event in pseudo-code example central action. when changed .each .map memory leak stopped, don't know how gc happening in regards these methods. since map returns array of results of evaluating block each member of array_of_strings, there going @ least 1 object collected.

c# - Some items of Parallel.ForEach<T> runs on ThreadPool, some doesn't -

i have simple algorithm this: parallel.foreach(mylist, new paralleloptions() { maxdegreeofparallelism = 4 } ,(job) => job.dosomething()); mylist list<mytype> . mytype has void dosomething() . inside dosomething check thread.currentthread.isthreadpoolthread . threads aren't "threadpooled"; the functions defined in parallel use thread called function 1 of worker threads. non thread pool threads jobs done on thread called parallel.foreach from.

python 3.5 - How to look through post in Reddit with praw -

i've been looking @ documentation praw , cannot find method looking through post. want through post import processingbot import auth import praw setphrases = ["python", "bots", "jarmahent", "is proves there no global warming in 1966", "test"] setphrase = ("this bot, ignore reply") username = auth.pg def run(): r = praw.reddit(auth.app_ua) print("signing in") r.set_oauth_app_info(auth.app_id, auth.app_secret, auth.app_uri) print("setting oauth app info") r.refresh_access_information(auth.app_refresh) sub = r.get_subreddit("processingimages") print("getting subreddit") for: #look through post post finder print("finished") return r while true: run() the formatting little wrong, spaced 4 times , pasted , still didnt work. this covered in example on the documentation front page : >>> import praw ...

compilation - C Error: comparison between pointer and integer [enabled by default] -

i trying learn basic c code, bolster general skills. wrote basic script tells me if number greater or less 10: #include <stdio.h> #include <unistd.h> #include <string.h> int main() { int number; printf("enter integer\n"); scanf("%d",&number); printf("integer entered %d\n", number); if ( "%d" > 10) printf("%d greater 10.\n", number); else printf("%d less 10.\n", number); return 0; } and yet when compile it, error stating i'm trying compare pointer , integer: dave@dave-[laptop]:~/code/c/examples$ gcc 004----takeandif.c -o 004----takeandif 004----takeandif.c: in function ‘main’: 004----takeandif.c:16:14: warning: comparison between pointer , integer [enabled default] if ( "%d" > 10) ^ and when run it, says numbers less 10: dave@dave-[laptop]:~/code/c/examples$ ./004----takeandif enter integer 2 integer entered 2 2 gre...

delete a row on mysql with php issue -

im trying delete row on php (i did it) but, delete last row, know why... because everytime refresh or enter in page, everytime got id = "lastrow", issue is, dont know why everytime got last row id...`$query = "select * ph"; $rs = mysql_query($query); while ($ph = mysql_fetch_array($rs)) { echo utf8_encode(" <tr class='etapastext'> <td > ".$ph['name']." </td> <td> <input type='submit' name='".$ph['id']."' value='eliminar' > <input type='hidden' name='name' value='".$ph['id']."'> </td> "); }` then can access id of item wish delete, use code $query = "delete ph ph.id = '".$_post['name']."'"; mysql_query($query); i'm using $_post['name'] b...

html - Custom Checkbox is Changing Size -

i creating custom checkboxes. hiding standard checkbox , replacing following: .newcheckbox:before { content: ""; display: inline-block; width: 30px; height: 30px; border-radius: 2px; background-color: rgba(29, 190, 96, 0.1); border: 1px solid #1dbe60; } input[type="checkbox"]:checked + .newcheckbox:before { color: #fff; background-color: #1dbe60; content: "\2022"; font-size: 20px; text-align: center; } the issue is, when add 'content', when checkbox in checked state height changes , elements beneath jumping. i've been wracking brain on what's causing this. here's plunk demonstrating issue: http://plnkr.co/edit/kc7xmgr4nogx0w6pmx9y?p=preview you can see when remove 'content', doesn't jump around. add overflow:hidden input[type="checkbox"]:checked snippet here /* styles go here */ input[type="checkbox"] { display: none; } .tech-green:before { ...

codeigniter - Parsing Variable into TCPDF -

my problem : undefined variable test. code : <?php require_once('tcpdf/tcpdf.php'); extract ($datapr); $test = $datapr ['ref_no']; //print_r $test = 'pr/1.2.3.4/ok' class mypdf extends tcpdf { public function footer() { $test; } } ?> problem undefined variable $test inside function footer. can me out? try in side function <?php require_once('tcpdf/tcpdf.php'); class mypdf extends tcpdf { // or rename footer index(); public function footer() { extract($datapr); // print_r $test = 'pr/1.2.3.4/ok' $test = $datapr['ref_no']; echo $test; } } if controller first letter of class name should upper case my_pdf.php , class my_pdf extends tcpdf {}

Value of column, based on function over another column in Matlab table -

i'm interested in value of result in same row min value of each column (and have many columns, loop on them, or rowfun not know how 'result' then). table a +----+------+------+----+------+------+--------+ | x1 | x2 | x3 | x4 | x5 | x6 | result | +----+------+------+----+------+------+--------+ | 1 | 4 | 10 | 3 | 12 | 2 | 8 | | 10 | 2 | 8 | 1 | 12 | 3 | 10 | | 5 | 10 | 5 | 4 | 2 | 10 | 12 | +----+------+------+----+------+------+--------+ solution 8 10 12 10 12 8 i know can apply rowfun, don't know how result. , then, can this, cannot loop on columns: a(cell2mat(a.x1) == min(cell2mat(a.x1)), 7) and have tried several ways of making variable can't make work, that: a(cell2mat(variable) == min(cell2mat(variable)), 7) thank you! assuming data homogeneous can use table2array , second output of min index results: % set table x1 = [1 10 5]; x2 = [4 2 10]; x3 = [10 8 5]; x4 = [...

android - Chaining 2 different async operations that is dependant on the value of an observable -

hi i'm new rxjava , trying wrap head around concepts. need value api, , run 2 more queries api dependent on value. i tried implementing way it's giving me networkonmainthreadexception. there way 'fork' stream, or understanding flawed? appreciated. connectableobservable<value> getsomevaluestream = _api .somehttpasynctask() .map(parsejsonresponse) .subscribeon(schedulers.newthread()) .observeon(androidschedulers.mainthread()) .publish(); getsomevaluestream .flatmap(httpasynctask2stream) .subscribe(); getsomevaluestream .flatmap(httpasynctask3stream) .subscribe(); getsomevaluestream.connect(); my guess want io-scheduler network calls , not main thread. this: .observeon(androidschedulers.mainthread()) should this: .observeon(androidschedulers.io()) remember observeon causes ob...

python - Is the uWSGI master process useful on Heroku? -

my understanding master process coordinating rolling restarts , such. isn't relevant on heroku. however, heroku guide in documentation includes in config, no explanation: http://uwsgi-docs.readthedocs.org/en/latest/tutorials/heroku_python.html#creating-the-uwsgi-config-file why useful on heroku? in instance, master isn't used control rolling restarts, it's memory-report option configuration recommends use. uwsgi , master controls advanced logging , statistics .

javascript - Sum three text fields whose values are controlled by jqueryui sliders -

i have 3 jqueryui sliders output numbers (stored in arrays) 3 text fields (that have css class .add). need 3 text fields summed , total shown in text field (with id #amount) automatically whenever sliders changed. have tried this: <script> var calcprice = jquery.noconflict(); calcprice('.add').change(function () { var sum = 10; calcprice('.add').each(function() { sum += number(calcprice(this).val()); }); calcprice('#amount').val(sum); }); </script> but sums 3 text fields if manually type numbers them. need flexibility change default starting amount (var = sum 10;) whenever needed , have display in #amount field on page load (it not display on page load atm). for ui slider, need use slider change event , value method value jquery(function($) { $('.add').slider({ min: 0, max: 10 }) }); var calcprice = jquery.noconflict(); var baseprice = 10; calcprice('#amount').v...

LESS parent selector chain in list -

can store (ampersand) parent selector chain in list? not (finally) enable (only) immediate parent selector? .parentpart(@n) { // actually, shouldn't "&" string parent selector chain. @part: extract(~"&", @n); @{part} { color: red; } } .a { .b { .parentpart(1); } } for now, output .a .b & { color: red; } but love this .a { color: red; } (or, actually, .b{color:red;} passing 2 if able parent selector chain extract function …

html - IE sometimes requests homepage (site root) at the same time as other page -

my site consists of sequence of form-submits. small number of browsers, less 1% , perhaps ie browsers, request home page @ same time every content page. 1 of problem browsers, typical section of iis logs looks this: 15-mar-13 11:07:39 pm post /content.asp 15-mar-13 11:07:39 pm /mainstyle.css 15-mar-13 11:07:39 pm /images/logo.gif 15-mar-13 11:07:39 pm /images/bar.gif 15-mar-13 11:07:39 pm /images/fill.gif 15-mar-13 11:07:39 pm /images/pbtop.gif 15-mar-13 11:07:39 pm /images/hr.gif 15-mar-13 11:07:39 pm /index.htm 15-mar-13 11:07:39 pm /images/pbbottom.gif the request /index.htm spurious (and causing lot of trouble). (iis logs "/index.htm" when request "/".) because iis logs resolved down full second, , items don't appear in exact sequence, it's hard sure if strange request index.htm being triggered preceding page, or in page loading. my first thought maybe there blank src="" in page somewhere, there isn't, @ l...

How to not overwrite the file, C++ logging -

here code. everytime "save", overwrites old txt file. how can output same file new line or atlas new file. dynamic array , i'm using switch cases. after entering data, want save text file. , load in next time. load function works well. #include<iostream> #include<string> #include<fstream> //to save file in text using namespace std; int main () { int *p1; int size=0; int counter=0; p1 = new int[size]; int userchoice; int i; int position; while(1) { cout << "please enter choice " << endl; cout<<endl; cout << "to insert press '1'" << endl; cout << "to delete press '2'" << endl; cout << "to view press '3'" << endl; cout << "to search press '4'" << endl; cout << "to save press '5'" << endl; cout << "to load saved data press '6'...

javascript - Autoclick on a button in popped up dialog box -

how auto-click on yes or no button on dialog box pops on website? one crude way i'm using set timer trigger click on button if dialog box visible once every 100ms. check following options: for native confirm() or alert() methods, cannot click programatically on buttons dismiss. can closed on user interaction. for html based dialog box (bootstrap modal example), initiate mutation observer listener debounce of 50ms (debouncing allow reduce evaluation calls on bunch of elements added). when modal elements inserted dom, trigger click event on necessary button mutation observer handler.

java - making changes in the lift app in eclipse -

i working lift webframe work integrated eclipse. have downloaded 1 sample app github , i'm trying add more lines it. if error occured in project, localhost:8080 showing errors after have fixed them. after making each changes used stop , start server. error still showing: exception occured while processing / message: java.lang.noclassdeffounderror: not initialize class code.lib.dependencyfactory$ code.snippet.helloworld.date(helloworld.scala:12) code.snippet.helloworld$$anonfun$howdy$1.apply(helloworld.scala:15) ....... ....... ....... i've tried revert changes made me initial state of example project, without luck. what can this?

using COALESCE in mysql to get the shipping charges -

need create sql view calculating commission & shipping charges. shipping charges per item charged on order id level can have multiple order items please have @ image attached. pls note shipping charges @ order id level.and not @ order item id level. order item id column blank shipping charges row.so in order shipping charges need divide no of items in order order item id no of items in order, each order id can have 1 or multiple order item id's image of view required sql fiddle schema select main.order_id, main.order_item_id, coalesce(p.a,0) + coalesce(c.a,0) - (coalesce(s.a,0) / main.c) price (((select order_id, order_item_id, count(*) c main group order_id, order_item_id) main left outer join (select amount main description='principal') p on main.order_id =p.order_id , main.order_item_id = p.order_item_id) left outer join (select amount main description='commission') c on main.order_id=c.order_id , main.order_item_id = c.order_item_i...

css - Styling GeoJSON polygons loaded via a URL in javascript, MapBox -

below little bit of code produces 2 polygon layers displayed gray, semitransparent shaded polygons default: var overlays = { seniorsnorm: l.mapbox.featurelayer().loadurl('data/seniorsage65+.geojson'), aqiriskzones: l.mapbox.featurelayer().loadurl('data/aqizones.geojson'), }; would possible assign fill color, opacity, etc? have tried , can't quite there. thank in advance. the signature l.mapbox.featurelayer follows: l.mapbox.featurelayer(id|url|geojson, options) https://www.mapbox.com/mapbox.js/api/v2.2.4/l-mapbox-featurelayer/#section-l-mapbox-featurelayer which means can pass url directly first parameter don't need use loadurl . can use if later on want reload or load url. set style on layer's features can use setstyle method described in documentation l.featuregroup l.mapbox.featurelayer extended from: sets given path options each layer of group has setstyle method. http://leafletjs.com/reference.html#featuregroup...

ios - How to navigate and pass data to another view controller without use of segue in swift -

hy, new swift. have on question. have 1 view controller in have textbox , button , have second view controller have textbox , button. want whenever pressed button of first view controller second view controller appear , data of textbox of first view controller pass textbox of second view controller without use of segue. please me. in firstviewcontroller.swift @ibaction weak var textfiled: uitextfield! @ibaction func senddatatonextvc(sender: uibutton) { let mainstoryboard = uistoryboard(name: "storyboard", bundle: nsbundle.mainbundle()) let vc : secondviewcontroller = mainstoryboard.instantiateviewcontrollerwithidentifier("secondviewcontrollersbid”) secondviewcontroller vc. recevedstring = textfiled.text self.presentviewcontroller(vc, animated: true, completion: nil) } in secondviewcontroller.swift var recevedstring: string = “” @ibaction weak var textfiled2: uitextfield! override func viewdidload() { super.viewdidload() textfiled2.text = r...

jquery - Ajax sending datastring error when a variable contains amparsand -

i making program submit form ajax combining values in variable datastring , sending ajax method.. suppose var varname="ram"; var varage=18; , var datastring='name='+varname+'&age='+varage; this works but var varname="ram & shyam"; var varage=18; , var datastring='name='+varname+'&age='+varage; when variable contain & in value received php code $_post['name'] has value 'ram' not 'ram & shyam' please tell solution problem try replace var varname="ram & shyam"; var senddata = varname.replace("&","%26"); another useful links how can send "&" (ampersand) character via ajax? http://www.w3schools.com/tags/ref_urlencode.asp https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/encodeuricomponent

sas - A macro to send a email -

my code send mail using sas data step. here trying create code send mail. filename outbox email ("***********"); data _null_; file outbox to=("************") from=("***********") subject=("example of sas e-mail" ); /* attach=(""); */ put " "; put "hello boss,"; put " "; put "attached daily operational reports."; put " "; put "rrt"; run; i don't tend include email parameters in datastep itself, rather in fileref. have tested code below email address , worked. as said in comments, need wrap datastep in macro if want run within macro. you can have positional or keyword parameters. see source detailed info. have used keyword parameters in example. call macro specifying keyword , value showed last line. if don't put anything, keyword gets ignored. by way, empty keywords result in initialised local macro variables. let statements ( %let from=from=...

select between two dates ms access using php -

i want select data ms access using php here code : $dbdir = "d:\payroll2\att2000.mdb"; $conn = odbc_connect("driver=microsoft access driver (*.mdb);dbq=$dbdir", "administrator", ""); $b = 4104; $jo = date('n/j/y h:i:s a',strtotime('2016-01-21 00:00:01')); $ji = date('n/j/y h:i:s a',strtotime('2016-01-21 23:59:59')); $sql = "select top 20 * checkinout inner join userinfo on checkinout.userid = userinfo.userid userinfo.ssn = '$b'"; $rs = odbc_exec($conn,$sql); odbc_fetch_row($rs, 0); while (odbc_fetch_row($rs)) { echo odbc_result($rs,"checktime"); print('<br>'); } odbc_close($conn); } it works fine , want select data between 2 dates add and checkinout.checktime between '$jo' , '$ji' query : $sql = "select top 20 * checkinout inner join userinfo on checkinout.userid = userinfo.userid userinfo.ssn = '$b' , checkinout.checkt...

c++ - When Visual Studio generates 32bit .obj file and 64bit .obj file? -

i have 2 machines, both of have same copy of code. both machines installed same visual studio, vs2013 ultimate version . the code qt project lots of windows apis. so, qmake generate makefile , makefile.debug , makefile.release . these makefile same on both machines. in makefile.debug , makefile.release , actual compiler , linker vs's cl , link . difference between 2 machines is, 1 windows 10, , other windows 8.1. both machines 64-bit machine. the problem is, on windows 10 machine, build progress in qt creator passes, on windows 8.1 machine, there 1 error while building. firstly, error "xxx.dll: lnk1112: module machine type 'x64' conflicts target machine type 'x86'" . know here "xxx.dll" indeed 'x64' type, , realized windows 8.1 machine thinks "target machine type" x86 , modified makefile.debug manually adding "/machine:x64" linkflag . action changed error become "yyy.obj: module machine type '...

ruby on rails - Rspec controller test does not hit my controller action -

i added import method controller, , works fine when test manually website, failing in rspec. here test looks like: require 'spec_helper' describe propertiescontroller let!(:user) { factorygirl.create(:user) } before :each sign_in user end describe "should upload user properties" before post :import, spreadsheet: fixture_file_upload("/files/property_upload_template.xlsx") end "should have created records" expect(property.count).to eq 3 # other assertions end end end when add puts statements inside import action, including on first line, none of them apparently invoked. test generating no errors other failing assertions. similarly, when @ test.log file, happens creation of test user (and devise confirmation email gets sent out), doesn't appear import action ever hit. test server seems recognize route fine, it's not executing action. is there wrong test configuration? i h...

ruby on rails 3 - Bound activerecords-queries using aggregate funcs (sum, avg,...) with limit -

given pseudo-query: model.sum(:column, :condition => ['id = ?', id], order => "date desc", :limit => x) here have problem sum obtained not "limited" value x (it takes sum values on column instead sum of x (firsts) entries). it seems limit taken after calculating aggregate func sum . how can sum limited firsts x entries? murifox's suggestion doesn't work because limit applies final result set, has 1 row (the sum). see this thread . the simplest way solve not count in database: model.where(:id => id).order('date desc').limit(3).pluck(:column).compact.sum this loads values of column ruby , sums there. now, if set of records enormous, observably less efficient, because values getting loaded app's memory. edit: added .compact - remove nils array before summing (which causes error). the suggested method of doing in sql using subquery, so: select sum(subquery.column) ( select * models id = 5 li...

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -

i trying decrypt data using certificate private key. works fine when certificate installed on local machine (i using self signed certificate testing , have private key certificate) when try access private key remote machine using same code, "keyset not exist" exception. i using console application testing, , have made sure id have read permissions on private key on remote server. here sample code using: var store = new x509store(@"\\server1\my", storelocation.localmachine); store.open(openflags.readonly); var result = store.certificates.find(x509findtype.findbysubjectname, "server1.test.com", false); var certificate = result[0]; store.close(); //this succeeds both local , remote server var rsapublic = (rsacryptoserviceprovider)certificate.publickey.key; //this succeeds local, fails remote server var rsaprivate = (rsacryptoserviceprovider)certificate.privatekey; here exception call stack unhandled exception: system.security.cryptography.crypto...

android - MD5 and Sh1 and debug keystrok in eclipse .? -

how search , sorry find md5 , sh1 , debug keystrok in eclipse .? you can find keystore in system @ path: ~/.android/debug.keystore fetch sha-1 , md5, can use command keytool -list -v -keystore "or"

php - Apache not loading htaccess but still rewriting -

i installed ubuntu on home computer dual boot. i have htaccess in following path: /var/www/html/cortana/html/.htaccess i'm using standard apache server version 2.4 now zend framework project sits at: /var/www/html/cortana/html/index.php and access going http://localhost/cortana/html/index.php in browser. here current .htaccess setenv application_env development rewriteengine on rewritecond %{request_filename} -f [or] rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php [nc,l] now when go index.php , type <?php echo getenv('application_env');die()?> no response also, here error log: [thu jan 21 03:00:06.542376 2016] [authz_core:error] [pid 5262] [client 127.0.0.1:52981] ah01630: client denied server configuration: /var/www/html/cortana/html/.htaccess however using mod rewrite module because handling redirects in application....

Custom JSF component: Using "startElement" with "script" results in a comment -

i'm rendering custom jsf component. in method encodebegin want include java script. public void encodebegin(facescontext context) throws ioexception { responsewriter writer = context.getresponsewriter(); writer.startelement("script", this); writer.writeattribute("type", "text/javascript", null); writer.writetext("var width=400",null); writer.endelement("script"); } when rendering component content of script tag commented out. <script type="text/javascript"><!-- var width=400; //--></script> can explain why comment appears , how rid of it? thanks in advance! this specific myfaces implementation, not jsf specification. mojarra implementation doesn't that. this approach of putting javascript body in html comment leftover of html prehistory when browsers existed doesn't support <script> elements. html comments hides javascript content prevent ancient htm...

.htaccess - Allow access only if URL matches exactly -

i have file (www.sample.com/sample.json). i file accessed url (www.sample.com/sample.json?custom-text). if it's accessed without custom-text, want redirect homepage or show forbidden error. i do not want make changes site www.sample.com. want changes file, sample.json (www.sample.com/sample.json) i'm new .htaccess, sorry if terms used wrong. in advance. you can use rule: rewriteengine on rewritecond %{query_string} !^custom-text$ [nc] rewriterule ^sample\.json$ - [f,nc]

java - Initialize an array via Loop in Velocity -

how can convert 1 foreach loop in velocity? #set($stararray5 = []) #set($stararray4 = []) #set($stararray3 = []) #set($stararray2 = []) #set($stararray1 = []) i tried 1 returns error. #foreach($i in [5..1]) #set($stararray$i = []) #end any appreciated.

php - Elegant way to get count of elements in each model in laravel 5.1 -

in each menu item need display number of items contained inside. example: users (22) posts (57) categories (14) cities (92) tried this: app/view/composers/addcountofmodels.php: namespace app\view\composers; use illuminate\view\view; use app\user; use app\post; use app\category; use app\city; class addcountofmodels { public function compose(view $view) { $view->with('count_of', [ 'users' => user::count(), 'posts' => post::count(), 'categories' => category::count(), 'cities' => city::count(), ]); } } app/providers/appserviceprovider.php: namespace app\providers; use app\view\composers; use illuminate\support\serviceprovider; class appserviceprovider extends serviceprovider { public function boot() { $this->app['view']->composer('_layouts.backend', composers\addcountofmodels::class); } } ... menu.blade.php: @extends('_layouts.backend'...

Re-render a Vue.js component -

Image
is there way re-render vue.js component? have dropdown list , form. both of seperate components, 1 located @ header , 1 one somewhere in middle of page. both seperate components , can't make 1 child component of another. so possible trigger re render of dropdown in vuejs ? if assume project list list component sent component via prop, it's trivial update main app's list, in hand update list component. quick example of how work: <div id="app"> <!-- app --> <list :projects="projectslist"></list> <!-- list component --> <add-project></add-project> <!-- project add component --> </div> <template id='project-list-template'> <!-- template list projects --> <div v-for="proj in projects">{{proj}}</div> </template> <template id="add-project-template"> <!-- template add project --> <input v-model=...

vba - Modifying a table cell's .Range.Text removes any attached comments -

Image
i've written small vba program remove trailing whitespace ms word table cells. iterates through cells of each table , modifies .range.text object using command c.range.text = myre.replace(c.range.text, "") where myre vbscript regexp 5.5 object , myre.pattern = "\s+(?!.*\w)" . entire program can found here . the program works fine except 1 problem. removes comments cells well. before: after (the space gone, comment): looking @ local object tree, can see changing c.range.text changes c.range.comments - why? what can prevent this? when work range.text, case whenever regex or, indeed, function manipulates strings used, formatting , other non-text characters lost when pure string written cell. for example, if single character in cell text formatted bold, bold formatting lost. or if change tracking in cell - lost. footnote or endnote lost. comments fall same category. you need different approach, 1 respects how word stores non-te...

android - How to disable virtual home button in any activity? -

i need disable 3 virtual buttons in activity in app. disabled button , multitask button somehow cannot dsable home button. i tried onattachedtowindow() style answers on stackoverflow didn't work me. i don't want disable home button entire app, want disable single activity window. helps! note : highly encourage not in app, if want deploy it. show how can it. since android 4 there no effective method disable home button.it needs little hack. think need kiosk mode in app. in general idea detect when new application in foreground , restart activity immediately. processes below.. at first create class called kioskservice extends service , add following snippet : public class kioskservice extends service { private static final long interval = timeunit.seconds.tomillis(2); // periodic interval check in seconds -> 2 seconds private static final string tag = kioskservice.class.getsimplename(); private static final string pref_kiosk_mode = "pref...

node.js - koa.js streaming response from remote url -

i want create koa route acts proxy url, delivers file few dozens of megabytes. therefore not block when making response. using this.body = yield request.get(url); currently, request [co-request ] 1 module. how stream response client ? edit : i doing following : var req = require('request'); //... this.body = req(url).pipe(fs.createwritestream(this.params.what)); if paste url in browser, file fine. if error: cannot pipe. not readable. in route. turns out solution : var req = require('request'); //... this.body = req(url); this because this.body has readable stream, req(url) returns. @danneu explanation.

apple watch - IOS protocol and framework minimum IOS version check -

i developing applewatch application. before developed ios application min version ios 6.0. applewatch application i'm developing watchos 2.0. below class code in ios application class. watchconnectivity framework , wcsessiondelegate protocol need min ios version 9.0. how run old version without crash .h #import <foundation/foundation.h> #if __iphone_os_version_min_required >= __iphone_9_0 #import <watchconnectivity/watchconnectivity.h> #endif #if __iphone_os_version_min_required >= __iphone_9_0 @interface watchconnectivitymanager : nsobject<wcsessiondelegate>{ #else @interface watchconnectivitymanager : nsobject{ #endif } @property(nonatomic, assign) bool onetimesaved; +(watchconnectivitymanager*)getinstance; -(void)shareddefaultsdatasave:(nsstring*)params; @end .m #import "watchconnectivitymanager.h" @implementation watchconnectivitymanager @synthesize onetimesaved; static watchconnectivitymanager *instance =nil; - (id) init { ...

caching - ionic infinit list reload cached page/view -

i have ionic list page template cached set true, each item clickable , way avoid reload cache page. however, need to reload list menu option appears controller isn't triggering. i've tried setting difference services using &ionichistory clearcache , clearhistory, nothing works. after banging heads few times, following solution worked! forcing reload of list controller following: $state.go("app.tabs.your_controller", {}, {reload: true}); note: $stateparams wouldn't take effect since page wasn't loading, instead "reload: true" works charm. continue use $state.go("app.tabs.your_controller") on other pages don't require page reload.

ios - Reducing the quality of a UIImage (compressing it) -

hi trying compress uiimage code so: var data = uiimagejpegrepresentation(image, 1.0) print("old image size \(data?.length) bytes") data = uiimagejpegrepresentation(image, 0.7) print("new image size \(data?.length) bytes") let optimizedimage = uiimage(data: data!, scale: 1.0) the print out is: old image size optional(5951798) bytes new image size optional(1416792) bytes later on in app upload uiimage webserver (it's converted nsdata first). when check size it's original 5951798 bytes. doing wrong here? a uiimage provides bitmap (uncompressed) version of image can used rendering image screen. jpeg data of image can compressed reducing quality (the colour variance in effect) of image, in jpeg data. once compressed jpeg unpacked uiimage again requires full bitmap size (which based on colour format , image dimensions). basically, keep best quality image can display , compress before upload.

c# - How to solve 'COMException not be controlled' caused by MODI (OCR reader) -

i'm trying read image modi (using c#), followed many of links found on internet. as can solve problem "comexception not controlled" running following code: public string reconeixnom(string filepath) { string nom; document md = new document(); //crea document modi.document md.create(filepath); //document amb la ruta que toca. md.ocr(milanguages.milang_spanish, false, false); modi.image image = (modi.image)md.images[0]; nom = image.layout.text; image = null; md.close(false); md = null; gc.collect(); gc.waitforpendingfinalizers(); return nom; } i tried submit block in try-cach capturing exception 'system.runtime.interopservices.comexception' but remains same. i have tried debug program, have found exception spear following line: md.ocr(milanguages.milang_spanish, false, false); please, know can happening?

Python Bokeh: Plotting same chart multiple times in gridplot -

i'm trying overview of plots of data of different dates. feeling of data plot relevant plots next each other. means want use same plot multiple times in gridplot command. noticed when use same chart multiple times show once in final .html file. first attempt @ solving use copy.deepcopy charts, gave following error: runtimeerror: cannot property value 'label' lineglyph instance before hasprops.__init__ my approach has been follows: from bokeh.charts import line, output_file, show, gridplot import pandas pd output_file('test.html') plots = [] df = pd.dataframe([[1,2], [3,1], [2,2]]) print(df) df.columns = ['x', 'y'] in range(10): plots.append(line(df, x='x', y='y', title='forecast: ' + str(i), plot_width=250, plot_height=250)) plot_matrix = [] in range(len(plots)-1, 2, -1): plot_matrix.append([plots[i-3], plots[i-2], plots[i]]) p = gridplot(plot_matrix) show(p) the results of html page grid...

sql - Count column in mysql -

provided have table in mysql: userid, paymentid, datetime blah, 123, 1/2/2011 blah, 144, 1/8/2011 foo, 151, 2/4/2011 bar, 178, 2,8,2011 how can add 'order' column, sequence count per user, ordered datetime? userid, paymentid, datetime, order blah, 123, 1/2/2011, 1 blah, 144, 1/8/2011, 2 foo, 151, 2/4/2011, 1 bar, 178, 2,8,2011, 1 select userid, paymentid, datetime, grptotal `order` ( select userid, paymentid, datetime, @sum := if(@grp = userid,@sum,0) + 1 grptotal, @grp := userid tablename, (select @grp := '', @sum := 0) vars order userid, datetime ) x sqlfiddle demo sqlfiddle demo ( with order datetime )

Elasticsearch - DateTime mapping for 'Day of Week' -

i have following property in class: public datetime insertedtimestamp { get; set; } with the following mapping in es "insertedtimestamp ":{ "type":"date", "format":"yyyy-mm-ddthh:mm:ssz" }, i run aggregation return data grouped 'day of week', i.e. 'monday', 'tuesday'...etc i understand can use 'script' in aggregation call this, see here , however, understanding, using script has not insignificant performance impact if there alot of documents (which anticpated here, think analytics logging). is there way can map property 'sub properties'. i.e. string can do: "somestring":{ "type":"string", "analyzer":"full_word", "fields":{ "partial":{ "search_analyzer":"full_word", "analyzer":"partial_word", "type":...

Facebook SDK 3.0 android code works by starting from eclipse but not in playstore app? -

in our app integrated facebook new facebook sdk version 3.0. if start app on test device eclipse works fine. facebook app (or webview if native app isn't installed) opens, logs in facebook calls , publishes post. but if relaease code apk in google playstore, download there , test it, facebook app starts, user logs in , allows publishing, nothing happens, no post wall o_o. here's code: private void facebooklogin() { session.openactivesession(this, true, new session.statuscallback() { @override public void call(session session, sessionstate state, exception exception) { // todo auto-generated method stub if(session.isopened()) { performpublish(pendingaction.post_photo); } } }); } private void performpublish(pendingaction action) { session session = session.getactivesession(); if (session != null) { pendingaction = action;...