Posts

Showing posts from April, 2013

javascript - include google maps geocoder in reactjs -

hello have following code in regular js/html: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script type="text/javascript"> function initialize() { var geocoder = new google.maps.geocoder(); ... } </script> now want transfer react component. export default class map extends component { initialize() { var geocoder = new google.maps.geocoder(); .... } render(){ ..... } } but doesn't work, since don't know how include google maps api component. <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> how can that?

Javascript Date -> numeric vs string -

var date1 = new date('1900-01-01'); console.log(date1); yields: "mon jan 01 1900 01:00:00 gmt+0100 (w. europe standard time)" var date2 = new date(1900,1,1); console.log(date2); yields: "thu feb 01 1900 00:00:00 gmt+0100 (w. europe standard time)" fiddle but don't understand why! you can see month difference since when pass individual components (year, month, day, etc) date object constructor, have consider month parameter should start 0 : console.log( new date('1900-01-01').getmonth() ); // 0 other jan/feb there shouldn't differences in dates. mdn: https://developer.mozilla.org/en/docs/web/javascript/reference/global_objects/date

c# - Creating Func body dynamically -

see sample below: var factorytype = typeof(func<>).makegenerictype(sometype); container.registerperrequest(sometype, null, sometype); func<object> factorydelegate = () => container.getinstance(sometype, null); //this returns object, hence delegate type func<object>, required type func<someclass> container.registerinstance(factorytype, null, factorydelegate); //not sure how create factory delegate i want create function body instance of sometype created using di container. the idea configure di container can inject func<someclass> other classes. how can done? just cast result: func<sometype> factorydelegate = () => container.getinstance(typeof(sometype), null) sometype; or create method (extension better): static func<t> resolvetypedelegate<t>() t : class { return () => resolvetype<t>(); } static t resolvetype<t>() t : class { return container.getinstance(typeof(sometype), null)

matlab - Csvwrite returns a single line output instead of multiple lines (displayed in notepad) -

Image
aim i want write .csv file in following format 1253.7500,1295.5000,-403.7500,1,0.000 1253.7500,1295.5000,-401.2500,1,0.000 1258.7500,1294.5000,-403.7500,1,0.000 1258.7500,1294.5000,-401.2500,1,0.000 1257.5000,1295.5000,-402.5000,1,0.000 code if use .csvwrite follows m = [3 6 9 12 15; 5 10 15 20 25; ... 7 14 21 28 35; 11 22 33 44 55]; csvwrite('test1.dat',m); type test1.dat matlab displays correctly this: 3,6,9,12,15 5,10,15,20,25 7,14,21,28,35 11,22,33,44,55 problem i want import program need above format if open created file in notepad looks this: 3,6,9,12,**155**,10,15,20,**257**,14,21,28,**3511**,22,33,44,55 (the stars dont appear used them highlight problem area here 2 numbers combined) is there way write in .csv file without happening ? the problem lies within notepad, not code or matlab. using notepad++ displayed correctly as: if used .csv instead of .dat format m = [3 6 9 12 15; 5 10 15 20 25; ... 7 14 21 28 35; 11 22 33 44 55]

sql server - Keep only desired characters and separate with semicolon in T-SQL -

the problem: i have text data imported db lot of unwanted characters. need keep 4 capital letter strings within imported text string. example: 1447;#mibd (this nice name);#2056;#lkre (very nice name indeed) this in 1 column in 1 row of table. need extract string is: mibd , lkre and result should preferably desired strings separated semicolons. it should applied whole column , cannot know how many of these 4 upper case letter strings might appear in 1 row. went through sorts of function patindex etc. not know how approach it. help! try this, assumes 4 char code preceded ;# . patindex case insensitive have added additional check verify 4 character capital. declare @mytable table( id int, mystring varchar(8000)) insert @mytable values (1, '1447;#mibd (this nice name);#2056;#lkre (very nice name indeed)') ,(2, ';#dbcc (this nice name);#2056;#llc (very nice name indeed) ;#abcd') ,(3, ';#aaaa;#opqr;1234 (and) ;#wxyz') ,(4

Jekyll: assigning a variable to a post on a for loop -

i'm trying create multilingual website company, and, because have lot of information, i'd include information in french , in english in same post so: en: title: "english stuff" fr: title: "french stuff" the thing is, in order use them dynamically in same layout using this, {{ post.[post.lang].title }} i wanted assign variable when for ed them, automatically assign language wanted on posts, like: {% post in site.categories.yesterday %} {% assign lang = en %} <li><h2><a href="{{ post.url }}">{{ post.lang.title }}</a><h2></li> {% endfor %} is doesn't seem working (the titles not rendered), wanted ask opinion. the viable way it? doing wrong , can improve it? the easiest solution build separate sites on separate domains. not dry, simple solution. google tell same. however, if have website requires changes/evolves on time, 'not being dry' part might become frustra

ios - traitCollectionDidChange: Called even I dont have any changes -

do know why traitcollectiondidchange called no size class changes. selecting uilabel, have in storyboard attribute inspector / installed check uilabel. no special cases installing according size class. therefore dont understand why traitcollectiondidchange called when rotate device? yes, called after viewdidlod, every time rotate device/ emulator. if wanted react rotation use viewwilltransitiontosize . update: hmm, re-thinking this. guess size class changing when rotate iphone. can think of traitcollectiondidchange specialised method of viewwilltransitiontosize - facilitating thresholds telling when crossing size class boundaries? the size class change if rotate iphone, won't change if rotate ipad (which has regular size class both horizontally , vertically). rotation considered change in interface environment, therefore traitcollectiondidchange called.

FCM Downstream message via Android - No notification? -

i try send downstream message via android. response code 200 don't notification. possible send notifications via firebase console, checked already. this code of post-request: public class downstreammessage extends asynctask<string,string,string> { asyncresponse delegate = null; int responsecode; @override protected string doinbackground(string... params) { httpurlconnection httpurlconnection = null; bufferedreader bufferedreader = null; string server_key = "key=12345"; string client_key; string content; string content_json_string; try { url url = new url("https://fcm.googleapis.com/fcm/send"); client_key = params[0]; httpurlconnection = (httpurlconnection) url.openconnection(); httpurlconnection.setrequestproperty("content-type", "application/json;charset=utf-8"); httpurlconnecti

java - How do I convert a String to array Integer? -

i trying convert string array integer ,i made code working in java ,but in android studio array converted don't take last value of array covered string string y="abc"; string[] array = y.split(""); int[] x = new int[y.length()]; (int i=0;i<y.length();i++) { string letter=array[i]; if( letter.equals("a")){x[i]=1;} if( letter.equals("b")){x[i]=2;} if( letter.equals("c")){x[i]=3;} sum =sum + x[i]; } sum variable dont count last value of conversation ,it should 6 3 you should define "sum" outside loop. keep value. string y="abc"; string[] array = y.split(""); int[] x = new int[y.length()]; int sum = 0; (int i=0;i<y.length();i++) { string letter=array[i]; if( letter.equals("a")){x[i]=1;} if( letter.equals("b")){x[i]=2;} if( letter.equals("c")){x[i]=3;} sum += x[i];

split string without removal of delimiter in python -

i need split string without removal of delimiter in python. eg: content = 'this 1 string big 2 need split 3 paragraph wise. 4 string 5 not formated string.' content = content.split('\s\d\s') after getting this: this\n string big\n need split it\n paragraph wise.\n string\n not formated string. but want way: this\n 1 string big\n 2 need split it\n 3 paragraph wise.\n 4 string\n 5 not formated string you use re.split forward lookahead: import re re.split('\s(?=\d\s)',content) resulting in: ['this', '1 string big', '2 need split it', '3 paragraph wise.', '4 string', '5 not formated string.'] this splits on spaces -- followed digit space.

set cookie on click with php -

hi want set cookie on button click have problem it first version of code , working fine <?php $id = is_numeric($_get['id']) ? $_get['id'] : 1; $cookie_name = "favoritepost"; if ( isset($_cookie[$cookie_name]) ) { $kookie = unserialize($_cookie[$cookie_name]); } else { $kookie = array(); } if ( ! in_array($id, $kookie) ) { $kookie[] = $id; } setcookie($cookie_name, serialize($kookie), time() + (86400 * 30), "/"); // 86400 = 1 day ?> <html> then said wanted change cookie set button click wrote code not workinf , gives me no cookie set problem. thanks <!doctype html> <?php $id = is_numeric($_get['id']) ? $_get['id'] : 1; $cookie_name = "favoritepost"; if ( isset($_cookie[$cookie_name]) ) { $kookie = unserialize($_cookie[$cookie_name]); } else { $kookie = array(); } if ( ! in_array($id, $kookie) ) { $kookie[] = $id; } ?>

php - Is there a need to test execute() result in PDO? -

i use following statement pdo mysql queries $query = $db->prepare('mysql statement'); $result = $query->execute(array()) use $query->fetch or fetchcolumn (to check count(*)) fetch data. my question - there need test whether $result true or not? in productive environment if mysql down error exist when declare new pdo. under circumstances need test whether execute true or false? it depends on pdo::attr_errmode , explained in errors , error handling chapter. if configure pdo throw exceptions ( pdo::errmode_exception ) no, pdo automatically throw exception on error. in other case (use default pdo connection options or explicitly set pdo::errmode_silent or pdo::errmode_warning ) yes, need verify manually success of each individual operation. it isn't useful pdo::errmode_exception not default but, know, php has history of hiding helpful error messages misguided user-friendliness.

jquery - Element popup and disappears -

i have used jquery toggle function element. every time load page element pops , disappears. my code here:-- $(document).ready(function(){ jquery("#button").toggle(function(){ jquery("#feedback_form").animate({right:"0px"}); }, function(){ jquery("#feedback_form").animate({right:"-362px"}); return false; } ); //toggle }); the button element appears , disappears. cant click it. i've done little bit different original code: js: $("#button").click(function(){ $('#feedback_form').toggleclass("move"); }); css: .move{ right:-362px !important; } here fiddle: https://jsfiddle.net/g2hncbdu/5/

Swift / iOS: How to assign value for OrderedDictionary variable? -

i want assign value ordereddictionary ( https://github.com/lukaskubanek/ordereddictionary ) , way, it's ok. var ordereddictionary: ordereddictionary<string, int> = ["a": 1, "b": 2, "c": 3, "d": 4] but this, doesn't work. // json data let abc:[string:anyobject] = ["a": [1], "b": [2], "c": [3], "d": [4]] var od: ordereddictionary<string, anyobject> = abc or var od: ordereddictionary<string, anyobject> = abc as! ordereddictionary<string, anyobject> why? what's different there? , how assign value it? i think there more different issues. first of all, array not anyobject, have change to var ordereddictionary2: ordereddictionary<string, any> = ["a": [1], "b": [2], "c": [3], "d": [4]] the second issue when trying assign dictionary directly, dictionaryliteralconvertible called (ordereddictionary has ex

javascript - AngularJS - Call Directive from Controller on ng-click -

html <li> <a ng-href ng-click="startstreaming(camera);">{{camera.name}}<i class="fa fa-tv"></i></a> </li> <object events="true" id="vlc" codebase="http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab" classid="clsid:9be31822-fdad-461b-ad51-be1d1c159921"> <embed width="800" height="650" loop="no" autoplay="yes" version="videolan.vlcplugin.2" type="application/x-google-vlc-plugin" id="vlc" embed-src="" src=""> </object> ctrl cameramodule.controller('streamingctrl', ['$scope', '$rootscope', 'cameramoduleserviceapi', '$timeout', 'svc', '$q', 'sharedservice','mysharedservice', function ($scope, $rootscope, cameramoduleserviceapi, $timeout, svc, $q, sharedservice, mysharedse

jacoco - Gradle JacocoReport task triggers confusing Exception -

i'm trying generate merged jacoco test coverage reports in non-standard multi-project gradle setup. in following gradle code 2 tasks. first one, jacocomerge , works (after struggling), generating combined.exec file in right place. second task, jacocomergedreport seems executed without error according log traces, nothing, , there's null pointer exception in trace shortly after execution. here's gradle fragment: afterevaluate { task jacocomerge(type: jacocomerge) { executiondata testtasks destinationfile = file("$builddir/../reports/combined.exec") executiondata = files(executiondata.findall({ it.exists() })) jacococlasspath = cp } task jacocomergedreport(type: org.gradle.testing.jacoco.tasks.jacocoreport, dependson: 'jacocomerge') { jacococlasspath = cp executiondata = files("$builddir/../reports/combined.exec") sourcedirectories = files(subprojects.findall { isactualproject(it) }.sourcesets.main.a

jquery does not display content -

i simple bit of test code loop through , display content array. when run in browser, doesn't display or run errors. <html> <head> <title>jquery each test</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script> <script type="text/javascript"> var arr = ["one", "two", "three", "four", "five"]; var task = ""; $(document).ready( $.each(arr, function(index, value) { task += value + "<br>"; $('div.content').html(task); })); </script> </head> <body> <div class="content"></div> </body> </html> change ready function code following line $(document).ready(function(){ $.each(arr, funct

android - Custom view and animated GIF - gif is not playing correctly -

i have implemented custom view has draweeholder. have implemented callbacks , listeners custom view (attach / detach / invalidatedrawable / setlistener). if set gif image url controller - not play gif correctly. refreshes gif when view redrawn. guess animated gif should have invalidation callback or something. p.s. gif work correctly if use draweeview. other images work correctly inside custom view. creating holder: private draweeholder<genericdraweehierarchy> createcomponentholder(view parent, context context) { genericdraweehierarchy componenthierarchy = new genericdraweehierarchybuilder(parent.getresources()) .setroundingparams(roundingparams.fromcornersradius(layouthelper.dp(3)).setborder(theme.color_media_border, 1)) .build(); draweeholder<genericdraweehierarchy> holder = draweeholder.create(componenthierarchy, context); holder.gettopleveldrawable().setcallback(parent); return holder; } setting controller: pipelin

php - How to use an Elasticsearch gauss function with min value but no max value, but still get results below min with reduced score? -

im trying create pretty complex query in elasticsearch , have run little problem. can shed light... i have price value can defined minimum value and/or maximum value, or neither. when min and max defined easy use gauss function results between min , max score of 1, , decreasing score outside of defined range... "gauss": { "price_amount": { "origin": 150000, "offset": 50000, "scale": 10000 } } however, when only min or max defined little trickier. so example, user defines price range: 100,000 - no max how construct elasticsearch query in order give consistent score above 100,000, pick documents price below 100,000, penalised score (like when using gauss function within function_score query)? ive thought of filtering results price first (before using gauss function) if set gte range query value min (100,000), exclude below 100,000. reduce value assign gte query capture documents bel

Scala macro to generate new instance of class with dependency injection of trait with abstract fields -

update: modified code use macro annotation, still missing something the following code works (question below): object mytypes { trait realtype class container[rt <: realtype] { this: rt => } trait somerealtype extends realtype trait partialrealtype extends realtype { val needed: int } } import mytypes._ object container { import scala.reflect.macros.blackbox.context import scala.language.experimental.macros def helper[rt <: realtype : c.weaktypetag](c : context) : c.expr[rt] = { import c.universe._ val weakrt = weaktypeof[rt] val gentree = q"new container[$weakrt] $weakrt {}" c.expr(gentree) } def apply[rt <: realtype] : container[rt] rt = macro helper[rt] } val ok = new container[somerealtype] somerealtype val ok_quasi = container[somerealtype] i wish able run following: val partial = container[partialrealtype]{val needed: int = 0} i've tried this: object container { import scala.reflec

xamarin.forms - Unable to Add System.ServiceModel Nuget Package in Xamarin Form PCL Project -

i trying follow official xamarin tutorial make use of wcf services xamarin form pcl project (url /guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_wcf/ on xamarin website) however, @ time of referencing system.servicemodel nuget package, following error , package not installed: could not install package 'system.servicemodel 1.0.0'. trying install package project targets '.netportable,version=v4.5,profile=profile7', package not contain assembly references or content files compatible framework. more information, contact package author. i tried profile 78 without luck (i removed windows phone 8.1 explained here since there no wcf support). i tried different profiles pcl project explained here , without success. also, tried using package management console , got similar error: pm> install-package -verbose cmdlet install-package @ command pipeline position 1 supply values following parameters: id: system.s

php - Duplicating data in SQL -

i making database validation system. upon validation, handler supposed send data email address, while simultaneously updating data database. values of id, name, board, query , rand received previous page. now, given code, unable update table named 'answers' within database. line of code functionality in bold. <?php $servername = "localhost"; $username = "root"; $password = ''; $dbname = "bsp"; $conn1 = new mysqli($servername, $username, $password, $dbname); $id=""; $value = ""; $name = ""; $board = ""; $query=""; $id = $_post['id']; $name = $_post['name']; $board = $_post['board']; $query = $_post['query']; $rand = $_post['rand']; $value=$_post['option']; $to=""; $subject=""; $msg=""; $headers=""; if($value=='delete') { $sql="delete rti id=$id"; if (

rest - Ideal way to identify encoding of a content in HTTP request? -

i have need develop rest-based api can accept either binary or base64 encoded content, , possibly other contents. has require encoding of file identified; otherwise assumed binary. don't want auto-guess based on contents of api. my first inclination use content-type base64 not appear 1 of well-known content types - makes sense since it's not type rather encoding. reading various rfc specs, 1 think content-transfer-encoding header appropriate place indicate whether content of request body encoded base64 or binary. however, not think appropriate because it's smtp protocols, limited 7 bits. then there's content-encoding or transfer-encoding don't see base64 well-known value header because both headers have more compressing content rather indicating whether base64 encoding has been applied. i'm inclined think using custom headers safest not breach existing specs wanted see if nice folks @ can come & definitive answer compliant rfcs.

html - store email ids in google documnet -

i have static html page containing form subscribe email list entering email address. since have no database store email addresses received through form, there way capture , store email addresses google document? subscribe newsletter<br/> <input type="text" placeholder="enter email id" /> <button> subscribe </button>

spring data with elasticsearch fails on findTopByOrderBy -

i'm using spring data elastic search. repository class has method latest insert in index. product findtop1byorderbyiddesc(); by fails following exception. java.lang.nullpointerexception: null @ org.springframework.data.elasticsearch.core.elasticsearchtemplate.queryforpage(elasticsearchtemplate.java:307) ~[spring-data-elasticsearch-2.0.1.release.jar:na] @ org.springframework.data.elasticsearch.core.elasticsearchtemplate.queryforobject(elasticsearchtemplate.java:251) ~[spring-data-elasticsearch-2.0.1.release.jar:na] @ org.springframework.data.elasticsearch.repository.query.elasticsearchpartquery.execute(elasticsearchpartquery.java:78) ~[spring-data-elasticsearch-2.0.1.release.jar:na] @ org.springframework.data.repository.core.support.repositoryfactorysupport$queryexecutormethodinterceptor.doinvoke(repositoryfactorysupport.java:482) ~[spring-data-commons-1.12.1.release.jar:na] @ org.springframework.data.repository.core.support.repositoryfac

node.js - App crashes with "Error: ENOENT" even if persistent folder exist -

lets assume digitalocean/dokku/nodejs/sails app called example.com , (will be) available via corresponding domain. i have added persistent storage app by: dokku docker-options:add example.com run "-v /home/dokku/_work_:/_work_" dokku docker-options:add example.com deploy "-v /home/dokku/_work_:/_work_" if run dokku run example.com "ls /app/_work_" or dokku run example.com "ls /app/_work_/uploads" i can see folder exists , there files/folders there. ok, in app code want check folders in /app/_work_/uploads folder , delete old ones. first try list of folders in /app/_work_/uploads by: ... var p = path.join(sails.config.rootpath, '_work_/uploads'); var dirs = fs.readdirsync(p); ... the problem code fails following error: error: enoent: no such file or directory, scandir '/app/_work_/uploads' @ error (native) @ object.fs.readdirsync (fs.js:808:18) @ cleandirs (/app/config/bootstrap.js:36:16) @ obj

mysql - Expressjs session : undefined sessionid -

i getting null sessionid in expressjs application here app.js file var session = require('express-session'); var app = express(); app.use(cookieparser()); app.use('/loginaction',loginaction); //session handling app.set('trust proxy', 1) // trust first proxy app.use(session({ secret: 'hellokitty', resave: false, saveuninitialized: true, cookie: { secure: true } })); in loginaction.js file located in routes folder. router.post('/', function(req, res, next) { console.log("session id"+req.sessionid); //test session req.session.test= 'something'; }); but session id undefined also req.session.test through error cannot resolved test your getting unidentified on req.sessionid because never sending sessionid client. requesting information request doesn't have. should try sending sessionid in initial login response. should remain persistent in request after (not sure on it'

javascript - filter dropdown by another dropdown -

i'm trying use value of 1 dropdown filter values displayed in next dropdown. dropdowns populated data multiple json files (as shown below). the desired result filter templates applications.name, can see templates has application.name inside of it, when first dropdown selected results first filtered check if templates.application.name == selectedtestscript.application (which ng-model of first dropdown). could point me in direction of useful resources or better yet explain i'm growing wrong? appreciated. applications json: { "applications": [ {"id": 1, "name":"deep thought"}, {"id": 2, "name":"agent smith"}, {"id": 3, "name":"glados"}, {"id": 4, "name":"jarvis"} ] } templates json: { "templates": [ {"id": 1, "name":"deep thought template 1", "application":{"name&qu

Different behaviour of javascript and jquery -

i have button , changing value , name on click showing same value in alert. working fine when use jquery not when use call function javascript function value not changing in front view in alert value changing totally strange. here demos javascript function change() { if ($(this).attr('name') == 'first') { $(this).attr('name', 'second'); $(this).attr('value', 'second'); alert('new name ' + $(this).attr('name')); } else { $(this).attr('name', 'first'); $(this).attr('value', 'first'); alert('new name ' + $(this).attr('name')); } }; <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type="submit" id="button" value="first" name="first" onclick="change()"> jquery $('#button').click(

getting an error on ubuntu : Command 'sudo' is available in '/usr/bin/sudo' -

i trying install java . getting following error . :~$ sudo apt-get update command 'sudo' available in '/usr/bin/sudo' command not located because '/usr/bin' not included in path environment variable. sudo: command not found i dont know how resolve problem? you can check content of path variable executing command $ echo $path if not find /usr/bin in output can append /usr/bin in path variable executing command $ export path=$path:/usr/bin

python 3.x - pyspider : No module named 'wsgidav' -

Image
i using python 3.5.2 on windows 10,i installed pyspider,and run pyspider all ,there errors,as follow: what should do? wsgidav doesn't support python3. ignore it, pyspider can still run without feature. update: both pyspider , wsgidav working python3 now. work of @mar10

webrtc - How to get all audio devices for Android APIs < 23 -

how can device info not using method of api 23 ? audiodeviceinfo[] devices = audiomanager.getdevices(audiomanager.get_devices_all); //or get_devices_outputs is there way? in case target api 19 - kitkat. thank you. to devices, can use navigator.mediadevices.enumeratedevices() method provided in webrtc. here simple javascript function audio input devices `navigator.mediadevices.enumeratedevices() .then(function(devices) { devices.foreach(function(device) { console.log(device.kind + ": " + device.label + " id = " + device.deviceid); if(device.kind=="audioinput"){ //audio device , use device.deviceid } }); })` the method tested chrome

html - Keeping side menu 100% height -

i have side menu keep @ 100% page height. the code right now: body, html { width: 100%; height: 100%; } .sidemenu { width: 200px; height: 100%; float: left; } the problem side menus height not extend rest of page. example have input fields can added form, , when few inputs have been added form extends below original view port. while menu not. heres jsfiddle demonstrate https://jsfiddle.net/m5yfqdsu/ , click "add row" button add inputs until theyre below viewport. so best solution keep menu @ 100% height? prefer css solution, js works if needed. add position: fixed; .sidemenu // quick function add more inputs $(document).ready(function() { $(".add").on("click", function() { $("fieldset").append("<div class='rowcontainer'><label>label:</label><input type='text' /></div>"); }); }); * { margin: 0; padding: 0 } body, html { w

regex - How to force HTTPS to subdomain (no www) -

how can force user following url while forcing https? https://subdomain.hostname.com/request-uri from of these links: http://hostname.com/request-uri http://www.hostname.com/request-uri https://hostname.com/request-uri https://www.hostname.com/request-uri i tried: rewriteengine on rewriterule .* https://subdomain.hostname.com%{request_uri} [l,r=301] and: rewriteengine on rewritebase / rewritecond %{http_host} ^(www\.)?hostname\.com$ rewritecond %{https} off rewriterule ^(.*)$ https://subdomain.hostname.com%{request_uri} [l,r=301] without having success... you can use : rewriteengine on rewritebase / rewritecond %{http_host} ^(?:www\.)?hostname\.com$ rewriterule ^(.*)$ https://subdomain.hostname.com%{request_uri} [l,r=301] clear browser cache before testing this.

Onesignal opt-in popup Cordova/Ionic Android fails -

unfortunately have problem onesignal ionic. what working?: - ios , android devices accept push messages fine - users show on onesignal admin panel fine - can manually opt-in , opt-out (using window.plugins.onesignal.setsubscription(true/false);) - on ios receive popup asking me opt-in push messages. not working: - not receive popup on android devices asking me opt-in. users automatically opt-in ;-) spent few hours reading stackoverflow, onesignal user manuals no solution provided. my app.js document.addeventlistener('deviceready', function () { // enable debug issues. // window.plugins.onesignal.setloglevel({loglevel: 4, visuallevel: 4}); var notificationopenedcallback = function(jsondata) { console.log('didreceiveremotenotificationcallback: ' + json.stringify(jsondata)); }; window.plugins.onesignal.init("11111111-1111-1111-1111-111111111111", {googleprojectnumber: "1111111111111&quo

angularjs - Ng-repeat on generic element -

i have problem. make ng-repeat on different json depending on call. i want this: when call made on elementheaderatmt display following code <table class="table"> <thead> <tr ng-repeat="element in elementsheaderatmt"> <th>{{ element.transportline }}</th> <th>{{ element.station }}</th> <th>{{ element.transformer }}</th> <th>{{ element.park }}</th> <th>{{ element.linemt }}</th> <th>{{ element.section }}</th> <th>{{ element.cd }}</th> <th>{{ element.transformercdcm }}</th> <th>{{ element.element }}</th>

geolocation - creating and adjusting color of L.polygon in leafletjs -

i working leaflet library v. 0.7.7 want create polygon, set markers , define polygon colors, there no way var polygon = new l.polygon(); <c:foreach var="marker" items="${markers}" varstatus="rowindex"> var marker${rowindex.index} = l.marker([${marker.lat},${marker.lng}],{icon: yellowicon,title: '${marker.title}'}).addto(mymap) .bindpopup( "${marker.htmlmarkerpopupcode}").openpopup(); polygon.addlayer (marker${rowindex.index}); </c:foreach> polygon.setstyle({fillcolor: '#0000ff'}); polygon.setstyle({color: 'red'}); polygon.setstyle({fillopacity: 0.5}); mymap.addlayer( polygon ); unfortunately l.polygon single layer, not layer group. not supposed contain other layers / markers. the polygon.addlayer() line should throw error. if understanding correct, draw polygon vertices markers? in case, should read markers coordinates , store

SQLite FTS4 compound MATCH doesn't work with FMDB (iOS, Objective c) -

i have simple fts4 query: select * addresses addresses match '(plz:12* or nummer:12*) , (ort:berlin*)' this query works fine sqlitemanager (i results), when execute query fmdb don't results (no errors no results). when use query fmdb works: select * addresses addresses match 'ort:berlin* plz:12* or nummer:12*' it seems fmdb has problem braces. there alternative braces? is there bug in fmdb? use simple tokenizer: [db executeupdate:@"create virtual table if not exists addresses using fts4(id, plz, nummer, ort, strasse, tokenize=simple);"];

office365 - WOPI Client (office online) Lock request -

i have strange response wopi client (i.e. office online) while locking document, provides me multiple locks in terms of short json string , long json string. how possible ? , if is, 1 should consider valid , whole json string, part of json string actual lock ? response contains json string below: {"f":6,"e":1,"c":"df1","m":"df-8f3a7ae03629","p":"59f8d569-8001-4cf1-a5a2-e89c24e18a7f","w":"df-d81ca88d14b7","b":"4b9ba727-dd57-4ce5-8f3d-6a814191db82","l":"df-94574cd614c8"} thanks in advance !! you store as-is 'a string'. if enabled supportsextendedlocklength in getfileinfo size of 'lock id' @ 1024 characters, otherwise 256 characters. make sure account this.

python - flask_mail, mails are stuck on thread and are never send -

i'm using flask + socketio ssl, , i'm trying send mail, reason, sending mail not working. here configuration: app.config['mail_server']='smtp.gmail.com' app.config['mail_port'] = 465 app.config['mail_username'] = 'xxx@gmail.com' app.config['mail_password'] = 'xxx;' app.config['mail_use_tls'] = false app.config['mail_use_ssl'] = true app.config['debug'] = true mail=mail(app) ... and when i'm using it: @app.route('/testmail') def testmail(): msg = message( 'hello', sender='xxx@gmail.com', recipients=['xxx@gmail.com']) msg.body = "this email body" mail.send(msg) return "" and here error log: file "/usr/local/cellar/python/2.7.11/frameworks/python.framework/versions/2.7/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:writ

android - Picasso displays in wrong orientation -

picasso.with(mcontext).load(lpreviewdata.getimage()).into(holder.lpreviewiv); this how rendering image url imageview. unfortunately when render image showing in landscape mode actual image in portrait. this problem exif rotation handling in picasso . should either rotate image in code or fix source image have correct orientation without using exif rotation. i should mention problem affects images retrieved via url.

javascript - jQuery tablesorter not initializing when tested with Jasmine -

i'm having issues testing jquery tablesorter table (with server-side sorting) jasmine. table never seems make ajax calls. in code below, fail @ expect(jasmine.ajax.requests.mostrecent().url).tocontain(reportslisturl); . "reportslisturl" base of tablesorterpager.ajaxurl . it seems though tablesorter failing make sort of ajax calls during jasmine testing. table functions in practice no errors. here jasmine test: jasmine.getfixtures().fixturespath = "fixtures"; describe("admin manage reports", function() { beforeeach(function() { loadfixtures("admin_manage_reports_template.html"); jasmine.ajax.install(); }); aftereach(function() { jasmine.ajax.uninstall(); }); it("calls reportslisturl when pagerupdate triggered", function() { expect(adminwriteaccess).tobedefined(); expect(reportslisturl).tobedefined(); expect(deleteurl).tobedefined(); expect(u

mysql - Concatenate static value while exporting CSV file using fputcsv in PHP -

Image
i using below code export csv file using fputcsv in php. code works proper , csv file generates. values/records coming database. want add dollar ($) symbol of column values. code exporting csv file. $filename1 = "all months.csv"; ob_end_clean(); $fp1 = fopen('php://output', 'w'); ob_start(); header("content-type: application/vnd.ms-excel"); header('content-disposition: attachment; filename='.$filename1); fputcsv($fp1, array('month', 'year', 'total production', 'credit adjustments', 'net production', 'hygiene production', 'collections', 'account receivable total', 'new patients', 'break points', 'net income', 'hygiene %')); $query = $db->query("select month, year, total_production, credit_adjustments, net_production, hygiene_production, collections, ac_receivable_tota

ios - Draw Drop Shadow Outside UIView -

Image
background i have uiview following properties: alpha = 1 backgroundcolor = white, 0.35 opacity rounded corners drop shadow code this how create drop shadow: ( uiview extension) self.layer.maskstobounds = false self.layer.shadowcolor = uicolor.darkgraycolor().cgcolor self.layer.shadowoffset = cgsizemake(0, 5) self.layer.shadowopacity = 0.35 self.layer.shadowpath = uibezierpath(roundedrect: self.bounds, cornerradius: self.layer.cornerradius).cgpath results this results in following: ...while not want see shadow beneath view this: question how can draw shadow outside view not visible below it? thanks in advance! this perhaps more complex need be, here's 1 solution. extend uiview following method: extension uiview { // note: method needs view context taken argument. func dropshadow(superview: uiview) { // context superview uigraphicsbeginimagecontext(self.bounds.size) superview.drawviewhierarchyinrect(cg

node.js - What does findOne() return exactly in mongoose -

you pass in callback: function(err, found) { if(err) // checks see if there error else if (found) // checks if document exists } to execute query "immediately". correct way check if document exists? how can tell if document exists or not? how can tell if there error executing query (suppose connection lost before database return results). i'm little confused , clarification appreciated. what have work fine. if there error, want throw error. if query returned document, found default true. you can proceed use found object inside second if statement. to see if query successful no user found: function(err, found) { if(err){ throw err; } if(found){ console.log(json.stringify(found)); }else{ console.log('the query successful, nothing found'); } }

python - Loop through list of dictionaries simlutaneously -

i have 2 lists of dictionaries like: a=[{"name":"jd","lat":12.1231,"long":10.123},{"name":"wq","lat":-1.21313,"long":7.31}] b=[{"name":"jd","time":datetime.datetime(1,2,3)},{"name":"wq","time":datetime.datetime(4,5,6)}] i want loop through 2 simultaneously: for i,j in a,b: i valueerror: many values unpack also for i,j in zip(a,b): i not output @ all. zip(a,b) empty list. how should go this? have @ zip for i,j in zip(a,b):

c# - Acrobat-like PopUp in WPF -

Image
im working on simple imageviewer. now came mind, might nice feature, context-sensitve actions zooming , rotating. to implement these functions not problem, contextmenu is. i've decided not use contextmenu -element, instead im going use popup. reasons popup: less styling better positioning isopen bindable (contextmenu not bindable on isopen against articles regarding this) here comes trouble: <image x:name="part_imgcurrent" verticalalignment="center" horizontalalignment="center" stretch="uniform" grid.row="0" grid.column="0" source="{binding elementname=part_previewpanel, path=selecteditem.source}"> <image.layouttransform> <rotatetransform angle="0"></rotatetransform> </image.layouttran