Posts

Showing posts from July, 2014

c - Reversing an input string -

i trying capture user input string, display string in reverse order next initial string. code follows: char str[300], revstring[300]; int i, strlen; int main(void) { printf("enter string: "); //prompt user input string gets(str); (i = 0; str[i] != null; i++) { //get length of string strlen += 1; } (i = 0; <= strlen; i++) { revstring[i] = str[strlen - i]; } printf("\n\nthe palindrome of input %s%s\n\n\n", str, revstring); return 0; } when run program however, see nothing after initial string. come python background maybe thinking in of python mindset, feel should work. after loop for (i = 0; str[i] != null; i++) { //get length of string strlen += 1; } str[strlen] equal terminating 0 '\0' . , next loop starts writing 0 in first element of array revstring when i equal 0. for (i = 0; <= strlen; i++) { revstring[i] = str[strlen - i...

android - PutLong on a null Long in argument Bundle -

given new instance method of fragment: public static myfragment newinstance(long somelong) { bundle args = new bundle(); myfragment fragment = new workoutdetailsroutineinfofragment(); args.putlong(args_long, somelong); fragment.setarguments(args); return fragment; } if somelong null, doesn't work. caused by: java.lang.nullpointerexception: attempt invoke virtual method 'long java.lang.long.longvalue()' on null object reference how store long if it's null? check if null , if null add -1 if not null add long object. pretty easy

git - List of tortoisegit equivalents of command line commands? -

i'm using tortoisegit , going through tutorials on git, of course use command line (for broad applicability). is there list somewhere (my google-fu failed me) of ? git command > tortoisegit equivalent if want tortoisegit command line, page need to: https://tortoisegit.org/docs/tortoisegit/git-command.html https://tortoisegit.org/docs/tortoisegit/ https://github.com/tortoisegit/tortoisegit

linux - Gradle sync failed: finished with non-zero exit value 2 -

i installed android 2.2 studio (i'm in ubuntu) , keep getting message: error:process 'command '/usr/local/android-studio/jre/bin/java'' finished non-zero exit value 2 i've tried suggested in internet ( java finished non-zero exit value 2 - android gradle ) i don't understand happening (this first time installation, , first time lauch on empty activity). here log, if can give idea, hint or can put light on road, i'll very thankful ! the important lines, believe, these: 2016-11-13 00:48:17,239 [ 34809] info - util.embeddeddistributionpaths - looking embedded gradle distribution @ '/usr/local/android-studio/gradle/gradle-2.14.1' 2016-11-13 00:48:17,239 [ 34809] info - util.embeddeddistributionpaths - found embedded gradle 2.14.1 2016-11-13 00:48:17,332 [ 34902] info - ls.idea.gradle.gradlesyncstate - started sync gradle project 'my application'. 2016-11-13 00:48:17,597 [ 35167] info - s.plugins.gradle...

oracle - Error ORA-01821 "date format not recognized" -

i trying alter session date format "yyyy-mm-dd hh:mi:ss:ff6" alter session set nls_date_format = 'yyyy-mm-dd hh:mi:ss:ff6' is i'm trying use , it's giving me error ora-01821 "date format not recognized". what doing wrong? the oracle date type has second-level precision (as opposed to, say, microsecond-level precision), date formats don't support ff notation. if want microseconds appended, can write: alter session set nls_date_format = 'yyyy-mm-dd hh:mi:ss:"000000"'; alternatively, maybe wanted set default timestamp format? if so: alter session set nls_timestamp_format = 'yyyy-mm-dd hh:mi:ss:ff6';

What does TortoiseGit NOT show if I uncheck Show Whole Project? -

Image
in tortoisegit windows interface, if looking @ log there checkbox "show whole project". if unchecked, shown? i don't see pattern removed.

Run Javascript code with ID and Hash -

what can run code hash , id? create onmousedown want run code has , id, like: #content + id="content" html: <div class="buttons"> <a href="#" onclick="return false" onmousedown="autoscroll('content')"> go content page</a> <a href="#" onclick="return false" onmousedown="autoscroll('contact')"> go contact page</a> <a href="#" onclick="return false" onmousedown="autoscroll('bottom')"> go bottom page</a> </div> <div id="content" class="content"></div> <div id="contact" class="contact"></div> <div id="bottom" class="bottom"></div> javascript: var scrolly = 0; var distance = 40; var speed = 20; function autoscroll(el) { var currenty = window.pageyoffset; var targety = document.getelementbyid...

javascript - JS artificial delay between async requests -

i trying find way introduce delay between requests. have async method called likephotos iterates array of photos , calls likephoto() each. rather fire off @ same time have second delay between each call likephoto , return caller once complete. async likephotos(photos) { // run function on photos var likes = photos.map(function(p, index, photos){ this.likephoto(p); }, this); return promise.all(likes); } likephoto(p) { let { token } = this.state; return new promise(function(resolve, reject) { http .post('/api/photos/' + p.id + '/likes', {}, { authorization: 'bearer ' + token }) .then((response) => { console.log("yeah"); resolve(); }) .catch((error) => { console.log("failed photo: " + p.id); reject(error.message); }) }); } settimeout doesn't quite seem fit bill here. i'm js noob suggestions appreciated! add counter simultaneous http requests. br...

c# - Data Pager Postback causes value lose -

i new asp.net. here scenario. trying build search functionality. if enter value in search box i.e. "test" , click search icon sql server returns results. have limited datapage size = "1". when click on next page refreshes page , search box looses value entered in case "test". if no value passed sql server returns default result everytime navigate through pages works first page each click after returns me default value. bind list view on prerender of datapage. here code snippets. protected void search_serverclick(object sender, eventargs e) { mydatapager_prerender(sender, e); } protected void mydatapager_prerender(object sender, eventargs e) { string var_search_firstname = globalsearchinput.value.tostring(); string var_search_city = citysearchinput.value.tostring(); string var_search_state = statesearchinput.value.tostring(); bool isadvancedsearch = false; //determine whether it's...

android - Ionic 1.x - push notifications with ionic cloud -

i'm looking @ feasibility of creating ionic app work around push notifications. in fact, app, if possible nothing handle these push notifications (it's internal workflow app potential client). general idea app ask use question via push notification, , (and part i'm unsure about) collect answer question saving our app's api. notifications default don't have functionality enable collecting additional info, did find info "detail view" ( https://developer.apple.com/ios/human-interface-guidelines/features/notifications/ ) basically says: provide intuitive, beneficial actions. notification detail view can include 4 action buttons. these buttons should performing common, time-saving tasks eliminate need open app. use short, title-case names describe action results. notification detail view can display onscreen keyboard collecting information needed take action. example, messaging app might let people respond directly new message notification. can i...

Pandas: Create several rows from column that is a list -

Image
let's have this: df = pd.dataframe({'key':[1,2,3], 'type':[[1,3],[1,2,3],[1,2]], 'value':[5,1,8]}) key type value 1 [1, 3] 5 2 [1, 2, 3] 1 3 [1] 8 where 1 of columns contains list of items. create several rows each row contains multiple types. ontaining this: key type value 1 1 5 1 3 5 2 1 1 2 2 1 2 3 1 3 1 8 i've been playing apply axis=1 can't find way return more 1 row per row of dataframe. extracting different 'types' , looping-concatenating seems ugly. any ideas? thanks!!! import itertools import pandas pd import numpy np def melt_series(s): lengths = s.str.len().values flat = [i in itertools.chain.from_iterable(s.values.tolist())] idx = np.repeat(s.index.values, lengths) return pd.series(flat, idx, name=s.name) melt_series(df.type).to_frame().join(df.drop('type', 1)).reindex_axis(df.columns, 1) setup df = pd.da...

compare multidimensional array to find array with largest value javascript -

i have multidimensional array has name , integer values in them. need able compare integer value in each array in multidimensional array. how can compare , return array? var totals = [ ['john', 'test', 45], ['bob', 'tester', 75] ]; how can loop on arrays in "totals" array , return 1 largest integer value? you use reduce . example: var totals = [ ['john', 'test', 45], ['john', 'test', 46], ['john', 'test', 42], ['john', 'test', 41] ]; var biggest = totals.reduce((a, b) => a[2] > b[2] ? : b); console.log(biggest); fiddle here it should noted, if reduce() not supplied initial value, a becomes first, , b becomes second in first call.

javascript - Ember: Custom JSONAPISerializer -

i having trouble persisting data api after create new record in datastore. // routes/application.js import ember 'ember'; export default ember.route.extend({ model(){ return this.store.findall('user'); }, actions: { test(name){ this.store.createrecord('user', { username: name, email: 'email@email.com', is_staff: false }).save(); } } }); the rest api expecting request: { "data": { "type": "user", "id": null, "attributes": { "username": "bill", "email": "email@email.com", "is_staff": false } } } ember-data sending this: { data: { attributes: { username: "bill", email: "email@email.com", is-staff: false }, type: ...

c# - Microsoft Cognitive Services Emotion API: Video Aggregate Result Frequency -

is there way set how produce aggregate results when analyzing emotions in videos? i using microsoft cognitive services emotion api ( https://www.microsoft.com/cognitive-services/en-us/emotion-api ), cannot find documentation on this. while doing research, found possible set interval using azure media analytics ( https://azure.microsoft.com/en-us/documentation/articles/media-services-face-and-emotion-detection/ ). setting preset such as: { "version": "1.0", "options": { "aggregateemotionwindowms": "987", "mode": "aggregateemotion", "aggregateemotionintervalms": "342" } } i'm looking similar microsoft cognitive services emotion api. thanks. this not possible through microsoft cognitive services today. can set presets when service invoked via azure media services.

node.js - Unable to install express using npm in windows 10 -

Image
i have tried number of times install express using npm. attached image shows nodejs npm install express syntaxerror i have manually copied npmrc file appdata same results. i have changed path c:\users[username]\appdata\roaming\npm;c:\program files\nodejs i can not express install.

css - background image missing in slides ionic rc 2 -

my intention have slide background image background image missing in ion-slide.background image working fine in other pages.the following code....... typescript import { component } '@angular/core'; import { modalcontroller, menucontroller, navcontroller } 'ionic- angular'; import { viewcontroller } 'ionic-angular'; // import { registrationpage } '../event-create/event-create'; import { linktoregistration } '../about/about'; import { modalpage } '../modal/modal'; import { userdata } '../../providers/user-data/user-data'; // import * moment 'moment'; // import * firebase 'firebase'; declare var firebase: any; export interface slide { title: string; description: string; //image: string; } @component({ templateurl: 'tutorial.html' }) export class tutorialpage { slides: slide[]; showskip = true; public time: any[] = []; amp = ""; count = 0; aseats = 0; gathering = 0; start = 0; sfix ...

c# - Difference in instantiating a variable using parenthesis and not -

this question has answer here: why c# 3.0 object initializer constructor parentheses optional? 5 answers difference in instantiating variable using parentencis , not with parentheses var mycity = new citydto() { id = 1, name = "ny" }; without parentheses var mycity = new citydto { id = 1, name = "ny" }; there's no difference. when calling default constructor, using object initializer syntax, () can removed. if remove object initializer, () required.

data annotations - Special character not encoded in [Required (ErrorMessage = "Latitude must be between -180&deg; and 180&deg;)] -

when validation message given on webpage though, doesn't show proper degree symbol , shows without encoding it. it appears adding special characters cshtml may best way , following show correct degree symbol in validation message. <span asp-validation-for="user" class="text-danger">error message &deg;</span>

chart.js - how to add ticks to all radar axis in Chartjs -

i creating chartjs radar chart . there want add ticks each axis. default ticks add ticks y axis. here ticks: { beginatzero: true, max: 100, backdropcolor: "rgba(0, 0, 0, 1)", maxtickslimit: 5, fontsize: 0, backdroppaddingx: 100, backdroppaddingy:1 } how can change make happen.

php - Remove duplicates from multidimensional array sub key -

i trying make php array unique. looks this: .... [7] => array ( [extensions] => array ( [empty cart] => array ( [title] => title [name] => cwp_emtpy_cart_title [type] => input [default] => might interested in: [help] => ) ) ) [8] => array ( [extensions] => array ( [idea vote] => array ( [title] => must logged in vote [name] => cwp_idea_logged_in [type] => dropdown [options] => array ( [0] => yes (default) ...

node.js - TypeError: Cannot read property 'push' of undefined Mongoose -

i getting below error doing app in node.js using express. using mongoose db operations below have detailed design party.js var mongoose = require("mongoose"); var partyschema = new mongoose.schema({ partyname: string, songs: [ { type: mongoose.schema.types.objectid, ref: "song" } ] }); module.exports = mongoose.model("party", partyschema); song.js var mongoose = require("mongoose"); var songsschema = new mongoose.schema({ videoid: string, videoname: string }); module.exports = mongoose.model("song", songsschema); my app.js app.post("/search/addsong", function(req, res) { party.find({partyname:"hello"},function(err,party){ if(err){ console.log("failed in find"); } else { console.log(party); // console.log(typeof(req.body.videoid)); var videoid = req.bod...

How do I run a Java program in a single node cluster in hadoop? Do I need to convert my java code into a JAR file and then execute? -

i want run custom java code/program on single node hadoop cluster. how run java program in single node cluster in hadoop? need convert java code jar file , execute? yes, need convert .jar file. explain step step 1)write java code in eclipse ide. 2)to create jar of project, follow this link 3)copy dataset hdfs using following command $ bin/hadoop dfs -copyfromlocal /path/to/file/on/filesystem /path/to/input/on/hdfs 4)run jar giving path of dataset stored in hdfs, can follow command $ bin/hadoop jar path/to/jar/on/filesystem /path/to/input/on/hdfs /path/to/outputdir/on/hdfs 5)the following command used verify resultant files in output folder. $ bin/hadoop fs -ls /path/to/outputdir/on/hdfs 6)the following command used see output in part-00000 file. file generated hdfs. $ bin/hadoop fs -cat path/to/output_dir/part-00000 hope helps you.

Error due to Site.Master file - asp.net using c# -

i receiving error due site.master file. have made numerous adjustments , still cannot past issue site.master file. have wrong specification perhaps? code executes in microsoft visual studios, when export site files hosted servers run issues. compiler error message: cs1002: ; expected line 1365: system.web.ui.webcontrols.listviewdataitem container; line 1366: system.web.ui.databoundliteralcontrol target; line 1367: across-america.models.category item; line 83 "e:\server\user\across-america\site.master" the error due following: <asp:listview id="categorylist" itemtype="across-america.models.category" runat="server" selectmethod="getcategories"> i have modified temtype="across-america.models.category" remove across-america still error. advice??? c# code error: <div id="categorymenu" style="text-align: center"> ...

android - Replace one fragment with an another fragment -

Image
i want replace old fragment new fragment , still buttons of old fragment still visible in new fragment. in old one, on button click fragmenttransaction transaction = getfragmentmanager().begintransaction(); fragment newfragment = genericmood.newinstance("a","b"); // replace whatever in fragment_container view fragment, // , add transaction stack if needed transaction.replace(r.id.allmoods, newfragment); transaction.addtobackstack(null); transaction.commitallowingstateloss(); i can replace old fragment new one, buttons r.id.allmoods fragment still visible on top of new fragment . i tried given below code. fragmenttransaction transaction = getfragmentmanager().begintransaction(); fragment newfragment = genericmood.newinstance("a","b"); // replace whatever in fragment_container view fragment, // , add transaction stack if needed transaction.replace(((viewgroup)getview().getparent()).getid(), newfragment); transaction.addtobacks...

authentication - Login into web site using Python -

this question has been addresses in various shapes , flavors have not been able apply of solutions read online. i use python log site: https://app.ninchanese.com/login , reach page: https://app.ninchanese.com/leaderboard/global/1 i have tried various stuff without success... using post method: import urllib import requests ourl = 'https://app.ninchanese.com/login' ocredentials = dict(email='myemail@hotmail.com', password='mypassword') osession = requests.session() oresponse = osession.post(ourl, data=ocredentials) oresponse2 = osession.get('https://app.ninchanese.com/leaderboard/global/1') using authentication function requests package import requests osession = requests.session() oresponse = osession.get('https://app.ninchanese.com/login', auth=('myemail@hotmail.com', 'mypassword')) oresponse2 = osession.get('https://app.ninchanese.com/leaderboard/global/1') whenever print oresponse2, can see i'm on l...

Restricting the values predicted by Decison trees in R to certain columns -

i have dataset related cricket following structure: (matchid,venue,team1,team2,mr,mrn,mw,or,orn,ow,winner) mr : runs scored home team after 14 overs. or : runs scored away team after 14 overs. mrn: run rate of home team after 14 overs. orn: run rate of away team after 14 overs. mw: number of wickets lost home team after 14 overs. ow : number of wickets lost away team after 14 overs. convention: team1 home team , team2 away team. i trying predict winner of match above data. using 70% of data training data frame train_data , other 30% testing data frame test_data using decision trees in r. test_data has been stripped off winner column. function calls follows: output.tree <- ctree(winner ~ venue + team1 + team2 + mr + mrn + mw + or+ orn + ow, data = train_data) #to create decision tree. testpred <- predict(output.tree, newdata = test_data[,1:(ncol(test_data) - 1)]) #use decision tree prediction note obviously, winner of match has 1 of team1 or team2. on analyzing p...

backbone.js - Backbone submit stucked -

here html code: <div id="overlay"> <form action="/login" id="login_form"> <input type="text" placeholder="login" id="login_form-login"> <input type="text" placeholder="password" id="login_form-password"> <input type="submit" value="log in"> </form> </div> and here backbone code: loginform = backbone.view.extend({ el: $("#overlay"), events: { "submit #login_form" : "login", }, login: function(e) { e.preventdefault(); console.log("hello backbone"); } }); var login_view = new loginform(); login function never called. know backbone models , templates, there way bind event existing html form? well, found solution. mu short right - #overlay did not exist yet when code executed. here fix: $(document...

java - How to start decreasing a duration stored in Firebase as string? Please see details -

i'm developing android app , have opted users choose duration , store on firebase string this: hms = string.format("%02d:%02d:%02d", timeunit.milliseconds.tohours(duration), timeunit.milliseconds.tominutes(duration) % timeunit.hours.tominutes(1), timeunit.milliseconds.toseconds(duration) % timeunit.minutes.toseconds(1)); it getting saved 1:30:00 . now, retrieving firebase , showing user want show decreasing duration. how can that? please let me know.

ios - Cell location in Personal Hotspot mode -

i trying capture uitablviewcell location in personal hotspot mode after clicking cell. know there larger blue status bar in mode. when use: cgrect cellrect = [tableview rectforrowatindexpath:indexpath]; cellrect = cgrectoffset(cellrect, -tableview.contentoffset.x, -tableview.contentoffset.y); it returns me not correct location of cell press on. correct without personal hotspot. wondering how solve this.

lisp - how to set a bunch of variables depending on one condition in elisp? -

suppose want set values of bar , baz depending on 1 condition, same in both cases, value of foo . using let special form, this (let ((bar (if foo 1 2)) (baz (if foo 3 4))) ... ) while above program correct, seems little strange checks value of foo twice. there idiomatic expression 1 can use in such cases avoid double-check? you needn't set values in let form itself. let form creates local bindings, after can set values wish. (let (bar baz) (if foo (setq bar 1 baz 2) (setq bar 3 baz 4)) ...)

can i edit lightswitch screen (or element of it like custom control) to load my entire HTML page? -

Image
i want load html page occupy entire lightswitch screen i tried can't make div take page (i tried edit width , height of custom control , of div didn't work) try adding custom control group layout item , stretching both fit container,

c# - Linq - get max of string that ends with an integer -

this question has answer here: max() in linq query 2 answers i'm trying max of string column such - a1 a2 a3 ... but when max number 10 or above - linq returns a9 max. why? how solve this? the code- from d in db.documents.orderbydescending(d => d.number) (.....) select d.number) .firstordefault(); thanks in advance! you cant normal linq, if want compare alphanumeric values, should this, static void main(string[] args) { list<string> vals = new list<string>(); vals.add("a1"); vals.add("a11"); vals.add("a41"); vals.add("a13"); vals.add("a12"); vals.add("a9"); var result = vals.orderbydescending(x => ordernumbers(x)); } public static string ordernumbe...

java - Missing return statement due to If condition -

so have following function: int digitsum(int n){ int s = n; if(n < 10) return s; while(s > 0){ n = s + n % 10; s = n / 10; } digitsum(n); } i want take number , sum of digits , want keep doing until end single digit number. can understand here, if statement causing error during compilation, says missing return statement , highlights last } . can me this? in non-void function , every function call must trace return statement , java says every execution path in function must lead return statement so add return digitsum(n); according rule in java , if condition if(n < 10) false there no further return statement exists either there should default return statement or there should other return statement in conditional else case.

r - cbind different length of data frames based on column -

this question has answer here: combine 2 data frames rows (rbind) when have different sets of columns 12 answers i have 2 dataframes: df1 name stock_1 stock_2 11 12 b 9 2 c 1 3 df2 name stock_1 d 2 e 4 expected output: name stock_1 stock_2 11 12 b 9 2 c 1 3 d 2 na e 4 na the name , stock_1 names of columns. try cbind 2 df not working. there efficient way? we use dplyr::full_join() : library(dplyr) df3 <- full_join(df1, df2) df3 name stock_1 stock_2 1 11 12 2 b 9 2 3 c 1 3 4 d 2 na 5 e 4 na

java - Selenium IDE - convert html to junit automatically -

i have application(spring boot, gradle). need find possible , easier way convert html scenario (created selenium ide) junit tests automatically (maybe run gradle task). found plugins - https://github.com/willwarren/selenium-maven-plugin (based on maven) , https://github.com/nextinterfaces/selenium4j (based on ant). how can add plugin application? posible add maven or ant based plugin gradle based application? maybe plugins gradle exist? highly appreciated. in selenium ide, find option in file menu export test case in multiple languages. goto: file> export test case as> java / junit 4 / web driver here's screenshot showing this: export test case in selenium java junit

Why i am still getting exception in hibernate logs? -

this first hibernate program , want run , getting same exception again , again tried add <property name="hibernate.temp.use_jdbc_metadata_defaults">false</property> didnt worked hibernate.cfg.xml: <?xml version="1.0" encoding="utf-8"?> <!doctype hibernate-configuration system "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.dialect">org.hibernate.dialect.oracle10gdialect</property> <property name="hibernate.connection.driver_class">oracle.jdbc.oracledriver</property> <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:xe</property> <property name="hibernate.connection.username">hibernate</property> <property name="hibernate.connection.password">hibernate</property> <property name=...

angular - In angular2 how do you do an ngEnter on a forms input box so that it calls a function -

in angular2 how do ngenter on forms input box calls function? i cant seem (keyup.enter) working. let me know if need import thing. this form: <form autocomplete="off" class="bs-component padding-top-20" role="form" #form="ngform"> <div class="form-group"> <input class="form-control" type="email" value="" name="email" placeholder="email" [(ngmodel)]="email" (keyup.enter)="test()" required /> </div> <a class="btn btn-default pink col-xs-12" type="submit" [routerlink]="['/register', {id: email}]"> join</a> </form> this function in component: test = (): void => { console.log(...

glsl - How to normalize image coordinates for texture space in OpenGL? -

say have image of size 320x240 . now, sampling sampler2d integer image coordinates ux, uy must normalize texture coordinates in range [0, size] (size may width or height). now, wonder if should normalize this texture(image, vec2(ux/320.0, uy/240.0)) or this texture(image, vec2(ux/319.0, uy/239.0)) because ux = 0 ... 319 , uy = 0 ... 239 . latter 1 cover whole range of [0, 1] correct? means 0 corresponds e.g. left-most pixels , 1 corresponds right pixels, right? also want maintain filtering, not use texelfetch . can tell this? thanks. no, first 1 correct: texture(image, vec2(ux/320.0, uy/240.0)) your premise "ux = 0 ... 319 , uy = 0 ... 239" incorrect. if render 320x240 quad, say, ux = 0 ... 320 , uy = 0 ... 240. this because pixels and texels squares sampled @ half-integer coordinates. so, example, let's assume render 320x240 texture on 320x240 quad. bottom-left pixel (0,0) sampled @ screen-coordinates (.5,.5). normalize dividing ...

elisp libxml-parse-html-region return NIL -

here elisp code (test url "http://httpbin.org/html") (with-current-buffer (url-retrieve-synchronously my-url) (goto-char (point-min)) (re-search-forward "^$") (delete-region (point) (point-min)) (setq dom (libxml-parse-html-region (point-min) (point-max))) (hoge--log-trace "current buffer content: %s" (buffer-string)) (hoge--log-trace "dom is: %s" dom) ) parse html use elisp function "libxml-parse-html-region" result is: current buffer content: <!doctype html> <html> <head> </head> <body> <h1>herman melville - moby-dick</h1> <div> <p> availing himself ... </p> </div> </body> </html> dom is: nil as can see buffer has content, elisp function libxml-parse-html-region return nill , result dom object nil. why?

Multiple loops logic and speed optimization in Python? -

here 2 python functions transfer data 1 file file. both source file , target file have same number of objects different data. def getblock(rigobj, objname): rigobj.seek(0) tag = false block = "" line in rigobj: if line.find("objectalias " + str(objname) + "\n") != -1: line in rigobj: if line.find("beginkeyframe") != -1: tag = true elif line.lstrip().startswith("0.000 ") , line.rstrip().endswith("default"): tag = false break elif tag: block += line return (block) def buildscene(sceneobj, rigobj, objlist): sceneobj.seek(0) rigobj.seek(0) newscene = "" line in sceneobj: newscene += line obj in objlist: if line.find("objectalias " + obj + "\n") != -1: tag = true ...

ava watch functionality and transpiling typescript -

is possible use ava --watch functionality when write tests in typescript? now have this "test": "tsc -p tsconfig.test.json && ava \"dist_test/**/*.js\"" only nice have test modified source / test files during development. you use chokidar-cli detect file changes , manually run build , test. "test": "tsc -p tsconfig.test.json && ava \"dist_test/**/*.js\"", "test:watch": "chokidar \"dist_test/**/*.js\" -c \"npm run test\" --initial", once changes detected in files run test you.

Open source UWP app, can I make the app identity public -

Image
i have open-source uwp app want use appveyor automatically create appxupload package me. i stumpled upon this instructions on how configure project create appxupload package without requiring app_storekey.pfx certificate file. now i'm wondering if can make these values, app identity, public, or if can harm them? i mean these values right here. now i'm wondering if can make these values, app identity, public, or if can harm them? yes , can. means distribute project's source code - uniquely identifies developer (and publishing chain) must kept secret because that's how consumers of application can trust build you, original developer, , not malicious third-party modified program evil (e.g. upload users' contacts list spamming service) - if make signing files publicly available can imitate you.

MongoDB: Case Insensitive search (Java) -

basicdbobject search = new basicdbobject(); search.put("name", uname); mongocursor<document> mongocursor = testcollection.find(search).iterator(); i've seen few ways online of them 2 years or old. don't work basicdbobject search well. correct way of going now? i'm using mongodb java driver 3.2 .

angularjs - angular-modal-service: "closeDeferred is null" and multiple instances -

i'm using library angularjs show custom modals: https://github.com/dwmkerr/angular-modal-service i ran problem when trying close modal $rootscope watch. this controller modal want close: app.controller('playlistmodalcontroller', function($scope, $rootscope, modalservice, close, playlist) { $scope.playlist = playlist; $scope.close = close; $scope.queuesong = function(song) { modalservice.showmodal({ templateurl: "templates/modals/confirm_queue.html", controller: "confirmqueuecontroller", inputs: { song: song } }); } $rootscope.$on("idleenter", function() { console.log(close) $scope.close(); }); }); the modal closes on 'idleenter' event , doesn't produce error , if it's first time event fired. when re-open model , event fired again produces error: error: closedeferred null cleanupclose@[...]/angular-modal-service.js:179:14 close/<@[...]/angular...

python - What does the following error message mean for an inverse matrix? -

i include of code, because don't know error comes from. here is: import numpy np import sympy sy sympy import matrix numpy import linalg mu = list(range(16)) # represent possible components (of metric) in 1 line array. t, x, y, z = sy.symbols("t x y z") # spacetime coordinates. lettercoords = [t, x, y, z] # coords in list easy access numcoords = [0, 1, 2, 3] # coords in numbers class metrictensor: # metric tensor class def __init__(self, g0, g1, g2, g3, g4, g5, g6, g7, g8, g9, g10, g11, g12, g13, g14, g15): # metric components self.g0 = g0 self.g1 = g1 self.g2 = g2 self.g3 = g3 self.g4 = g4 self.g5 = g5 self.g6 = g6 self.g7 = g7 self.g8 = g8 self.g9 = g9 self.g10 = g10 self.g11 = g11 self.g12 = g12 self.g13 = g13 self.g14 = g14 self.g15 = g15 def lmetric(self): lstmetric = [self.g0, self.g1, self.g2, self.g3, self.g4, self.g5, self.g6, self.g7, self.g8, self.g9, self.g10, self.g11, self....

regex - Texwrangler replacement string -

i use reqex expression: \s\.\d find expression, e.g., ".9" , replace expression "0.9", i.e., part of search pattern part of replacement pattern. avoid replacing .true. 0.true. i've tried replacement patterns such 0.\d puts "d" in replacement string. you may use & backreference entire match. if want match dot preceded non-word char , followed digit, may use \b\.\d , replace 0& . however, if use \s\.\d , want add zero, need capturing group - (\s)(\.\d) , replace \010\2 (where \01 backreference first capturing group, 0 0 , \2 backreference second capturing group. note approach won't let match @ string start, need add alternative in first group: (^|\s)(\.\d) ^ matches start of string/line.

go - How can I build a command line app for android? -

i want build small app android can run android command line while i'm remotely connected android device through ssh. don't want button/launcher/icon or gui interface of kind. i prefer in golang if possible. i tried using gomobile ( golang.org/x/mobile ) when put apk on device , try run error: u0_a44@ghost:/data/data/berserker.android.apps.sshdroid/home $ start gserv.apk starting: intent { act=android.intent.action.main cat=[android.intent.category.launcher] pkg=gserv.apk } java.lang.securityexception: permission denial: startactivity asks run user -2 calling user 0; requires android.permission.interact_across_users_full @ android.os.parcel.readexception(parcel.java:1546) @ android.os.parcel.readexception(parcel.java:1499) @ android.app.activitymanagerproxy.startactivityasuser(activitymanagernative.java:2504) @ com.android.commands.am.am.runstart(am.java:770) @ com.android.commands.am.am.onrun(am.java:307) ...

python modules are not displaying -

help> modules please wait moment while gather list of available modules... c:\users\abcd\anaconda3\lib\site-packages\ipython\kernel__init__.py:13: shimwarning: ipython.kernel package has been deprecated. should import ipykernel or jupyter_client instead. "you should import ipykernel or jupyter_client instead.", shimwarning) c:\users\abcd\anaconda3\lib\site-packages\flask\exthook.py:71: extdeprecationwarning: importing flask.ext.cors deprecated, use flask_cors instead. .format(x=modname), extdeprecationwarning at end python shell closed, how solve above problem?

c# - how get propertyField Mapped Relation (MapFrom) in Automapper -

i have sample code: namespace automappercontracts { public interface ihavecustommappings { void createmappings(iconfiguration configuration); } } public class classa { public int id { get; set; } public string nametest { get; set; } public string familytest { get; set; } public icollection<classb> classbs { get; set; } } public class classb { public int id { get; set; } . . . public datetime dateinsert { get; set; } public int classaid { get; set; } public classa classa { get; set; } //other realation public int classcid { get; set; } public classc classc { get; set; } } public class classabviewmodel : ihavecustommappings { public int id { get; set; } public string name { get; set; } public string family { get; set; } public string fullname { get; set; } public string dateinsert { get; set; } public int classcid { get; set; } public string clas...

How to create binary matrix from numerical matrix in R? -

pseudocode matrix operation try find out if matrix cell value < alpha, put 1. else 0. i want create binary matrix alpha p-value matrix p.mat cannot handle apply correctly try satisfy pseudocode. first approach # http://stackoverflow.com/a/4236383/54964 new <- apply(p.mat.p, 1, function(x) if (alpha > x) { x <- 0 } else { x <- 1 } ) second approach fails new <- apply(p.mat.p, 1, function(x) x <- (x < alpha) ) print(new) #error in match.fun(fun) : argument "fun" missing, no default #calls: apply -> match.fun #execution halted trial , code library("psych") ids <- seq(1,11) m.cor <- cor(mtcars) colnames(m.cor) <- ids rownames(m.cor) <- ids p.mat <- psych::corr.test(m.cor, adjust = "none", ci = f) p.mat.p <- p.mat[["p"]] alpha <- .00000005 # http://stackoverflow.com/a/4236383/54964 new <- apply(p.mat.p, 1, function(x) if (alpha > x) { ...