Posts

Showing posts from March, 2012

Can I to make svg icon using data-uri with built-in data for the properties of the background? -

i want result of code: html { font-size: 16px; } .ico { display: inline-block; } .ico_size_s { width: 1.3rem; height: 1.3rem; } .ico_size_m { width: 2rem; height: 2rem; } .ico_first { background-image: url(data:image/svg+xml;base64,phn2zyb4bwxucz0iahr0cdovl3d3dy53my5vcmcvmjawmc9zdmciihzpzxdcb3g9ijagmcaxniaxnii+phbhdgggzd0ittezljuxmi40ntmgns40nzugmtiundc4ideunza4idgumjgunjy3idkunja1iduunjazide1lja2ide0ljcymiaxljyxm3oilz48l3n2zz4k); background-color: yellow; } .ico_last { background-image: url(data:image/svg+xml;base64,phn2zyb4bwxucz0iahr0cdovl3d3dy53my5vcmcvmjawmc9zdmciihdpzhropsixnnb4iibozwlnahq9ije2chgiihzpzxdcb3g9ijagmcaxniaxnii+dqo8cgf0acbkpsjnmtusmgmtmc40ndysmc0wljcxoswwljm0nc0wljkzoswwljy5ouw2ljgwnywxmy4zotnsltuums01ljfsmcwwqzeunti2ldgumteyldeumjc2ldgsmsw4qzaundq4ldgsmcw4ljq0ocwwldkncgljmcwwlji3niwwljexmiwwljuyniwwlji5mywwljcwn2w2ldzdni40nzqsmtuuodg4ldyunzi0lde2ldcsmtzjmc40ndysmcwwljgxmi0wljm0ncwwljk4nc0wljy5oww3ljy3mi0xmy41

javascript - Creating a simple directive with Angular -

i having simple problem , can't figure out why it's not working. reviewctrl.html angular.module('liveapp.review',['liveapp.factory']) .controller('reviewctrl', ['$scope','$http','datafactory','$location',reviewctrl]) .directive("datepicker", function() { return { restrict: "e", template: '<div>i want show in review view</div>' } }) review.html <datepicker></datepicker> my expectation of code see "i want show in review view" in view corresponding controller. view injected <div ng-view></div> in index.html. have simple example here, reason not working how expect. assume routes set correctly. have idea why might be? use <date-picker> in html work. because angular converts camelcasing snake-casing, datepicker directive needs renamed date-picker in html. why use camelcasing: n

php - Need to fetch values from Angular JS array -

i using mvc model in php. getting following string view layer (this angular.js array getting string): [ { "name" : "item", "price" : "123", "quantity" : 12, "id" : 1 }, { "name" : "hhh", "price" : "000", "quantity" : 12, "id" : 2 }, { "name" : "kk", "price" : "88", "quantity" : 12, "id" : 3 } ] how can extract values of name, price, quantity , id string , put insert query? this known serialized array , meaning javascript array in string form (json). can use php's json_decode function deserialize string, there can use normal array: $json='[ { "name" : "item", "price" : "123", "quantity" : 12,

javascript - Object.getNotifier() part of Polymer webcomponents polyfill? -

i have polymer app runs in chrome, in firefox , safari error typeerror: object.getnotifier not function i included webcomponents.min.js polyfill library (which includes observe-js), thought polyfilled functionality. there i'm missing? we're using polymer v0.5.5 thanks!

Saving integer input into a list in (swi-)prolog -

how create list n entries , fill integers user input? example: write('how long should list be?'), nl. user enters number n write('enter n integers. press enter after each integer.'), nl. user enters n integers i not quite why need actual i/o (at point). if possible, try stick using prolog-toplevel . can save lot of trouble / time / effort during development phase of "relational core" of problem want tackle.

breeze - One to many navigation property not working -

i using breezejs v.1.5.4 odata web api controllers (and angularjs v.1.4.0 if makes difference). i have following models (simplified): public partial class job { ... [required] [stringlength(128)] [index("ix_workdonebyid")] [display(name = "work done id")] public string workdonebyid { get; set; } [foreignkey("workdonebyid")] public virtual user workdoneby { get; set; } } [datacontract] public partial class user : identityuser { ... [key] [stringlength(128)] [display(name = "id")] [datamember] public override string id { { return base.id; } set { base.id = value; } } [inverseproperty("workdoneby")] [datamember] public virtual icollection<job> jobs { get; set; } } when trying job information , expanding workdoneby , works , user information (i.e. user binded job). while

javascript - Reference to div element is null when navigating away from view -

i referencing div in initialize function backbone.marionette view. issue having when navigate away view , come reference div null . example: var div = $('#video_player'); console.log(div); will return correct div first time page loads if navigate view , come reference null . i working other people's code tasked maintain , update startup companies website. this javascript define(['marionette', 'tpl!templates/views/plan.html', 'localizer', 'common/servererrors', 'jquery', 'models/sessionmodel', 'common/serverapiurls', 'utilities/events'], function ( marionette, tpl, localizer, servererrors, $, session, serverapiurls, events) { 'use strict'; //var player; var planview = marionette.itemview.extend({ classname: 'membershipitem', tagname: 'li', template: function(data) { return tpl({resources: localizer.resources, plan: dat

mysql - Group query results by "today", "in last 7 days", "in last month" and "older" -

i have simple question related grouping rows date "narrative" periods. let's assume have simple table articles. id pk, title , date. date column datetime / timestamp. i group somehow results can present them in view like written today: art 944 art 943 written in last 7 days: art 823 art 743 written in last 30 days: art 520 art 519 art 502 older: art 4 art 3 art 1 can achieve in 1 single query group by statements? gordon should have credit writing out. think want append column appropriate descriptor , sort them in order you'd see them. select title, case when date = curdate() 'today' when date >= curdate() - interval 6 day 'last 7 days' when date >= curdate() - interval 29 day 'last 30 days' else 'older' end bucket, ... order case when date = curdate() 1 when date >= curdate() - interval 6 day 2 when date >=

ios - Swift Array(string) not working -

i'm trying make hangman game. i'm going paste code in because feel problem somewhere in here i'm not seeing. down , find part wrote error occurs. here error message get: missing argument label 'arrayliteral' in call. when add arrayliteral code not work. i'm new swift appreciated! thank you! (sorry there's lot of code that's unrelated issue) import uikit class viewcontroller: uiviewcontroller, uitextfielddelegate { @iboutlet weak var secret_word_label: uilabel! @iboutlet weak var guess_field: uitextfield! @iboutlet weak var submit_button: uibutton! //only bug testing @iboutlet weak var arb_print: uilabel! @iboutlet weak var print_secret: uilabel! var user_guesses = [string]() var secret_word = "asdf" var wrong_guesses = 0 var guess_letter = "" var correct_guesses = 0 let limit_wrongs = 3 var secret_word_loc = [string]() func return_len(text: string) -> int {

windows - A python script that activates the virtualenv and then runs another python script? -

on windows vista, need script starts activate (to activate virtualenv) script in c:\users\admin\desktop\venv\scripts\ and later, in virtual environment, starts manage.py runserver in folder : c:\users\admin\desktop\helloworld\ how should do? modules should use? you can activate virtualenv , start server using bat file. copy script in file , save .bat extension (eg. runserver.bat) @echo off cmd /k "cd /d c:\users\admin\desktop\venv\scripts & activate & cd /d c:\users\admin\desktop\helloworld & python manage.py runserver" then can run bat file (just double click) start server

pointers - Objective C Primitive Types -

i've been reading objective-c datatypes , primitive types inherits c. data types bool inherited type-def bool , declared like: bool mybool; where nsstring declared like: nsstring * mystring; my doubt how know when use * , when not to? primitive types don't need * , know that, that's little confusing because eg: nsstring * mystring; where nsinteger myint; so doubt is, understand using * objective c's own data types no * primitive types. but in example above nsinteger primitive type. how differentiate between primitive , non-primitive data types ? (ns prefix isn't correct answer)

maps - get geographical coordinates from address -

i ask user write address , have show on map. know how write script don't know how coordinates having street address. can do? ps: using leaflet first have include .js files of geocoder in head of html code, example have used one: https://github.com/perliedman/leaflet-control-geocoder . this: <script src="control.geocoder.js"></script> then have initialize geocoder in .js: geocoder = new l.control.geocoder.nominatim(); have specify address looking for, can save in variable. example: var yourquery = (addres of person); (you can address out of database, save in variable) then can use following code 'geocode' address latitude / longitude(coördinates). function return latitude / longitude(coördinates) of address. can save latitude / longitude(coördinates) in variable can use later marker. have add marker map. geocoder.geocode(yourquery, function(results) { latlng= new l.latlng(results[0].center.lat, results[0].cent

ruby on rails - How to test OPTIONS request with Capybara? -

what way test options response capybara? use case: need configure rails app response headers cors. know not part of "user experience". however, if browser cannot make request, user not going able use site. a way test options response capybara not using capybara. jokes aside, better done in controller test since not involve actual html parsing. rspec.describe rabbitscontroller describe "get :show" "enables cors" :index expect(response.headers['access-control-allow-origin']).to eq "*" end end end you can test options http method process :show, "options" [1]

winapi - Ignoring exclusively locked files in SHFileOperation -

i using windows 7 professional , using shfileoperation() recursive copy 1 folder contents another. there locked file (opened exclusively application); need skip it, shfileoperation() returns 0x20 when tries copy file. how can skip file during file copy operation? update : code: // // copydirectory() // рекурсивное копирование содержимого одной директории в другую средствами windows // lpszsource - исходная папка // lpszdestination - папка назначения // bool copydirectory( lpstr lpszsource, lpstr lpszdestination ) { lpstr lpsznewsource = null; // структура операции с файлами shfileopstruct fileop = { 0 }; // выделим память под новый путь lpsznewsource = (lpstr)calloc(strlen(lpszsource) + 50, 1); // запишем новый путь с маской wsprintf(lpsznewsource, "%s\\*", lpszsource); // запишем параметры операции копирования fileop.wfunc = fo_copy; fileop.pto = lpszdestination; fileop.pfrom = lpszsource; fileop.ff

Bug in javascript with multiply -

this question has answer here: is floating point math broken? 20 answers today have entered random float number , multipled hundred firstly using normal code , in console giving me wrong number, console returning me same. the given float number is: 1050.6 therefore: 1050.6 * 100 should 105060, javascript returning me 105059.99999999999 anyone knows why? javascript uses 64-bit floating point representation ( double precision ). numbers represented in format whole number multiplied power of two. this based on ieee 754 standard rational numbers denominator isn't power of 2 can't represented. why floating point multiplication gives result. source: https://en.wikipedia.org/wiki/ieee_floating_point if want real value, there 2 methods can use rounding math.round math.round(1050.6 * 100) or tofixed (1050.6 * 1000).tofixed(0)

converter - Downgrade Conversion from Swagger 2.0 to 1.2 -

there tools (e.g. mashape) support older versions of swagger. there utilities downgrading swagger version 2.0 json specs older 1.2 version? i ok tool downgrade best-effort , drops features not supported in older version. you can use restlet studio convert between swagger 1.2, swagger 2.0 , raml. you can try here : http://studio.restlet.com

google app engine - Trying to download a file using Dropbox Java API in the GAE -

i have xml file on dropbox want access google app engine using dropbox java api. after bit of playing around find gae doesn't support fileoutputstream . fileoutputstream outputstream = new fileoutputstream("myfile.txt"); try { dbxentry.file downloadedfile = client.getfile("/myfile.txt", null, outputstream); system.out.println("metadata: " + downloadedfile.tostring()); } any ideas how can xml data gae (client or server side) dropbox? tim got it! thanks. bytearrayoutputstream worked. else trying read dropbox file in google app engine environment (i.e. read memory), here worked me string filename = "myfile.xml"; outputstream out = new bytearrayoutputstream(); try { dbxclient.getfile("/" + filename, null, out); } catch (dbxexception e) { e.printstacktrace(); } system.out.println("file contente: " + out.tostring());

Clipping Graphs in MATLAB 2013b -

Image
my plot extends beyond specified axis limits. matlab documents here , default 2013b (the version i'm using). seems want set 'clipping','3dbox' doesn't seem work (perhaps isn't available in 2013b). know how can fix this?

java - How to display random numbers in jlabel? -

i need how display random number in jlabel java used random sum1 = new random(); jlabel1.settext(random1); random class used generate random numbers - need use calling 1 of nextwhatever methods: random r = new random(); jlabel1.settext(string.valueof(r.nextint());

rdf - range function in sparql -

i need years in given range values in sparql (especially sesame implementation). is there way "generate" new numbers in sparql like: select (range(2,10) ?numbers) where{} without taking deeper look, 1 naive answer in spirit of rdf materialize numbers , use filter range. in other words, insert them graph: ex:year ex:anumber "1900"^^xsd:integer . ex:year ex:anumber "1901"^^xsd:integer . ... ex:year ex:anumber "2100"^^xsd:integer . and have pattern in section: select ?number { ex:year ex:number ?number . filter (?number < 2020) filter (?number > 1999) } as commented above, hard imagine use case "knowing" numbers: cross-product else in query, unless getting numbers purpose of query or filtering being applied (in latter case there no need generate numbers @ all).

python - Attribute Error Kivy -

i 'm not sure why getting attribute error in following code when try access instance's attribute score: class ellipsemaker(widget): score = 10 class modules(gridlayout): moduleone = objectproperty(none) def on_touch_down(self,touch): print self.moduleone.score in .kv doc: <modules>: cols:1 moduleone: ellipseone ellipsemaker: id: ellipseone size: (root.width/4,root.height/4) pos: self.parent.center <ellipsemaker>: canvas: ellipse: pos:self.pos size:self.size the error getting "attributeerror: 'ellipsemaker' object has no attribute 'score'" the issue had .kv file in ellipsemaker defined, program kept referencing ellipsemaker class instead.

javascript - Google API and wrong result from its own function directionService -

i' m having problem , when load page , insert origin , destination, after clicking button "locate" doesn't show in google map, because says response not object , tried stamp console.log , says response=null , if reload page , click fast on locate , draws route. here's code function init(){ var latlng = new google.maps.latlng(40.635636, 17.942414); var mapoptions = { zoom: 12, center: latlng }; map = new google.maps.map(document.getelementbyid('map-canvas'), mapoptions); } function updatemap(){ init(); var origingeocoder = new google.maps.geocoder(); var destinationgeocoder = new google.maps.geocoder(); var origin = document.getelementbyid( "origin" ).value + " brindisi 72100"; var destination = document.getelementbyid( "destination" ).value + " brindisi 72100"; var directionsservice2 = new google.maps.directionsservice(); origingeocoder.geocode( { 'address

javascript - HTML5 <Dialog> Only works on chrome? -

using dialog on website appears work on chrome, on other browsers , on iphone dialog open permanently , on place. there should using instead of <dialog> ? <p><button id="launchstyledmodal">learn more</button></p> <dialog id="styledmodal"> insert dialog text here <button id="close">close</button> </dialog> <script src="js/dialog.js"></script> javascript: window.onload = function () { // buttons. var styledmodalbtn = document.getelementbyid('launchstyledmodal'); var close = document.getelementbyid('close'); // dialogs. var styledmodal = document.getelementbyid('styledmodal'); // setup event listeners styledmodalbtn.addeventlistener('click', function(e) { e.preventdefault(); styledmodal.showmodal(); }); close.addeventlistener('click', function(e) { this.parentnode.close(); }); }; html5 dialog

api - "Could not update the configuration for app" error message when adding Office365 Unified Application permissions -

i want started office365 unified api , decided register new web app our azure directory. in section: "permissions other applications" , select office365 unified api(preview) i set delegated permission (i don't have admin powers in our tenant), choose ones need (user profiles, sign-in , exact number not matter). when save configuration message could not update configuration app "" information tells me: unauthorized. not have sufficient permissions access resource. the strange , when log out , return application in azure portal, see modification in configuration ?! finally when try call rest endpoint (with valid accesstoken etc..) message: {"error":"invalid_grant","error_description":"aadsts65001: no permission access user information configured 'f1299649-ea20-4cf6-9cd6-afb69d9b5760' application, or expired or revoked.\r\ntrace id: 69ab1a6c-eeda-4351-8e1e-2b774c19a5a0\r\ncorrelation id: 968a962e-d851-48b

Returning Map<T, List<V>> as a JSON from Spring. Map key elements do not parse into JSON format -

i have question connected returning map<t, list<v>> json response. i have spring server returns json objects, i'm exploring problem returning map in format. want return map<t, list<v>> server json , display in form this: -t.name: { v.somefield1 = ..., v.somefield2 = ..., . . }, { v.somefield1 = ..., v.somefield2 = ..., . . }, -t.name: { ... } .... i have @onetomany relation between objects t , v . return in way, apart t objects - jackson return object t not json, full package/path t class in project, [app.something.tobject.class] . cannot access field there. should try cast object jsonobject example before i'll send (i think stupid)? have no idea why jackson parse objects in list , return them in json format , not change key objects t json. any ideas or solutions how resolve problem? edit : maybe @ this first. well, had same probl

java - QBChatMessage.isMarkable() always returns false even after setting markable to true before sending message -

i'm working on android app, quickblox sdk. while implementation of private chat, i'm setting markable property of message true calling message.setmarkable(true) on qbchatmessage object before sending message. below processmessage override function. here incoming qbchatmessage message has markable property false . due this, doesn't allow message 'read' using privatechat.readmessage() function. @override public void processmessage(qbprivatechat chat, qbchatmessage message) { log.w(tag, "new incoming message: " + message); message.setmarkable(true); chatactivity.showmessage(message); if (message.ismarkable()) { try { privatechat.readmessage(message.getid()); } catch (xmppexception e) { } catch (smackexception.notconnectedexception e) { } } } let me know wrong here. thanks in advance. this fixed in sdk 2.2.2 2 months ago http://quickblox.com/developers/android#f

c# - Calculate future latitude longitude with initial coordinates, heading and distance -

i have been reading through stackoverflow , site ( http://www.movable-type.co.uk/scripts/latlong.html ) how this, cant code give correct answer. giving coordinate isnt in correct direction. have been working on day , seem have hit wall. function: public static void destination() { double heading = 335.9; double startlatitude = 41.8369; double startlongitude = 87.6847; //convert radians startlatitude = startlatitude * math.pi / 180; startlongitude = startlongitude * math.pi / 180; heading = heading * math.pi / 180; int distancekilometers = 100; double angulardistance = distancekilometers / 6371e3; double endlat = math.asin((math.sin(startlatitude) * math.cos(angulardistance)) + (math.cos(startlatitude) * math.sin(angulardistance) * math.cos(heading))); double endlong = startlongitude + (math.atan2((math.sin(heading) * math.sin(angulardistance) * math.cos(startlatitude)), mat

How to show few lines with jstl into html td tag? -

all, i have simple print in website, using jstl td html tag, simple print, show few lines, maybe last 5, there way this? see below: <td class="domain"><c:out value="${row.domain}" escapexml="false" /></td>

Export (Android/Java) string data in with extended characters for import into Excel -

i need export string data includes 'degrees' symbol ("\u00b0"). data exported csv text file utf-8 encoding. expected, degrees symbol encoded 2 characters (0xc2, 0xb0) within java (unicode) string. when csv file imported excel, displayed capital circumflex accent, followed degrees symbol. i know "utf-8" supports 7-bit ascii (as single byte), not 8-bit "extended ascii", , "us-ascii" supports 7-bit ascii period. is there way specify encoding such 0xc2 prefix byte suppressed? i'm leaning toward allowing normal processing occur, reading & overwriting file contents, stripping byte. i'd prefer more eloquent solution... excel assumes csv files in 8-bit code page. to excel parse csv utf-8, need add utf-8 byte order mark start of file. edit: if you're in western europe or us, excel use windows-1252 character set decoding , encoding when encountering files without unicode byte order mark. as 0xc2 , 0xb0

Write an R function which takes two words as arguments/inputs -

i write r function takes 2 words arguments/inputs , returns “equal length” if number of characters equal in 2 words , “not equal length” otherwise. suppose name of function compare. work below compare("eps568","summer") equal length compare("eps568","summera") not equal length i have started - compares <- function(a,b) { if (str_length(a) == str_length(b)) return("equal length") } i learning r , appreciated you need think mean "equal length" mean in memory, in counted characters, or in screen width? luckily same function deals three, need change 1 argument!! compares <- function(a,b) { # use type="chars" number of human readible characters # use type="bytes" storage size of characters # use type="width" size of string in monospace font if (nchar(a, type="chars") == nchar(b,type="chars")) { return("equal length") } else { return (&q

truncation - Remove last 5 characters in string - ColdFusion -

i trying clean date/timestamp before show user on page. i pulling following information database mssql , stored in mydate variable: #mydate# = 2015-06-10 11:47:00.0 what cleanup mydate looks this: 2015-06-10 11:47 i have explored using left believe works strings. i not 100% sure how accomplished in coldfusion. thanks let me know if more information needed. if using cf9 or below, can use dateformat() , timeformat() functions accomplish it. this. <cfoutput> #dateformat(mydate, "yyyy-mm-dd")# #timeformat(mydate, "hh:mm")# </cfoutput> in case want display time in 24 hour format can use hh mask in timeformat() function. more details go through these links: dateformat() timeformat() if using cf10 or above then, @leigh suggested, can use datetimeformat() function. this. <cfoutput> #datetimeformat(mydate, "yyyy-mm-dd hh:nn")# </cfoutput> where nn mask displaying minutes. more op

VB.NET regex searching for AAA-9999 -

i need finding first 3 capital letters a-z , space followed 4 numbers 0-9. dim individualclasses matchcollection = regex.matches(allexitclasses(a), "([a-z])([a-z])([a-z]) ([0-9])([0-9])([0-9])([0-9])") an example input string aml 4309 or def 4298 . above 7 characters want out of string. edit: since preprocess input string, can use dim individualclasses matchcollection = regex.matches(allexitclasses(a).replace(" ", "-"), "[a-z]{3}[-][0-9]{4}") regex explanation : [a-z]{3} - 3 occurrences of english letters z [-] - character class matching 1 hyphen [0-9]{4} - 4 occurrences of digits 0 9. note removed capturing groups since not seem using them @ all, , using limiting quantifiers , e.g. {4} . note use input string , previous regex [a-z]{3}\p{zs}[0-9]{4} , need iterate through match collection , replace space in each match.value hyphen creating new array. here ideone demo

swift - How do I check if a username is taken with parse? -

i'm little unsure how set query this. can find solutions in php or javascript. please help! this code snippet used check whether username exits in parse class or not /* checks username exists take - username return - bool (true/false) */ func checkisuserexists(username: string, completion: ((isuser: bool?) -> void)!) { var ispresent: bool = false; let query: pfquery = pfquery(classname: "your_class_name") query.wherekey("your_key", equalto:username) query.findobjectsinbackgroundwithblock { (objects: [anyobject]?, error: nserror?) -> void in if error == nil { if (objects!.count > 0) { ispresent = true; } } else { // log details of failure println("error: \(error) \(error!.userinfo!)") } completion(isuser: ispresent); }

saucelabs - Timeouts testing polymer elements with web-component-tester and sauce labs -

we're having trouble testing our polymer elements web-component-tester , sauce labs. when try test more browsers our subscription level allows run simultaneously, tests don't run time out. seems wrong sauce labs and/or wct doesn't know how wait begin executing test until other tests finished, can queue many tests wish without having worry vm utilization. has figured out? thanks. here our wct.conf.js in case helps: module.exports = { testtimeout: 600 * 1000, persistent: false, ttyoutput: false, verbose: false, expanded: true, browseroptions: { name: "twt component tests" }, suites: [ 'elements/twt-elements/test/index.html' ], root: 'app', webserver: { pathmappings: [ {'/secrets.json': '../db/secrets.json'}, ], }, plugins: { local: { disabled: false, browsers: ['chrome', 'safari', 'canary', 'firefox'] }, sauce: { dis

R passing data.table parameters through function calls -

so if have data.table defined as: > dt <- data.table (x=c(1,2,3,4), y=c("y","n","y","m"), z=c("pickle",3,8,"egg")) > dt x y z 1: 1 y pickle 2: 2 n 3 3: 3 y 8 4: 4 m egg and variable fn <- "z" i can pull column data.table following: > dt[,fn, with=false] what don't know how data.table equivalent of following: > factorfunction <- function(df, fn) { df[,fn] <- as.factor(df[,fn]) return(df) } if set fn="x" , call factorfunction(data.frame(dt),fn) works fine. so try data.table, doesn't work > factorfunction <- function(dt, fn) { dt[,fn, with=false] <- as.factor(dt[,fn, with=false]) return(dt) } error in sort.list(y) : 'x' must atomic 'sort.list' have called 'sort' on list? you can try dt[,

Play Scala Json Writer for Seq of Tuple -

i'm trying find way use built in macro json writer in order serialize seq[(string,customer)] i managed seq[customer] when adding touple, compiler starts screaming @ me. this code works: package models.health import play.api.libs.json._ case class customer(name: string, age: int) //we use dummy var workaround json writer limitations (cannot handle single argument case class) case class demo(customers: seq[customer], dummy: option[string] = none) object demo { import play.api.libs.functional.syntax._ implicit val customer_writer = json.writes[customer] implicit val writes: writes[demo] = ( (__ \ "customers").write[seq[customer]] , (__ \ "dummy").writenullable[string]) { (d: demo) => (d.customers,d.dummy) } } but below code (simply change seq[customer] seq[(string,customer)] doesn't copmile... appreciated: package models.health import play.api.libs.json._ case class customer(name: string, age: int) //we use dummy var

sapui5 - Eclipse can't be opened Mac UI5 -

so trying develop using ui5 , can not seem open eclipse. every time open program says following: "the application 'eclipse' can't opened". have solution. downloaded version has ide built in. possible issue? problem open eclipse - did instal correct on mac i had no problems installing keppler version : @ http://www.eclipse.org/downloads/ -> go kepler eclipse ide java ee developers (mac 64 bit), download file eclipse-jee-kepler-sr2-macosx-cocoa-x86_64.tar.gz ! open (unpack) it, create entry: eclipse.app. afterwards, when done, open eclipse , install "sap ui5 – development toolkit" in eclipse through: help/install new software/ open site -> https://tools/hana.ondemand.com/kepler best luck, markus

mysql - Need Help Breaking Up PHP Script / max_execution_time exceeded -

i have php script updates popular , trending images on website. script meant run cron job once day believe due traffic database (on relies) in daily statistics each image stored, being large, script times out. on hostgator shared hosting , there no way increase max_execution_time , unfortunately vps or dedicated server not feasible @ time. appreciate if has suggestions on can following script, or database (currently on 100mb) make run smoothly. think truncating databse idea, or mess important aspects on image data? the current script follows: <?php $minute = date("i"); // if($minute=='00') { include("../config/config.inc.php"); include("../includes/meme-function.php"); $date = date("y-m-d"); $query = mysql_query("select `meme_id` `$database1`.`memes`"); while($row=mysql_fetch_assoc($query)) { $query_b = mysql_query("select `views` `$database2`.`daily_m

meteor - MeteorJS and Iron:Router error with WebSocket -

i'm using meteorjs iron:router on windows 8.1, i've created simple meteor project , added iron:router library, copy example ( router controller ) throws error. layot.html <head> <title>route_controllers</title> </head> <body> </body> <template name="applayout"> <div class="container"> <nav> <ul> <li><a href="/posts">/posts</a></li> </ul> </nav> <article> {{> yield}} </article> </div> </template> <template name="home"> <h1>home</h1> </template> <template name="postindex"> <h1>post index</h1> </template> layout.js router.route('/', { name: 'home' }); router.route('/posts', { controller: 'postcontroller', action: 'index' }); if (meteor.isclient) {

user interface - MATLAB: How to make camera light follow 3D Rotation -

i have come problem when trying rotate 3d objects. building gui , have separate figure object plotted. in figure, allow user use matlab's built-in rotate button move object around. however, unable have light follow rotation seems fixed on 1 part of object. create light, using c=camlight('right'); set(c,'style','infinite'); one solution have thought of add light whenever user releases rotate button, not nice. not know how use rotate callbacks when button in separate figure. does know how make light "track" 3d rotation, current view illuminated? thanks! implement own rotation functionality you can implement own functionality adjust axes , lights @ same time. way light gets adjusted continuously while rotating axes. function follow_me_1 figure axes('buttondownfcn', @buttondownfcn); % assign callback set(gca,'nextplot','add'); % add next plot current axis surf(peaks,'hit

packages - Combine rows/observations by column value in R -

i have data frame 3 columns: id class score abc123 science 1 jkl456 math 0 zpe789 english 1 abc123 science 0 jkl456 math 0 yth293 art 1 i want combine observations id, , add column sums scores (total score), shows number attempted (even if got wrong), , calculates percent correct, so: id class total score number attempted percent abc123 science 1 2 50 jkl456 math 0 2 0 zpe789 english 1 1 100 yth293 art 1 1 100 are there r packages or functions collapse across id , corresponding class , produce these results? thank you. df <- read.table(textconnection("id class score abc123 science 1 jkl456 math 0 zpe789 english 1 abc123 science 0 jkl456 math 0 yth293 art 1

php - Symfony2 & PHPUnit - Access getContainer() -

i have problem phpunit test on symfony2. connect application, use web service, created userprovider. in function loaduserbyusername use symfony2 parameters saved in app/config/parameters.yml . i'm not in controller need use global variable $kernel , args this: global $kernel; $url = $kernel->getcontainer()-getparameter('myparam'); when use application, works, when write test this: $crawler = $client->request('get', '/login'); $form = $crawler->selectbutton('submit')->form(); $form['_username'] = $username; $form['_password'] = $pass; and execute phpunit error : fatal error : call member function getcontainer() how can access symfony2 parameters or use getcontainer when execute phpunit? in symfony documentation how create custom userprovider , under 'create service user provider' states: the real implementation of user provider have dependencies or configuration options or oth