Posts

Showing posts from March, 2014

Perl - How to solve the trouble with encoding in windows console? -

trying use russian lettaz , console acts donkey, because not react on use utf8/utf-8 or cp1251 directives . encoding of text marked red colour don't know. knows how solve ? code listing below: #!/usr/bin/perl -w use strict; use warnings; use tie::ixhash; tie %hash, "tie::ixhash"; %hash = ( 'шляпа' => 'серая', 'водка' => 'горькая', 'вобла' => 'вкусная'); print "В упорядоченной вставке список хеша такой:\n"; foreach $qwerty (keys %hash){ print " $qwerty\n"; } print "Кроме того, предметы обладают некоторыми свойствами:\n"; while((my($predmet, $opredelenie)) = each %hash){ print "$predmet $opredelenie","\n"; } you need specify stdout encoding. script utf-8 encoded: use strict; use warnings; #use tie::ixhash; use utf8; binmode stdout, ":encoding(cp866)"; %hash = ( 'шляпа' => 'серая', 'водка&#

r - Color Coding Sweave Only Partially Working -

i still working on this question . i've got gives correct cells red backgrounds, not giving other cells green backgrounds. note: using sweave only, not knitr. here code: <<>>= flag <- data.frame(hosp,dept, overall, dc_info, care_trans) @ <<results=tex>>= color_cells <- function(df, var){ out <- ifelse(df[, var]=="", paste0("\\cellcolor[html]{2db200}{", df[, var], "}"), paste0("\\cellcolor[html]{ff0600}{", df[, var], "}")) } flag$overall <- color_cells(df = flag, var= "overall") flag$dc_info <- color_cells(df = flag, var= "dc_info") flag$care_trans <- color_cells(df = flag, var= "care_trans") @ <<results=tex>>= flagx <- xtable(flag) align(flagx) <- "|c|l|l|c|c|c|" print(flagx[1:40,], hline.after=c(-1:40), sanitize.text.function=identity, sanitize.colnames.function = hmisc::latextrans

sql - How to improve mysql NATURAL LANGUAGE MODE search query? -

this query select * mytable match (name) against ("apple m1" in natural language mode) if search apple m1 results orange m1 third or more position apple m-1 – value stored , assuming should first! my question is: there way fine tune mysql search? they best way improve mysql natural language mode search use boolean full-text searches instead. same natural language mode search, can use additional modifiers finetune results, e.g. by > < these 2 operators used change word's contribution relevance value assigned row. > operator increases contribution , < operator decreases it. there 1 minor difference, boolean mode search not order automatically according relevance, have order yourself. select * mytable match (name) against (">apple m1" in boolean mode) order match (name) against (">apple m1" in boolean mode) desc and remark: both versions of fulltext search not find m-1 if match against m1 (ev

machine learning - When to stop training - LOOV MLP -

i'm running mlp classify set of values 10 different classes. simplified down, have sonar gives me 400 "readings" of object. each reading list of 1000 float values. i have scanned 100 total objects , want classify them , evaluate model based on leave-one-out cross validation. for each object, split data training set of 99 objects , test set of remaining object. feed training set (99 objects, 99*400 "readings") mlp , use test set (1 objects, 1*400 "readings) validate. my question is: how know training epoch use final "best" model? googled around , people said use epoch had best validation accuracy, seems cheating me. shouldn't instead pick model based on statistics of training data? (my thought process random weight reshuffling in training create artificially high validation accuracy doesn't provide useful model new objects scanned in future) so answer says use training epoch gives best validation accuracy: whats difference

html - Centering text/content under images in flexbox? -

i've been attempting add paragraph text under vertically aligned image in flexbox, have been getting trouble getting render onto next line. possible text centered under image? here have: jsfiddle html: <section class="landing"> <div class="left-half"> <article> <img src="http://placehold.it/400x600" /> <div class="text"> <p>i need text under image</p> </div> </article> </div> </section> css: .landing { display: flex; } .left-half { flex: 1; height: 100vh; } .left-half article { height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; } .left-half article img { max-width: 50%; display: block; } .caption { display: block; } just set .left-half article flex-direction:column; : .left-half article { height: 100%; width: 100%; display: flex; align-i

Calling a URL via POST method with JSON object, but using Powershell -

i attempting call specific url via post method, json object passed post form parameter. json object needs passed this: obj={ "login":"[username here]", "pword":"[password here]" } with powershell, attempting create hash , convert json, connect invoke-restmethod command. $hash = @{ login = "username"; pword = "password" } $obj = $hash | convertto-json invoke-restmethod 'https://website.com/login' -method post -body $obj -contenttype 'application/x-www-form-urlencoded' however, returns error. double-checking documentation, notes form parameter name must obj , web services looks parameter called obj , takes string value, converts json object retrieve internal values. this getting little stuck. how can specific form parameter name when using powershell? the form you've presented: obj={ "login":"[username here]", "pword":"[pas

android - How can I add groups to my listview? -

i populate list view using adapter , data webservice final simpleadapter adapter = new simpleadapter(this, items, android.r.layout.simple_list_item_2, new string[] {"id", "description"}, new int[] {android.r.id.text1, android.r.id.text2}); final listview listview = (listview) findviewbyid(r.id.recordview); listview.setadapter(adapter); i need add groups similar https://code.google.com/archive/p/android-amazing-listview/ but seems amazinglistview isn't usable anymore. tutorials i'm finding vague , years , years ago.

c# - Read a file line by line and write it transformed line by line into another file -

i have read content of existing file "operativedata.txt" line line , write data excelsheet "datawarehouse.csv" line line. content of file "operativedata.txt" looks following in picture ( operativedata.txt )): the data in operativedata.txt have written transformed in different way datawarehouse.csv. have in csv file: "date;time;randomvalue\n" \n means after these 3 lines return this type of format have written (all 10 seconds) in datawarehouse.csv file. should @ end: datawarehouse.csv code generating datawarehouse.csv: using system; using system.io; using system.threading; namespace etltxt2csv { class program { string[]content;//array reading each line of file operativedata.txt public void loop() { content = file.readalllines(@"c:\etl-process\operativedata.txt");//file read while (true)

bash - How to match numbering of files across different folders e.g. rename NAME9.txt to NAME00009.txt -

i have huge list of files, came through different processes, reason ones in first folder numbered this a9.txt a1.txt while ones in other have a00009.txt a.00001.txt have no more 99837 files only 4 "extra" 0 on 1 side. i need rename files inside 1 folder names matches. there way in loop? help. you should take @ perl-rename (sometimes called rename ) not confused rename util-linux . perl-rename 's/\d+/sprintf("%05d", $&)/e' *.txt the above script rename .txt files in directory following: a1.txt -> a00001.txt a10.txt -> a00010.txt hello225.txt -> hello00225.txt test online

Google Geocoding Access Denied Error -

one of our clients has started access denied error on site. here error: there error google's geocoding service: request_denied exception details: system.applicationexception: there error google's geocoding service: request_denied stack trace: [applicationexception: there error google's geocoding service: request_denied] googlemapsapihelpers.getgeocodingsearchresults(string address) +337 findastorecoatings.btnsearch_click(object sender, eventargs e) +67 system.web.ui.webcontrols.button.raisepostbackevent(string eventargument) +155 system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) +3804 basically has of sudden has stopped working of week ago. , requests hadn't hit on 2,500 free requests per day , have billing setup pay days go on amount. does have idea on check for? always check "error_message" field in json (or tag in xml) response, there should explana

java - How do I easily include Google's GCS package into my code? -

i want use google cloud storage java in app engine. documentation on how install thin. found source code com.google.appengine.tools.cloudstorage when source put build path (eclipse) generates lots of compile errors. track down sources, add them in , more compile errors more dependencies. seems missing how use code in simpler way. you can generate library jar , dependencies using java ant , direction mentioned here or better yet, use maven , include appengine-gcs-client dependency.

javascript - Passing multiple viewmodels to a component - performance issues? -

using knockout.js components i'm wondering if performance affected when passing multiple viewmodels component instead of single one. having following: function masterviewmodel(){ this.demo = new demoviewmodel().init(); this.demo2 = new demo2viewmodel().init(); this.demo3 = new demo3viewmodel().init(); this.demo4 = new demo4viewmodel().init(); this.demo5 = new demo5viewmodel().init(); this.demo6 = new demo6viewmodel().init(); } var mm = new masterviewmodel(); ko.applybindings(mm, $(':root').get(0)); i thinking of passing whole masterviewmodel variable component in order able access viewmodels it: ko.components.register(element, { viewmodel: { instance: mm }, template: { require: 'text!views/mycomponent.html' }, }); would performance affected in bad way if instead of passing single viewmodel? ko.components.register(element, { viewmodel: { instance: mm.demo3 }, template: { require: 'text!views/mycomponent.htm

r - Day to day rolling correlations by matching name -

let have data frame below. (the data set have not small this.) library(lubridate) x <- data.frame( date = c(rep(ymd(20160601), 4), rep(ymd(20160602), 3), rep(ymd(20160603), 3)), name = c("a", "b", "c", "d", "a", "b", "c", "b", "c", "d"), observation = sample(1:10) ) # date name observation # 1 2016-06-01 10 # 2 2016-06-01 b 7 # 3 2016-06-01 c 3 # 4 2016-06-01 d 2 # 5 2016-06-02 8 # 6 2016-06-02 b 6 # 7 2016-06-02 c 4 # 8 2016-06-03 b 5 # 9 2016-06-03 c 1 # 10 2016-06-03 d 9 i want find day day correlation of observations of matching names, i.e., date 2016-06-02, want find correlation between <8, 6, 4> , <10, 7, 3> because a, b, , c common in both 2016-06-02 , 2016-06-01. can such (there better ways this): filte

ios - How to use extern NSString for move the string value from first view to second View Controller -

i use extern nsstring moving string value first view controller second view controller . is there example show how use extern nsstring pass data between 2 view controllers. thank you. try this: in first view controller : extern nsstring *str; then define in @interface @interface{ nsstring *str; } then assign value per requirement in @implementation and can use str variable in second view controller

php - load params from database in joomla 2.5 -

data params not load database, i've tried several different structures module without success. my following mod_xml # <?xml version="1.0" encoding="utf-8"?> <extension type="module" version="2.5" client="site" method="upgrade"> <name>mod_bruno</name> <author>joomla! project</author> <creationdate>july 2004</creationdate> <copyright>copyright (c) 2005 - 2013 open source matters. rights reserved. </copyright> <license>gnu general public license version 2 or later; see license.txt</license> <authoremail>admin@joomla.org</authoremail> <authorurl>www.joomla.org</authorurl> <version>2.5.0</version> <description>mod bruno</description> <files> <filename>mod_bruno.xml</filename> <filename>mod_bruno.php</filename> </files> <config> <fields n

asp.net - Disable Dropdown inside Grid View -

i trying disable couple of drop downs while checkbox unselected. have drop down populating @ moment, need enable/disable accordingly. checkbox <asp:templatefield headertext="hpv"> <itemtemplate> <asp:checkbox id="hpvcheck" runat="server" value="feedback"/> </itemtemplate> drop down list <asp:templatefield headertext="hpv criteria"> <itemtemplate> <asp:dropdownlist datatextfield="description" datavaluefield="aqdcode" id="ddlhpvviolation" runat="server" datasource="<%# hpvviolation() %>"/> </asp:dropdownlist> </itemtemplate> </asp:templatefield> the grid protected void gvviolationscited_onrowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow || e.row.rowtype == datacontrolrowtype.header) { //gridviewfunctions.fin

php - How can I get a column from database based on the value of the column -

i wondering how can retrive item database using value of column, have database item column called sid, have different values based on should used for, have 1 item sid of "description" , sid value of "profile_view". how can 1 value of description using php pdo, code trying use: try { $getsettings = $db->prepare("select * `profile_settings` profileid=?"); $getsettings->bindvalue(1, $profileid, pdo::param_str); $getsettings->execute(); $settingsdata = $getsettings->fetchall(pdo::fetch_assoc); foreach ($settingsdata $settingsrow) { $description = $settingsrow['sid']['description']; $profile_view = $settingsrow['sid']['profile_view']; } } catch (pdoexception $e) { } $settingsrow['sid'] not associative array, it's string value of sid column in row. need compare values you're looking for, value column. foreach ($settingsdata $settingsrow) {

asp.net mvc - Changing the structure of my database / edmx model -

i using edmx editor create database visually, whenever change structure, , choose option "generate database model", current data in database wiped. is @ possible change structure of database, , retain data? how people work around problem? thank you here solutions: use code first or database first workflow, suggested in comment question. note : can use code first existing database. maintain data insert script should run after every "generate database model". make schema changes in database first, use "update model database" instead of "generate database model". if using code first workflow possibility you, recommend going route. hope helps.

swift - Animate an SKSpriteNode with textures that have a size different from the original -

Image
i want animate skspritenode using textures sktextureatlas, using skaction.animatewithtextures(textures,timeperframe,resize,restore) . however, textures in atlas have size larger original texture (it's character moving). when action run, textures either compressed fit original size of sprite, or recentered when set resize false , changes position of character. want, though, textures anchored @ lower-left corner (or lower-right, depending on direction) position of character doesn't change apart part of texture. i've tried changing anchor point of sprite prior running action, applies original texture well. also, guess changing size of original texture have impact on physics behaviour, want avoid. does have suggestion how this? thanks! david this work edit textures match size of largest sized texture. just give smaller textures padding using alpha channel give transparent background. e.g. notice how first texture has lots of negative space (from ca

c# - Removing Uncheck values on datagrid -

i want remove values have unchecked on data grid cancel button.i know how checked ones how can in unchecked rows? here code checkeded button proceed foreach (gridviewrow row in gridview1.rows) { checkbox chkrow = (row.cells[0].findcontrol("chkrow") checkbox); if (chkrow.checked) { con.open(); cmd = new sqlcommand(@"update jobquotations1 set transactionstatus = @done transactionid = @tid , transactionnum = @num", con); cmd.parameters.addwithvalue("@done", "done"); cmd.parameters.addwithvalue("@tid", row.cells[2].text); cmd.parameters.addwithvalue("@num", row.cells[4].text); cmd.executenonquery(); con.

css - How to remove table and cells borders when they are clicked -

i created table this: <table class="table table-without-margin"> <thead> ... </thead> <tbody> <tr ng-show="row.sprint == undefined " ng-repeat="row in rowcollectionuserstories | orderby:sorttype:sortreverse |filter:search" ng-class="row.selectedcell ? 'cellselectedclass' : ''"> <td data-ng-click="viewdetailsuserstory(row)" class="table-cell05">{{row.voters.length}}</td> <td data-ng-click="viewdetailsuserstory(row)" class="table-cell23">#{{row.num}} {{row.subject}}</td> </tr> </tbody> </table> and in css: .panel-body-backlog-userstories-list .table { border-bottom:0px !important; } .panel-body-backlog-userstories-list .table th, .table td { border: 1px !important; } .panel-body-backlog-userst

java - Is a ConcurrentHashSet required if threads are using different keys? -

suppose have hash set of request ids i've sent client server. server's response returns request id sent, can remove hash set. run in multithreaded fashion, multiple threads can adding , removing ids hash set. however, since ids generated unique (from thread safe source, let's atomicinteger gets updated each new request), hashset need concurrenthashset ? i think case might cause problem if hashset encounters collisions may require datastructure changes underlying hashset object, doesn't seem occur in use case. yes. since underlying array hash table might need resized instance , because of course ids can collide. having different keys not @ all. however, since know ids increasing, , if can have upper bound on maximum number of ids outstanding (lets 1000). can work upper , lower bound , fixed size array offset indexing lowest key, in case not need mutexes or concurrent data structure. such data structure fragile since if have more upper bound ousta

c# - MVC - Moq Unit Test FileContentResult (ActionResult) - NullRefernceException -

so i'm posting mvc controller, makes call repository telerik report, exports pdf. i'm having trouble unit testing , keep getting error - system.nullreferenceexception: object reference not set instance of object. controller public class reportcontroller : controller { private ipdfrepository _pdfrepository; //dependency injection using unity.mvc5 nuget package public reportcontroller(ipdfrepository pdfrepository) { _pdfrepository = pdfrepository; } [httppost] [validateantiforgerytoken] public actionresult pdfexport(pdfviewmodel model) { byte[] report = _pdfrepository.buildexport(model); return file(report, "application/pdf", model.selectedreport + ".pdf"); } } unit test [testmethod] public void report_pdfexport_returns_actionresult() { //arrange var mockrepository = new mock<ipdfrepository>(); mockrepository.setup(x => x.buildexport(it.isany<pdfviewmod

c++ - Secure, password specific std::string that zeroes itself upon de-allocation -

i found relevant question @ [ 1 ] boost specific due age of post , c++11 having not been matured point otherwise, i'm looking secure std::string typedef of sort below zeroes upon de-allocation. typedef std::basic_string<char, std::char_traits<char>, securestr<char>> string; [ 1 ] - how 1 securely clear std::string? would know of examples? code must not optimized away on compilation , such, compromise security of application. know can quite problem without use of apis o/s and/or compiler. the accepted answer in question linked doesn't appear boost-specific; doesn't mention boost. it's custom allocator use std::basic_string . however, mentions depending on implementation of basic_string , allocator may not invoked; basic_string may have space store small strings internally without having separate allocation. instantiating basic_string custom allocator not enough: need 0 memory of string object itself, in addition buffers may hav

retrieve sequence alignment score produced by emboss in biopython -

i'm trying retrieve alignment score of 2 sequences compared using emboss in biopython. way know retrieve output text file produced emboss. problem there hundreds of these files iterate over. there easier/cleaner method retrieve alignment score, without resorting that? main part of code i'm using. from bio.emboss.applications import stretchercommandline needle_cline = stretchercommandline(asequence=,bsequence=,gapopen=,gapextend=,outfile=) stdout, stderr = needle_cline() i had same problem , after time spent on searching neat solution popped white flag. however, speed processing of output files did following things: 1) used re python module handling regular expressions extract data needed. 2) created ramdisk space output files. use of ramdisk here allowed processing , exchanging data in ram memory (much faster writing , reading output files hard drive, not mention saves hdd in case of processing massive number of alignments).

mysql - Show only records that bought a specific product without buying another specific product -

i have hypothetical table transac_id user_id product ---------- ------- ------- 2051613 189546 monthly plan 8746169 189546 commission fee 7845946 998741 commission fee 8897155 166235 sms 6325477 166235 newsletter 8897452 166235 commission fee 4328941 302604 monthly plan 8897415 309888 sms 2564718 960007 commission fee 7451352 960007 yearly plan what need extract user_id have bought commission fee product, not monthly plan , yearly plan , show record commission fee product. basically, it'll display this: transac_id user_id product ---------- ------- ------- 7845946 998741 commission fee 8897155 166235 commission fee. thanks! to find entities in many-to-many table have row value a particular attribute no row value b , can perform nonexistence self join. lef

node.js - Trying to send message with gunmail, error -

tried following mailgun's nodejs tutorial , error: error { [error: <!doctype html public "-//w3c//dtd html 3.2 final//en"> <title>404 not found</title> <h1>not found</h1> <p>the requested url not found on server.</p><p>if entered url manually please check spelling , try again.</p> ] statuscode: 404 } undefined the code i'm using in node server looks this: var express = require("express"); var expressapp = express(); var server = http.createserver(expressapp); //port number server var portnum = process.env.port || 80; var mailgun = require('mailgun-js'); //get requests expressapp .get("/", function routehandler(req, res) { res.sendfile(path.join(__dirname, "../client/index.html")); var api_key = 'key-00000000000000000000'; var domain = "https://api.mailgun.net/v3/mydomain.com"; //i think error must here var mai

1004 Global Error - Excel VBA -

my code doesn't work. want a2 + 1 = a3 in macros, when tried using p integer, gives me 1004 global error . how (n,1) a2 + 1 = a3 in excel vba? sub agregarproducto() range("a7:g7").select range("g7").activate selection.copy dim p integer p = 0 p = range("a2:a50").count p = p + 1 range(p, 1).select selection.pastespecial paste:=xlpastevaluesandnumberformats, operation:= _ xlnone, skipblanks:=false, transpose:=false range("e2:e3").select activecell.formular1c1 = "0" range("l11").select activecell.formular1c1 = "1" end sub change range(p, 1).select to cells(p, 1).select

Create PDFMake table cells from angularjs .forEach loop over array -

the code below renders following pdf: link pdf on google docs . (i not allowed paste picture post) there song titles , chord progressions each song. looking have single row each song/chords cells. in example hard coded 1 last song in code show should render like. each song should have own table row. have been @ hours , can't figure out ...hoping it's simple solution , i'm missing pretty obvious. thanks help. //fired when set header clicked generate pdf $scope.openpdf = function (setname, setsongs) { songtitles = []; songchords = []; angular.foreach(setsongs, function(value, key) { songtitles.push({ text: value.title, style: 'tableheader'}); songchords.push({ text: value.chords, style: 'tableheader'}); }); var docdefinition = { pageorientation: 'landscape', content: [ { text: &#

Search file in other google drives -

i have google drive storing few google sheets. java web application able search file present in own google drive using javascript api. there way search specific files in other's google drive via code? getting shareable link google drive supposed search. can done? far checked not possible. there no in google document says can search files in other's drive. kindly confirm. this oauth question, not gdrive question. the account gdrive api apply determined access token called with. so, if can access token else's drive, can use search drive. how such token depend on details of use case , trust relationship.

Clarify understanding of VirtualBox snapshots re deleting -

as part of testing installation , function of application, deploy fresh virtualbox guest each time. in order this, first installed fresh copy of guest os vm , made snapshot, intent being revert snapshot before each test run. however, there 1 small change made after event (i seem miss something ). mounting of host drive keep test scripts , application data there , run single command on guest kick off , report on everything. so made changes, took snapshot, , situation now: baseline (22 days ago) | +- hostmounted (21 days ago) | +- current state since don't need baseline more, , build system takes huge amount of space, i'd rid of it. however, being paranoid type, wanted confirm: will deleting baseline snapshot still leave me identical hostmounted ? i'm looking ensure end with: hostmounted (21 days ago) | +- current state i've looked @ doco , various posts on discussion groups seem ambiguous me. the hostmounted snapshot can considered sta

php - Unable to Access @attributes in XML Node -

i trying access 'field' element in 'criteria' node in following xml: <?xml version="1.0" encoding="utf-8"?> <result> <product> <data> <field>spr_tech1</field> <value>s7</value> <criteria field="xfield_3"> <criteria_list>green</criteria_list> <criteria_list>beige</criteria_list> </criteria> </data> <data> <field>spr_tech1</field> <value>s1</value> <criteria field="xfield_3"> <criteria_list>red</criteria_list> <criteria_list>blue</criteria_list> <criteria_list>yellow</criteria_list> </criteria> </data> <data> <field>

python - Trim an ordered dict to the last x items -

i'm trying trim ordered dict last x items. i have following code, works doesn't seem pythonic. is there better way of doing this? import collections d = collections.ordereddict() # snip: populate dict here! d = collections.ordereddict(d.items()[-3:]) this works bit faster: for k in range(len(d) - x) : data.popitem(last = false) not sure how pythonic though. benefits include not having cast create new ordereddict object, , not having @ keys or items.

xslt - How to change all decimal to Zeroes using XSL -

how change decimal value zeroes in xsl example value: from : 9876.123 to : 9876.000 in case number of digits after decimal point unknown in advance, use : concat(substring-before(., '.'), '.', translate(substring-after(., '.'), '123456789', '000000000')) here complete xslt transformation example : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:template match="d"> <xsl:value-of select= "concat(substring-before(., '.'), '.', translate(substring-after(.,'.'), '123456789','000000000'))"/> </xsl:template> </xsl:stylesheet> when transformation applied on following xml document : <t> <d>9876.1</d> <d>9876.

c# - Way to get around stack size -

have recursive factorial function in c#. using deal biginteger . problem arises when want deal large integers , because function recursive cause stackoverflow exception. simple solution not make function recursive. wondering if there way around this? i'm thinking along lines of more ram allocated the stack? biginteger factorial(biginteger n) { return n == 1 ? 1 : n * factorial(n - 1); } i understand nice if express recursive functions in c# without worrying stack. unfortunately not directly possible, , no matter how big make stack there situations run out of stack space. furthermore performance pretty horrendous. if have tail recursive function factorial can done, pretty lets express function in original recursive way, without huge penalty. unfortunately c# not directly support tail recursive calls, workarounds possible using so-called "trampoline" construction. see example: http://bartdesmet.net/blogs/bart/archive/2009/11/08/jumping-the-trampolin

Cordova and Ionic build error for android -

i'm using ionic develop app android, whenever build application error: [fatal error] oss-parent-7.pom:2:1: content not allowed in prolog. [fatal error] oss-parent-7.pom:2:1: content not allowed in prolog. [fatal error] lombok-ast-0.2.3.pom:2:1: content not allowed in prolog. [fatal error] org.abego.treelayout.core-1.0.1.pom:2:1: content not allowed in prolog. failure: build failed exception. * went wrong: problem occurred configuring root project 'android'. > not resolve dependencies configuration ':classpath'. > not resolve com.google.guava:guava:17.0. required by: :android:unspecified > com.android.tools.build:gradle:1.5.0 > com.android.tools.build:gradle-core:1.5.0 > com.android.tools.build:transform-api:1.5.0 :android:unspecified > com.android.tools.build:gradle:1.5.0 > com.android.tools.build:gradle-core:1.5.0 > com.android.tools.build:builder:1.5.0 > com.android.tools:common:24.5.0 > not par

Bulk renaming of files in PowerShell with sequential numeric suffixes -

i found several answers on site renaming files in powershell i'm sorry if repeat. i've spent 5 hours on google , various websites trying figure out. have tried explain well. not programmer meticulous filing. i have 14,000 pictures sorted files year , month taken multiple cameras , want file name reflect date taken. example october 16, 1998 pictures in folder called 1998\10 october\19981016 . want pictures named 19981016_0001 19981016_0002 etc. tried multiple suggestions hasn't worked. due lack of programmer knowledge haha. me out , give me dummy instructions? can point lists folder want change i'm unable change it. of pictures .jpg. tried attach screenshot of did unfortunately can't since i'm new here. in advance! i created temp file of copies in case messed up. started typing cd "c:\documents , settings\brooke lastname\desktop\temp" after getting file load used formula found on forum. ls *jpg | foreach {$i=1} {rename-item _ -newname ("

Improve GPS accuracy - Android turn-by-turn map -

i building navigation application similar waze. have problem in accuracy of gps positions. when i'm driving car on street, marker position on sidewalk , across street. have similar precision waze , googlemaps position on street. i'm leaving accuracy fine did not work. first must tell app there road/path, , snap location road or path. you can use snap road api https://developers.google.com/maps/documentation/roads/snap you can make requests snaptoroads method of google maps roads api @ following url. requests must sent via https. https://roads.googleapis.com/v1/snaptoroads?parameters&key=your_api_key parameter usage required parameters path — path snapped. path parameter accepts list of latitude/longitude pairs. latitude , longitude values should separated commas. coordinates should separated pipe character: "|". example: path=60.170880,24.942795|60.170879,24.942796|60.170877,24.942796.

javascript - Stop running nodemon via Gulp -

here's idea, start app specific port using nodemon run tests, , stop running app run again anytime. gulp.task('test', function(cb) { nodemon({ script: 'server.js', env: { 'node_env': 'test' } }); // run tests.... // stop application , exit running gulp -> how this? }); is there way stop or force ctrl+c running gulp? thanks, kevin i got these require('shelljs/global'); // https://github.com/shelljs/shelljs gulp.task('test', ['nodemon-test', 'mocha-test']); gulp.task('nodemon-test', function(cb) { nodemon({ script: 'server.js', env: { 'node_env': 'test' } }) .on('start', function() { cb(); }) }); gulp.task('mocha-test', ['nodemon-test'], function() { exit(1); });

Python Print Displays -

i having problem project i'm working. problem having @ end of display list getting negative number, wondering if give me direction on how fix problem? need zero. initalprice = float(input("enter price of computer: ")) month = 0 downpayment = initalprice * .10 balance = (initalprice - downpayment) aninterest = balance * .01 / 12 monthlypayment = balance * 0.05 print("%0s%20s%20s%20s%13s%23s" %("month", "current balance", "interest owed", "principal owed", "payment", "balance remaining")) in range(1, 100): #aninterest = aninterest if balance >= 0: initalprice = initalprice - initalprice * .10 principal = monthlypayment - aninterest balance = balance + aninterest - monthlypayment print("%0d%20.2f%20.3f%20.2f%13.2f%23.2f" %(i, initalprice, aninterest, principal, monthlypayment, balance)) you subtracting constant amount monthlypaymen

java - Type erasure interferes with polymorphism -

Image
i reading core java volume , encounter question in translating generic expression. here book said. i don't understand why there interfere. highlighted sentence, why setsecond(object) method called? shouldn't setsecond(date) method since interval dateinterval object? the main problem, think, comes between brackets (in case ) exists when you're writing code. it's compilation-time checking. that's type erasure about. when compile code, have references object , these bridge methods in bytecodes.

Python: How would one represent this particular for loop using list comprehension? -

as title states, know how use "list comprehension" shorten loop. loop functional; however, details of assignment given me states should have @ least 1 list comprehension , loop in code. way, new python. z=0 elements in if a[z] in c: z=z+1 elif a[z] in b: c.append(a[z]) z=z+1 else: z=z+1 also, if there general tips shorten this, appreciated. i assume want take elements a , place them in c if elements present in b . want make sure 1 such element exits in c , meaning c set. you can as >>> = [1, 3, 5, 7, 3] >>> b = [3, 5] >>> set([ in if in b ]) set([3, 5])

javascript - How to setup a hyperlink that only downloads part of a file? -

if have hyperlink links mp3 file on server, how can have browser download first 15 seconds (or other duration) of file when user clicks on link? there html5 attribute automatically? yes, sort of - there media fragment uri specification allows specify time ranges in uri. can append uri fragment , t= : #t=from,to for example: http://domain.to/music.mp3#t=0,10 (or t=,10 in case if from=0) will load data 0-10 seconds. example loading... auto-play<br> <audio src="https://mp3l.jamendo.com/?trackid=912259&format=mp31#t=0,10" autoplay controls preload="none"></audio> <br><br>or click link:<br> <a href="https://mp3l.jamendo.com/?trackid=912259&format=mp31#t=0,10"> ctrl + click link play 10s of audio in new tab...</a> however , won't prevent browser loading rest of audio data. fragment tells media element start , stop @ times without need manually beyo

android - issues when I use tablayout and viewpager inside fragment -

hi have tablayout , viewpager inside fragment public class explore : android.support.v4.app.fragment, appcompatactivity { private tablayout tablayout; private viewpager viewpager; private timebuget timebuget; private specialactivity specialactivity; public override void oncreate (bundle savedinstancestate) { base.oncreate (savedinstancestate); // create fragment here } public override view oncreateview (layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // use return custom view fragment // return inflater.inflate(resource.layout.yourfragment, container, false); //return base.oncreateview (inflater, container, savedinstancestate); return inflater.inflate(resource.layout.explorelayout,container,false); viewpager = view.findviewbyid<viewpager> (resource.id.viewpagerexplore); setu

node.js - How to serve a different home page with Express? -

is possible serve different home page user depending if they're logged in or not? for example, app uses: app.use(express.static(__dirname + '/public')); which serves index.html home page. although serve login.html home page if user not authenticated, , app.html if user authenticated. using middleware. can done expressjs? you can try following approach : app.get('/', function(req, res, next) { try { var contents, authenticated; // user logged-in or not. authenticated = true/false; if(!authenticated) { contents = require('fs').readfilesync(require('path').join(__dirname, './login.html')).tostring(); } else { contents = require('fs').readfilesync(require('path').join(__dirname, './index.html')).tostring(); } res.setheader('content-type', 'text/html');

ios - Media type is unsupported error in json post method Swift -

i'm new swift , making simple application converts celsius fahrenheit using : json webservice my code on button btn action: @ibaction func btn(sender: anyobject) { let celnum = txtfirld.text let myurl = nsurl(string: "http://webservices.daehosting.com/services/temperatureconversions.wso"); print("pass 1") let request = nsmutableurlrequest(url: myurl!); request.httpmethod = "post"; print("pass 2") let poststring = "ncelsius=\(celnum)" request.httpbody = poststring.datausingencoding(nsutf8stringencoding); let task = nsurlsession.sharedsession().datataskwithrequest(request){ data, response, error in print("pass 3") if error != nil { print("error 1") return } let responsestring = nsstring(data: data!, encoding: nsutf8stringencoding) print("responsestring = \(responsestring)") do