Posts

Showing posts from July, 2012

apache - PHP code is rendered as text -

i'm using ubuntu 16.04 , want run php files. i installed php 7 on using: sudo mkdir -p /var/www/html sudo chown -r $user:$user /var/www/html sudo apt install php sudo apt install apache2 i created php file (e.g. test.php ) in /var/www/html . can access in browser (e.g. http://localhost/test.php ). instead of executing <?php ... ?> code, displayed plain text: i tried turn short_open_tag on . edited /etc/php/7.0/fpm/php.ini , enabled it. then ran sudo service php7.0-fpm restart . didn't make change in browser. php code still displayed plain text. how can fix this? you didn't install apache properly, doing apt-get on apache2 not install everything. what @newman stated correct can follow guide, or here digitalocean link usuable production server (since on droplet). note full stack lamp, assume when want dab mysql https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04

SAS: Passing in Array Names -

i'm working on code change coding of several hundred variables stored 1/0 or y/n in numeric 1 or 0. because need in flexible process, writing macro so. issue have macro unable pass sas column names macro work. thoughts? %macro test(s,e); %array(a,&s.-&e.); %mend; data subset; set dataset); %test(v1,v20) run; sas supports variable lists. macro parameters text strings. long use macro variable value in place sas supports variable lists there no problem passing variable list macro. example here simplistic macro make array statement. %macro array(name,varlist); array &name &varlist ; %mend; which use in middle of data step this. data want; set have ; %array(binary,var1-var20 a--d male education); on binary; binary=binary in ('y','1','t'); end; run; the difficult part if want convert variables character numeric need rename them. make difficult use variable lists (x1-x5 or vara -- vard). can solve problem l

hadoop - Can Hdfs has different replication policy -

can have different replication policy in different folder in hdfs? example files in folder /important_data wanna it's replicate 3, files in folder /normal_data wanna it's replicate 1. thanks! you can use setrep set replication hadoop fs –setrep –w 3 -r /my/dir1 hadoop fs –setrep –w 1 -r /my/dir2 you set custom replication on file too. hadoop fs –setrep –w 3 /my/file here documentation http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/filesystemshell.html#setrep

Tableau Web Data Connector to Google Sheets -

i trying build connection between tableau public , google sheets. here repository: https://github.com/aschharwood/aschharwood.github.io and here page enter link google sheet: https://aschharwood.github.io/googlesheetsconnector.html however, nothing happens when click connect. have feeling missing necessary file. thoughts? tableau 10 has native connector google sheets, if cannot wait long free microsoft power bi .

clpfd - Constraint - SWI- Prolog Queries -

i have exam coming , i'm going through past papers understanding. i came across following past paper question: consider following queries , answers. answers coincide swi-prolog infer whereas others erroneous. indicate answers genuine , ones fake (no explanation of answer required). (i) |?- [a, b, c] ins 0 .. 2, #= b + c. = 0..2 b = 0..2 c = 0..2 (ii) |?- in 0 .. 3, * #= a. = 0..2 (iii) |?- [a, b] ins -1 .. 1, #= b. = 1 b = 1 (iv) |?- [a, b] ins 0 .. 3, #= b + 1. = 1..3 b = 1..2 i'm struggling see how each 1 either true or false. able explain me how figure these out please. thank you, appreciate help. the key principle deciding answers admissible , not whether residual program declaratively equivalent original query. if residual constraints admit solution original query not, or other way around, answer fake (or have found mistake in clp(fd) solver). if shown answer not syntactically valid, answer definitely fake. let's it: (i) |?- [a, b,

ios - Reorganize dictionary order by values? -

i have app receives json file webserver , convert nsdictionary can see below: [nsjsonserialization jsonobjectwithdata:data options:0 error:&jsonerror] the structure of dictionary follows: [0] => { "name" = "josh", meters = "8" } [1] => { "name" = "lina", meters = "10" } [2] => { "name" = "pall", meters = "21" } you can see data organized key meters , unfortunately webserver not give possibility maintain open connection, in case, new records come through apns (push notification) assuming comes following record notification: {"name" = "oli", meters = "12"} i insert in dictionary, once that's done, how can rearrange array , order meters? there's no order inherent in dictionary. see ordering in initial set accidental. arrays have ordering, , can array dictionary sending allkeys or allvalues . using fact organize di

sql - Add schema name to dynamic Postgres query -

my database using postgres schemas provide separated, multi-tenant environment users. every schema has copy of same tables. i have 1 particular query need join across schemas, return list of records (in case, children ). have working via dynamic sql query, shown below. however, want add in column each result specifies name of schema row came from. current dynamic query (schema's like: operator_schema_my-great-company ) create or replace function all_children_dynamic() returns setof children $$ declare schema record; begin schema in execute format( 'select schema_name information_schema.schemata left(schema_name, 16) = %l', 'operator_schema_' ) loop return query execute format('select * %i.children', schema.schema_name); end loop; end; $$ language plpgsql; -------- -- usage: select "id", "name" all_children_dynamic(); this returns like: ------------- | id | name | | 1 | bob | | 2 |

c# - Check neighbouring numbers in matrix -

how count neighbouring ones in 3x3 matrix, this 1 1 1 1 0 0 0 0 0 and desired output be( in square brackets indexes [x,y], care numbers, indexes accuracy) [0,0] - 2, [1,0]- 3, [2,0]- 1, [0,1]-2, etc... not count middle number in. i have large matrix , task loop through each number, imagine matrix , count how many ones around number in middle. code, cant make work. here method: public int checkarea(int cordx, int cordy) { int count = 0; (int = cordx - 1; <= cordx + 1; i++) { (int j = cordy - 1; j <= cordy + 1; j++) { if (j != cordy && != cordx && tilefield[i, j]) { count++; } } } return count; } it shouldnt index problem cos setup matrix this: tilefield = new boolean[width, height]; (int x = 0; x < width; x++) { (int y = 0; y < height; y++)

Create a cookie from an express server and send it back with the response -

Image
i'm playing , learning bit express i'm doing post specific route data related user , i'm trying create cookie expressjs server , send response. unfortunately nothing happened. i'm testing route postman , it's telling me: no cookies returned server here's how i'm trying res.status(200).cookie('rememberme', '1', { expires: new date(date.now() + 900000), httponly: false }).send('cookie sent...?'); i'm doing or missing stupid, what's wrong that? ideas please..? if use older version of postman, 1 runs in browser, able see cookie. however, new 1 doesn't run in browser anymore, becomes seperate chrome app, doesn't read browser cookies anymore. in order see cookie, need install postman interceptor

.htaccess - htaccess redirection for a pattern -

i searched solution of issue , tried several ways none of them worked. i migrating website new system , want change url structure too. couldnt find solution 1 of them important one. it e-commerce site. product page urls had domain.com/product/productname/ in previous system , need them go domain.com/productname.html . product part should catched , redirected version without product/ . might simple couldnt find solution that. thanks in advance cheers you can use simple rule in site root .htaccess: redirectmatch 301 ^/product/([^./]+)/?$ /$1.html

iis 8 - AppInitialize not firing in WCF Service Application on WIndows Server 2012 -

we have wcf service applications deployed windows server 2012. in these services, there class called initializer in /app_code/ folder. class follows; public class initializer { public static microserviceinitilization.msinit iinit = null; public static void log_string(string line) { //if (string.isnullorempty(app_path)) //{ // return; //} system.text.stringbuilder sb = new stringbuilder(); sb.append(line + environment.newline); string log_path = system.web.hosting.hostingenvironment.applicationphysicalpath; file.appendalltext(log_path + "log.txt", sb.tostring()); sb.clear(); } public static void appinitialize() { log_string("appinitialize called"); // called on startup microserviceinitilization.msinit iinit = new microserviceinitilization.msinit(configurationmanager.appsettings["log_directory"], configurationmanager.appset

Add php5-imagick to Heroku php buildpack -

someone can show me how customize official buildpack heroku/php in order add php5-imagick extension? thanks you not need customize buildpack. extension supported. just follow instructions in docs, https://devcenter.heroku.com/articles/php-support#extensions your composer.json needs ext-imagick in require section; next deploy have extension enabled automatically.

Malicious popup injected in my Wordpress site -

i setup own blog using wordpress. don't have lots of experience think managed ok create nice. here's link, http://blog.yveschaput.com (it's in french) my problem have popup coming when 1 clicking first time on link on site. once popups, doesn't reappear again until seems randomly set time or event. injected javascript script in page visitor first viewing, not in home page. anyone has idea script might come from? i'm guessing plugin use can't seem find one. here's code being injected: var pushown = false; var popwidth = 1370; var popheight = 800; var popfocus = 0; var _top = null; function getwindowheight() { var myheight = 0; if( typeof( _top.window.innerheight ) == 'number' ) { myheight = _top.window.innerheight; } else if( _top.document.documentelement && _top.document.documentelement.clientheight ) { myheight = _top.document.documentelement.clientheight; } else if( _top.document.body && _top.document.body.clientheight

cubism.js - Matching date in Millis in Javascript -

i trying fetch data db every 10 mins data inserted timestamp. using timestamp want visualize field. visualization has step size of 10 mins. checks start till stop time find match. here code - while((i += step) < stop) { var key = (new date(i)).gettime(); var value = key in lookup ? lookup[key].gtse: null; values.push(value); } callback(null, values); my problem timestamp fetched db never matches. here data make clear. the key values - 1st iteration - 1372168200000 2nd iteration - 1372168800000 database fetched value - 1372786393088 so in case key never matches when iterating on lookup. if dont use step , change while loop while((i += 1) < stop) browser hangs since there lot of processing after this. should manipulate date before db insertion , change trailing 5-6 places 0 or should handle on client side? i need advice how tackle this.

Is there a way to dynamically upload catalog items from my database to PayPal Here using the API? -

i'm looking see if it's possible add catalog items changing code rather manually entering them 1 one. want make use of barcode scanning feature on paypal here pos app in store never sells same item twice. here entry page i'm looking automate paypal api: image of paypal interface (was new stackoverflow embed it) i haven't found hint of in api docs or on web. know if it's possible?

Add 2 seconds of blank/black video with ffmpeg -

let’s have 2 videos want play simultaneously. moviea.mp4 38.6 seconds duration, , movieb.mp4 31.14 seconds duration. using ffmpeg there easy way fill end of movieb.mp4 black silence 38.6 seconds (matching moviea.mp4). there’s niche technical reason want this, don’t ask haha!! also if possible, less important, way remove afterwards. been searching 2 days sort of easy way around without luck!!! thanks in advance! you can via command this: ffmpeg -i moviea.mp4 -i movieb.mp4 -filter_complex "color=black:wxh[c]; \ [0][c]overlay=shortest=1[base];[base][1]overlay=eof_action=pass[v]" \ -map "[v]" -map 1:a bextended.mp4 this assumes resolution of 2 videos same. should scale them, otherwise, make so. wxh should replaced resolution of moviea e.g. color=black:1280x720

java - How can I parse String containing XML tags , so that I can get value of all the sub tags -

i have parse string containing xml tags 1 hard coded below can values of tags separately. here when using nodelist node = doc.getelementsbytagname("event"); it returning value "ajain1ankitjain24-04-199223:09.08" i want retrieve value each tag , store separately in different variables. like eg in scenario want store value : string uid = ajain1 string firstname = ankit string lastname = jain date date = "24-04-1992 23:09.08" here sample code working on. package test; import java.io.ioexception; import java.io.stringreader; import javax.xml.parsers.documentbuilder; import javax.xml.parsers.documentbuilderfactory; import javax.xml.parsers.parserconfigurationexception; import org.w3c.dom.document; import org.w3c.dom.element; import org.w3c.dom.nodelist; import org.xml.sax.inputsource; import org.xml.sax.saxexception; public class demo { public static void main(string[] args) { string xmldata = "<event><class>

c# - Can't this be rewritten more concisely using fluent syntax? -

public static class listoft { public static list<selectlistitem> toselectlist<t>(this list<t> value, func<t, string> gettext, func<t, string> getvalue, string selectedvalue) { list<selectlistitem> items = new list<selectlistitem>(); foreach (var item in value) { items.add(new selectlistitem { text = gettext(item), value = getvalue(item), selected = selectedvalue == getvalue(item) }); } return items .orderby(l => l.text) .tolist(); } } sample usage: [httpget] public actionresult create() { list<state> states = new list<state>() { new state {name = "michigan", statecode = "mi&qu

vim - Windows autoupdate cscope database from GVIM -

i work gvim , cscope c on window 7. but, cscope database gets outdated , when code updated. so, added following gvimrc nmap <f11> :cs k 0 <cr> :!cscope -br <cr> :cs cscope.out<cr> since, work 1 cscope database, sufficient kill first cscope database connection. however, when execute cscope command not run project root directory. can't figure out how instruct cscope/cmd.exe run cscope project directory within gvim. how achieve this. there known plugins available feature ? try out plugin made: https://github.com/mihaifm/bck among other things has changetoroot command, changes vim's current working directory project root of current file. the project root defined presence of several files/folders (root markers). defaults are: ['.git/', '.git', '_darcs/', '.hg/', '.bzr/', '.svn/', 'gemfile'] you can customize g:bckroots variable in .vimrc . need add .sln in there if you're

Getting "null" in place of textvalue After parsing XML using PullParser in Android -

i had @ this . please dont redirect me site. i had used dom parser , here problem that. i having same xml : <myresource> <item>first</item> <item>second</item> </myresource> and have no way parse xml via pullparser. methods taken this : private list readfeed(xmlpullparser parser) throws xmlpullparserexception, ioexception { // todo auto-generated method stub list entries = new arraylist(); parser.require(xmlpullparser.start_tag, ns, "myresource"); while (parser.next() != xmlpullparser.end_tag) { if (parser.geteventtype() != xmlpullparser.start_tag) { continue; } string name = parser.getname(); // starts looking entry tag if (name.equals("myresource")) { entries.add(readentry(parser)); } else { skip(parser);

ruby on rails - Still getting 413 Request Entity Too Large even after client_max_body_size 100M -

i'm using rails , nginx on digital ocean , i've been trying upload 17.6 mb file , i'm still getting 413 request entity large after setting client_max_body_size 100m in /etc/nginx/nginx.conf file. here's snippet file: http { ## # basic settings ## client_max_body_size 100m; sendfile on; tcp_nopush on; ... } after setting i've used sudo service nginx reload . when didn't work i've done full reboot using sudo shutdown -r now , cap production puma:start local machine. i've tried client_max_body_size 0; which, understand should disable checking of file sizes entirely. nothing works. plus, in getting point, i've made mistakes in location of client_max_body_size statement , in situations server has failed start correctly giving "something went wrong" error, i'm pretty sure changes i'm making right file. is there might missing? there place i'm missing configure this? there i'm missing in way i'm

javascript - Video to full modal -

i inserting youtube videos in website iframes , need make video full screen , background white (like full screen mode). know how make both, cant move video javascript container new 1 without stoping how can it? time this works if you're using bootstrap. think should able use if arent using bootstrap too. ytmodal helps play youtube videos in popup window based jquery , twitter bootstrap modal component. requires jquery youtubedefaultimageloader.js insert youtube video iframes post images web page http://www.jqueryscript.net/other/youtube-video-modal-with-jquery-bootstrap-3-ytmodal.html

sockets - Linux TCP: packet segmentation? -

i working on virtualization environment (linux on hyperv). linux driver virtual nic supports tso , gso (tcp segmentation on , generic segmentation on). now, create tcp socket , send buffer set 128k. based on ifconfig data (tx bytes , tx packets), average packet size 11 k. so question is, packet segmented (from 128k 11k)? how control/configure in socket options or tcp options? thanks! ===========edit================== i have application can reach 8gbps throughput in 10g network 32 tcp connections - in case, average packet size 20 kbytes pretty good; when increased tcp connections 256, throughput 1gbps packet size on nic down 3 kbytes. i know packet size critical performance cost of processing traffic per packet, not per bytes, packet on nic, better if bigger. so, question is: how increase tcp packet size? there tcp settings control this? your question seems little bit confusing, there number of settings need play 10gige work right on linux. see here: http://

java - How could i turn this into a loop? -

this question has answer here: how can pad integers zeros on left? 12 answers public string tostring() { if(zipcode < 10000) { if(zipcode < 1000) { if(zipcode < 100) { if(zipcode < 10) { return "0" + "0" + "0" + "0" + integer.tostring(zipcode); } return "0" + "0" + "0" + integer.tostring(zipcode); } return "0" + "0" + integer.tostring(zipcode); } return "0" + integer.tostring(zipcode); } else { return integer.tostring(zipcode); } } is there loop add 0 in front of string depending on exponent of 10 number stored in zipcode is? i'm not looking rid of zeroes i'm looking keep zeroes, zeroes taken away. string.format("%05d&q

Awk split use array later in bash -

if have awk command... echo $line | awk '{split($0,array,"|")}' ...how can use array later in bash program? if try print out information array later it's empty. you can use awk array contents outside of awk if print it: ifs=$'\n' read -d '' -r -a line < <(echo 'o|p|s' | awk '{split($0,array,"|"); (i in array) print array[i]}') declare -p line # output: declare -a line='([0]="o" [1]="p" [2]="s")'

mysql - Ionic App Breaks With PHP Scripts -

i followed this lynda tutorial working ionic app, , followed this lynda tutorial set mysql backend php scripts (i highly recommend both tutorials, way!). trying ionic app connected mysql database. the ionic app grabs data js/data.json , json data in app.js : .controller('listcontroller', ['$scope', '$http', '$state', function($scope, $http, $state) { $http.get('js/data.json').success(function(data) { $scope.artists = data.artists; }); }]); i wrote php script displays exact same thing data.json . thought first step towards bridging gap between 2 tutorials. in load_data.php : $response = ""; //omitting code fill $response //the same info data.json $json = json_encode($response); printf("%s", $json); i have compared outputs of data.json , load_data.php , indeed identical. have used jsonlint make sure valid json. however, replacing js/data.json js/load_data.php makes data disappear no

asp.net panel defaultbutton dosn't work -

i got panels textfields & buttons. problem is, though have panel defaultbutton, still uses first button on page when ever i'm clicking enter. iv'e done lot of times, stopped working? <asp:panel id="pnlwrite" defaultbutton="btnwallsubmit" runat="server"> <div class="input-group"> <span class="input-group-addon" id="basic-addon1"><asp:literal id="litname" runat="server" /></span> <asp:textbox id="txtmind" runat="server" cssclass="form-control" aria-label="..." placeholder="what's on mind?" /> <div class="input-group-btn"> <asp:button id="btnwallsubmit" runat="server" cssclass="btn btn-default" text="publish!" onclick="btnwallsubmit_click" /> </div> </div> <br /> <

ios - UISearchController - blank space hides status bar -

i'm using uisearchcontroller , working fine. leaving blank space on search bar (when focused) partially hides status bar. this espace i tried setting self.edgesforextendedlayout = uirectedgenone self.navigationcontroller.extendedlayoutincludesopaquebars = yes space still there. tried setting self.definespresentationcontext = yes; but generated searchbar take status bar position like this . i'm using uiviewcontroller embedded in uinavigationcontroller . setup im implementing now: @interface directoryviewcontroller : uiviewcontroller <uitableviewdatasource , uitableviewdelegate ,uisearchbardelegate, uisearchcontrollerdelegate, uisearchresultsupdating> @property (strong, nonatomic) nsmutablearray *personsarray; @property (nonatomic, strong) uisearchcontroller *searchcontroller; @property (nonatomic, strong) nsmutablearray *searchresults; @implementation directoryviewcontroller - (void)viewdidload { [super viewdidload]; uinavigationcontroller *searchres

c# - How can I delete items from my asp.net database -

i'm trying out asp.net , i'm stumped system.data.entity.infrastructure.dbupdateconcurrencyexception . exception occurs on line try save changes database in 'delete' action method. here code edit method, works fine: public actionresult edit(int id) { movie movie = db.movies.find(id); if (movie == null) { return httpnotfound(); } return view(movie); } [httppost] public actionresult edit(movie movie) { db.entry(movie).state = system.data.entity.entitystate.modified; db.savechanges(); return redirecttoaction("index"); } and here code delete method not! public actionresult delete(int id) { movie movie = db.movies.find(id); if (movie == null) { return httpnotfound(); } return view(mov

php - Codeigniter access input type inside echoed table -

i have table echoed inside controller , loaded div id via jquery trigger event. problem table consists of input type texts made datepickers it's not working. here code inside controller: echo "<table class='table table-striped table-borderless' width='100%'> <tbody> <tr> <td><label class='control-label'>awol</label></td> <td><select class='form-control' id='cmbawol1' name='cmbawol1'>"; $awol_code = array(); $awol_code[] = $val['awol']; echo "<option value='".$val['awol']."'>".$val['awol']."</option>"; foreach($data['offense'] $value) { if(!in_array($value['offense'],$awol_code)) {

How big the spark stream window could be? -

i have data flows need calculated. thinking use spark stream job. there 1 thing not sure , feel worry about. my requirements : data comes in csv files every 5 minutes. need report on data of recent 5 minutes, 1 hour , 1 day. if setup spark stream calculation. need interval 5 minutes. need setup 2 window 1 hour , 1 day. every 5 minutes there 1gb data comes in. 1 hour window calculate 12gb (60/5) data , 1 day window calculate 288gb(24*60/5) data. i not have experience on spark. worries me. can spark handle such big window ? how ram need calculation 288 gb data? more 288 gb ram? (i know may depend on disk i/o, cpu , calculation pattern. want estimated answer based on experience) if calculation on 1 day / 1 hour data expensive in stream. have better suggestion?

How do I set the tab order in a form in Excel 2013 -

Image
i've created excel input form 4 textboxes line on top of each other. can't figure out how set tab order. in properties section controls thing close 'tab' 'autotab' , 'tabkeybehavior', both of boolean values, true , false. how set tab order form controls in excel? what after called tabindex . shows in properties when control selected. first field has tabindex 0.

Swap two number in 8085 Microprocessor without using temporary variable -

is there procedure swap 2 numbers in microprocessor 8085 out using temporary register ? know same problem in c programming can done following manner a=a+b; b=a-b; a=a-b; here 1st , last lines executable 2nd line cannot implemented in 8085 mp result stored in accumulator. there other possibility so? wikipedia says there xchg instruction: the xchg operation exchanges values of hl , de.

list - F# System.InvalidOperationException: Collection was modified; enumeration operation may not execute -

i encountering problem in f# [not c# there similar post similar answer] i understand not possible modify dictionary while enumerating in loop how should go around ? let edgelist1 = [(1,2,3.0f);(1,2,4.0f);(5,6,7.0f);(5,6,8.0f)] let dict_edges = new dictionary<int*int,(int*int*float32) list>() x in edgelist1 dict_edges.add ((fun (a,b,c)-> (a,b)) x, x) k in dict_edges.keys dict_edges.[k] <- (dict_edges.[k] |> list.rev) system.invalidoperationexception: collection modified; enumeration operation may not execute. at system.throwhelper.throwinvalidoperationexception(exceptionresource resource) @ system.collections.generic.dictionary`2.keycollection.enumerator.movenext() @ .$fsi_0101.main@() individually working dict_edges.[(1,2)] <- dict_edges.[(1,2)] |> list.rev;; in loop need change dictionary values, not keys. thanks the code posted not syntactically correct, it's not clear precisely trying achieve (com

jsp - Cannot find any information on property in bean... in Hello World -

i'm starting out in jsp in adobe cq , i'm trying simple hello world access data world's simplest bean. i've read, correct. what's going on here? my jsp (html.jsp) is: <%@page session="false" contenttype="text/html;charset=utf-8" import="org.apache.sling.api.request.responseutil" %> <%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling/1.0"%> <sling:defineobjects/> <html> <body> <jsp:usebean id="mybean" class="com.example.hellobean.sampleutil" > <jsp:getproperty name="mybean" property="text"/> </jsp:usebean> </body> </html> and modified template-generated "hello world" class (sampleutil.java) follows: package com.example.hellobean; public class sampleutil{ private string text; public sampleutil(){ this.text = "hello world.";

Paypal /v1/payments/payment 503 Node.js not working -

the following route not work. valid card_id, and, amount that's 100.00 , description "sale"... please tell me i'm doing wrong... router.post("/payment", function(req,res) { var savedcard = { "intent": "sale", "payer": { "payment_method": "credit_card", "funding_instruments": [{ "credit_card_token": { "credit_card_id": req.body.card_id } }] }, "transactions": [{ "amount": { "currency": "usd", "total": req.body.amount }, "description": req.body.description }] }; paypal.payment.create(savedcard, function (err, payment) { if (err) return res.status(500).send(err) return res.status(200).send(paym

Requesting multiple Bluetooth permissions in Android Marshmellow -

i'm developing app connectivity connects bluetooth device sdk 23 compile with. i'm having problems requesting multiple permissions bluetooth. have done far: @override public void onstart() { super.onstart(); if (d) log.e(tag, "++ on start ++"); if (contextcompat.checkselfpermission(mybluetoothclientactivity.this, manifest.permission.bluetooth) != packagemanager.permission_granted) { } else { activitycompat.requestpermissions(mybluetoothclientactivity.this, new string[]{manifest.permission.bluetooth, manifest.permission.bluetooth_admin}, request_enable_bt); } if (contextcompat.checkselfpermission(mybluetoothclientactivity.this, manifest.permission.bluetooth) != packagemanager.permission_granted) { } else { activitycompat.requestpermissions(mybluetoothclientactivity.this, new string[]{manifest.permission.bluetooth

r - How can I speed up this sapply for cross checking samples? -

i'm trying speed qc function checking similarity between samples. wanted know if there faster way compare way doing below? know there have been answers kind of question pretty definitive (on or otherwise) can't find them. know should investigate plyr i'm still getting hold of sapply . the following sample data representative output of working randomized , don't think impact application original question. ## sample data nsamples <- 1000 nsamplesqc <- 100 nassays <- 96 microarrayscores <- matrix(sample(c("g:g", "t:g", "t:t", na),nsamples * nassays,replace = true), nrow = nsamples, ncol = nassays) microarrayscoresqc <- matrix(sample(c("g:g", "t:g", "t:t", na),nsamples * nassays,replace = true), nrow = nsamples, ncol = nassays) mycombs <- data.frame(experiment = rep(1:nsamples,nsamplesqc),qc = sort(rep(1:nsamplesqc,nsamples))) ## testing function system.time( sapply(seq(length(myc

ios - URL does not load in uiWebView but takes too long to load in wkWebView and Safari -

i running issue urls not loading in uiwebview . while loading in uiwebview page freezes , have resort killing application reuse webview . the url loads in wkwebview , safari takes 1 minute load page. url: http://my.gateway3d.com/acp/app/?l=acp2&c=tzxmnn4hp4df5mb#p=1086474&guid=15254&pc=16483&r=webgl&ep3durl=http://www.casehype.gateway3d.com/personalise-it/product/callback&epa=http://my.gateway3d.com/acp/api/p/2/epa/get/p/

fullcalendar - When I mouse over a day, I want to call tooltip -

Image
if write below, can function but, don't know how call tooltip event. when apply eventmouseover, work perfectly, below, dosen't call anything. $('body').on('mouseover', 'td.fc-day, td.fc-day-number', function() { var start=$(this).data('date'); var tooltip = '<div class="tooltipevent" style="width:200px;height:50px;background:#fff;position:absolute;z-index:10001; padding:20px; border:1px solid rgba(0,0,0,0.1);">' + "ssss" + '</div>'; $(this).append(tooltip); }); use bootstrap tooltip plugin http://getbootstrap.com/javascript/#tooltips . , inside eventrender callback write following: eventrender: function(event, element) { $(element).tooltip({title: event.title}); } this work update : above hover on event, hover on day: $(".fc-day").hover(function(){ // code creating tooltip });

How do i send arguments from C# windows form to GDB console? -

i'm trying make app tests buffer overflow through c# windows form. that, need open gdb c# process , pass following commands: cd c:\users\user\desktop file file.exe disas main run file insert input the following code start gdb.exe, unfortunately not change working directory. process p = new process(); p.startinfo.filename = "gdb.exe"; p.startinfo.arguments = @"cd c:\users\andrei\desktop"; p.start(); the gdb console output looks like: cd: no such file or directory. c:\users\andrei\desktop: permission denied. so, have 3 problems now: how make change working path? how send other commands arguments? how console output c# in label/textbox? thank you.

Hide create Button and upload button in alfresco Doclib -

Image
i want show create , upload button inside document library only, , in document library if create sub folder. inside sub folder don't want allow user create folder or upload document. is possible in alfresco 5.0.d please refer below image. in image want hide create , upload option. want show both option specific folder (i.e document library) can me this? thanks in advance. it's worth remembering if hide "create content" , "upload" buttons won't prevent users creating content dragging , dropping files document library trigger upload - nor stop creation of content via other mechanisms such mobile client or other apis webdav (if organisation happens using them). the effective method prevent upload , content creation ensure folders created @ root of document library not allow children created within them. if "createchildren" permission on folders false upload , create actions automatically disabled without having - , prevent

git - Domino Designer and Source Tree (Overwrite issue) -

we have been working combination of notes 8.5.3 , source tree since more year , things moving smoothly, however, recently, after upgrade 9.0, have observed that, designer project doesn't sync on-disk project. not sure, manier times new element/custom-control sync'ed correctly, however, changed element not replaced correctly. strange thing happens randomly, when open on-disk project, in there correctly, however, after manually performing sync operation designer, times design won't in right state. it strange issue , not sure if has faced such problem, suggestions here lot of help. thanks.

Passing Generic Input object to a method C# -

i have method abc() gets called 2 different places in application. , both places have different objects of class implemented common interface "idestination". my 2 classes , interface looking this: public class classa: idestination { public string var1 { get; set; } public string var2 { get; set; } public string var3 { get; set; } } public class classb: idestination { public string var1 { get; set; } public string var2 { get; set; } public string var3 { get; set; } public string var4 { get; set; } public string var5 { get; set; } } public interface idestination { string var1 { get; set; } string var2 { get; set; } } as of method abc() accepts object of classa, want can accept object of classb. have made method defination generic below: public string abc<t>(t obj) { } but, problem inside abc method want access properties of classes (classa , classb both). public stri

angular material - angularjs single input filed for both email and mobile number -

in registration form have single field both email , mobile number doesn't working properly. <form name="regform" > <md-input-container flex md-no-float> <input ng-model="vm.form.email" type="text" placeholder="email or phone" translate translate-attr-placeholder="register.email" name="email or phone" ng-pattern="/^([_a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,5}))|\d+$/" required="true"> <div ng-messages="regform.email.$error" ng-show="regform.email.$touched"> <div ng-message="required">this field required</div> <div ng-message="email">your email address invalid</div> </div> </md-input-container> </form> below code showing schema in model file usermodel.js var userschema = new schema({ name: string, email: {type: string, required: true, select:

node.js - Undo Unwind in aggregate in mongodb -

i have multiple data this { "_id" : objectid("57189fcd72b6e0480ed7a0a9"), "venueid" : objectid("56ce9ead08daba400d14edc9"), "companyid" : objectid("56e7d62ecc0b8fc812b2aac5"), "cardtypeid" : objectid("56cea8acd82cd11004ee67a9"), "matchdata" : [ { "matchid" : objectid("57175c25561d87001e666d12"), "matchdate" : isodate("2016-04-08t18:30:00.000z"), "matchtime" : "20:00:00", "_id" : objectid("57189fcd72b6e0480ed7a0ab"), "active" : 3, "cancelled" : 0, "produced" : 3 }, { "matchid" : objectid("57175c25561d87001e666d13"), "matchdate" : isodate("2016-04-09t18:30:00.000z"), "matchtime&

ios - Loading a UIImage from xcassets -

Image
i'm trying load launch image image.xcassets folder no avail. there other answer s (and this one ) on purport answer main solution, load image so uiimage *image = [uiimage imagenamed:@"default@2x"]; returns nil me. the filename named correctly , project setup use assets. does have idea how or doing wrong? thanks in advance. edit: edit 2: final code: -(void) loadsplashimage{ if ([self isipad]){ self.imageviewsplash.image = [uiimage imagenamed:@"default-portrait"]; } else{ if (self.view.frame.size.height == 480){ self.imageviewsplash.image = [uiimage imagenamed:@"default"]; } else if (self.view.frame.size.height == 568){ self.imageviewsplash.image = [uiimage imagenamed:@"default-568h"]; } else if (self.view.frame.size.height == 667){ self.imageviewsplash.image = [uiimage imagenamed:@"default-667h"]; } } } please note works portrait only. you d

java - Map JSON to pojo using Jackson for List that have different parameters -

json format: [ { "0": { "cast":"", "showname":"woh pagle", "type":"episodes" }, "video":[ { "src":"video.mp4" }, { "drm":"false" } ] } ] here problem getting below exception: org.codehaus.jackson.map.jsonmappingexception: can not deserialize instance of java.util.arraylist out of start_object token @ [source: java.io.stringreader@1c9ca1; line: 1, column: 55617] (through reference chain: com.apalya.myplex.valueobject.thirdpartycontentdetailsarray["video"]) my pojo classes : @jsonignoreproperties(ignoreunknown = true) @jsonproperty("0") private thirdpartysubcontentdetails subcontent; @jsonproperty("video") private list<thirdpartysubcontentvideoinfo> video; my sub class pojo : private string src; @jsonign

java - Automating jar input -

i have jar file asks user value of n . , adds values entered. when jar executed cmd.exe , works well. when invoked .bat file, not prompting input rather executes further statements. tried using pipe,as, (echo 3 echo 10 echo 20 echo 30)| java -jar add.jar but didn't work.how can automate input? note: values not accepted arguments, prompt. without knowing code it's hard tell why it's not working you. see below simple working example add.java import java.util.scanner; public class add { public static void main(string[] args) { scanner scanner = new scanner(system.in); int sum = 0; while (scanner.hasnextint()) { int value = scanner.nextint(); sum += value; system.out.println("sum = " + sum); } } } run.bat @echo off (echo 2 echo 10 echo 20 echo 30 echo end ) | java -jar add.jar compile , build jar javac add.java echo main-class: add > manifest.mf jar cmf

visual studio 2013 - Moodle: web service call to get assignments under course -

i have application need fetch record moodle. i receiving courses , categories following api calls. core_course_get_courses core_course_get_categories but not able find right parameter(or may implementation wrong) mod_assign_get_assignments i tried below http://moodle/webservice/rest/server.php?wsfunction=mod_assign_get_assignments&moodlewsrestformat=json&wstoken=token&courseids[0]=27 can have idea how can assignments course? please help following method used fetch records under course in moodle http://moodle/webservice/rest/server.php?wsfunction=mod_assign_get_assignments&moodlewsrestformat=json&wsfunction=core_course_get_contents&moodlewsrestformat=json&courseid=

Input a system of DE's with Matlab GUI -

does know how input system of differential equations (or part of system) matlab gui , put m function file. i've tried this: pod = vectorize(get(handles.edit35,'string')); and in function file: function dy = myeq1(~,y) dy=zeros(2,1); u=y(1); v=y(2); global a11 a12 a13 a21 a22 a23 s k pod dy(1) = a11*u - a12.*pod; dy(2) = a21*v - a22.*pod; it not working. my example of pod function: pod equal u*v/2; promt how right, please. thank you.

C# check conversion from List<string> to single string using String.Join, is possible or not? -

i have 1 list<string> length undefined, , purpose i'm converting entire list<string> string , want's check before conversion possible or not(is gonna throw out of memory exception?) can process data , continue in batch. sample int drc = importconfiguration.data.count; list<string> queries = new list<string>() { }; //iterate on data row generate query , execute (int drn = 0; drn < drc; drn++)//drn stands data row number { queries.add(generate(importconfiguration.data[drn], drn)); //so here want"s check size //if it"s not possible in next iteration i'll execute right //and emptied list again next batch if (drn == drc - 1 || drn % 5000 == 0) { sqlhelper.executenonquery(connection, system.data.commandtype.text, string.join(environment.newline, queries)); queries = new list<string>() { }; } } since trying send large amount of text sql server instance, use sql server's streaming