Posts

Showing posts from February, 2011

r - Can ls() have a pattern > 1? -

say have 10 data.frame s contain dates in names 01-01-00 10-01-00 other letters , symbols added end in format ddmmyy e.g. 010100/sgh/d_3 and 020100/aff/d_1 if wanted create vector of above data.frame , there way select them without writing them out individually? i tried creating vector of sequence of dates , putting in pattern = came error (code below): dates <- seq(as.date("2000-01-01"),as.date("2000-01-02"),1) dates <- format(dates,"%d%m%y") ls(pattern=dates) in grep(pattern, all.names, value = true) : argument 'pattern' has length > 1 , first element used i'm assuming pattern can 1 value? create pattern matches of date strings want. 1 way join strings | characters: > dates <- seq(as.date("2000-01-01"),as.date("2000-01-10"),1) > dates [1] "2000-01-01" "2000-01-02" "2000-01-03" "2000-01-04" "2000-01-05" [6] "2000-01-0...

javascript - lodash flow and multiple arguments -

i have 2 functions add in lodash flow: function normalizedformfields(fields) { // needs 1 argument return _.mapvalues( fields, function( value ) { return { 'content': value }; } ); } function mergedmodelandformfieldss(model, normalizedformfields) { return _.merge( {}, model, normalizedformfields ) } const execution = _.flow( normalizedformfields, mergedmodelandformfieldss ) const errormessagebag = function( fields, model ) { return execution( fields, model ) // initiate flow 2 arguments } as can see first function normalizedformfields takes 1 argument. second 1 needs 2: value returned previous function (which normal behavior of flow), , one: model. but in errormessagebag invocation, launch flow process 2 arguments. how have second argument, available second function in addition returned product of first function ? see problem first function in flow takes , need 1 argument. kind of situation "curry" should come play ? please illustr...

javascript - Protect display contact number -

i have classified website , in product detail of page contact number show normal text. these numbers visible in search engine result. how protect or how show phone number image hide se? you can similar this. print phone number image. <?php $img = imagecreate(100, 20); //dimension of image $bg = imagecolorallocate($img, 255, 255, 255); //give white background $textcolor = imagecolorallocate($img, 0, 0, 0); //gives black colour string. both follow format in format (image, red, green, blue) $phone = "1234567890"; imagestring($img, 6, 2, 2, $phone, $textcolor); // imagestring ( resource $image , int $font , int $x , int $y , string $string , int $color ) // output image header('content-type: image/png'); imagepng($img); //outputs png image imagedestroy($img); //frees memory associated image ?>

mysql - sql query return wrong results -

why query returns results companyvisible 0, asking companies companyvisible has value of 1? select c.companyid, c.companydescription , c.companyname ,c.copmanydrastiriotita, c.companyvisible company c c.companyvisible = 1 , c.companydescription '%keyword%' or c.companyname '%keyword%' or c.copmanydrastiriotita '%keyword%' because of or clause apply brackets around and ...or clause use this select c.companyid, c.companydescription , c.companyname ,c.copmanydrastiriotita, c.companyvisible company c c.companyvisible = 1 , (c.companydescription '%keyword%' or c.companyname '%keyword%' or c.copmanydrastiriotita '%keyword%')

docker - Starting Multiple service in Dockefile -

i have 1 dockerfile below. from centos:centos6 run yum install httpd* -y run yum install mysql* -y entrypoint service mysqld start && bash entrypoint service httpd start && bash docker file running successful when enter container 1 service in start start httpd. i want start both service automatically using dockerfile. please let know how that you should create entrypoint.sh file: #!/bin/bash service mysqld start service httpd start and dockerfile: from centos:centos6 run yum install httpd* -y run yum install mysql* -y copy ./entrypoint.sh / run chmod +x /entrypoint.sh entrypoint ["/entrypoint.sh"] you try use supervisord in docker image

c# - Handling CData in converting Xml to Json using Newtonsoft -

i'm trying convert xml json , run business logic , deserialize c# object using newtonsoft json.net . xml has cdata values. how can deserialize json such value inside cdata mapped c# field. edit: xml may/maynot contain cdata e.g. xml: with cdata <?xml version="1.0" encoding="utf-8"?> <root> <text><![cdata[sample text]]></text> </root> with plain text <?xml version="1.0" encoding="utf-8"?> <root> <text>sample text></text> </root> json: with cdata: {"text":{"#cdata-section":"sample text"}} with plain text: {"text":"sample text"} code: class data { [jsonproperty("text")] public string text { get; set; } } public static data convertjsontoobject(string json) { return jsonconvert.deserializeobject<data>(json); } thank advance. xsd xml sample. defin...

How to include Background images for android apps -

i have designed background images layout , list view 6 different dpi scales, how can included them in project cause image assets configuration has luncher , navigation & tabs & notifications icons (not images) . (how include , tell android have background image each screen ??) any suggestions appreciated you have put images different densities (alternate resource files) in different folders contains density qualifier in names. like in: drawable drawable-hdpi drawable-xhdpi to create such folders in android studio: right click on resource folder ('res') or click on file menu new > android resource directory change resource type 'drawable' add (>>) 'density' available qualifiers choose required density qualifier dropped list on right side and click ok or right click on resource folder ('res') new > directory type 'drawable' required qualifier (ex. drawable-xhdpi) read here more det...

angularjs - How to get selected innetText value in select box using angular -

html: <select ng-model="productlist.name" ng-options="productitem.uuid productitem.name productitem in product.items"> </select> render : <option value="prod_1">product 1</option> <option value="prod_2">product 2</option> when select option in drop down list need show label value product 1 or product 2. so make @ ng-model productlist.label. but "prod_1" or "prod_2"

algorithm - Finding the average intersection line for multiple planes -

i have planes in 3d space, in theory should intersect @ same line. each plane calculated taking 3 measured points. there error in measurement of these points. so in practice, planes not intersect @ same line. how can "average" intersection line these planes? i intersect each plane each other plane, , average lines. however, when 2 planes have same orientation, small error in measurements result in huge error in calculated intersection. magnifying measurement error when calculating average intersection way. is there fairer way calculate common intersection line? i think need not averaging algorithm detects outliers (i.e. bad intersections lines) , discards them. one standard algorithm doing random sample consensus ( ransac ). able use have define kind of distance between lines, should possible in meaningful way. another possibility find inlier (i.e. intersection lines) hough transform . in algorithm, whole parameter space of lines subdivided cells. ...

git tag - Validating a tag name in a git repository -

i have 13 git remote repositories. in local machine have folder remote repositories "added" using git remote add command. want find whether tag "v1.0" present in particular remote repository. i tried with: git rev-list v1.0 but in command cant specify remote repository name. is there command similar git rev-list in can specify remote repository name also? the ls-remote subcommand should want: git ls-remote --tags https://git.example.com/repo.git "v1.0"

javascript - Just adding js script to typo3 -

i have following problem. have typo3 page without template made myself, gets in way style , behavior of other pages (i mean navigation, footer , on). have written html inside page creating html element. in html element, included js-code, uses jquery. problem is, page loads jquery @ footer , scripts loading before (in html element). script not recognize jquery. how can add scripts @ whole end of page? know, has templates, when create new template page, whole content disappears. would nice help. cheers, andrej it practice read js single file placed in footer of page. add setup section of page template: page.includejsfooter.scripts = fileadmin/js/scripts.js then remove js html template , put file. file hold custom js , possibly libraries use on page (if not loading them cdn). bonus: js doesn't have re-loaded on every page view can read cache. for reference: https://docs.typo3.org/typo3cms/typoscriptreference/setup/page/index.html#includejsfooter-array ...

javascript - make div bigger and animate bigger section upwards on hover -

i trying animate div upwards when user hovers on div. i able animate div making bigger, animation happens downwards. trying keep bottom of div remain in same place, , have smooth animating increasing size of div upwards. see jsfiddle here which demonstrates code doing. please see code below: .box { height: 170px; padding-bottom: 15px; width: 50%; } .content { background-color: #e3e4e6; height: 100%; text-align: center; } .content:hover { height: 110%; } <div class="box"> <div class="content">test</div> </div> you can using transform:scaley() , set transform-origin bottom . put margin-top:100px see effect better. can use transition make scale smoother you need scale text. see here: jsfiddle you need scale text it's original state in same time scale div. if scale div 2 times. need scale text 1/2 , same if scale 3 times...scale 1/3 in case enlarge .content 1.5 n...

android - display connection error messages in ionic framework -

i developing ionic mobile app getting difficulty display connection error message. when device not connected internet or when there connection timeout or want show popup display error message. first time encountering this. --first add plugin project in app.js include below code js document.addeventlistener("offline", onoffline, false); $rootscope.online = true; function onoffline() { // handle offline event $rootscope.$apply(function() { $rootscope.online = false; alert("there no active internet connection app. please check connectivity."); //implement method off error when connection terminates }); } document.addeventlistener("online", function() { $rootscope.$apply(function() { alert("connected"); $rootscope.online = true; $rootscope.closetoast(); }); ...

Jenkins Pipelines: Why is CPS Global Lib not loading? -

i'm following tutorial on pipeline library plugin . made repository containing following files: d:. │ test.groovy │ ├───src └───vars helloworld.groovy helloworld.groovy contains: def call(name){ echo "hello world, ${name}" } test.groovy contains: helloworld("joe") i installed pipeline plugins, in particular workflow-cps-global-lib-plugin. created new pipeline job in load repository , set script path test.groovy. when run job following error: java.lang.nosuchmethoderror: no such dsl method 'helloworld' found among [archive, bat, build, catcherror, checkout, deletedir, dir, echo, emailext, error, fileexists, git, input, isunix, jiracomment, jiraissueselector, jirasearch, load, mail, node, parallel, properties, pwd, readfile, readtrusted, retry, sh, sleep, stage, stash, step, svn, timeout, tool, unarchive, unstash, waituntil, withenv, wrap, writefile, ws] why helloworld step not defined? here list of installed plugins: h...

In Java what should be the regex, if i need the text withing the quotes as one element? -

my input string is: apple, orange, "banana,cherry", peach i need output as: apple orange banana,cherry peach i have tried using regex as: ",(?=([^\"]*\"[^\"]*\")*[^\"]*$)", -1 ...in split() method of java, output as: apple, orange, "banana, cherry" peach this 1 should work, though regex should figure out yourself. gods if ever want change in it; since didn't design monster you'll have no clue how works. and monster is, believe me. \s*("?)\s*([^",]+?(\s*,\s*[^",]+?)*?)?\s*\1\s*(,|$) basically, puts in optional quote @ start , makes capture group out of it, ("?) , , uses backreference \1 later in regex make sure matched content should either surrounded quotes, or not have them @ all. the rest whitespace , comma-separated content of format "optional stuff" + "repeating optional stuff starting comma", using "not quote or comma" group [^...

How to add Dreamfactory OAuth facebook login in Ionic? -

i trying implement dreamfactory oauth in ionic app. following resource implementation: http://wiki.dreamfactory.com/dreamfactory/tutorials/using_oauth this call making: $http.post('/api/v2/user/session?service=facebook').then(function (result) { console.log("result: "+ json.stringify(result)); }); the log above shows me json data redirects facebook url returned call , returns html facebook page. is there different approach should using in hybrid/ionic apps df oauth login? make ajax call (or set request header [x-requested-with: xmlhttprequest]). return actual url needed, not redirected response in html. let me know if have questions.

python - Pandas error TypeError: data type not understood -

i've been trying slice pandas dataframe using boolean indexing code like: subset[subset.bl.str.contains("stoke city")] the column bl of object type. yet when run it, have error: typeerror: data type not understood how go fixing it? update: i tried using: subset[subset.bl.astype(str).str.contains("stoke city")] but returned: unicodeencodeerror: 'ascii' codec can't encode character u'\xa3' in position 37: ordinal not in range(128) i tried resolving that: subset.bl = subset.bl.str.encode("utf-8") that worked, returned same error: 'data type not understood error' when again tried: subset[subset.bl.astype(str).str.contains("stoke city")] you can try cast str astype , because object can else string : subset[subset.bl.astype(str).str.contains("stoke city")] you can check type of first value by: type(subset.ix[0, 'bl']) edit: you can t...

cobol - SunSystems debugging -

please debugging cobol program on sunsystems 5.2.1 via mf net express 3.1.11 sp1. on virtual machine windows xp. on debug when not quick enough got message: "the sunsystems server unavailable. since there no remaining functions open sunsystems close down." if debugging quick going fine. please can help? there setting that? found in sun root directory file sun5.ini , there option: cci-time-out=3000 try set 9000 no change. help.

iso image for qemu generation -

i tried run command creating iso image qemu tar jxf arm-system-2011-08.tar.bz2. but got following error bzip2: compressed file ends unexpectedly; perhaps corrupted? possible reason follows. bzip2: inappropriate ioctl device input file = (stdin), output file = (stdout) possible compressed file(s) have become corrupted. can use -tvv option test integrity of such files. can use `bzip2recover' program attempt recover data undamaged sections of corrupted files. tar: unexpected eof in archive tar: unexpected eof in archive tar: error not recoverable: exiting now. how resolve this.

javascript - IE8 issue - Object doesn't support property or method error -

Image
this problem.. code in -- cbpanimatedheader.min.js file var cbpanimatedheader=(function(){var b=document.documentelement,g=document.queryselector(".cbp-af-header"),e=false,a=100;function f(){window.addeventlistener("scroll",function(h){if(!e){e=true;settimeout(d,250)}},false)}function d(){var h=c();if(h>=a){classie.add(g,"cbp-af-header-shrink")}else{classie.remove(g,"cbp-af-header-shrink")}e=false}function c(){return window.pageyoffset||b.scrolltop}f()})(); searched issue , found thread script438: object doesn't support property or method ie "html element id has same id variable in javascript function".. is solution.. mean.. have no idea.. can me out.. there several other issues too, quick found this: window.addeventlistener("scroll", where addeventlistener not supported in ie8 , queryselector() method partially supported. so, can either have fallback like: var cbpanimatedheader = (f...

html - Unable to locate input box with ends-with keyword- Xpath -

thank taking look. i've been able work out starts-with below source code reason, ends-with doesn't work <input type="text" value="" name="email" style="background-color: rgb(248, 248, 248);"/> //input[starts-with(@name,'ema')] - works absoultelty fine css=input[name*='ema'] - works fine css=input[name$='ail'] - works fine //input[ends-with(@name,'ail')] - doesn't work //input[ends-with(@.,'ail')] - doesn't work i using firepath 0.9.7.1.1 & tried in version 1.0- no luck. in advance i've tried xpath "ends-with" not work & didn't help. the ends-with() function requires xpath 2.0.

sql - Pass value from one PHP file to another -

i'm trying pass value input box on 1 php page (itinerary.php) php page ('submit.php') can, there, saved database. can't quite figure out how across. i've tried using can see code below, using statement receive , acknowledge value same page 'submit'. guess overcomplicating it, knowledge of php still pretty limited @ stage ideas appreciated! this extract itinerary.php file (it sits within bootstrap/html framework. note entry contains input box sequence number). <h3><br>your itinerary</h3> <?php //display contents of itinerary if(!empty($_session['itinerary'])){ //retrieve details of each location in array database $query = "select * locations loc_id in ("; foreach ($_session['itinerary'] $loc_id=>$value) {$query.=$loc_id.',';} $query = substr($query, 0, -1).')order loc_id asc'; $result = mysqli_query($db, $query); echo'...

jcr - AEM rollout configuration not working for blueprint to live copy flow triggered from code -

i have setup blueprints , live copies experiencing weird behavior. example 1: edit title of page (blueprint) using ui -> title gets set in live copy example 2: edit title of page (blueprint) using code -> title gets set in blueprint does not set in live copy code: session session = resourceresolver.adaptto(session.class); resource brandpageresource = resourceresolver.getresource("/content/platform-blueprints/company/nl/brands/439"); page brandpage = brandpageresource.adaptto(page.class); resource brandpagecontentresource = brandpage.getcontentresource(); node brandpagecontentnode = brandpagecontentresource.adaptto(node.class); try { brandpagecontentnode.setproperty(jcr_title, "new-title-from-endpoint"); } catch (repositoryexception e) { log.error("error initializing components", e.getmessage(), e); } session.save(); does know why happening , how can fix this? when change node's property surrounding pag...

python - Printing one list side by side repeatedly -

i'd print list side side repeatedly. happens in program take row of data spreadsheet in for loop , populate list client = []. have series of if , else statements determine whether or not print value. clear client = [] @ end of each row. prints top bottom, because want print output, i'd print results each row of data side side. note each row of spreadsheet contains data relevant 1 client , want print list each client side side. client = [] rowofcellobjects in millar_sheet['a2':'aa13']: cellobj in rowofcellobjects: client.append(cellobj.value) print(client[0]) #policy number print(client[9]) #license plate if client[12] != "not applicable": float(client[12]) print('s.i. = ' + '$' + str("%0.2f" % client[12])) else: print('s.i. ' + client[12]) print('basic = ' + '$' + str("%0.2f" % client[13])) client = [...

php - Phabricator: run unit test -

i want write custom unit test phabricator. for purpose, checked out documentation writing unit tests in phabricator , created file @ ./phabricator/src/infrastructure/testing/testcase/phabricatortrivialtestcase.php (for using trivial phabricator test case) following content class phabricatortrivialtestcase extends phabricatortestcase { private $two; public function willrunonetest($test_name) { // can execute setup steps run before each test in // method. $this->two = 2; } public function testallisrightwiththeworld() { $this->assertequal(4, $this->two + $this->two, '2 + 2 = 4'); } } when try run it, following message. $ cd ./phabricator $ arc unit src/infrastructure/testing/testcase/ no tests run. why can't run test documented? there step missing? finally figured out solution. a few things had done. moved test file directory ./src/extensions/__tests__ (the folder has __tests__ ) renamed class phabricato...

DBUS Java: How to export properties on DBus interface -

i trying use dbus java library project, while can found tutorials/docs on how create methods , signals dbus interfaces, not helpful documentation describe me in detail exporting properties dbus interfaces. one thing tried is, implementing get(), set(), , getall() methods of org.freedesktop.dbus.properties interfaces, added separate property interface 3 methods on dbus interface path. to better describe wanted do, below used org.freedesktop.networkmanager interface example. this structure of networkmanager interface on d-feet, , wanted add/include properties on java based dbus interface in way included here on network manager properties. /org/freedesktop/networkmanager > org.freedesktop.dbus.introspectasble > org.freedesktop.dbus.peer > org.freedesktop.dbus.properties > org.freedesktop.networkmanager > methods // network manager methods…. > properties //network manager properties > signals //network manager signals h...

php - SphinxQL Facet returns no more than 1000 results -

i have sphinx index , query via sphinx ql facets... this sphinx ql query: select id index_search match('refrigerator') order weight() desc limit 0,20 option max_matches=5000 facet category_id facet manufacturer_id facet store_id facet value_id limit 5000; select min(min_price), max(min_price) index_search match('refrigerator'); show meta now returns results this: array ( [0] => array ( [0] => array([id] => 3256) ... [19] => array([id] => 3242) ) [1] => array ( ... category filters ... ) [2] => array ( ... manufacturer filters ... ) [3] => array ( ... store filters ... ) [4] => array ( [0] => array ( [value_id] => 0 [count(*)] => 1146 ) ... [999] => a...

CloudKit - How to perform Not Exists query? -

i want perform database query in cloudkit in sql: select * table1 t1 not exists (select * table2 t2 t1.userid = t2.userid) do know how that? try select * table1 t1 t1.userid not in( select t2.userid table2 t2); or select t1.userid table1 t1 minus select t2.userid table2 t2;

android - How to upload a Video file to Twitter -

there many questions unfortunately not answered , outdated upload video twitvid how upload video twitter in android application? best way upload video on twitter i'm using twitter4j upload image , working when use same code upload video , message tweeted , there no video statusupdate statusupdate = new statusupdate(message); statusupdate.setmedia(files[0]); status status = twitter.updatestatus(statusupdate); also don't know if twitvid still available because tried download doesn't exist fabric twitter kit, supported upload video ?? because didn't find thing on documentation. you can user tweetcomposer sharing twitter. tweetcomposer.builder builder = new tweetcomposer.builder(mcontext) .text(status) .image(videouri); builder.show(); careful while sharing uri in 24 n above , uri should content://com.sample.myproject.provider/my_images/image430.jpg in format.

How to generate KeyPair in IOS and Android using Cordova? -

i creating banking app using angularjs1 , ionic1 ios , android. due security concerns clients device should generate public , private key using sha/rsa. don't want use javascript plugin, strictly denied client. digged lot, openssl , letsencrypt options left far know. both websites discuss manual command prompt key generation on operating system. want mechanism can: generate keypair on device. generate json web key(jwk). sign/hash data using private key. below reference in .net/java(i want in cordova) signature = rsa256signdata(asciibytes(data signed), rsaprivatekey) encoded signature = base64encode(signature) i couldn't find cordova plugin can handle this. if there no cordova plugin i'll glad if can tell me in pieces or native. thanks. i not know of cordova plugin can accomplish these tasks. there excellent javascript libraries provide these functions. have @ node-jose allows work jwk, jwe , jws. library depends on (a altered version of) nod...

android - React native -- call phone number with extension -

i trying open phone number extension. linking works phone number tried few options linking.openurl('tel:xxxxxxxxx,xxx'); linking.openurl('tel:'+ encodeuricomponent('xxxxxxxxx,xxx')); dialer dials primary number , doesnt include extension i write native code , expose method, last option i know late, can try component: react-native-communications . it works both on ios , android. you have import in file need: import communications 'react-native-communications'; and use need: <touchableopacity onpress={() => communications.phonecall(phonenumbers[0].number, true)}>

javascript - Heroku not including JS files but CSS files but works on localhost -

don't ignore this,yeah there similar questions not of solutions worked me. i have rails app on heroku not including js files other application.js //= require jquery //= require jquery_ujs //= require turbolinks //= require bootstrap-sprockets //= require react //= require react_ujs //= require components //= require js-routes //= require axios component.js //= require lodash //= require alt //= require axios //= require initialize //= require_tree ./react and yet none of files in application.js files included, have jquery's code loaded none of other js files included. config/production.rb rails.application.configure # settings specified here take precedence on in config/application.rb. # code not reloaded between requests. config.cache_classes = true # eager load code on boot. eager loads of rails , # application in memory, allowing both threaded web servers # , relying on copy on write perform better. # rake tasks automatically ignor...

c# - Communication between windows service and ASP.NET web application via wcf -

i tried communicate between windows service , asp.net mvc web application wcf service, self hosted in windows service. [servicecontract(namespace = "myservice")] public interface imyinterface { [operationcontract] string test(string message); } class message : imyinterface { public string test(string message) { return "message service: " + message; } } public partial class myservice : servicebase { public servicehost servicehost = null; protected override void onstart(string[] args) { if (servicehost != null) servicehost.close(); servicehost = new servicehost(typeof(message)); servicehost.open(); } } my windows service contains thread, running , start, stop und control other external processes. web appliaction should able show state of processes. i'm looking way pass process data web application, i'm not sure solution problem. after start windows service wcf service...

ruby on rails - Add Methods to Iterated Objects -

i have block looks similar one: <% @github_tmp_files.files.each |file| %> <li><%= link_to @github_tmp_files.filename(file.key), @github_tmp_files.download_url(file.key) %></li> <% end %> as can see in loop call 2 methods file argument: @github_tmp_files.filename(file.key) @github_tmp_files.download_url(file.key) i prefer call 2 methods that: file.filename (should return) @github_tmp_files.filename(file.key) file.download_url (should return) @github_tmp_files.download_url(file.key) so @ end can write loop this: <% @github_tmp_files.files.each |file| %> <li><%= link_to file.filename, file.download_url %></li> <% end %> how have change files method in @github_tmp_files , allows behaviour? thanks #in @github_tmp_files -> class def files github_bucket.objects(prefix: @folder) end just out of curiosity: <% @github_tmp_files.files.map(&:key).each |file| %...

c# - How to put combobox Items in a list? -

i added items combobox using: sqldatareader sqlreader = sqlcmd.executereader(); while (sqlreader.read()) { string name = sqlreader.getstring(0); combobox1.items.add(name); } sqlreader.close(); conn.close(); now want put these value in string list. possible , how can that? simply can like string[] items = new string[combobox1.items.count]; for(int = 0; < combobox1.items.count; i++) { items[i] = combobox1.items[i].tostring(); } or if want create string list directly reader object var itemlist=new list<string>(); sqldatareader sqlreader = sqlcmd.executereader(); while (sqlreader.read()) { string name = sqlreader.getstring(0); combobox1.items.add(name); itemlist.add(name); } sqlreader.close(); conn.close(); } use of linq make job easier var arr = combobox1.items.cast<object...

authentication - Issue authenticating Web App and Web Api in Azure -

i deployed web app , web api project azure app service. added authentication web app , web api using azure active directory. when calling web api web app getting below error. have enabled cors in web api. xmlhttprequest cannot load https://login.windows.net/2xxxxxxx/oauth2/autho…fvalues%2fgetmaxdate&nonce=80daeef12xxxxxxxxxx_201xxxxxxx453. no 'access-control-allow-origin' header present on requested resource. origin 'null' therefore not allowed access. if remove azure active directory authentication web api works fine. cannot remove authentication web api entering api url browser give user json data.

php - Using isset to display page content -

i having issue using isset display content on page. my php file called messages.php i directing users links url: messages.php?inbox using if(isset($_get['inbox'])) { } display users inbox. same principle other users options such compose message is: messages.php?compose again using isset the problem have cannot stop people manually typing stuff domain.com/messages.php or domain.com/messages.php?somethingrandom. is there way direct users messages.php?inbox when type in address bar isnt assigned isset? i did try use switch couldnt seem work how ive laid out html. an example of whole file here http://pastebin.com/sfqn2l7g i new php , think may have gone down complicated route. any advice appreciated. thanks the answer added work, having array of valid options maybe check against later on. $validpages = array('inbox', 'compose'); $pagefound = false; foreach ($validpages $validpage) { if (isset($_get[$validpage])) { $...

Spring Service Discovery Restriction -

i followed page: https://spring.io/guides/gs/service-registration-and-discovery/ and far no problem. can register spring services automatically discovered. i need discover services accessible on specific domain (to distinguish between test , prod, example) this means i'll have 2 discovery services run. 1 should fetch services on mytestdomain.domain.ch , , other 1 on myproddomain.domain.ch . anyone has idea how distinction ? you should use different profiles define different eureka zone url test/prod environment. package/run app profile.

kony - can't set a property for flex container in segment widgets -

i new kony framework. going through widget. there came across segment widgets using create flex container labels , textbox. my ui design : 1. created segment , set flex container labels , text box in segment 2. after turn off flex container visible 3. , type code : function flex() { frmassign.sgmt1.flex1.isvisible = true;//to show flex visible not read property of flex } in simple terms if click segment first row flex container isvisible should true enter image description here want achieve design in kony try change frmassign.sgmt1.flex1.isvisible = true; frmassign.sgmt1.flex1.setvisibility(true);

ruby - getting latitude and longitude values from controller in rails-geocoder gem -

is possible latitude , longitude values in controller when using geocoder gem in rails? what doing getting nearby location pass location name below. event_address = event.near(location, 15, order: 'distance') so there way fetch lat , lng used above requested location using later in subsequent requests same location? @latitude= #some method @longitude= #some_method geocoder.coordinates(location) for eg : geocoder.coordinates("25 main st, cooperstown, ny") returns [42.700149, -74.922767]

java - Spring MVC: What is an HttpEntity? -

this question has answer here: what http entity? 8 answers i have read spring docs httpentity. accordingly, represents http response/request entity. arrived in conclusion same character in character stream. however, consists of header , body. please elaborate httpentity or http response/request in general. links welcome. the spring web model-view-controller (mvc) framework designed around dispatcherservlet dispatches requests handlers, configurable handler mappings, view resolution, locale, time zone , theme resolution support uploading files. default handler based on @controller , @requestmapping annotations, offering wide range of flexible handling methods. introduction of spring 3.0, @controller mechanism allows create restful web sites , applications, through @pathvariable annotation , other features. the httpentity similar @requestbody , @respons...

python - Matplotlib: Constrain plot width while allowing flexible height -

Image
what achive plots equal scale aspect ratio , , fixed width , dynamically chosen height . to make more concrete, consider following plotting example: import matplotlib mpl import matplotlib.pyplot plt def example_figure(slope): # create new figure fig = plt.figure() ax = fig.add_subplot(111) # set axes equal aspect ratio ax.set_aspect('equal') # plot line given slope, # starting origin ax.plot([x * slope x in range(5)]) # output result return fig this example code result in figures of different widths, depending on data: example_figure(1).show() example_figure(2).show() matplotlib seems fit plots height, , chooses width accomodate aspect ratio. ideal outcome me opposite -- 2 plots above have same width , second plot twice tall first. bonus — difficulty level: gridspec in long run, create grid in one of plots has fixed aspect ratio , , again align graphs exactly. # create 2x1 grid import matplotlib.gridspec...

loops - Python range with start larger than stop -

i want extract i indices of vector uniformly t times. instance, if have vector x = [1,2,3,4,5,6,7] , i = 3 , t = 5 , indices in each time must be: t = 1; [1,2,3] t = 2; [4,5,6] t = 3; [7,1,2] t = 4; [3,4,5] t = 5; [6,7,1] would possible in python range() ? you can use itertools.islice on itertools.cycle . make cycle object iterable, , slice object using window size i : from itertools import cycle itertools import islice l = [1,2,3,4,5,6,7] t = 5; = 3 c = cycle(l) r = [list(islice(c, i)) _ in range(t)] # range appears here # [[1, 2, 3], [4, 5, 6], [7, 1, 2], [3, 4, 5], [6, 7, 1]] you can apply different non-negative values of i , , when i greater length of list: i = 10 r = [list(islice(c, i)) _ in range(t)] print(r) # [[1, 2, 3, 4, 5, 6, 7, 1, 2, 3], [4, 5, 6, 7, 1, 2, 3, 4, 5, 6], [7, 1, 2, 3, 4, 5, 6, 7, 1, 2], [3, 4, 5, 6, 7, 1, 2, 3, 4, 5], [6, 7, 1, 2, 3, 4, 5, 6, 7, 1]]

javascript - dynamic name property for php -

i use code generating dynamic name attribute in html page based on index key each input tag user add plus button: var afterremove = function afterremove() { var setindex = function setindex(inputnameprefix) { $('input[name^="' + inputnameprefix + '"]').each(function (index, value) { $(this).attr('name', '' + inputnameprefix + index); }); }; ['jobtitle', 'organname', 'jobyearfrom', 'jobyearto'].foreach(function (prefix) { setindex(prefix); }); ['research', 'researchcomment'].foreach(function (prefix) { setindex(prefix); }); ['teachingsub', 'teachingpr', 'teachingplace'].foreach(function (prefix) { setindex(prefix); }); ['teachermobile', 'teachertel', 'teacheremail'].foreach(function (prefix) { setindex(prefix); }); ['fieldofstudy', ...

ionic2 - ionic serve not working after installing ionic 2 -

recently installed ionic2. after when try run/open (i.e. ionic serve) ionic 1 projects have done earlier throwing me message: "warn: ionic.project has been renamed ionic.config.json, please rename it. uh oh! looks you're missing module in gulpfile: cannot find module 'gulp' need run npm install ?" i have tried installing bower,gulp, gulp-util . nothing worked. has got issue? can me?

android - ImageView displays PNG but not JPEG -

strong texti trying load picture gallery , display in image view, png pictures being displayed fine jpg images not displaying @ , have no idea why here code: public void openga(view view){ //create ga||ery intent , set action pick object intent galleryintent = new intent(intent.action_pick); //set destination of intent when opens pictures file destination = environment.getexternalstoragepublicdirectory(environment.directory_pictures); //get path string cast uri string path = destination.getabsolutepath(); //cast path uri uri pathuri = uri.parse(path); //set hte information of intetn destination , types |ook galleryintent.setdataandtype(pathuri, "image/*"); //start activity resu|t startactivityforresult(galleryintent, request_photo_gallery); } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { super.onactivityresult(requestco...

ngrx - Angular 2 emit when Http has finished to subsequently run another function -

i have general function doing delete call api. function this: deleteitem(url, item, action) { return this.http.delete(url) .subscribe( () => this.store.dispatch({ type: action, payload: item }), error => this.errorhandler(error), () => console.debug('delete complete') ) ; i call function few places sending in different urls, items , actions. let's i've got function this: deletebookcase(bookcase) { this.apiservice.deleteitem(bookcase_url, bookcase, bookcase_remove); } sometimes, i'd trigger action once item has been deleted api. example, maybe want check whether global store of books has changed removed bookcase. is there simple way let deletebookcase functions know http call , subsequent actions have completed before prematurely triggering action? use map() instead of subscribe() in deleteitem() deleteitem(url, item, action) { return this.http.delete(url) ...

parsing - Parse POST HTTP response using Python -

i want parse post http response using python. my response looks like: { "result": 0, "responsestatus": { "errorcode": null, "message": null, "stacktrace": null, "errors": null }, "sessionid": "68ebcd6f-0aef-420d-a12b-c953f8df8ed1", "responseheader": { "succeeded": true, "errors": [] } } i want parse - "sessionid" 2nd http request. how can achieve it? ! import json response = '{"result": 0, "responsestatus": { "errorcode": null,"message": null, "stacktrace": null, "errors": null },"sessionid": "68ebcd6f-0aef-420d-a12b-c953f8df8ed1", "responseheader": { "succeeded": true, "errors": [] } }' json_response = json.loads(response) print json_response['sessionid'] i guess using urllib, recommen...

c# - EF6 Updating Relative Table Values -

when user clicks button next element on page want elements isaccepted value change. when button pressed db.savechanges() command throws exception of type entityvalidationerrors. controller namespace webapplication6.controllers { public class appcontroller : controller { [httpget] public actionresult accept(int? id) { emailformmodel itemtoupdate = db.projectinfo.find(id); itemtoupdate.isaccepted = true; //only value want change db.savechanges(); return redirecttoaction("maindbview"); } } } model public class emailformmodel { public emailformmodel() { isaccepted = false; ressurs = new list<ressursbehov>() { new ressursbehov() }; } public int id { get; set; } public bool isaccepted { get; set; } [required(errormessage = "påkrevet"), display(name = "prosjektnummer"), regularexpression(@...

Phabricator feed.http-hooks not notifying -

i trying setup slack notifications phabricator using etcinit/phabulous . however, phabricator not seem notifying server. my config looks this: { feed.http-hooks: [ "http://127.0.0.1:8085/v1/feed/receive" ] } if run curl http://127.0.0.1:8085 within server {"messages":["welcome phabulous api"],"status":"success","version":"2.4.0-beta1"} i running phabulous in debug mode, can see no request ever made 127.0.0.1:8085 since gin shows no debug message. am missing configuration in phabricator made feed.http-hooks work? turns out had restart daemon.

ios8 - iOS Rejection due to Google SignIn. Latest Google SignIn (4.0.0) goes to safari -

our app got rejected apple for design - 4.0 we noticed user taken safari sign in or register account when logging in google+, provides poor user experience. next steps please revise app enable users sign in google+ in app. can updating latest google+ sdk. we recommend implementing safari view controller api display web content within app. safari view controller allows display of url , inspection of certificate embedded browser in app customers can verify webpage url , ssl certificate confirm entering sign in credentials legitimate page. i using pod , have latest google signin library, not googleplus one. library 4.0.0 (15/05/2016), says on release notes https://developers.google.com/identity/sign-in/ios/release removes allowssigninwithbrowser , allowssigninwithwebview properties gidsignin. that means don't have way force on ios 8 have default ios 9 behavior (open safari browser within app). having installed google app ...

jquery - $()Autocomplete is not a function -

Image
below code render. google out , found there may mistake of jquery order. changed given still not work me. @model ienumerable<usermanagementsystem.models.userdetail> @using system.linq @{ viewbag.title = "index"; } <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="~/scripts/jquery-1.10.2.js"></script> <script src="~/scripts/jquery-1.10.2.min.js"></script> <script src="~/scripts/jquery-ui.js"></script> <script type="text/javascript"> $(document).ready(function () { jquery("#searchname").autocomplete({ source: function (request, response) { $.ajax({ url: "/home/index", type: "post", datatype: "json", data: { prefix: request.term }, ...

youtube - Send email to user of google hangout -

i'm wondering if there way send email participant in google hangout. we'd adjust our hangout on air app when broadcasting in finished, participants send link recording on youtube. we've been looking through hangout api: https://developers.google.com/+/hangouts/api/gapi.hangout.html#gapi.hangout.participant superfically guess can't - participants google ids, guess that's far can go? any appreciated. there 3rd party apps can used hangout on air registration info... checkout business-hangouts.com see how it. afaik, there no way info directly google using api.

java - How do I restart a Wowza application from within a module? -

i want restart wowza application, module no need go services restart wowza service. if possible please give better solution or there method so? you should able use iapplicationinstance.shutdown(isservershutdown, isappshutdown) or iapplication().shutdown(isservershutdown) in module or httpprovider. in httpprovider, need reference application instance shutdown.

c - Concatenation macro not properly expanding macro parameter -

the macro of interest (ioport_create_pin) part of library , works desired in general. converts specific pin on specific port library internal unique numeric representation. it defined as: #define ioport_create_pin(port, pin) ((ioport_ ## port) * 8 + (pin)) normal usage be ioport_create_pin(portd, 4) for example, concatenate ioport_ , portd ioport_portd. ioport_portd in example internal definition of library further expands numeric value. however, since portd (defined #define portd (*(port_t *) 0x0660) , not relevant here) part of definition #define flashport portd so using ioport_create_pin(flashport, 4) wrongly concatenates ioport_flashport instead of desired ioport_portd inside ioport_create_pin definition. i had @ this interesting answer , tried apply 1 level of indirection hoping macro expanded, wasn't able right. is there way "wrap" macro somehow make compiler evaluate flashport portd before concatenation? edit: john pointed out proble...

ggplot2 - For loop assigns variable while i want to plot something with qplot (R) -

so have following loop: for (count in 1:19){ png(paste0(colnames(fdd$rawcounts)[count], ".pdf")) qplot(y = log2(fdd$rawcounts[,count]), main = colnames(fdd$rawcounts)[count]) dev.off() } which should plot count data put head here: structure(c(11l, 3l, 12l, 8l, 15l, 2l, 5l, 2l, 8l, 7l, 6l, 10l, 6l, 1l, 7l, 4l, 2l, 1l, 3l, 0l, 4l, 4l, 2l, 5l, 8l, 0l, 13l, 4l, 10l, 7l, 2l, 1l, 2l, 4l, 7l, 7l, 14l, 4l, 25l, 17l, 14l, 16l, 4l, 2l, 5l, 5l, 5l, 2l, 9l, 5l, 11l, 8l, 1l, 4l, 10l, 8l, 8l, 7l, 9l, 5l, 9l, 15l, 14l, 11l, 16l, 8l, 11l, 4l, 3l, 6l, 3l, 0l, 6l, 3l, 4l, 6l, 1l, 4l, 11l, 11l, 12l, 6l, 2l, 6l, 7l, 9l, 22l, 8l, 13l, 7l, 6l, 1l, 4l, 5l, 6l, 2l, 4l, 2l, 6l, 7l, 3l, 2l, 6l, 3l, 3l, 2l, 5l, 5l, 9l, 2l, 6l, 5l, 4l, 2l), .dim = c(6l, 19l), .dimnames = structure(list(feature = c("chr10:100000001-100000500", "chr10:10000001-10000500", "chr10:1000001-1000500", "chr10:100000501-100001000", "chr10:100001-100500", ...