Posts

Showing posts from February, 2015

java - Android MultiDex ClassNotFoundException -

because of large application, have use multidex split app pre lollipop devices. when debugging app on nexus 4 (ics 4.3), following errors. why classes not found? defaultconfig { applicationid "de.itout.bring.handsoffme" minsdkversion 17 targetsdkversion 23 versioncode 6 versionname "1.2" multidexenabled true } buildtypes { release { //signingconfig signingconfigs.debug minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' signingconfig signingconfigs.release } debug { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } dexoptions { //javamaxheapsize "512m" //predexlibraries = false javamaxheapsize "4g" incremental true } dependencies { compile project(':emoji') provided filetree(dir: 'libs...

zmalloc - How to measure Valgrind's memory usage? -

i have application written in c uses zmalloc (borrowed redis) memory wrapper keep track of total dynamic allocated memory program. using valgrind on linux find memory leaks , invalid memory accesses. the problem zmalloc , top show totally different memory usage reports when using valgrind. makes me think valgrind consuming memory. how measure valgrind's memory usage? valgrind tools such memcheck or helgrind use lot of memory tracking various aspects of program. so, normal top shows lot more memory program allocates itself. if want have idea memory used valgrind, can do: valgrind --stats=yes ... the lines following ------ valgrind's internal memory use stats follow ------ will give info valgrind memory usage. use valgrind --profile-heap=yes ... have detailed memory use. note if not use standard malloc library, might need use option --soname-synonyms=... have tools such memcheck or helgrind working properly.

Change an image on a html web page using javascript depending on an ID -

i new javascript , trying display image changes depending on id user types in. below have declared variable "icon" store values of url + icon id + .png complete url : icon = "http://ddragon.leagueoflegends.com/cdn/6.2.1/img/profileicon/" + summonericon + ".png" an example of variable contain is: "http://ddragon.leagueoflegends.com/cdn/6.2.1/img/profileicon/14.png" i use information in variable display on html page, when user types in username, javascript should return image matches id user has submitted. these images stored @ url displayed above, not stored locally. thanks reading question. use jquery hook change event on input dictate id , pull value icon variable. html <input type="text" name="userid" id="id /> js function getvals() { var icon = $( "#id" ).val(); } $( "input" ).change( getvals ); getvals(); you'll have tweak getvals function re-renders ...

How can check with C# if Microsoft Outlook is already open? -

i have tried looking answer question... forgive me if have overlooked it. what trying automate sending email. have want in code code assumes outlook not open. is there way me test if outlook open before opens instance of outlook? microsoft.win32.registrykey key = microsoft.win32.registry.localmachine.opensubkey("software\\microsoft\\windows\\currentversion\\app paths\\outlook.exe"); string path = (string)key.getvalue("path"); if (path != null) system.diagnostics.process.start("outlook.exe"); else messagebox.show("there no outlook in computer!", "systemerror", messageboxbuttons.ok, messageboxicon.exclamation); int proccount = 0; process[] processlist = process.getprocessesbyname("outlook"); foreach (process theprocess in processlist) { proccount++; } if (proccount > 0) { //outlook open } ...

node.js - Correct approach to handle react-routes on a server? -

i have uploaded application server , encountered problem. going example.com displays homepage correctly, after doing example.com/dashboard error cannot /dashboard . assume because server trying path, still needs go through index.html single page app using react-router. believe need redirect requests got index.html make work, i'm not sure how can implement this. using express server files, here server.js var express = require('express'); var app = express(); app.use(express.static(__dirname + '/dist')); app.listen(8080, function() { console.log('listening on port: ' + 8080); }); you need set express if request is not static file falls through , handled frontend route react app on index.html . adding above example, this, var express = require('express'); var app = express(); app.use('/static', express.static(__dirname + '/dist')); app.get('*', function (req, res, next) { if (req.path.startswith(...

jquery - AJAX called within JavaScript closure (triple nested for) -

i've tried using this: javascript closure inside loops – simple practical example but cannot head around how does: arrayone[0] secondarray[0] thirdarray[0] thirdarray[1] thirdarray[2] secondarray[1] thirdarray[0] thirdarray[1] secondarray[2] thirdarray[0] thirdarray[1] thirdarray[2] arrayone[1] //and on... i want call ajax post within every thirdarray loop therefore i've been informed must use closures instead of simple triple nested loops. using first, second , third array can show me way works, more apparent if example fit purpose, dont understand how examples achieve want. edit: (my attempt) var ak47array = ['aquamarine revenge', 'wasteland rebel', 'jaguar', 'vulcan', 'fire serpent', 'point disarray', 'frontside misty', 'cartel', 'redline...

sas - loop through variables to create interaction terms -

i seek loop through variables (can contained in macro variable or data set) create macro variable interaction terms can use in regression. here example. let’s original variables in macro variable. %let predictors = age sex bmi; i seek loop through these variables , create macro variable can use in regression. in first iteration, have age. seek create: % interactions = age sex bmi sex*age bmi*age fit regression. then use sex in next iteration. % interactions = age sex bmi age*sex bmi*sex; and on. thanks! note sure how using this, simple %do loop should handle request. %macro test(predictors); %local n j ; %let n=%sysfunc(countw(&predictors)); %do i=1 %to &n; %let interactions=&predictors; %do j=1 %to &n; %if &i^=&j %then %let interactions= &interactions %scan(&predictors,&i)*%scan(&predictors,&j) ; %end; %put &=i &=interactions; %end; %mend ; %test(age sex bmi); which produce...

javascript - Serializing an object of type -

Image
i wanted implement angularjs in mvc4. how return json in format of angular in mvc4. here codes: controller: [httpget] public actionresult sample1() { return json(db.account_info.tolist(), jsonrequestbehavior.allowget); } account.js app.controller('account', ['$scope', '$http', '$timeout', function ($scope, $http, $timeout) { $scope.bag = []; $scope.alldata = function () { // $http.get('/accounts/sample1').then(function ($response) { $scope.bag = $response; }); } //execute on page load $timeout(function () { $scope.alldata(); }); }]); app.js var app = angular.module('myapp', []); view: <script src="~/scripts/angular/angular.min.js"></script> <script src="~/scripts/angular/app.js"></script> <script src="~/scripts/angular/account.js...

ruby - Getting Implicit Converstion Error -

i have created item class , trying rake test it. when running code outside test no errors thrown. because of assume testing wrong. class item attr_accessor :name, :description, :item def initialize (item, description, name) @name = item[:name] @description = item[description] end end and code using test require "asheron's_call/item.rb" require "test/unit" class testgame < test::unit::testcase def test_item 1 = item.new ("potion","red") assert_equal("potion", one.name) end end =>93: 1 = item.new ("potion","red") 94: assert_equal("potion", one.name when running test getting new error syntax error. expecting ')' after potion. when changed see happen , came saying expected me place 'end' me feels wrong. the test fine. item ’s constructor not: c...

c++ - stuck with creating node and linked-list of specific requirement -

Image
i have requirement create linked list of m size , each node contain b size. have attached image how link list , load should , elements in it. structure required of linked list: can 1 can tell me how should format node meet requirement. i not understand post 100%, based on understand , guess, got following things. 1. element head 8bit, means linked list should within 256 elements. 2. element valuelen 4bit, means value should less 16 bit so defined structure struct node { unsigned int nextptr:8; unsigned int key:4; unsigned int valuelen:4; unsigned int value:16; }; which have 4byte (32bit) , whole linked list should be typedef node linkedlist[256]; total 1k bytes.

datetime - Extracting 2 digit hour from POSIXct in R -

i extract hour posixct time in r, retrieve 2 digit answer. for example, test=as.posixct("2015-03-02 03:15:00") test [1] "2015-01-02 03:15:00 gmt" month(testing) [1] 1 hour(testing) [1] 3 the results give relevant month , hour, see 01 , 03 instead of 1 , 3 . try this: strftime(test, format="%h") to extract hours and strftime(test, format="%m") for month

Solr 5.1.0 and 5.2.1: Creating parent-child docs using DIH -

i trying import solr 5.1.0 , 5.2.1 data-config should produce documents following structure: <parentdoc> <someparentstuff/> <childdoc> <somechildstuff/> </childdoc> </parentdoc> from understand 1 of answers on this question nested entities in dih , versions of solr should able create above structure following data-config.xml : <dataconfig> <datasource type="jdbcdatasource" driver="com.mysql.jdbc.driver" url="" user="" password="" batchsize="-1" /> <document name=""> <entity rootentity="true" name="parent" pk="parent_id" query="select * parent"> <field column="parent_id" name="parent_id" /> <entity child="true" name="child" query="select * child...

ajax - Unwanted <p:resetInput> behaviour on JSF Form -

i'm using p:resetinput allow users clear specific fields when want, if type on these text areas, , press enter while focus on inputtext, clears first textarea of form. version: jsf 2.2 primefaces 5.2 example: <h:form> <p:inputtextarea id="test"></p:inputtextarea> <p:commandbutton value="clear" update="test" process="@this"> <p:resetinput target="test"></p:resetinput> </p:commandbutton> <br /> <p:inputtextarea id="test2"></p:inputtextarea> <p:commandbutton value="clear" update="test2" process="@this"> <p:resetinput target="test2"></p:resetinput> </p:commandbutton> <br /> <p:inputtext id="input_id" > </p:inputtext> </h:form>

c# - Randomly generate blocks on a flat map -

Image
i'm trying randomly generate blocks on flat map , make don't overlap each other. have made matrix (c# array) of size of map (500x500), blocks have scale between 1 , 5. code works if generated block overlaps one, destroyed , not regenerated somewhere else. only around 80 of 1000 blocks try generate don't overlap block. here picture of map around 80 blocks generated, green squares blocks void generateelement(int ratio, int minscale, int maxscale, gameobject g) { bool elementfound = false; (int = 0; < ratio * generationdefault; i++) { gameobject el; // randomly generate block size , position int size = random.range(minscale, maxscale + 1); int x = random.range(0, mapsizex + 1 - size); int y = random.range(0, mapsizey + 1 - size); // check if there element (int j = x; j < x + size; j++) (int k = y; k < y + size; k++) if (map[j][k] != null) elem...

twilio - Can twiml set a rate limit on responses? -

i have number set small twiml script (using twimlets). want have stop responding bit if it's overused. example if it's dialed 5 times in 1 minute should wait 3 minutes before responding again. possible twiml/twimlets or need move own server , set code detect this? twilio developer evangelist here. unfortunately you't able set rate limit twiml. set time limit each call, wouldn't accomplish want. my suggestion moving own server able have full control of pages return, therefore showing different content according number of times it's been requested. you can spin free heroku instance make things easier you. this page shows how , more.

python - Merging dataframe rows that have a offset (generated the same day but bearing a different timestamp) -

i'm trying merge several dataframes, in each frame data such timestamp cap 0 1387118554000 3488670 1 1387243928000 1619159 2 1387336027000 2191987 3 1387435314000 4299421 4 1387539459000 9866232 each value represents daily generated data, each value not generated @ exact same millisecond timestamps not merge. need way convert timestamp year, month , day components. able merge data sets (unless there way solve such issue). you can try to_datetime : print pd.to_datetime(df['timestamp'], unit='ms') 0 2013-12-15 14:42:34 1 2013-12-17 01:32:08 2 2013-12-18 03:07:07 3 2013-12-19 06:41:54 4 2013-12-20 11:37:39 name: timestamp, dtype: datetime64[ns] df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms') print df timestamp cap 0 2013-12-15 14:42:34 3488670 1 2013-12-17 01:32:08 1619159 2 2013-12-18 03:07:07 2191987 3 2013-12-19 06:41:54 4299421 4 2013-12-20 11:37:39 986623...

SQL Server create User-Defined Table Types with schema not working properly -

Image
i'm creating user-defined table types on sql server 2008r2/2012 statement: create type [myschemaname].[myusertabletype] table ( [id] varchar(20) not null ); this works intended. i got stored procedure deletes associated object given schema. user-defined table types not working properly. expecting types created associated schema. if try drop schema, complain schema associated user-defined table type. hence not deleted. but if query objects in db type_table tells me table types not belong schema. belong schema 'sys' select name, schema_id, type_desc [testdb].sys.objects type_desc = 'type_table'; select * sys.schemas; any idea why? here screenshot output instead of looking in sys.objects these should in sys.types or sys.table_types (which additionally exposes type_table_object_id ). select name, schema_id /*will "test" schema id*/ sys.types is_table_type = 1 , name = 'myusertabletype' when cr...

html - How to keep row position same when zoom your browser more than 100% using Bootstrap? -

i have small issue bootstrap grid system , have row has grid setup 2 sections col-md-6 , problem when zoom browser more 100% close label , input moving next line. want them stay same place time zoom should not effect position of rows.i tried use col-xs-1 not work. how can achieve task using bootstrap ? main.html <div class="row"> <div class="container col-md-6"> <div class="form-group"> <label class="col-md-5">actual cycle start:</label> <div class="col-md-7"> <div class="row"> <div class="col-xs-5"> <input class="form-control" ng-model="riskassessmentdto.cyclestartdate" k-format="'mm/dd/yyyy'" disabled /...

ios - Print at console the information of a website -

Image
i've made server runs https website. want print out information of website on console in xcode. to that, added following viewcontroller.m : - (void)viewdidload { [super viewdidload]; nserror *error; nsstring *address = [nsstring stringwithformat: @"https://54.169.239.78:3001"]; nsurl *url = [nsurl urlwithstring:address]; nsstring *theweb = [nsstring stringwithcontentsofurl:url encoding:nsasciistringencoding error:&error]; nslog(@"%@", theweb); } however, results (null) . in addition, error: nsurlsession/nsurlconnection http load failed (kcfstreamerrordomainssl, -9813) even though have allowed app transport security in info.plist what's wrong? issue certificate only. if have set plist this. if want verify thing change url ( https://developer.apple.com/ ) of website in code , update code as: - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. ...

java - How can I add horizontal line to bar chart in Jasper Report? -

Image
i'm trying designing report bar chart, in need add threshold. have tried multi-axis chart, in scale in different axis different. is there other solution add line bar chart? my expect output chart below: to draw line on bar chart add valuemarker categoryplot. in jasper report done adding jrchartcustomizer public class mychartcustomizer implements jrchartcustomizer { @override public void customize(jfreechart jfchart, jrchart jrchart) { categoryplot plot = (categoryplot) jfchart.getplot(); //set @ value line, color , size of stroke valuemarker vm = new valuemarker(13000,color.blue, new basicstroke(2.0f)); //add marker plot plot.addrangemarker(vm); } } in jrxml make sure class in classpath , set customizerclass attribute on chart tag <barchart> <chart customizerclass="mychartcustomizer"> .... </chart> ... </barchart> if using dynamic-reports can add direc...

deployment - How can I get Bluemix to pull in multiple runtimes? -

my primary application requires node.js runtime on bluemix. however, other components of application require both python , java. how can bluemix pull in 3 runtimes when push app? i recommend following microservices architecture , keeping deployment lifecyle of each of 3 applications separate. can have manifest.yml file each of application , push application when needs updated. allows scale them individually well. if need push , update 3 applications @ same time, can write simple script cf push each manifest. cf push -f ./some_directory/application1/ cf push -f ./some_directory/application2/ cf push -f ./some_directory/application3/ you can have multiple applications defined in 1 manifest file https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#multi-apps --- # manifest deploys 2 applications # apps in flame , spark directories # flame , spark in fireplace # cf push should run fireplace applications: - name: spark memory: 1g instances: 2 host: fli...

sql server - TSQL Pivot query -

Image
i need on tsql pivot , getting error. appreciated. below query , data. declare @cols varchar(8000), @query varchar(8000) set @cols = stuff((select distinct ',' + quotename(c.steps) tableabc c xml path(''), type ).value('.', 'varchar(8000)') ,1,1,'') --print @cols set @query = 'select name, elapsedtime_sec,' + @cols + ' ( select name,elapsedtime_sec tableabc ) x pivot ( max(steps) elapsedtime_sec in (' + @cols + ') ) p ' execute(@query) table information: without expected output , faulty pivot query, i'm guessing want. here script works based loosely on question. i'm guessing it's not output want, can work script , maybe turn need. create table #tableabc(id int,name varchar(256), steps varchar(1024),elapsedtime_se...

python - Django post_save not getting many-to-many attributes on create -

i binding post_save method model in django, following code: def save_mymodel(sender,instance,*args,**kwargs): print 'save called' parameter in instance.parameters.all(): print parameter.name post_save.connect(save_mymodel, sender=mymodel) here models: def mymodel(models.model): parameters = models.manytomanyfield(parameter) def parameter(models.model): name = models.charfield(max_length=100) when try create mymodel django admin number of parameters, save called output. if save same mymodel object again admin, parameters printed. difference between calling save on create , not on create? how can make sure attributes of model using post_save on creation? manytomany fields not participate in model save() method, post_save not recognize m2m changes. detect m2m change, use m2m_changed signal. django doc m2m_changed .

ruby on rails 4 - customizing devise routes for sign in and sign up -

i have sign-up , sign-in form on same page , want sign-up , sign-in errors such 'email exists' appear on page. i've customised registrations controller using this solution , created custom devisefailure class errors on sign in redirect page. i have 2 questions: if sign fails due error in form (e.g. entering email address has been registered) , try sign in internal server error - inget, accepted http methods options, get, head, post, put, delete, trace, connect, propfind, proppatch, mkcol, copy, move, lock, unlock, version-control, report, checkout, checkin, uncheckout, mkworkspace, update, label, merge, baseline-control, mkactivity, orderpatch, acl, search, mkcalendar, , patch. if reload redirect occurs correctly. dont know how address error. how trap errors sign in form or sign form? errors displaying twice - once each form. routes.rb authenticated :user root 'preorders#by_campaign', as: :authenticated_root end root to: 'users...

c# - Try/Catch Fails When Trying to Extract EntityValidationErrors -

Image
i'm experiencing problem program cannot save db. receive "validation failed 1 or more entities. see 'entityvalidationerrors' property more details." went online , found articles applying try/catch around "savechanges()". project in mvc. project works locally without issue when push live when receive error message. controller // // get: /account/logoff [authorize] public actionresult logoff() { // user information var user = membership.getuser(); var userid = (int)user.provideruserkey; var userprofile = db.userprofiles.where(up => up.userid == userid).single(); // used display notifications, last login date set when user logs off var profile = db.userprofiles.where(up => up.userid == userid).single(); profile.lastlogindate = datetime.now.addhours(2); db.entry(profile).state = entitystate.modified; try {...

c# - Combobox SelectedItem and Binding in UWP -

Image
currently developing uwp application having troubles comboboxes. i binding observablecollection combobox (it works) var warehouselist = new observablecollection<warehouse>(taskmag.result); warehousebox.itemssource = warehouselist; what show selecteditem when load data form. not using mvvm , combox xaml <combobox horizontalalignment="stretch" width="400" fontsize="32" name="warehousebox" margin="20,0,0,0"> <combobox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal" width="auto" height="auto"> <textblock text="{binding name}"/> <textblock text="{binding warehouseid}" name="mid" visibility="collapsed"/> </stackpanel> </datatemplate> </combobox.itemtemplate> </combobox> i have no idea start documentation implies mvvm or other thing have not implement...

html - iOS AJAX Post "not working" -

here problem. have unifi access point, gives customer ability use our wifi. splash page asks user enter name , email. posts google form, saves information spreadsheet. works on except iphones. iphone goes straight aol.com after user enters information. gives them internet access not post form info spreadsheet. <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>classic city computing, inc.</title> <link rel="stylesheet" type="text/css" href="<unifi url="css/bootstrap.min.css"/>" /> <link rel="stylesheet" type="text/css" href="<unifi url="css/stylesheet.min...

r - Shiny: dynamic default value for textInput -

i see textinput has default value field. however, can't seem figure out how dynamically set default value field. lets have selectinput , want default value of textinput value selected in selectinput text appended it, user can freely edit. on ui side have textinput can't value=paste0(output$selectname,"_sometext") because can't use output . i'm guessing answer involves code on server side updates textinput . can't seem figure how updatetextinput want, though sounds want. advice on dynamically generating default value textinput appreciated. regards it appears needed use observe in server side , updatetextinput worked.

Phonegap app does not show images from the internet? (android) -

Image
i have been trying show content in app youtube videos images around web not show up. for example, if create google play badge through google ( https://play.google.com/intl/en_us/badges/ ) the button show through chrome fine once export app onto android image disappears. same thing happens when try , show youtube video in app. feel if app not have access internet 1 of default permissions comes app don't know whats causing it. i attached screenshots of app: android(left) chrome through desktop (right) thank help!

angularjs - How to $watch changes in array item but not the array itself -

for example have $scope.array = [{ foo: 'bar'}, { foo: 'bar2'}] i want watch array such that $scope.array.pop(); //$watch not called $scope.array[0].foo = 'newbar'; //$watch called $scope.array = [{ foo: 'bar' }, { foo: 'anotherbar' }]; //$watch not called is possible accomplish $scope.$watch? you can use function return required value watch: $scope.$watch(function(scope) { return scope.array && scope.array[0].foo; }, function(newvalue, oldvalue) { // action here } ); if need observe more itens, can return array foo's objects, example.

javascript - IE 'x' icon is not clearing the counter? -

i have created angular directive counts character inputs , text area, working expected, problem raised user when clear input using ie 'x' icon not clear out count should set maylength of 256. how can resolve issue ie ? main.html <div class="col-md-3"> <input type="text" class="form-control" ng-model="input.searchvalue" placeholder="enter search item" maxlength="256" name={{$index}} data-tooltip-html-unsafe="<div>{{256 - input.searchvalue.length}} characters left</div>" tooltip-trigger="{{{true: 'focus', false: 'never'}[ input.searchvalue.length >= 0 || input.searchvalue.length == null ]}}" tooltip-placement="top" tooltip-class = "bluefill"/> </div> directive.js angular.module('mymaxlength', []).directive('mymaxlength', function () { 'use strict'; ...

java - Parenthesis Compiler Error -

i keep getting parenthesis highlighted compiler errors. got of code oracle docs. docs code: package helloworld; import javafx.application.application; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.layout.stackpane; import javafx.stage.stage; public class helloworld extends application { @override public void start(stage primarystage) { primarystage.settitle("javafx welcome"); primarystage.show(); } gridpane grid = new gridpane(); grid.setalignment(pos.center); grid.sethgap(10); grid.setvgap(10); grid.setpadding(new insets(25, 25, 25, 25)); scene scene = new scene(grid, 300, 275); primarystage.setscene(scene);\ text scenetitle = new text("welcome"); scenetitle.setfont(font.font("tahoma", fontweight.normal, 20)); grid.add(scenetitle, 0, 0, 2, 1); label username = new label("user name:"); grid.add(use...

html - Invert Top Rounded Borders to Create Bowl Effect -

Image
this question has answer here: how can create concave bottom border in css? 5 answers i have div rounded corners invert these rounded corners create bowl effect. here have: html{ background:red; } #test { position: absolute; bottom: 0; left: 0; right: 0; height: 150px; border-top-left-radius: 50%; border-top-right-radius: 50%; background: blue; } <div id="test"></div> so instead, like: is possible css? update if not clear, 'red' meant illustrate rest of body of page , need transparent change top bottom . border- bottom -left-radius: 50%; border- bottom -right-radius: 50%; edit: see fiddle then.

php - How to stop array from being overwritten? -

i'm using symfony2, version 2.7. should able answer because it's not entirely relevant symfony. i have function. want function add new item (once clicked on form) array. instead, array keeps getting overwritten new item clicked. i tried few foreach loops couldn't right. please, appreciated. below relevant function. /** * displays bought items * * @route("/buy/{id}", name="item_buy") * @method("get") * @template() */ public function buyaction(request $request, $id) { $session = $request->getsession(); $cart[] = $id; $em = $this->getdoctrine()->getmanager(); $entity = $em->getrepository('appbundle:item')->find($id); $entities = $em->getrepository('appbundle:item')->findall(); $session->set('cart', $cart); if (!$entity) { throw $this->createnotfoundexception(...

Cloudflare http to https redirect for Lighttpd -

i use cloudflare sites , need make default redirect http https. use lighttpd web server without ssl, wish use ssl of cloudflare. i found article redirect http https don't now, how make lighttpd add following lighttpd.conf file, assuming have added .pem , .crt files domain name. uses mod_rewrite under server.modules don't forget add mod_rewrite. lighttpd.conf file should @ server.modules section server.modules = ( "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_simple_vhost", "mod_setenv", "mod_rewrite", ) at end of lighttpd.conf file, append rewrite http links https $http["scheme"] == "http" { $http["host"] =~ ".*" { url.redirect = (".*" => "https://%0$0") } } alternatively can force cloudflare ssl going cloudflare domain settings. log in cloudflare account. under desired domain, go crypto, , cha...

javascript - gulp sourcemap is created but not working -

styles styles.less @import "one.less"; @import "two.less"; one.less body { background:red; } two.less body { font-size: 12px; } gulpfile.js var gulp = require('gulp'); var less = require('gulp-less'); var sourcemaps = require('gulp-sourcemaps'); gulp.src('./src/assets/less/styles.less') .pipe(less()) .pipe(sourcemaps.init({loadmaps: true})) .pipe(sourcemaps.write('./')) .pipe(gulp.dest('./dist/css/')); result: styles.css + styles.map.css created map file doesn't load when enter web page (and when inspect "body" see styles.css) links gulp less - https://github.com/plus3network/gulp-less gulp-sourcemaps - https://github.com/floridoo/gulp-sourcemaps i'm frustrated, i'd appreciate help. thanks. you're "piping" less() before initializing sourcemap plugin, right way is: var gulp = require('gulp'); var less = require('gulp-less...

r - Forcing mutate_each to create new column names for a subset of columns evaluate via ifelse -

problem i'm working data frame similar extract generated below: set.seed(1) df <- data.frame(columna1 = 1:10, columnb1 = 1:10, columnb99 = runif(n = 10)) i create set of columns contain custom flags corresponding values derived columns have 1 in column name. approach my present approach summarised below: require(dplyr); require(magrittr) df %<>% mutate_each(funs(ifelse(. == 1, "val1", ifelse(. == 10, "val10", na))), contains("1")) this generates required values, however, not create additional columns: > head(df, n = 10) columna1 columnb1 columnb99 1 val1 val1 0.26550866 2 <na> <na> 0.37212390 3 <na> <na> 0.57285336 4 <na> <na> 0.90820779 5 <na> <na> 0.20168193 6 <na> <na> 0.89838968 7 <na> <na> 0.944675...

ASP.NET MVC - Choose which validation annotations to use -

i have model properties this: public class yourdetails { [required(errormessage = "code required")] [stringlength(10, errormessage = "code length wrong", minimumlength = 2)] [range(0, int.maxvalue, errormessage = "please enter value bigger {1}")] public int code { get; set; } } the ui validation setup usual out of box way unobtrusive js validation plugin. the issue: have 2 navigation actions, , next. next fine, validation fires when things wrong, , when things right i.e. .isvalid() returns true, data passed db service etc etc. however when press 'back' have requirement validate form/viewmodel differently prior saving. i.e. make sure code positive integer, don't bother required or stringlength validation. so want validate on next partially on back. possible? when i've done similar in past easiest way found use fluent validation http://fluentvalidation.codeplex.com/wikipage?title=mvc . can pass parameters...

c# - Interact with MessageDialog using Coded UI on Windows Phone -

i'm writing coded ui tests simple application , cannot seem code find or interact messagedialog box. using test builder able see box, , associated controls, in test unable find elements in app. i think issue xamlwindow being used searching limited app under test, , popup exists outside context. have tried instantiate new xamlwindow context popup exists in, code unable find window except app of hardware buttons. i have seen referenced in few other places messagedialog can found when using uimap, hand coding these tests , trying avoid use when possible. not against using uimap if there way generate in code , load messagedialog if possible. after working automatically generated code able figure out answer. in order access messagedialog need instantiate uitestcontrol referencing popup window. issue comes because window outside of scope of app being tested. able instantiate uitestcontrol object of window using following: uitestcontrol popupwindow = new uitestc...

php - MySQL: Complete missing data with parent tables -

let's assume have 3 tables in database, representing hierarchic order: countries , states , , cities each city connected 1 state, each state 1 country. simple represent in database. let's further assume each of tables contains field tax_rate . in basic case tax rate defined on country level , null on other levels. however, overwritten on of levels below. when query city node tax rate. defined right within same node, more defined on of next-higher levels. what efficient way accomplish either in mysql or on php level? in real life application there not 1 such field many of them. below simple database schema of example. of course have foreign key definitions. create table `countries` ( `id` int(11) unsigned not null auto_increment, `tax_rate` float(4,2) default null, `name` varchar(20) default null, primary key (`id`) ); insert `countries` (`id`, `tax_rate`, `name`) values (1,8.00,'switzerland'), (2,16.00,'germany'); create ta...

javascript - Time difference between fadeIn() delay() and fadeOut() -

i trying calculate time difference moment command line (3) starts , ends, looks wrong, line(7) shows zero. expecting show 6500 (1500 + 3500 + 1500). please me. sd = new date(); sdm = sd.getmilliseconds(); $(imgs).eq(i).fadein(1500).delay(3500).fadeout(1500); ed = new date(); edm = ed.getmilliseconds(); df = edm - sdm; document.getelementbyid('df').innerhtml = df; the reason throwing question is, writing slideshow (very simple) , not showing images in sequence jumps 1 another. this html , js. $(document).ready( function() { var i=0; var imgs = $('#images ul').children(); var j = imgs.length; setinterval(function(){ runit(); }, 6500); function runit() { = + 1; if (i == j) { i=0;} $(imgs).eq(i).fadein(1500).delay(3500).fadeout(1500); } }); <div id="slider"> <ul> <li><img src=...

c# - Visual Studio 2015 and uwp development - User-Mapped section error and CopyWin32Resources error -

continuing uwp development , 2 things keep happening visual studio , can't work out if vs2015 bug, fact deploying windows mobile 10 device or else. randomly when try build or deploy device either. could not copy "obj\arm\debug\myapp.exe" "bin\arm\debug\myapp.exe". exceeded retry count of 10. failed. unable copy file "obj\arm\debug\myapp.exe" "bin\arm\debug\myapp.exe". requested operation cannot performed on file user-mapped section open. or get copywin32resources failed exit code 500 seems random , can't nail down causing either. googling didn't help. said anti-virus disabling mine did nothing. said visual studio achievements extension don't have installed. anyone know cause or fix? making development difficult when can't deploy. update: ok first set of errors more related windows 10 think. when error appears again try manually copy file , when receive similar error in explorer. error 0x...

postgresql - In SQL how to select previous rows based on the current row values? -

Image
i've simple sql table looks this- create table msg ( from_person character varying(10), from_location character varying(10), to_person character varying(10), to_location character varying(10), msglength integer, ts timestamp without time zone ); i want find out each row in table if different 'from_person' , 'from_location' has interacted 'to_person' in current row in last 3 minutes. for example, in above table, row # 4, other mary mumbai (current row), nancy nyc , bob barcelona has sent message charlie in last 3 minutes count 2. similarly, row#2, other bob barcelona (current row), nancy nyc has sent message charlie in ca (current row) count 1 example desired output- 0 1 0 2 i tried using window function seems in frame clause can specify rows count before , after can't specify time itself. as known, every table in postgres has primary key. or should have @ least. great if had primary key defining expect...