Posts

Showing posts from September, 2014

How to access specific row from CSV with Jekyll? -

i using jekyll [2.5.3] build prototype , need access specific rows file in _data in layouts. in file _data/badges.csv have: name, image_url heat, http://pathtoimage.com/image-1.png water, http://pathtoimage.com/image-2.png zoning, http://pathtoimage.com/image-3.png ... in _layout/page.html trying access zoning row badges.csv passing value site.data so: {% assign badge = site.data.badges.name["zoning"] %} {{ badge.image_url }} eventually make ["zoning"] page variable load specific badges based on page. i've tried [zoning] , ['zoning'] , ["zoning"] . none of these output data , not throw error during jekyll build . how can access specific row csv? i believe csv files treated arrays instead of maps. if want find specific entry in csv this: {% badge in site.data.badges %} {% if badge.name == "zoning" %} {{ badge.image_url }} {% endif %} {% endfor %} you move _includes , pass argument reuse fu

algorithm - How to round value UP to nearest factor of a number -

this question has answer here: c++: rounding nearest multiple of number 25 answers there several questions on here how round value known multiple. example there question shows how round value specified multiple (e.g. round 9 multiple of 5 yield 10). want round value nearest factor of given number. example lets says want round value closest factor of 48. factors of 48: 1, 2, 3, 4, 6, 8, 12, 16, 24, 48 if value 9 want round 12. way know brute force: class program { static void main(string[] args) { const int clock = 48; int value = 9; while( value < clock && (clock % value) != 0) { value++; } console.writeline(value); } } this works fine it's not clever or efficient, @ least suspect case. there better way round number factor of base number other brute force? private int ucln(

java - JavaFX Loading in Background -

this question has answer here: javafx 2: background , platform.runlater vs task/service 1 answer how have dialog has indeterminate progressindicator in foreground while main thread loads bunch of data in background , loads on main scene . currently, when program loads, page is white, unresponsive, , looks bad. also, best way or there better way. your window frozen/unresponsive because loading data in main thread (which thread used javafx render window). what need perform loading in separate thread, run parallel main thread. when loading complete, thread notify main thread , pass loaded data render. here quick way create new thread loads data: thread mythread = new thread(new runnable() { @override public void run() { // perform loading here // once loading complete,

javascript - Other browser windows don't go back to user login page after Meteor.logout() -

i have written meteor application user login. after user logs out, application redirects user login page. however, when multiple tabs in browser (or multiple browser windows) application active (and user logged in), active tab or browser window goes user login page. in other window seems user still logged in. however, when user further work in other window, nothing synced db on server anymore. thought meteor.logout() reactive, how possible other browser tabs or windows don't refresh? i have folowwing in router?js file: var filters = { isloggedin : function(pause) { if(!meteor.user()){ this.render('login'); } else { this.next(); } } .... } router.onbeforeaction(filters.isloggedin); after pushing logout button following js code executed meteor.logout(); thanks help. try this: meteor.logoutotherclients meteor.logoutotherclients should log out sessions. designed situations user logged in on multiple devices , wants log out on of them

date - AngularJS Dateformatting -

i date in format: 2015-02-19 00:00:00 now need format date to 19-02-2015 i tried: sc.documents.datestring = $filter("date")('2015-02-19 00:00:00', 'dd-mm-yyyy'); but didn't work, have idea of how this? first argument should date object, not string. yon need is: sc.documents.datestring = $filter("date")(new date('2015-02-19 00:00:00'), 'dd-mm-yyyy');

javascript - setInterval() not working as intended -

this question has answer here: why variable unaltered after modify inside of function? - asynchronous code reference 6 answers i wrote function when called returns 5, yet when console.log function inside of setinterval() returns expect. why doesn't work when called? function countdown(seconds){ var tick = 0; setinterval(function() { if (seconds > tick) { seconds--; console.log(seconds); //counts down expected. } }, 1000); return seconds; } console.log(countdown(5)); //returns undefined. also, know settimeout() preferred when swap out setinterval doesn't work @ all. , clarity issue appreciated it. //returns undefined. because seconds not defined when function returns. see function body. setinterval isn't called till function returns. function countdown(seconds){ var tick = 0; setinterval(functio

PowerShell add-ons -

what complete steps installing and/or adding add-on profile? (ex. ise scriptinggeek) (powershell v4.0) i have tried following: downloaded , unzipped isescriptinggeek-master in c:\users\fname.lname\documents\windowspowershell\modules\ directory. added get-command -module isescriptinggeek profile. ran following command - get-command -module isescriptinggeek , restarted powershell ise. i not see add-ons dropdown. showing steps every add-on not feasible in format because every custom module can have different steps. with regards isescriptinggeek add-on , command putting in profile wrong, should be: import-module isescriptinggeek you can verify works first running command in powershell session.

if string contains else if it doesn't contain - Javascript -

i trying check whether string, in case document title, contains word, , if display "str1" if doesn't contain word display "str2" var str1 = document.title.replace(/new - business name/i, ''); var str2 = document.title.replace(/ - business name/i, ''); if(document.title.indexof("sale") == 1){ document.write(str1);} else if(document.title.indexof("sale") != 1){ document.write(str2);} check indexof docs var str1 = document.title.replace(/new - business name/i, ''); var str2 = document.title.replace(/ - business name/i, ''); if(document.title.indexof("sale") > -1){ document.write(str1); } else if(document.title.indexof("sale") === -1){ document.write(str2); }

javascript - Nested iframe jquery issue -

i have youtube video iframe on page here -- http://viibe.tv/testingtime/index2.html the video pauses when scroll vertical (when video not on screen), , starts playing again when video comes on screen. working fine on page. there case same video coming on page, through embed iframe -- http://viibe.tv/testingtime/index.html and pause/play on scroll doesn't seems work on page. have tried solutions, doesn't fixed. please see if can of or guide me in right direction. jquery.visible used tracking visibility of iframe on screen. thanks in advance. in first example, embedded video directly youtube. in second example , source different. try link second example. https://www.youtube.com/embed/2q2cmhjnwce?autoplay=1&rel=0&showinfo=0&enablejsapi=1 i think problem.

ios - How Can I Solve the Collection View Blinking Issue? (Swift) -

i'm working on collection view project uses parse backend server. , not quite sure here why collection view blinks every time gets appeared on screen.. second cell of collection view gives me blink second after view got appeared on screen, image of third cell. so, can guys me solve problem? , current file looks like.. override func viewdidappear(animated: bool) { super.viewdidappear(animated) if pfuser.currentuser() == nil { // user hasn't logged in yet showlogin() } else { // user logged in, else fetchinterests() let center = nsnotificationcenter.defaultcenter() let queue = nsoperationqueue.mainqueue() center.addobserverforname("newinterestcreated", object: nil, queue: queue, usingblock: { (notification) -> void in if let newinterest = notification.userinfo?["newinterestobject"] as? interest { if !self.interestwasdisplayed(newinterest) { self.interests.insert(newinterest, atindex: 0

javascript - Disable click event over GridView ASP.NET -

i'm working on asp.net gridview made clickable method: protected void onrowdatabound(object sender, system.web.ui.webcontrols.gridviewroweventargs e) { gridview gr = (gridview)sender; if (e.row.rowtype == datacontrolrowtype.datarow) { e.row.attributes["onmouseover"] = "this.style.cursor='hand';this.style.background='#3260a0';;this.style.color='white'"; e.row.attributes["onmouseout"] = "this.style.textdecoration='none';this.style.background='white';this.style.color='black'"; e.row.attributes["onclick"] = page.clientscript.getpostbackclienthyperlink(rh, "select$" + e.row.rowindex); e.row.attributes["style"] = "cursor:pointer"; } } now i want disable functionality when press button , don't know how to. tried using enable = false, a

How to load SVG file into SVGRenderer in three.js -

i'm trying use svgrenderer in three.js ( http://threejs.org/examples/#svg_sandbox ). example shows how make svg element (a circle) on fly. want import svg file have in computer. how that? the createelementns command doesn't seem support importing svg files? i want image.svg displayed on three.js scene. you can use three.svgloader() library achieve : var svgmanager = new three.svgloader(); var url = 'https://upload.wikimedia.org/wikipedia/commons/b/b0/newtux.svg'; function svg_loading_done_callback(doc) { init(new three.svgobject(doc)); animate(); }; svgmanager.load(url, svg_loading_done_callback, function(){console.log("loading svg...");}, function(){console.log("error loading svg!"); }); var amount = 100; var camera, scene, renderer; function init(svgobject) { camera = new three.perspectivecamera(75, window.innerwidth / window.inne

How to store an image using sharedpreferences? Android -

my code below put image gallery imagebutton when leave application or move activity image don't save , first background appear again. i need help, how can save image define imagebutton background i read sharedpreferences, don't know how use on app - - class protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //adding picture bit imgbutton = (imagebutton) findviewbyid(r.id.addpic); imgbutton.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { intent galeryintent = new intent(intent.action_pick, android.provider.mediastore.images.media.external_content_uri); startactivityforresult(galeryintent, result_load_image); } }); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestcode, resultcode, data); if (req

Build JavaFX app using ant -

i 'm looking solution problem long time , not find me, need create exe app, when compile works , when try generate exe give me exception: caused by: java.lang.illegalstateexception: location not set. @ javafx.fxml.fxmlloader.loadimpl(unknown source) @ javafx.fxml.fxmlloader.load(unknown source) @ br.nivelamento.mainapp.initrootlayout(unknown source) @ br.nivelamento.mainapp.start(unknown source) @ com.sun.javafx.application.launcherimpl.lambda$launchapplication1$163 (unknown source) build.xml <project name="nivelamento" default="do-deploy" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant"> <target name="init-fx-tasks"> <path id="fxant"> <filelist> <file name="${java.home}\..\lib\ant-javafx.jar" /> <file name="${java.home}\lib\jfxrt.jar" /> </fi

Crystal Reports | Case Statement in Select Expert -

i'm looking filter 1 group of records based upon parameter. still want include other groups, however. i'm @ now, in select expert: {name_full.nametype} = "a" , (if {generic.grouptag} in ["a","b","c","d","e","f","g","h","i","j","k","m","n","o","p","q","r","s","t","u","v","w","x","y","z"] or {generic.grouptag} = "l" , {membership_full.membtype} = "ials" , {subscriptionlevel_full.subltype} = "life" true) there has better/more efficient way this, i'm @ loss. i'm using crystal reports xi oracle db.

html - How to display input button from two different form in single line -

i have display both these buttons in single line. tried adding style="{display:block-inline;}"> in form element suggested somewhere didn't me. idea how ? <html> <body> <div> <form > <input type="submit" value="button1" /> </form> <form > <input type="submit" value="button2" /> </form> </div> </body> </html> put both forms in own div , use float in css. see fiddle example: <body> <div> <div id=form1> <form > <input type="submit" value="button1" /> </form> </div> <divid=form2> <form > <input type="submit" value="button2" /> </form> </div> </div> </body>

linux - Issue with R packages installed with root -

for reason, not install rjava package without root privilege (using sudo r , install.packages('rjava')). should have solved problem, can use package when launching r sudo r. if launch without sudo, r act if package not installed. i tried looking @ /usr/local/lib/r/site-library, every package belongs user , group "staff" except one, belongs root , staff. rights every package rwxrwxr-x , in group staff, should have permissions need. in addition, tried changing owner of rjava folder user , didn't change anything. have idea why rjava not recognized if start r without sudo? thanks! i had issues installing rjava i'll outline steps took fix though may specific system. there's @ least chance work too. remove rjava , openjdk: sudo apt-get purge r-cran-rjava sudo apt-get purge openjdk-7-jre install oracle java: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer reinstall rjava sudo

iOS - Detecting calls, cancel them an then do something -

is possible 1 make app listens call events, if number equal something, cancel call , other stuff? edit: people asking why wanna when it's such simple question that, i'm having difficulty in understanding negative feedback. question states, wanted capture call events , if number dialed equal specific number, call wouldn't proceed , else instead. question not broad (unless have place whole requirements engineering of app) neither complicated one. simple question of "is possible in ios?". as answered helpful people (fortunately), it's not possible. no, it's not possible, if want app accepted app store. can detect incoming , outgoing calls using core telephony , cannot phone number. plus, usage of core telephony framework means rejection app store, if that's concern.

.net - ASP.NET 5 not running in development mode -

Image
i have updated asp.net 5 project beta 8, , supposed following web command "commands": { "web": "microsoft.aspnet.server.kestrel" }, now have updated project environment variables. this has updated launchsettings.json file, so { "profiles": { "web": { "commandname": "web", "environmentvariables": { "aspnet_env": "development" } } } } but reason, every time run command dnx web says hosting environment production. why not starting in development mode? the settings in launchsettings.json used vs. if run console, have set environment variable manually. cmd: set aspnet_env=development dnx web ps: $env:aspnet_env=development dnx web

javascript - how sorting do sorting in angular js using filter -

could please tell me how sort column in ascending , descending order when user click on header of each column .i have list in header placed on top .i want sort column using "^" , "v" key .i make directive sort column not work .first image not display image "v" , "^" (not display) , second when click on header column not sorting table in ascending , descending order. here code http://plnkr.co/edit/wswyugoyazlvua8sxwee?p=preview .directive('sortheader', function($timeout) { return { require: '^headerrow', restrict: 'e', scope: { 'label': '@', 'sortstring': '&sortexp', 'idx': '@index' }, templateurl: 'sort-header.html', link: function(scope, element, attrs, headerctrl) { headerctrl.addsortheader(scope); scope.reverse = false; element.o

angularjs - angular directive scope inheritance/ isolation -

i have directive build dynamic table collection. have 2 types of columns checkbox , dropdowns. however, scope not resolving correctly @ directive level. getting 'undefined'. need bind drop down options controller. html <div ng-app="myapp"> <div ng-controller="myctrl"> <ui-table source="students"> <check-col title="passed" field="passed"/> <drop-down-col title="std" field="std" /> </ui-table> </div> </div> angular js var myapp = angular.module('myapp',[]); myapp.directive("uitable", function ($compile) { var generatetablehtml = function ($scope) { // header var html = "<table class='table table-condensed table-bordered table-responsive'><thead class='thead12'><tr class='active'>"; angular.foreach($scope.columns, function

java - JSON: Null pointer exception -

from this tutorial , got error java.lang.nullpointerexception: attempt invoke virtual method 'java.lang.string org.json.jsonobject.tostring()' on null object reference it came mainactivity.java class attemptlogin extends asynctask<string, string, string> { // <--- cause of error /** * before starting background thread show progress dialog * */ boolean failure = false; @override protected void onpreexecute() { super.onpreexecute(); pdialog = new progressdialog(mainactivity.this); pdialog.setmessage("attempting login..."); pdialog.setindeterminate(false); pdialog.setcancelable(true); pdialog.show(); } @override protected string doinbackground(string... args) { // todo auto-generated method stub // here check success tag int success; string username = user.gettext().tostring(); string password = pass.gettext().tostring(); try {

jquery - How can I add arrows to my slidershow? -

sorry bad english , i'm newbie jquery. i'm using existing theme html uses "layerslider" , add left , right arrow without change inside code of layerslider. my html: <section id="slider"> <div class="ls-wp-fullwidth-container" style="height:600px;"> <div class="ls-wp-fullwidth-helper"> <div id="layerslider_1_1" class="ls-wp-container" style="width:100%;height:600px;margin:0 auto;margin-bottom: 0px;"> <div class="ls-slide" data-ls="transition2d:1;timeshift:-1000;"> <img src="upload/slide3.jpg" class="ls-bg" id="sliderr" alt="slide3" /> <img src="img/prettyphoto/sprite_prev.png" class="ls-l" id="leftarrow" style="top:300px; left: 6% !important; border-radius: 15px; width: 50px;"/

android - ACRA not sending to eMail -

i trying send crash reports email when app crashes nothing happens. tried messing around configurations kept getting errors (unknown member mostly, wth is). here's code class. @reportscrashes( mailto = "me@gmail.com") public class myapplication extends application { @override public void oncreate() { super.oncreate(); // following line triggers initialization of acra acra.init(this); } } my manifest: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ghostdevelopment.ueni2" android:versioncode="1" android:versionname="1.0" android:debuggable="true"> <uses-permission android:name="android.permission.internet"></uses-permission> <uses-sdk android:minsdkversion="8" android:targetsdkversion="25" /> <application android:name="

c# - Group, Sort, and then Merge to a Observable Collection? -

i have list of items have "displayorder" property. can either have null or int value. if has int value, has priority , should in 1st group of observable collection. items in 1st group sorted displayorder. if null, belongs 2nd group, sorted alphabetically. the 1st group , 2nd group combined main items collection observable collection bind listview. this current code though worried if there optimal way of doing it. var mainitemcollection = new observablecollection<mainitemviewmodel>(); var itemswithproperty = new observablecollection<mainitemviewmodel>(); var itemswithnullproperty = new observablecollection<mainitemviewmodel>(); foreach (var item in dataobject.mainitems) { if (item.displayorder == null) itemswithnullproperty.add(new mainitemviewmodel(item)); else itemswithproperty.add(new mainitemviewmodel(item)); } itemswithproperty = new observablecollection<mainitemviewmodel>(itemswithproperty.orderby(c => c.di

linux - what is the working of this command ls . | xargs -i -t cp ./{} $1 -

i new bee bash scripting. while studying advanced bash scripting came across command. i'm not understand how command working , use of curly braces. in advance. your command: ls . | xargs -i -t cp ./{} $1 could divided following parts: ls . list current directory (this list files/directories hidden ones) | xargs -i -t cp ./{} $1 basically xargs breaks piped output (ls in case) , provides each element in list input following command (cp in case). -t option show in stderr xargs executing. -i used string replacement. in case since nothing has been provided substitute {} input. $1 name of destination files copied (i guess in case should directory command make sense otherwise copying files same destination). so example, if have lets directory has files called a, b, c. when run command perform following: cp ./a $1 cp ./b $1 cp ./c $1 note : the -i option deprecated, -i (uppercase i) should used instead

Display XML with Javascript -

here's sample xml code: <?xml version="1.0" encoding="utf-8"?> <entry n="5"> <form type="lemma">hi <orth xml:lang="syc">ܐܳܐܱܪ</orth> </form> <gramgrp> <gram type="pos">noun</gram> <gram type="gender">commongender</gram> </gramgrp> <etym> <lang>greek</lang> <mentioned>ἀήρ</mentioned> </etym> <form type="inflected" ana="#n_pl"> <orth xml:lang="syc">ܐܰܐܷܪ̈ܰܣ</orth> </form> <sense> <cit type="translation" xml:lang="en"> <quote>air, breeze</quote> </cit> </sense> </entry> i need display in formatted fashion, depending on tags. i've followed code found @ w3schools http://www.w3schools.com/xml/xml_applications.asp , changing filename , tag

php - MySQL: group on timestamp -

Image
i have messages table this: and want group messages same timestamp secondary table. expected output this: i'm using following script, reason isn't working: <?php $message = mysql_query("select * message group member_id"); while($row = mysql_fetch_array($message)) { @mysql_query("insert message2 values ('$row[time_recorded]','$row[member_id]', '$row[message]')"); } use select *, group_concat(message separator ', ') message message group member_id in first selection.

.net - Visual Studio Test Explorer error: An exception occurred while initializing the database. See the InnerException for details -

i using visual studio 2013. have 2 branches. test explorer works fine on branch not on branch b. following error in test output window: ------ discover test started ------ **an exception occurred while initializing database. see innerexception details.** ========== discover test finished: 4530 found (0:00:07.34) ========== as can see, seems discover tests not populate test explorer window. what database use? there project specific cache remove? i use resharper tried turning unit test engine off did not help. have done rebuilds cleans etc. no avail. i installed vs 2015 not yet using it? issue? any appreciated. i had issue today, resolve did following: close visual studio 2015 , open visual studio 2013 click tools > options > database tools > data connections , change sql server instance name (localdb)\mssqllocaldb close visual studio 2013 open task manager , end sql server windows nt - 64 bit processes use windows explorer navigate location of

jstl - How to construct dynamically attribute name in xhtml - JSF -

i want assign dynamic value input in xhtml page. managedbean contains 3 string attributes: customfield1, customfield2 , customfield3 in xhtml page i'm looping on list of values custruct components: <ui:repeat value="#{listbean.customfields}" var="item" varstatus="status"> <div > <p:outputlabel value="#{item.label}" /> <br /> <c:set var="test" value="#{'mybean.customfield'.concat(status.index)}"/> <p:inputtext value="#{test}" /> </div> </ui:repeat> what did concatenation not work since concider whole expression string unable bind "#{test}" bean attribute. you think possible in jsf ? thanks in advance ! please try <p:inputtext value="#{mybean['customfield'.concat(status.index)]}"/>

d3.js - nvd3 insert a break in a line chart -

i using nvd3 linechart , looking way insert break in plotted line. if have dataset 10 points need chart draw line connecting first 5 points , last 5 points not connecting points 5 , 6 ie 1-2-3-4-5 6-7-8-9-10 i have tried setting both chart.defined , line.defined = false point 5 results in no line connecting points 4, 5 , 6 ie 1-2-3-4 5 6-7-8-9-10 unfortunately have got standalone snippet of code involved in rendering chart - here 2 functions resulted in point 5 being rendered stand alone point: chart = nv.models.linechart(); chart.defined(function (d,i) { if (i == 4){ return false; }else{ return true; } } } lines.defined(function(d,i){ if (i==4 ){ return false }else{return true} })

Unable to install node.js serialport npm package on windows -

i trying install node.js modem npm package stopped on serialport subpackage install. not understand doing wrong? maybe why node-pre-gyp stop install? that: c:\users\myfirefox-addon>npm install modem npm warn package.json myfirefox-addon@0.0.1 no repository field. | serialport@2.0.1 install c:\users\myfirefox-addon\node_modules\modem\node_modu les\serialport node-pre-gyp install --fallback-to-build (node) child_process: options.customfds option deprecated. use options.stdio instead. gyp warn install got error, rolling install gyp err! configure error gyp err! stack error: tunneling socket not established, cause=socket ha ng gyp err! stack @ clientrequest.onerror (c:\program files\nodejs\node_module s\npm\node_modules\request\node_modules\tunnel-agent\index.js:174:17)

c# - asp net multiple file upload with progress bar -

hi working in code should allow select multiple fileupload , when uploading files should show progress bar percentage of loading here code webform.aspx <%@ page language="c#" autoeventwireup="true" codebehind="webform2.aspx.cs" inherits="progressbar.webform2" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="http://malsup.github.com/jquery.form.js"></script> <link href="jquery-ui.css" rel="stylesheet" /> <script type="text/javascript">

Get full custom log from website in Asp.Net MVC -

i have asp.net mvc application. i need full custom log of website don't want use google analytics, iis log file , etc. i familiar customactionfilter , httpmodule . shall use these or there better way? you can use application insights tracking user actitivy. can track own events, exceptions, etc. directly in javascript code. appinsights.trackevent("wingame"); appinsights.trackevent ("wingame", // string properties: {game: currentgame.name, difficulty: currentgame.difficulty}, // numeric metrics: {score: currentgame.score, opponents: currentgame.opponentcount} ); appinsights.trackpageview ("page name", "http://fabrikam.com/pageurl.html", // string properties: {game: currentgame.name, difficulty: currentgame.difficulty}, // numeric metrics: {score: currentgame.score, opponents: currentgame.opponentcount} );

html - CSS: how to put element next to last line of text -

i have span text inside , has max-width property. times text inside bigger max width span breaking lines. until here no problem. but when text breaks looks element next doesnt go down aswell. here example <span> text fine width</span> <div> div</div> output this: some text fine width div but when text long looks that: <span> text more max width</span> <div> div</div> some text more div max width and want this: some text more max width div i manage this: some text more max width div but want div next last line of text. possible via css? in css add style element: display: inline;

localhost:8080/ returns status 404 - Spring -

this code: @controller @requestmapping("/") public class merchantscontroller { @autowired merchantsservice merchantsservice; @autowired productsservice productsservice; @autowired ordersservice ordersservice; @requestmapping(value = "/merchants", method = requestmethod.get) public modelandview showmerchantslist() { modelandview modelandview = new modelandview("merchantslist"); list<merchant> merchants = merchantsservice.getmerchantslist(); (merchant merchant : merchants) { if(merchant.getorder_type() == ordertype.no_ordering){ merchant.setorderuntil(time.valueof("00:00:00")); } } modelandview.addobject("merchants", merchants); return modelandview; } as understand when send request localhost:8080/ should open localhost:8080/merchants, not working. has suggestions? your showmerchantslist me

javascript - How to get place Name of location from google.maps.Geocoder()? -

i want name of location google geocoder(). have draggeble marker on map, when dragend marker, position of marker following code. geocodeposition(marker.getposition()); i able address of location, how name of location, if drage marker on known building white house , should give name of location white house . var geocoder = new google.maps.geocoder(); function geocodeposition(pos){ geocoder.geocode({ latlng: pos }, function(responses){ if (responses && responses.length >0){ $scope.address=responses[0].formatted_address; $scope.name=responses[0].address_components[0].long_name; } else{ $scope.address='cannot determine address @ location'; } }); } the geocoder translating postal addresses coordinates. reverse geocoder reverse (translates coordinates addresses). if need name of place (or if want include name of place alo

directory - How can I scrape file names and create directories for each filename in Python? -

i'm trying scrape filenames inside folder , make directories each filename inside folder. i've got far when run it, doesn't create new folders in destination folder. when run in terminal doesn't return errors. import os import shutil folder = "/home/ro/downloads/uglybettyfanfiction.net/" destination = "/home/ro/a python scripts/dest_test/" # each files path name def ensure_dir(f): d = os.path.dirname(f) if not os.path.exists(d): os.makedirs(d) files in os.listdir(folder): new_path = folder + files ensure_dir(new_path) you've got few mistakes. no need use dirname , should write destination , not same folder : def ensure_dir(f): if not os.path.exists(f): os.mkdir(f) files in os.listdir(folder): new_path = destination + files ensure_dir(new_path)

java - How do I use the printf function while keeping columns organized? -

i'm trying print out invoice report in java project having trouble formatting sheet. code i'm having problems with. stringbuilder sb = new stringbuilder(); sb.append(string.format("%s%s%-82s%s%10.2f%s","discount ( ","placeholder"," )", "$", 99.99, "\n")); which prints out this discount ( placeholder ) $ 99.99 if change character length of word "placeholder," $99.99 column moved, such. discount ( p ) $ 99.99 what need code whether word "placeholder" replaced word 10 characters long or 1 character long, $99.99 needs stay in same place in correct column when print. tried modifying %s $ seems still move if placeholder changed. advice? you try width parameter. (15 width here): system.out.printf("%s%15s%-82s%

java - Google Play services location API - Counting distance -

i've been following https://developer.android.com/training/location/index.html tutorial. here's class implementing new google's location api: public class gpstracker implements locationlistener, googleapiclient.connectioncallbacks, googleapiclient.onconnectionfailedlistener { private final context context; private textview distancetextview; private googleapiclient mgoogleapiclient; private locationrequest mlocationrequest; private location mlastlocation; private double totalmeters = 0; public gpstracker(context context, textview distancetextview) { this.context = context; this.distancetextview = distancetextview; buildgoogleapiclient(); } protected synchronized void buildgoogleapiclient() { mgoogleapiclient = new googleapiclient.builder(context) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .addapi(locationservices.api)

javascript - I have a single page real estate listing web app I created with AngularJS, decided to serve up data w/$http service, didn't work. Can anybody see why? -

below, following 3 files believe issue originates. know have used post, get, put, delete, deliberately trying $http. mansionscontroller.js file: angular .module('ngmansions') .controller('mansionscontroller', function($scope, mansionsfactory) { $scope.mansions; mansionsfactory.getmansions().success(function(data) { $scope.mansions = data; }).error(function(error) { console.log(error); }); }); mansionsfactory.js file: angular .module('ngmansions') .factory('mansionsfactory', function($http) { function getmansions() { return $http.get('data/data.json'); } return { getmansions: getmansions } }); data.json file: [ { "type": "condo", "price": 220000, "address": "214 grove street", "descripti

sql server - Row_Number() partitioning according to consecutive rows -

i working on query sql server 2008 needs partition in way considers consecutive nature of rows in table, meaning has no "memory" , restart row numbering when consecutiveness breaks down partition. to illustrate: declare @test table ( customerid varchar(10), itemid varchar(10), platformname varchar(10), date datetime ) insert @test values ('aaaa', 'x', 'mobile','2015-10-24 22:52:47') insert @test values ('aaaa', 'x', 'mobile','2015-10-23 22:56:47') insert @test values ('aaaa', 'k', 'mobile','2015-10-22 21:52:47') insert @test values ('aaaa', 'k', 'tablet','2015-10-20 22:12:47') insert @test values ('aaaa', 'x', 'mobile','2015-10-19 20:52:47') insert @test values ('aaaa', 'k', 'tablet','2015-10-18 12:52:47') insert @test values ('aaaa', 'k', 'tablet',

encoding - How can I encode and decode percent-encoded (URL encoded) strings in Python? -

i wrote simple application downloads articles wiki pages. when search, example firstname lech , code returns strings lech_kaczy%c5%84ski or lech_pozna%c5%84 instead of lech_kaczyński , lech_poznań . how can decode characters ordinary polish letters? tried use: urllib.unquote(text) got lech_kaczy\xc5\x84ski , lech_pozna\xc5\x84 instead of lech_kaczyński , lech_poznań . i have in code: # -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding("utf-8") but result same (it not work). try this: import urllib urllib.unquote("lech_kaczy%c5%84ski").decode('utf8') this return unicode string: u'lech_kaczy\u0144ski' which can print , process usual. example: print(urllib.unquote("lech_kaczy%c5%84ski").decode('utf8')) will result in lech_kaczyński

Can I use Eclipse Dependency injection (DI) in normal Java Model? -

i trying write java model act model eclipse rcp. model should able run without ui (i.e in command line). wanted use (explore, new this) di supported e4. can 1 guide me on this? as described in eclipse bug 323075 e4 rcp startup wants create window. not can use 'headless' rcp.

ios - Change date format using NSDateFormatter -

Image
i want use date format 2015-08-14 unfortunately getting format 16/11/15 below code have used desired output. nsdateformatter *dateformatter = [[nsdateformatter alloc] init]; [dateformatter setdateformat:@"yyyy-mm-dd"]; nstimezone *gmt = [nstimezone timezonewithabbreviation:@"gmt"]; [dateformatter settimezone:gmt]; [dateformatter setdatestyle:kcfdateformattershortstyle]; nsstring *formatteddatestring = [dateformatter stringfromdate:selecteddate]; can please suggest how fix issue? just remove line [dateformatter setdatestyle:nsdateformattershortstyle];

Storing java.sql.Timestamp type into HSQL database -

we have multiple databases our application. the date of type java.sql.timestamp being stored in datetime data type of sql server. but for storing same type in hsql db, using timestamp, , not able cast it. i not able change in java code because working in sql server , oracle both, need casting in hsql query only. current working query sql server datetime field is: insert system_documents values(?) java code: timestamp=new java.sql.timestamp(new java.util.date().gettime()); string q="insert system_documents values(?)"; pstm = con.preparestatement(q); pstm.settimestamp(1, timestamp); pstm.executequery(); if you're using hibernate can simple adding @temporal annotation @temporal(temporaltype.date) private date date; temporal has timestamp , date , time enums

python - Trying to print JSON value -

i have json output dell website , i'm trying access values having hard time accessing values. for example, have following json being retrieved: { "getassetwarrantyresponse": { "getassetwarrantyresult": { "faults": null, "response": { "dellasset": { "machinedescription": "t350, new balance", "shipdate": "2010-05-04", "servicetag": "89m1", "ordernumber": 518, "localchannel": 25, "assetparts": { "@nil": "true" }, "countrylookupcode": 11, "itemclasscode": "v02", "isduplicate": "false",

jquery - problems understanding nth-of-type selector -

Image
i'm struggling on i've never found difficult :s have objects class .everyday (are every cell each day of month), have differentiate objects being: 5 green 3 red consecutively, starting on 3rd element. first 2 must red. well, i've though jquery: $(document).ready(function() { $("td.everyday:nth(0), td.everyday:nth(1)").css({"background-color": "red", "color" : "white"}); $("td.everyday:nth-of-type(4n+4), td.everyday:nth-of-type(5n+5)").css({"background-color": "green", "color" : "white"}); }); and no way working! have tried existing numbers! -___- , have how works, not 100% clear , maybe less clear though... knows how use , can explain me? cheers! update: it closer need, however, not right doesn't follow 5 red 3 green whole year (starting on 3rd element): so if can still explain me how nth-child , numbers within parenthesis work... better! don