Posts

Showing posts from July, 2010

azure - How to add the diagnostics extension on cloud service using ARM template -

i know how need define resource in arm template enabling diagnostics extension on cloud service deployed. in examples came across, see virtual machines iaasdiagnostics. couldnt find on enabling diagnostics on cloud service(paasdiagnostics). thanks in advance arm template used deploy , provision of resources application in single, coordinated operation, available in azure resource manager while cloud service in azure service manager, not use cloud service in arm template. you @ create windows virtual machine monitoring , diagnostics using azure resource manager template enable diagnostics in arm template.

asp.net - Strange behavior of ASP .net TextBox -

i have simple asp net web form consists of 2 textboxes 1 single line , 1 multiline in addition fileupload control , button. the page works perfect , button triggers post usual. when copy , paste text "web pages" in particular , paste them in multiline textbox post never triggered, time out error, bad request!!! this behavior generated in iis, not observed in iis express. the text not long, 30 lines or less, noticed when deleting lines of text issue resolved , no errors generated, can't find special in lines deleted, no control characters or other special characters. any idea? has encounter same situation? that strange problem, never had experienced think can problem related browser cache or browser compatibility issue. make sure have declared right version of browser in html code. also, try debug problem placing breakpoint , see runs every time or not.

javascript - Sending Audio file/blob from UI to Servlet for saving at server. -

we trying send our audio file ui side using following code var url = (window.url || window.webkiturl).createobjecturl(blob); var link = document.getelementbyid("save"); link.href = url; link.download = filename || 'output.wav'; var fd = new formdata(); fd.append('fname', 'sample1.wav'); fd.append('data', blob); $.ajax({ type: 'post', url: 'audiototext', data: fd, processdata: false, contenttype: "audio/wav" }); but unable process in servlet. can me javascript code send audio file servet , servlet code save audio fie in servlet. in advance. good day you can use plugin fileupload https://github.com/blueimp/jquery-file-upload there quite full instruction how use spring , ajax: http://krams915.blogspot.ru/2012/06/file-upload-with-spring-and-jquery-part_2793.html (from wiki of plugin) quick tutorial (don't forget include plugin) html code: <label...

java - using sl4j to log from an eclipse osgi plugin -

i'm using sl4j eclipse (luna) osgi bundles. working fine until upgraded eclipse mars. broke something, somewhere , can't figure out did wrong. after few hours trying put back, decide write simple osgi bundle test mecanism that, i thought , understood. i'm going through new osgi wizard , create simple bundle: the manifest : manifest-version: 1.0 bundle-manifestversion: 2 bundle-name: service bundle-symbolicname: service bundle-version: 1.0.0.qualifier bundle-activator: service.activator bundle-requiredexecutionenvironment: javase-1.8 import-package: org.osgi.framework;version="1.3.0", org.slf4j require-bundle: ch.qos.logback.classic, ch.qos.logback.core and activator code is: public class activator implements bundleactivator { private logger logger=loggerfactory.getlogger(this.getclass()); public void start(bundlecontext context) throws exception { system.out.println("hello world!!"); logger.error("logging error {}", t...

html - TD borders not rendered correctly with Firefox -

Image
better check if it's code issue before reporting bug firefox dev team... here fiddle of little table css-styled. css quite simple : table { border-collapse: collapse; font-size: 1em; } th { background-color: #a0a0d8; font-weight: bold; width: 20em; } th, td { border: 1px solid #8080b8; padding: 2px; } sadly, , without zoom , got irregular borders displayed . did make mistake, or issue should reported (didn't find such report exepcte ones zoom) ? note : zooming forward or backward gets borders regular coefficient. edit : here html requested : <div class="content"> <table id="groups"> <thead> <tr> <th class="groupes">groupes</th> <th class="action add" title="ajouter un nouveau groupe">+</th> </tr> </thead> <tbody> <tr id="new-group-tr" style="display: none;"...

delphi - XE6 - How to convert TStringStream content to TStream? -

i using following code convert tstringstream tstream. give error when try copy tstringstream's content tstream. it seems making obvious mistake not able catch it. my code: procedure tfrmmain2.button1click(sender: tobject); var ss:tstringstream; s, s2:tstream; photostr: string; begin photostr := 'hello world, testing: /9j/4aaqskzjrgabaqaaaqabaad//' + 'ga7q1jfqvrpujogz2qtanblzyb2ms4wich1c2luzybjskcgslbfryb2njip' + 'lcbxdwfsaxr5id0goduk/9saqwafawqebamfbaqebqufbgcmcachbwcpcwsj' + 'dbepehirdxerexycfxmughurerghgbodhr8fhxmxiiqihiqchh8e'; ss := tstringstream.create(photostr); s := tstream.create(); s.copyfrom(ss, ss.size); //<= line gives error end; the error message getting is: ...class ewriteerror message 'stream write error'. i don't know why getting error. you creating instance of tstream abstract class. must never instantiate tstream directly. instantiate descendent class instead, su...

conflicts in Git feature branches, how to detect them early -

with developing java git, have frequent problem different people change same classes in different feature branches, results in merge conflicts. while these problems inevitable point, detect these problems early, people can talk , align. i see 2 possible solutions here: best practices (like looking @ other peoples branches) , tool support. if miss best practices, please point me document. if there tools (you add branches list , email in case of possible conflicts), please tell me. that's similar continuous integration. you have whatever build-system use continuous integration (teamcity, jenkins) try merge branches every day/hour , send e-mail when failed automatically.

node.js - how to specify local modules as npm package dependencies -

i have application has usual set of dependencies on third party modules (e.g. 'express') specified in package.json file under dependencies. e.g. "express" : "3.1.1" i structure own code modularly , have set of local (meaning on file system in) modules installed package.json. know can install local module running: npm install path/to/mymodule however, don't know how make happen via package.json dependencies structure. using --save option in command putting "mymodule": "0.0.0" package.json (doesn't reference filepath location). if remove installed version node_modules, , try re-install package.json, fails (because looks "mymodule" in central registry, , doesn't locally). i'm sure way of telling "dependencies": {} structure want installed file system path, don't know how. anyone else had problem? thanks. as of npm 2.0.0, importing local dependencies supported natively. d...

oracle - export and import schema using expdp and impdp -

Image
i use this tuotrial export/import schema. steps in tutorial working until expdp command, see screenshot: i using oracle12c. idea? the article linked to notes that: the directory object pointer physical directory, creating not create physical directory on file system of database server. you have create physical operating system directory separately, outside database. physical directory has readable , writable operating system user running oracle database; seem on windows account services running under. you can create physical directory before or after creating directory object independent, except when oracle trying access through utl_file or related activity - data pump uses utl_file, can see error message stack. the create directory doesn't check physical directory points exists; , can delete or create physical directory without oracle noticing; long there accessible when try use it. from the oracle documentation : a directory object specifies a...

php - How to inject code in posts after X images in Wordpress -

we have function in wordpress show block of code after 3 paragraphs in posts: add_filter('the_content', 'wpse_ad_content'); function wpse_ad_content($content) { if (!is_single()) return $content; $paragraphafter = 3; //enter number of paragraphs display ad after. $content = explode("</p>", $content); $new_content = ''; ($i = 0; $i < count($content); $i++) { if ($i == $paragraphafter) { $new_content.= '<div style="col-xs-12">'; $new_content.= 'code here'; $new_content.= '</div>'; } $new_content.= $content[$i] . "</p>"; } return $new_content; } we trying complete function include , display block of code in post contains @ least 8 images (understanding image each <img src=... ). this block should displayed after image nº8, if aren't 8 images, additional function doesn't d...

json - Determining if a perl scalar is a string or integer -

from read, perl doesn't have real type integer or string, him $variable scalar. recently had lot of trouble old script generating json objects required process values inside json must integers, after debug found because simple print function: json::encode_json was generating string instead integer, here's example: use strict; use warnings; use json; $score1 = 998; $score2 = 999; print "score1: ".$score1."\n"; %hash_object = ( score1 => $score1, score2 => $score2 ); $json_str = encode_json(\%hash_object); # work print "$json_str"; and outputs: score1: 998 {"score1":"998","score2":999} somehow perl variables have type or @ least how json::encode_json thinks. is there way find type programmatically , why type changed when making operation concatenation above? first, incorrect. yes, every values scalar, scalars have separate numeric , string values. that's need know particular ...

arrays - Random element generation without duplicates Java -

this question has answer here: creating random numbers no duplicates 15 answers best way pick random subset collection? 10 answers i trying code run without duplicates having no success researching area. its start of question doing ask user input missing element. however, when generate random elements getting duplicates import java.util.random; public class questiononea2 { public static void main(string[] args) { string[] fruit = {"orange", "apple", "pear", "bannana", "strawberry", "mango"}; random numbergenerator = new random(); (int = 0; < 5; i++) { int nextrandom = numbergenerator.nextint(6); system.out.println(fruit[nextrandom]); } } } ...

solr - Nutch to allow when the host name is having portnumber -

i using nutch push , index data solr. in nutch, have added abc.com:85 domain-urlfilter.txt , +^ http://abc\.com\:85 regex-urlfilter.txt . the problem nutch not indexing data , throwing message total number of urls rejected filters:1 here in url, need portnumber ,this configuration done. could please let me know how make nutch work port number :85 added. the problem syntax: +^http://abc\.com\:85 not correct. please check syntax here: nutch regex-urlfilter syntax hope helps, le quoc do

javascript - URL Route Parameters in AngularJS ui-router -

i want able reload nested view of application , attached route parameter on can have url routing in application. cannot figure out how this, had working query this: $location.search('userid', user._id); //http://localhost:9000/#/user/?userid=123456789 my desired url below, userid = 123456789 http://localhost:9000/#/user/123456789 my app.js file $stateprovider .state('index', { url: '/', views: { '@' : { templateurl: 'views/layout.html' }, 'top@index' : { templateurl: 'views/top.html', controller: function($scope, $state) { $scope.userlogout = function() { $state.go('login'); }; } }, 'left@index' : { templateurl: 'views/left.html' }, 'main@index' : { templateurl: 'v...

angularjs - Get duration of local video selected using angular -

is possible validate duration of local video user has selected using file input in angular? i have following html binds selected video model. <input type="file" ng-model='video.videotoupload' accept="video/*" required> the properties of video in controller include filesize , filetype no duration. want avoid overhead of submitting video web server validate duration. this not pure fit angular-- works!! have tried mp4 format. var myvideos = []; window.url = window.url || window.webkiturl; function setfileinfo(files) { myvideos.push(files[0]); var video = document.createelement('video'); video.preload = 'metadata'; video.onloadedmetadata = function() { window.url.revokeobjecturl(this.src) var duration = video.duration; myvideos[myvideos.length-1].duration = duration; updateinfos(); } video.src = url.createobjecturl(files[0]);; } function updateinfos(){ document.que...

Cassandra: can I index and query along a third dimension? -

Image
i want put third dimension criteria on queries in cassandra. alows efficient 2-d queries because not key-value store, key-key value store. is: simple key-value store: key-key-value store: so attraction cassandra given value keya, can perform efficient range queries along keyb, because contiguously stored. now possibe, given keya , keyb, have index along third dimension, keyc, can limit values returned based on keyc? so essentially: basically given keya, keya-1, , range of keyb, keyb-2 thru keyb-4, want return values corresponding keyc-3, shown green above. i know possible because simple key-value store can multiple indices. question is, efficient . still perform fast range queries along keyb? my use case time series, want store minute-resolution, , daily-resolution data same series. keya series want, keyb day, , keyc minute. want because storing minute mean if needed daily data, mean getting far data out , on network (24*60 minutes per day , want 1 of them), m...

w3c - HGROUP element removed from the HTML5 Specification. What alternative technique can be used instead? -

as of of heard hgroup element being removed html5 specification . (for more info, see w3c html working group's decision on request drop hgroup html5 on w3c's public mailing list archives.) now i'm working on redesign of site using tag creates way of adding sub heading. my current thoughts add hx tag under main header, i'm not sure if semantic enough so. <h1>darren reay</h1> <h2>a developing web developer</h2> <p>hello world</p> could either come alternative using sub headers or @ least point me in right direction? a couple of points consider: even if tag removed html5 specification, doesn't mean stop working overnight. browsers keep backwards compatibility long time (afaik if not browsers still render <font> correctly!) even if browsers drop support overnight, they'd still render page correctly because don't think hgroup tag adds inherent styling , (modern) browsers lenient in allowin...

Suppress Outlook permissions warning in MS Access -

sometimes when using outlook subroutines ms access i'll permission prompt: "a program trying access e-mail address information stored in outlook. if unexpected, click deny , verify antivirus software up-to-date." with option allow access 1 minute 10 minutes. there way can either ignore prompt automatically or set auto-choose 10 minutes each time? the way know of using rdo use in vbscript , ruby, vba possible. here example in vbscript lists contents of pst file. set session = createobject("redemption.rdosession") file = "c:\test\archive_test.pst" call session.logonpststore(file) set ipmroot = session.stores.defaultstore.ipmrootfolder total =0 subtotal = 0 each folder in ipmroot.folders wscript.echo "" wscript.echo folder.name wscript.echo "" each msg in folder.items wscript.echo " " & msg.subject & " " & msg.size & " " & msg.senderemailaddress s...

c# - Merging XPS files leaves open file handles to document references -

i merging xps files via iis web application during merging process, leaves document reference file handles open. in windows wpf or console application, wouldn't worry handles released after application closed. recycling app pool close handles too. however, can't recycle app pool closing file handles due caching , performance. is there way close these file handles after merge complete? i've tried few different merging approaches, following code has given me best results: private documentpaginator createmergeddocument(ienumerable<string> xpsfiles) { using ( memorystream mergedstream = new memorystream() ) { using ( var pkg = package.open( mergedstream, filemode.create, fileaccess.readwrite ) ) { var pack = "pack://merged.xps"; var uri = new uri( pack, urikind.absolute ); packagestore.addpackage( uri, pkg ); using ( xpsdocument mergeddocument = new xpsdocument( pkg, compressionoption.maximum, pack ) ) { ...

c# - How to speed up a linq statement that checks two lists for missing records -

what trying achieve. i working on reconcile process , need ensure database table has correct entries. need find records in table not in master list. when have found these entries need group them , find recent in each group. if operation fields of recent entries defined “added”, need add additional records operation fields marked “deleted”, not defined in master list. the code have written selects records in database not in master list. groups these , orders them , select first item in each group newest in each group. return items have operation defined “added”. have run code against unit tests , “real” data. although works, slow taking maybe forty seconds when run against database of 16 thousand records (when run within visual studio). can advise on if possible modify code improve speed? shown below code finds mismatched records var linksindb = _ctx.linkrecords.tolist(); return (from dbl in linksindb select dbl) .except( dbl in l...

android - Integrating Static Library Getting Error "No rule to make target : export_includes needed by import_includes" -

i facing issue while integrating static library existing shared library on android platform (lollypop) i trying add static library(.a) in android l linked shared module(.so). module exist (i.e being built) , intend link static library module. the code structure below ::- -abc --xxx --yyy --zzz [newly added folder] ---android.mk [newly added] ---foo.c [wrapper file library along header files] ---newlib.a [the actual static lib being discussed] --android.mk [this present , builds library incorporates xxx , yyy name of oldlib.so] now have added zzz folder contains static library(newlib.a) , wrapper c file (foo.c).zzz contains android.mk build itself. please check syntax of both android.mk newly added android.mk local_path := $(call my-dir) include $(clear_vars) local_module := newlib local_export_ldlibs := -lnewlib local_module_suffix := .a local_module_tags := optional local_src_files := foo.c local_src_files += newlib.a include $(prebuilt_static_library) syntax of pres...

python - HTML parsing with lxml - how to keep empty content in resulting list? -

i using lxml parse html file: from lxml import html tree = html.parse(myfile) data = tree.xpath('//p/text()') i have 300 <p>text</p> tags in html file, len(data) 250 because i'll have <p></p> in html. want these included in data either 'nan' or '' . any suggestions on how this? //p/text() find texts of p elements having non-empty text. instead, find p elements , call .text_content() each one: data = [p.text_content() p in tree.xpath('//p')] to demonstrate difference: >>> lxml import html >>> >>> >>> data = """ ... <p>text1</p> ... <p></p> ... <p>text2</p> ... """ >>> >>> tree = html.fromstring(data) >>> data = tree.xpath('//p/text()') >>> len(data) 2 >>> >>> data = [p.text_content() p in tree.xpath('//p')] >>...

r - RShiny: Display a single table with multiple inputs using select box -

i have 2 sets of inputs: month(jan ~ dec), quarter(q1 ~ q4) , saved dataframe in r environment. (12 months + 4 quarters, total 16 dataframes) and have created 2 select boxes can choose display months or quarters picture below. enter image description here but when write 2 output$table code, shiny app reactive either month output or quarter output. i have created 2 tables in single main panel. however, rather display 2 tables(looks ugly), display single table in main panel reacting both select box. (two input , single output). so have tried write if statement, not work. here server.r , ui.r have been testing with ui <- shinyui(fluidpage( sidebarlayout( sidebarpanel( selectinput("dataset", "choose month:", choices = c("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep","oct","nov","dec")),...

svn - visualsvn or git local repo only -

what trying achieve - do automated deployment of .net project. i want use source control not want store files on places github.com, want store them on server , access them via workstations i want use jenkins achieving above, use msbuild building project, source control keep track of files , want jenkins automatically deploy application every night on server. i new using jenkins, visualsvn , git. far have given above scenario try , able create repository using visualsvn using vs2015. in jenkins able configure msbuild when came configuring git or svn pain. for git repository url not take local file path for svn repository url not take local file path kept giving me error "unable access file:///c:/repositories/webapplication1/trunk : svn: e180001: unable open ra_local session url svn: e180001: unable open repository 'file:///c:/repositories/webapplication1/trunk' " can please explain, in jenkins, configure git , svn repository url, have point github...

Projection with AsQueryable in MongoDB C# driver 2.2 -

i trying hands @ mongodb c# driver version 2.2. trying use projection not want retrieve elements in document. found 1 way use project operator along find operator, this: collection.find(key => key.index == 1).project<myclass>(builders<myclass>.projection.include(key => key.name).include(key => key.index)). toenumerable (); however interested in using asqueryable api along operator, this: collection.asqueryable().where(key => key.index == 1); is possible use projection in above case? if use select operator, have same effect projection? or still fetch elements database server , select specified elements in application server? yes, possible. if add select ( select(i => new { i.name, i.index}) ) query , call tostring method @ end, you'll see linq provider generates aggregation pipeline 2 operations (a $match , $project ): var query=collection.asqueryable().where(key => key.index == 1).select(k=>new {k.name,k.index}); var aggre...

Python: Add occurrences of a list element and its total count to another list, avoid adding duplicates -

this question has answer here: trying add dictionary values counting occurrences in list of lists (python) 4 answers i have corpus of text containing sentences. wish count number of occurrences of each word , avoid adding word more once (e.g. multiple occurrences of ',' must added once return ',': 2047 ) desired output: 'partner': 7, 'meetings': 7, '14': 7, 'going': 7, etc. realize need use set() avoid duplicates. don't know how. currently, avoiding adding elements in list saying append if not in occurrences this isn't working getting ',':2047 multiple times in result. i avoiding list comprehensions in sample code increase reader's comprehension! :p counting occurrences of words[i] in words occurrences = [] in range(1, words.__len__() - 1): if words[i-1] not in occurrences: o...

geolocation - Appcelerator Could not find method android.app.Activity.checkSelfPermission -

Image
i cant seem geo location work on android seem following bug. [info] : dalvikvm: not find method android.app.activity.checkselfpermission, referenced method ti.modules.titanium.geolocation.geolocationmodule.haslocationpermissions [warn] : dalvikvm: vfy: unable resolve virtual method 32: landroid/app/activity;.checkselfpermission (ljava/lang/string;)i [info] : dalvikvm: not find method android.app.activity.requestpermissions, referenced method ti.modules.titanium.geolocation.geolocationmodule.requestlocationpermissions [warn] : dalvikvm: vfy: unable resolve virtual method 82: landroid/app/activity;.requestpermissions ([ljava/lang/string;i)v my code follows. ti.geolocation.purpose = "please allow find you."; //ti.geolocation.showcalibration = false; if (os_android) { titanium.geolocation.android.locationprovider = ti.geolocation.provider_gps; } ti.geolocation.accuracy = ti.geolocation.accuracy_best; ti.geolocation.distancefilter = 10; ti.geolocation.reques...

google chrome - How to change the default browser used by the ipython/jupyter notebook in Linux? -

i'm on linux mint 17.3. how change default browser used jupyter notebook? i've installed notebook part of anaconda 3, , opens in default browser, chrome. reason, chrome won't let me make new ipynb. clicking 'new' button doesn't anything.so copied notebook url firefox, , works fine there. is there way can make work chrome? otherwise, how change default browser? usual answer i've come across i've gotta change c.notebookapp.browser option, can't find way so, since trying find ipython_notebook_config in terminal comes 4 results: ./anaconda3/lib/python3.5/site-packages/jupyter_core/tests/dotipython/profile_default/ipython_notebook_config.py ./anaconda3/lib/python3.5/site-packages/jupyter_core/tests/dotipython_empty/profile_default/ipython_notebook_config.py ./anaconda3/pkgs/jupyter_core-4.0.6-py35_0/lib/python3.5/site-packages/jupyter_core/tests/dotipython/profile_default/ipython_notebook_config.py ./anaconda3/pkgs/jupyter_core-4.0.6-py35_0/lib...

c++ - VC12 Command Line Error when Linking .lib Files -

i'm trying compile c++ program vs2013 command window includes , linked libraries. pretty standard stuff. however, microsoft's website explaining syntax not clear me. i'm trying following command: cl /ehsc program.cpp /i "\path\to\includes" /libpath:"\path\to\library\directory" /link libfile1.lib libfile2.lib note: it's on 1 line when execute it, readability i've split here. the quotes because of directories in paths have whitespace in them beyond control (like program files). i'm trying adapt command property sheet made using visual studio interface, if helps, mapping i'm making is: includepath --> /i librarypath --> /libpath: additionaldependencies (under link) --> /link i running admin in x64 native tools command prompt on machine running 64-bit windows 10. however, gives me these warnings , errors: cl: command line warning d9002: ignoring unknown option '/libpath:\path\to\library\directory'...

linux - Facebook automatic page posting posts to all my pages (raspbian) -

i own couple of facebook pages. friend , have developed app can run on raspbian , can post on facebook when want to. uploads pictures specific map facebook. script in .sh. to accomplish needed page token , facebook app. facebook app needed direct messages towards page. page token got https://developers.facebook.com/tools/explorer/ (select app needed, select page token want generate , make permanent token). i use cronjobs automate process , upload images when want upload. example: 15 * * * * /home/pi/directory1/script1 50 * * * * /home/pi/directory2/script2 30 * * * * /home/pi/directory3/script3 43 * * * * /home/pi/directory4/script4 my problem when use cronjobs page posting interferes. images on page 1 posted on page 2 , other way around. have no clue how fix have tried anything. when running script on own without cronjobs seems work automated not. if have suggestion can try please tell me so. thank you!

Unable to get page feeds that are shared from a facebook profile -

ok restriction facebook unable find in developer docs. when request data facebook using https://graph.facebook.com/{user-id}/feed?limit=1&locale=en_gb&access_token={access-token}&fields=id,from,message,link,actions,status_type everything works ok profile. though page provides feeds, page has created , shared other pages, never returns feeds shared facebook profile. i tried sending other parameter in fields, nothing works me. suggestions? ok, think answer. , impossible restriction facebook api since api 2.0 i answers facebook team on this. below link it: https://developers.facebook.com/bugs/1057965060965057

php - Storing an escape sequence in a variable for use later -

this might seem trivial, it's curiosity that's been bugging me somewhat. i have front-end page user uploads csv file. can select delimiter, file, , on, , have server process request. if user selects "tab" option, example, '\t' stored delimiter in variable, can retrieve model later. the problem arises when try use value, as-is; $csv->setdelimiter($this->csv_delimiter); because it's not being treated escape sequence, league\csv (the library using) throw exception, stating delimiter must single character. i can overcome doing so; if($this->csv_delimiter == '\t'){ $csv->setdelimiter("\t"); } else{ $csv->setdelimiter($this->csv_delimiter); } however me seems cumbersome , bit of code smell. tried enclosing variable in double-quotes within setdelimiter method, doesn't work either. there way force variable work escape sequences? or perhaps should working more literal representations, such characte...

bluebird - Bookshelf.js FindOrCreate method -

i have following in bookshelf model create (data, options = {}) { return this.forge(data) .save(null, options); }, findone (data, options = {}) { return this.forge(data).fetch(options); }, findorcreate (data, options = {}) { let createopts = _.clone(data); let findopts = _.pick(data, 'name', 'id'); return this.findone(findopts, options) .then(model => { return model ? model : this.create(createopts, options); }); } i have controller method calls findorcreate method so: function insertrows(scenescollection, location) { return config => { const payload = config.payload; const projectid = config.project.get('id'); const userid = config.userid; let inserts = filterimportpayload(payload); let inserted = []; _.foreach(inserts, obj => { let opts = extractoptions(obj, p...

subtract - MySQL - subtracting one query set from another -

i'm not sure how lecture notes tell me use "except" in sql mysql not seem support this. i've been thinking should use "where not in" alternative, problem both of these columns need compare have different names. here incorrect query: (select id projects) id not in (select project_id projects_viewed); i want select rows table "projects" id column not appear in "projects_viewed" table. column called "project_id" instead of "id" because it's foreign key. basically logic behind result set returned query should project id's have not been viewed (the ones in 2nd table). there several ways this. here's 1 using outer join null check: select p.id projects p left join projects_viewed pv on p.id = pv.project_id pv.project_id null and not in : select id projects id not in (select project_id projects_viewed) i think these methods more efficient in mysql not exists .

Execute Javascript function oninit in Framework7 on index page - Cordova -

on app start want execute javascript function. i tried work on index having - data-page="index" , using below function: myapp.onpageinit('index', function (page) { // "page" variable contains required information loaded , initialized page }) but function doesn't work when application started. you have trigger it. myapp.onpageinit('index', function() { // code here }).trigger(); use .trigger() index route. can read more in framework7 documentation. update you can check issue conversation in framework7 github repo.

javascript - How to ensure that users are running most up-to-date version of an application instead of a cached version -

we in stages of developing application, regularly releasing updates app fix bugs or add new features. however, our users accidentally run cached versions of app instead of up-to-date version after release. our users not technical , can't step of them through clearing cache. also, not want set no-cache because our app rather large. have seen on other posts programmatically clearing cache not option. practical solutions? one trick place different parameter in url. should force browser download new version. for example: <script src="main.js?version=1"> and: <script src="main.js?version=1.1"> and on. or longer random string, guid, should never repeat. i'm not huge fan of approach myself, quick , easy , common. if have full access expiry server sets on such files, , know it's going changing, can tell browser not store cached version long. for example: expiresbytype text/javascript "access plus 1 d...

How to create URL from ASP.Net Web Form class name -

i have 2 classes inherit system.web.ui.page (two web pages) seen below. ~/catalogs/item.aspx.cs public partial class item: system.web.ui.page { protected global::system.web.ui.webcontrols.hyperlink downloadlink; protected void page_load(object sender, eventargs e) { // expect "~/catalogs/download.aspx" // how can implement method? this.downloadlink.navigateurl = gettheurlfor(new download()); } } and ~/catalogs/download.aspx.cs public partial class download : system.web.ui.page { protected void page_load(object sender, eventargs e) { // perform download here } } how can implement method gettheurlfor(page) return url given page? update1 : asp.net web application project on .net 4.5 update2 : request.url not work because gets url of current page want url of different page base on understanding of question, looking this? namespace demowebform { public partial class default : system....

python - Stably computing large quantites through recursion -

i have 2 quantities & b defined recursion , through reference list of values x = [ x_1, x_2, ... x_n ], input program. program iterate on values in x , update & b according to: for n in range(1,n) a[n] = a[n-1] * exp(+x[n]) + b[n-1] * exp(-x[n]) b[n] = b[n-1] * exp(+x[n]) + a[n-1] * exp(-x[n]) and starting values a[0] = exp(+x[0]) b[0] = exp(-x[0]) the values in x not big numbers (always <10) n in hundreds, , because of exponentials final values of & b large. i'm worried because of form of recursion multiplying exponentially large numbers exponentially small ones , adding them scheme become quite numerically unstable. ideally calculate log(a) , log(b) instead stop values becoming large. because of recursion scheme that's not possible, unless compute messier like log_a[n] = x[n] + log_a[n-1] + log( 1 + exp(-2*x[n] + log_b[n-1]-log_a[n-1] ) ) is numerical stability right concerned here? , if log based scheme stabilise it? we c...

c++ - fixed size container to variadic template argument list conversion -

i have call variadic template function can take number of arguments. template < class ... args > void f( args&... args); i wish write small wrapper function can call f n arguments of same type contained in fixed size container std::array. the goal write like std::array<int, 3> arr = {1,2,3}; wrapper(arr); // calls f(1,2,3); i tried use combination of initializer lists , std::forward no avail. there way achieve want ? if compiler supports c++14 can following way: template <class ... args> void f(args&&... args) { ... } template<typename t, std::size_t n, std::size_t... i> void wrapper_impl(std::array<t, n> const &arr, std::index_sequence<i...>) { f(arr[i]...); } template<typename t, std::size_t n, typename indices = std::make_index_sequence<n>> void wrapper(std::array<t, n> const &arr) { wrapper_impl(arr, indices()); } live demo for c++11 based on so answer code mach...

r - Conditional Factor Level Selection in Aggregation of Data Table -

i'm trying aggregate data.table 1 row per id. suppose first column represents id , last column factor of interest: mydt <- data.table(matrix(c(1,2,"level 1", 1,12,"level 0", 1,12,"level 0", 2,12,"level 3", 2,12,"level 2"), nrow = 5, ncol = 3, byrow = true)) mydt v1 v2 v3 1: 1 2 level 1 2: 1 12 level 0 3: 1 12 level 0 4: 2 12 level 3 5: 2 12 level 2 i have non-intuitive rules how aggregate factor: if level 1 exists row of id aggregated row should have level 1 id if not, if level 2 exists id use it if not, level 3 if exists if not, level 0 the actual data.table large , there no numeric component of actual factor levels, strings. script run @ least once per day, i'm trying avoid slow pre-processing loops. the desired result this: v1 v2 v3 1: 1 8.67 level 1 2: 2 12 level 2 however can't find suitable aggregation function... mydt[,.(v2 = mean(v2, na.rm = t), v3 = if(...

java - Getting error in implementation of heap sort -

i'm trying create , sort heap using array in java. keep getting exception in thread "main" java.lang.arrayindexoutofboundsexception: 42 @ heapsort.exchange(heapsort.java:28) @ heapsort.max_heapify(heapsort.java:22) @ heapsort.build_heap @ heapsort.sort(heapsort.java:36) @ heapsort.main(heapsort.java:46) i'm not sure error coming from. public class heapsort { public static int n; public static int[] a; public static int largest; public static void build_heap(int[] a){ n = a.length-1; for(int = n/2; >= 0; i--){ max_heapify(a,i); } } public static void max_heapify(int[] a,int i){ int left = 2*i; int right = 2*i +1; if(left <= n && a[left] > a[i]) largest = left; if(right <=n && a[right] > a[largest]) largest = right; if(largest != i) exchange (a[i],a[largest]); max_heapif...

html - Click the Text in a Div and Type to change It -

here html: <div class="div1" id ="div1" onclick="onstepclicked()" style ="text-align:center">step 1</div> here css: .div1 { width: 300px; height: 100px; border: 1px solid blue; box-sizing: border-box; i'm trying google , when click text allows edit it. don't know if there in css or in div me able this. you can use contenteditable edit make text or div editable . html: <div contenteditable="true">this editable text.</div> contenteditable