Posts

Showing posts from April, 2012

html - Inverting a div render in CSS -

Image
i have 2 divs, 1 white background, 1 black background: <style> #leftside { float:left; width:50%; height:100%; background:#fff; } #rightside { float:right; width:50%; height:100%; background:#000; } <div id="leftside"> </div> <div id="rightside"> </div> what wish write text goes on both of divs has inverted color depending on div letter's pixel over. something like i <span> , set letter's color doesn't handle situation when single letter on both divs. anything do? (if possible i'd not down css chrome 47 , firefox 43 support). you can not without ugly hacky code. make 2 elements 2 texts overlapping each other hidden on other element. better explained example. check out jsfiddle. <div class="wrapper"> <div id="left"> <span>this long sentence test.</span> </div> <div id="right"> <span>this lo

node.js - Raspberry btmon --server parameter -

i looking solution monitor ble devices near raspberry rssi value. far done monitoring, devices , current rssi value displayed on screen, store values in database or send them rabbitmq (either solution fine). i using btmon monitoring has switch " -s " or " --server ". unfortunately did not find useful documentation on (might fault). thought might start monitoring in way can query application. clue? the other solution node.js/noble , noble installation fails. well, btmon not solution device discovery needs triggered hcitool lescan not have recurrence parameter (only hcitool scan has). solution node.js/noble . installation failed, because tried latest version of noble.js. going 10.x solved problem.

c++ - Is there is a way to get the associated MN's to an access point? -

i'm using inet , want simulate scenario consist of 3 access points (ap)and 1 mobile node (mn), may each ap has other associated mns on range, want : while mn (in scenario) move around , beacons aps, before association aps can number of other mns associated each ap? explored many source codes , found macaddresstable , stalist in ieee80211mgmtap ,are useful me? , use them total number of associated mns, how can evaluate length of stalist? or macaddresstable? else must put counter count @ on ap side , emit through beacon frame? if please give me guides or shortcuts regards .... in ieee 802.11 ap does not send information number of associated stations. therefore in order broadcast information have introduce own modification/extension ieee 802.11 protocols, example new field in beacon frame. in inet model ap stores own stations in stalist map. locally calculate current number of associated station can use following code: stalist::const_iterator it; int assocsta =

Datatype mismatch converting SAS numeric to Teradata BIGINT -

i have sas dataset numeric variable acct_id (among other fields). attributes in proc contents are: # variable type len format informat label 1 acct_id num 8 19. 19. acct_id i know field doesn't have non-integer values in it, want store bigint in teradata, , i've specified dbtype data set option this: data td.output(dbtype=(acct_id="bigint", <etc etc>)); however, gives following error: error: datatype mismatch column: acct_id. there no missing or non-integer values in field, , error persists if round acct_id using round(acct_id, 1) explicitly remove floating point values could exist. strangely enough, no error given if assign decimal(18,0) in teradata rather bigint. guess 1 workaround, i'd understand how can create integer fields in teradata sas numeric variables given sas doesn't distinguish types between integer , floating point. sas not support bigi

sql server - SQL insert statement for each update row -

now made cursor update in 2 tables , insert in 1 table based on specific select statement select statement return 2 columns x , y need x update in table "px" because x primary key in table , need x update in table "fx" because x foreign key in table insert in third table x data. i need change cursor , use update , insert script tried found need make loop achieve target if 1 know if can change cursor . and in advance declare @id int declare @clientid uniqueidentifier declare @code int declare @wtime int declare @closecomplaint cursor set @closecomplaint = cursor fast_forward select complaintid, [clientid] complaint complaintstatusid = 5 , (waitingforcutomerclosedatetime < getdate() or waitingforcutomerclosedatetime = getdate()) open @closecomplaint fetch next @closecomplaint @id, @clientid while @@fetch_status = 0 begin select waitingforcutomerclosetime = @wtime systemconfiguration

Using different Server IPs in Javascript GET/POST requests? -

after searching while , didn't find hoping i'm asking myself if it's possible send get/post requests 2 different ips, if server/vps has 2 different ip addresses assigned? the requests looks this: $.ajax({ type: "get", cache: false, url: "http://url", datatype: "json", success: processdata, error: function() { somefunctio(); } }); my questions are: possible access header of request should sent , if so, need change change ip address in request? or need migrate language, such c++ or node make happen?

css - z-index, show title over image -

i'm using wordpress revolution slider on page http://meorboston.org/homepage want header 'upcoming events' show on slider. slider looks has z-index: 20 when make .program_subheader { z-index: 50;} doesn't help. the code slider is: <div class="home-slider-wrap"> <a href="#container" id="slider-continue"><i class="ss-navigatedown"></i></a> <!-- start revolution slider 4.6.0 fullwidth mode --> <div id="rev_slider_45_1_wrapper" class="rev_slider_wrapper fullwidthbanner-container" style="margin:0px auto;background-color:#e9e9e9;padding:0px;margin-top:0px;margin-bottom:0px;max-height:900px;"> <div id="rev_slider_45_1" class="rev_slider fullwidthabanner" style="display:none;max-height:900px;height:900px;"> <ul> <!-- slide --> <li data-t

javascript - Get line from file - NodeJS function -

how write function returns line file nodejs? program runs in loop, , each time call function should return new string. , if file ends begins again, first line. function takes randomly, how consistently? var fs = require('fs'); // random line file function getrandsocks() { var socks = fs.readfilesync('socks.txt').tostring().split("\n"); var randsock = socks[math.floor(math.random()*socks.length)]; return randsock.split(':'); } function loop() { // ... var socks = getrandsocks(); console.log('host: '+socks[0]+'port :'+socks[1]); //... loop(); } perhaps help. gets next line , wraps start. based on given getrandsocks function minimal change. var current_line = 0; function getnextlines() { var socks = fs.readfilesync('socks.txt').tostring().split("\n"); var randsock = socks[current_line % socks.length]; current_line = (current_line + 1) % socks.length return ran

ios - different storyboard based on phone model -

i'm working on app in swift needs run on iphone models 4s onwards want to laid out differently on 4s, want direct app load different storyboard on 4s. know can done ipad in info tab setting main storyboard file base name (ipad) cannot find way different iphone models. appreciated following answer of @has here , can know model of device. let's make swift file entitled devicemodel keep parts of extension separated. devicemodel.swift import uikit private let devicelist = [ /* ipod 5 */ "ipod5,1": "ipod touch 5", /* iphone 4 */ "iphone3,1": "iphone 4", "iphone3,2": "iphone 4", "iphone3,3": "iphone 4", /* iphone 4s */ "iphone4,1": "iphone 4s", /* iphone 5 */ "iphone5,1": "iphone 5", "iphone5,2": "

objective c - UINavigationItem is not deleting from Navigator -

Image
the uinavigationitem not deleting navigator. seems it's locked on there , viewcontroller. how remove it? you may have done embed-in navigationcontroller without noticing it. go check @ menu editor. moreover, it's better unplug associated navigation controller. right click item , see outlet find if connected. if so, remove them all. after done, should able remove item properly.

python - Consume Kafka continuously and update queue at specific intervals using multiprocessing -

i trying continuously consume events kafka. same application uses consumed data, perform analysis , update database in n-second intervals (assume n = 60 seconds). in same application, if process1 = kafka consumer , process2= data analysis , database update logic. process1 run continuously process2 executed once every n=60 seconds process2 concerned computation , database update , hence take 5-10 seconds execute. not want process1 stall during time process2 executing. hence, using multiprocessing module ( process1,process2 thread1,thread2 if using threading module in python due have read gil , threading module not being able leverage multi-core architecture, decided go multiprocessing module.) achieve concurrency in case. (if understanding of gil or threading module limitations mentioned above incorrect, apologies , please feel free correct me). the application have has simple interaction between 2 processes wherein process1 fills queue messages receives in 60 s

razor - Set value to @Html.Editor MVC -

can me here, have following: @html.editor("entities[" + @k + "].amount", entity.amount) i editor display amount in text-field. have tried following: @html.editor("entities[" + @k + "].amount", entity.amount, new { @value = "45"}) <text> m</text> and got following error: cs1928: 'system.web.mvc.htmlhelper<projectname.order>' not contain definition 'editor' , best extension method overload 'system.web.mvc.html.editorextensions.editor(system.web.mvc.htmlhelper, string, string, object)' has invalid arguments. any suggestions? thanks! i used textbox instead , worked fine =) @html.textbox("entities[" + @k + "].amount", entity.amount, new { htmlattributes = new { @class = "text-field" } })

ios - Media Picker Items's Plus Button Not Animated When Pressed -

Image
my app calls ios' native mpmediapicker during music selection playlist. code: // show media picker mpmediapickercontroller *picker = [[mpmediapickercontroller alloc] initwithmediatypes: mpmediatypemusic]; picker.delegate = self; picker.allowspickingmultipleitems = yes; [self presentviewcontroller:picker animated:yes completion:nil]; but during selection, below screen: when tap on "+" buttons of songs, button doesn't animate (like becoming grey, highlighted, etc), user has no feedback button tapped. i did not observe in ios 7.0, after upgraded ios 8, problem showed up. how can solve it? this issue seemed arise around ios 8.4 , seems still exist in ios 9.0 final. the bug has apparently been reported apple , should fixed in later release. fingers crossed. more info @ https://forums.developer.apple.com/thread/9758 edit: update - seems situation bug proving "complicated" according apple team member @ link a

javascript - scrolling with velocity.js doesn't scroll -

i can't work. i've added via cdn , code snippet smooth scrolling in app.js straight example author sure got right. clicking on link takes me nowhere. <li class="active"><a href="#footer">contact</a></li> ...html <footer class="footer" id="footer"> ...html <script src="bower_components/jquery/dist/jquery.min.js"></script> <script src="bower_components/foundation/js/foundation.min.js"></script> <script src="//cdn.jsdelivr.net/velocity/1.2.2/velocity.min.js"></script> <script src="//cdn.jsdelivr.net/velocity/1.2.2/velocity.ui.min.js"></script> //app.js $("#footer").velocity("scroll", { duration: 800, delay: 500 });

c# - option select in razor can't work for me -

this code doesn't work me: <div class="col-md-4"> @html.dropdownlistfor(m => m.etattik, new selectlist(new list<object> { new { value = 0 , text="text1" }, new { value = 1 , text = "text2" }, new { value = 2 , text = "text3"} }) ) @html.validationmessagefor(m => m.etattik) </div> it shows me { value = 0 , text=text1 } you did not specify datavaluefield , datatextfield selectlist : @html.dropdownlistfor( m => m.etattik, new selectlist( new list<object>{ new { value = 0 , text="text1" }, new { value = 1 , text = "text2" }, new { value = 2 , text = "text3"} } , "value", "text

r - How do I change the color of an infobox in shinydashboard based on the value displayed -

i trying creating simple weather display, change infobox color based on temperature. color value correct displays correctly, color parameter not recognize color. it reports error in validatecolor(color) : invalid color: . valid colors are: red, yellow, aqua, blue, light-blue, green, navy, teal, olive, lime, orange, fuchsia, purple, maroon, black. in addition: warning message: in if (color %in% validcolors) { : condition has length > 1 , first element used the code shown below critical lines preceded comment library(shiny) library(shinydashboard) library(rweather) getcolor <- function(station) { t <- as.numeric(getweatherfromnoaa(station_id = station, message = false)$temp_c) if(t > 30) {return('red')} else if (t < 5) {return('blue')} else return('yellow') } header <- dashboardheader(title = 'current weather') sidebar <- dash

javascript - Polymer element doesn't trigger the "on-<property>-changed" event when property changes -

i using google-sigin element polymer catalog . want listen changes signedin attribute outside polymer element. property set notify: true , in polymer documentation related change notifications, says that: when using polymer element other elements or frameworks, can manually attach on-property-changed listener element notified of property changes, , take necessary actions based on new value. i have tried listening on-signin-changed , on-sign-in-changed , on-property-changed , signin-changed , sign-in-changed , none of these events being triggered. the code listens event looks like: document.addeventlistener("domcontentloaded", function() { document.queryselector('google-signin').addeventlistener('on-signin-changed', function() { // never gets called }); }); i know listening google-signin-success event (which works btw , can see signedin has been changed true ), want understand why event isn't being triggered/what doi

c# - Scale all sprites on screen based on resolution -

i decided move game windowed fullscreen mode , that's first problem face. i'm looking way of resizing of sprites based on screen resolution. background in (0, 0) coordinates, need have , sprites scale kind of fixed aspect ratio ( 16:9 preferred). , resize them portion background stretched fill screen. , not more, not less. i've looked online tutorials couldn't understand concept used. can explain how that? read using rendertarget2d , passing spritebatch.begin() call, has kind of effect, there's got more code. i'm not looking supporting resolution change option, adapting sprites current resolution. it sounds you're talking resolution independence . the general idea make game using virtual resolution , scale or down fit actual resolution of screen. var scalex = (float)actualwidth / virtualwidth; var scaley = (float)actualheight / virtualheight; var matrix = matrix.createscale(scalex, scaley, 1.0f); _spritebatch.begin(transformmatrix

Select only rows if the value in a particular set of columns is 'NA' in R -

i have data frame many rows , columns in (3000x37) , want able select rows may have >= 2 columns of value "na". these columns have data of different data types. know how in case want select 1 column via: df[is.na(df$col.name), ] how make selection if want select 2 (or more) columns? first create vector nn of number of na's in each row , select rows >= 2 na's d[nn>=2,] d = data.frame(x=c(na,1,2,3), y=c(na,"a",na,"c")) nn = apply(d, 1, fun=function (x) {sum(is.na(x))}) d[nn>=2,] x y 1 na <na>

Use Contacts name in Gmail search -

i search within gmail (mail.google.com interface) emails friend albert baker. has many email addresses such , , etc., put them under gmail contacts contact name of albert baker. gmail search syntax seems provide way search not email address, name, if name 1 word [1]. have many friends called albert, , several other bakers. how do search such this: from:"albert baker" but 1 above shows nothing.

powershell - Cannot bind argument to parameter 'Path' because it is an empty array -

Image
this .csv file: i use following code read data .csv. data read table converted normal variable can calculations. $scriptpath = split-path $myinvocation.mycommand.path $transportoptions = $scriptpath + "\transportoptions.csv" $transportoptionsid = @() $transportoptions = @() $transportenergy = @() $co2 = @() import-csv $transportoptions |` foreach-object { $transportoptionsid += $_."transportoptionsid" $transportoptions += $_.transportoptions $transportenergy += $_.transportenergy $co2 += $_.co2 } $inputid = read-host -prompt "transportoptionsid" if ($transportoptionsid -contains $inputid) { $where = [array]::indexof($transportoptionsid, $inputid) $inputname = $transportoptions[$where] if ($transportoptions -contains $inputname) { $where = [array]::indexof($transportoptions, $inputname) $inputenergy = $transportenergy[$where] $htransportenergy = [double]$inputenergy if ($transpo

javascript - Send JSON Object to HTML -

in html code, have javascript. in order check whether code worked/became json object, first sent json object in blank html print out json. {"nodes": [{"id": "latin 2"}, {"id": "latin 2"}, {"id": "computer science 2"}, {"id": "calculus 2"}], "links": [{"id": 1, "target": "latin 1", "source": "latin 2"}, {"id": 2, "target": "latin 1", "source": "latin 2"}, {"id": 3, "target": "computer science 1", "source": "computer science 2"}, {"id": 4, "target": "calculus 1", "source": "calculus 2"}]} you can see did render json object, when wanted put json object in javascript, inside html, error code: {&#34;nodes&#34;: [{&#34;id&#34;: &#34;physics 5&#34;}, {&#34;id&a

java - Is there a way on getting Scanner input without having to create an instance of the class? -

let's have code: scanner scan=new scanner(system.in); char x = 'h', aux; system.out.println("insert single letter"); aux=scan.nextline().charat(0); if (x==aux)system.out.println("match"); is there way avoid scanner scannerobject = new scanner(); and work done function tool c's scanf() or fget()? confused this! you don't have use scanner input in java. scanner high level class parsing input while reading it. can read static inputsteam system.in . want wrap in bufferedreader though since want deal strings more byte arrays. e.g. bufferedreader br = new bufferedreader(new inputstreamreader(system.in)); string line = br.readline();

Explanation for index and value inputs to anonymous function in javascript -

Image
i have question on how anonymous functions work in javascript. saw beautiful piece of code toggle "disabled" html element [from post link stack overflow ]: $('#el').prop('disabled', function(i, v) { return !v; }); the inputs anonymous function , v index , value. why that? because of .prop() or somehow property of anonymous functions? there other inputs available? thanks solution: answer question in docs .prop() api.jquery.com/prop/ : it's how jquery .prop() method implemented. if sees second parameter function, calls function each matched element, passing element index , attribute value. inventing api in javascript involves making decisions situations involving callback api clients use. there no hard-and-fast rules in general, though contexts have conventions should followed when possible. example node world, it's common callbacks passed 2 arguments, (possibly null) error , data relevant operation.

javascript - AngularJS accessing $stateParams in run function -

i able access url parameters in run function , make actions based on params. however, pretty surprised see ui.router's $stateparams object empty in run function. angular.module('app', ['ui.router']) .run(['$rootscope', '$state', '$stateparams', '$location', function($rootscope, $state, $stateparams, $location) { $rootscope.$state = $state; $rootscope.location = $location; $rootscope.$stateparams = $stateparams; $rootscope.$on('$statechangestart', function(event, tostate) { if (tostate.name === 'main') { event.preventdefault(); $state.go('main.child', { param: 1 }) } }); console.log('$stateparams empty!'); console.log($stateparams); console.log($rootscope.$stateparams); }]) .config(['$stateprovider', '$urlrouterprovider', '$locationprovider', function($stateprovider, $urlrouterprovider, $locationprovid

image - PHP: ImageDestroy() with imagecopy()? -

it possible delete image-memory php-function "imagecopyresampled()" fatal error: allowed memory size of 134217728 bytes exhausted (tried allocate 12288 bytes) for example, have create images in loop: <?php while($break===false){ $img=imagecreate($x); } function imagecreate($x){ $tmp= imagecreatefromjpeg($x); imagecopyresampled($img,$tmp,0,0,0,0,100,100,100,100); //imagedestroy($img); ??this destroying before return $img return $img; } ?> how use imagedestroy() imagecopyresampled() ? dude there difference between imagedestroy() destroy tmp_image temporary folder. imagecopyresampled() create resampling image original copy of image.

xcode - Got Error 'repetition-operator operand invalid' with negative look behind regex (?<!(Log\())@"[^"]+" -

i want find hardcoded strings in project except words starts log( . using regex getting error mentioned above. keywords='(?<!(log\())@"[^"]+"' find "${srcroot}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename "($keywords).*\$ is there other alternative regex or script same result. you might filter out don't want see: xargs -0 grep -eh '@"[^"]+"' | grep -v 'log\(@"' if want stick regular expression: xargs -0 perl -ne 'print "$argv: $_" if /(?<!log\()@".+?"/'

swing - Scroll Bar not working in Java -

i writing program in java, reason scroll bar in bottom component isn't working. have no idea why. should apply vertical scroll bar bottom text area. doing wrong? import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.*; import javax.swing.timer; import java.text.*; import java.lang.*; import java.util.*; public class timergui extends jframe { private static final int frame_height = 300; private static final int frame_width = 600; private jpanel toppanel; private jpanel leftpanel; private jpanel bottompanel; private jlabel toplabel; private jlabel leftlabel; private jtextfield settimer; private jtextarea displaytimer; private jscrollpane scrollpane; private jbutton startbutton; //no-arg constructor public timergui() { createtoppanel(); createleftpanel(); createbottompanel(); setsize(frame_width, frame_height); } //creates top panel, including label , text field private void createtoppanel() {

javascript - Removing the email extension but want to keep the "@" but ignore the yahoo.com part. Not printing out the @ sign -

//need printing out xxx@ removing yahoo.com email address function emailsort(){ var emails = document.getelementbyid("emailtextarea").value.split("\n"); var users = [], l = emails.length, id; while (l--) if ((id = emails[l].match(/(\w+)\@/)) && (-1 === users.indexof(id[1]))) users.push(id[1]); } try this var v="abcd@yahoo.com"; console.log(v.split("@")[0]+'@');

javascript - How do I convert an array of integers to an array of objects? -

i convert , array in format var values = [1,2,3]; to array in format var data = [ {x: 0, value: 1}, {x: 1, value: 2}, {x: 2, value: 3} ]; you use array.prototype.map method: var data = values.map(function(el, i) { return { x: i, value: el } });

automated tests - Tirggering a get request is giving me a java.net.ConnectException: Connection Refused: connect -

i have written simple functional api test using restassured, org.json , testng. here code: what's interesting everytime run test i'm getting following error message: when copy url in browser http:/restcountries.eu/rest/v1/name/norway i'm getting results. dont think it's firewall issue package com.jaway.restassured.rest_assured; import static com.jayway.restassured.restassured.get; import org.json.jsonexception; import org.json.jsonarray; import org.testng.assert; import org.testng.*; import org.testng.annotations.test; import org.testng.annotations.*; import com.jayway.restassured.response.*; public class apptest { @test() public void getrequestfindcapital() throws jsonexception{ //make request fetch capital of norway response resp = get("http:/restcountries.eu/rest/v1/name/norway"); jsonarray jsonresponse =new jsonarray(resp.asstring()); system.out.println(resp.asstring()); string capital = json

SQL Server indexing includes questions -

i've been trouble shooting bad sql calls in works applications. i've been reading on indexes, tweaking , benchmarking things. here's of rules i've gathered (let me know if sounds right): for heavily used quires, boil down query needed , rework where statements use common columns first. make non clustered index on columns used in statement , including on remaining select columns (excluding large columns of course nvarchar(max) ). if query going return > 20% of entries table contents, it's best table scan , not use index order in index matters. have make sure structure statement index built. now 1 thing i'm having trouble finding info on if query selecting on columns not part of index using statement is? index used , leaf node hits table , looks @ associated row it? ex: table id col1 col2 col3 create index my_index on my_table (col1) select id, col1, col2, col3 my_table col1 >= 3 , col1 <= 6 is my_index used here? if so, how resolve

Does GIT merges based on datetime? -

i understand how git merge happens. master & feature a--b--c --g--h--i --d--e--f here changes made , date when changed. g(master) - aug - 8th h(master) - aug - 10th i(master) - aug - 15th d(feature) - aug - 9th e(feature) - aug - 11th f(feature) - aug - 12th so, if merge master branch feature how history appear? merge based on date change , display this? feature branch a--b--c--g--d--h--e--f the way git merge creates if will, patch of diff between current branch , branch trying merge. applies patch whole branch commit - merge "source branch" "target branch" this new commit having. if want revert --d--e--f don't revert them individually, revert big merge commit. as time stamp, yes git give merge of commits in both branches can revert yourself. so imagine this, branch 1: - b - c - - g - h - branch 2: d - e - f merging these in branch 1 give - branch 1: - b - c - d - e - f - g - h - -

android - External Storage Differences -

this potentially stupid question, , i'm not sure if goes here, i'm confused. currently have lg nexus 5 phone. app have made uses filepath: file = environment.getexternalstoragedirectory().getpath() + filename; this works great on phone. saves pdf file can access it. i go plug in tablet (samsung) , try use app, find breaks due saving pdf in file name above, producing in error log: 08-31 14:38:57.918 w/system.err﹕ java.io.filenotfoundexception: /storage/emulated/0/31/08/2015 2:38:57 pm.pdf: open failed: enoent (no such file or directory) after doing bit of googling can see it's because don't have sd card in tablet. makes sense. @ phone , can't find sd card slot anywhere? why work , save on phone, not on tablet. will have buy sd card make work? file i'm trying save pdf file generated itext. i've read apparently can't/shouldn't save internal storage either. any explinations/help appreciated. getexternalstoragedirectory() , t

javascript - div doesn't update on Calling watchLocation -

below html5 code finding updated geolocation. latitude , longitude values pops in alert box. but, value cannot assigned div using $(id).html(value); . using watchposition() function. <html> <head> <script type="text/javascript"> var watchid; var geoloc; function showlocation(position) { var latitude = position.coords.latitude; var longitude = position.coords.longitude; alert("latitude : " + latitude + " longitude: " + longitude); $("#lat").html(latitude); $("#long").html(longitude); } function errorhandler(err) { if(err.code == 1) { alert("error: access denied!"); } else if( err.code == 2) { alert("error: position unavailable!"); } } function g

javascript - How can I search through the HTML source of an outside URL and return the results to my app? -

i trying search outside url content matching "title" , return results html page in background through javascript. have been using javascript , not found resources resolve query, maybe i'm asking wrong? but search document : var title = document.getelementsbyname("title"); the hard part connecting page , searching through html source code. tia! you can't content outside url unless server allows so. but, can server side. able content of url server. server must include header in response name access-control-allow-origin contains patterns/name of domain. however, can server side anyway, unless blocked server. you need develop solution in grab content outside url server. can php, node.js, c# etc. after receiving response external server, deliver in response browser using ajax or anything. can play anyway want using javascript or jquery. important note: make sure whatever trying access in anyway, allowed so. if (your outside url) wan

Spring is not able to detect WebException in java file -

i'm trying data server given id every thing working well, want handle exceptions in code invalid id such id there no data @ server server throws me error want handle exception tried use web exception spring not detecting it error is: webexception cannot resolved type my pom file: <properties> <spring.version>4.1.0.release</spring.version> </properties> <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- spring dependencies --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>${spring.version}</version> </dependency> <dependency>

python - odoo context.get.active_id is not working -

i have create registration module in school management system in odoo 8. in module have one2many field called enrollment_ids. want activated registration_id when create new enrollment. it's not working. here code. def default_get(self, cr, uid, fields, context=none): data = super(op_enrollment, self).default_get(cr, uid, fields, context=context) registration_id = context.get('active_id', false) return true why can't active registration_id. return false. try way, write on xml code: <field name="enrollment_ids" widget="one2many_list" context="{'default_registration_id': active_id}"> <tree> ... </tree> </field>

how will i pass the path of a file name to void *buffer using c language? -

implementing processrequest , wants copy data buffer return caller the function signature following : int processrequest(hcst hcst, void *buffer, short tag, short status) path name of file stored in char src [40] ; you need : int processrequest(int hcst, void *buffer, short tag, short status) { // stub function static char test[] = "test"; strcpy(buffer, test); return 0; } ... char src [40]; ... processrequest(myhcst, src, mytag, mystatus); /* src contains "test" */ this code simple , unsafe because processrequest doesn't know size of buffer , hence may potentially overwrite past end of buffer .

ios - Limit the min value of videoZoomFactor when pinching to zoom. -

when pinch zoom using method below videozoomfactor go below 1 , app crash. how can modify method when try zoom min value zoom factor doesn't go below 1. looking natural zoom , not adding pinch scale factor 1. -(void) handlepinchtozoomrecognizer:(uipinchgesturerecognizer*)pinchrecognizer { const cgfloat pinchvelocitydividerfactor = 5.0f; nslog(@"%f", atan(pinchrecognizer.velocity / pinchvelocitydividerfactor)); if (pinchrecognizer.state == uigesturerecognizerstatechanged) { nserror *error = nil; if ([inputdevice lockforconfiguration:&error]) { inputdevice.videozoomfactor = inputdevice.videozoomfactor + atan(pinchrecognizer.velocity / pinchvelocitydividerfactor); [inputdevice unlockforconfiguration]; } else { nslog(@"error: %@", error); } } }

MYSQL - Unknown column 'a' in 'field list' -

when running query works perfectly: select 10 a; but when using column a select 10 a, (a - 1) b i following error: unknown column 'a' in 'field list' why isn't working way? you can't reuse alias in same select statement in defined. perhaps closest thing want here this: select t.a, (t.a - 1) b (select 10 dual) t;

xaml - Slider type progress-bar in Xamarin or Windows phone -

i developing xamarin form application. want create custom progress bar. slider increments it's according progress. slider value should minimum , should increment it's value according progress. when task finished slider should have maximum value. how can achieve this? there windows phone custom progress bar this? please me? var progressbar = new progressbar(); you can change progress manually: progressbar.progress = 0.2f; or bind viewmodel: progressbar.setbinding<yourviewmodel>(progressbar.progressproperty, v => v.yourprogressproperty); // then: yourviewmodel.yourprogressproperty = 0.4f; or animations: await progressbar.progressto(0.95f, 250, easing.linear); https://developer.xamarin.com/api/type/xamarin.forms.progressbar/

watchkit - Beta6 Images in Watch App/Extension -

i've got 2 images, names: raccooninapp , , duckinextension . first image resides in assets.xcassets folder in watchkit app , , second image resides in assets.xcassets folder in watchkit extension . i've built watch app before earlier in may, thought relatively simple. dragged 2 wkinterfacecontroller objects storyboard, placed wkimageview in both of them, , using attributes inspector set image property each of pictures. upon running app, nothing displayed. ideas? unlike ios app device uses @1x images if @2x / @3x not available, images in apple watch cannot take image in @1x column.

node.js - Unexpected token ILLEGAL - istanbul test _mocha -

related questions: does know module.js error talks is? just found here it looks module.js load function thinks command '.js' file. how can add extension handlers '.cmd' files? ??? after creating project using yo , generator-gulpplugin-coffee , have run issue straight away command npm test the full command listed in base package.json "test" paramater coffeelint gulpfile.coffee index.coffee test -f ./coffeelint.json && istanbul test _mocha --report lcovonly -- ./test/*.coffee --require coffee-script/register --reporter spec the coffeelint works fine when extract command , run it, istanbul test _mocha... fails unexpected token illegal error @ '@' symbol in _mocha.cmd file: $ npm test > gulp-ember-template-compiler-2@0.0.0 test c:\users\me\code\something > coffeelint gulpfile.coffee index.coffee test -f ./coffeelint.json && istanbul test _mocha --report lcovonly -- ./test/*.coffee --requi

signalr - Client side event is not calling for " Clients.Group(groupName).MessageReceived(UserName, message, groupName); " -

hub class public void sendtoall(string username,string message,string grpid,string groupname,string userid) { if (grpid == "3") { //this working clients.all.messagereceived(username, message, groupname); } if (grpid == "4") { //this not working clients.group(groupname).messagereceived(username,message,groupname); } } client side: $('#btnsendtoall').click(function () { var grpid = $(this).parent().attr('groupid'); var grpname = $(this).parent().attr('groupname1'); chat.server.sendtoall($("#hdnusername").val(), $('#txtmsg').val(), grpid, grpname, $("#hdnuserid").val()); $('#dvgroupchat', $(this).parent()).find('ul').append($('#txtmsg').val()); $('#message').val('').focus(); }); chat.client.messagerecei

reactjs - How redirect to login page when got 401 error from ajax call in React-Router? -

i using react, react-router , superagent. need authorization feature in web application. now, if token expired, need page redirect login page. i have put ajax call functionality in separated module , token send on each request's header. in 1 of component, need fetch data via ajax call, below. componentdidmount: function() { api.getone(this.props.params.id, function(err, data) { if (err) { this.seterrormessage('system error!'); } else if (this.ismounted()) { this.setstate({ user: data }); } }.bind(this)); }, if got 401 (unauthorized) error, maybe caused token expired or no enough privilege, page should redirected login page. right now, in api module, have use window.loication="#/login" don't think idea. var endcallback = function(cb, err, res) { if (err && err.status == 401) { return window.location('#/login'); } if (res) { cb(err, res.body); } else {

objective c - How to share notes data with share extension in iOS 9? -

Image
my application working fine till ios 8 in ios 9 beta not able share notes text/image can please suggest me thinks need implement this? add **nsextensionactivationdictionaryversion** attributes in plist file. see image reference.

openstreetmap - Shape File Data Map to Osm Data For Routing -

i working routing application working on .osm file . have shape file file need changes used qgis desktop application . have no idea shape file attributes map osm data attributes following tag used osm data routing way types highways routing oneway,junction,maxspeed,bridge,tunnel,surface,access relations type directions lanes,name,name_1,ref relations type

c# - Consume FileStream from WCT Restful service -

i have created wcf restful service, following code: interface: [servicecontract] public interface isigservice { [operationcontract] [webinvoke(method = "get", responseformat = webmessageformat.xml, bodystyle = webmessagebodystyle.bare, uritemplate = "getmultimedia/{id}")] stream getmultimedia(string id); } the code implements service: public stream getmultimedia(string id) { string filepath = multimediabll.getfilepath(int.parse(id)); if (string.isnullorempty(filepath)) return null; try { filestream multimediafilestream = file.openread(filepath); return multimediafilestream; } catch (exception ex) { console.writeline("not able multimedia stream:{0}", ex.message); throw ex; } } i need consume service gets filestream multimedia file (image, audio or video) far have this: restclient client = new restclient(urlservice); restrequest request = new

node.js - Complicated relationship with 2 Thorough Models -

i have complicated relationship includes 2 thorough models. want create custom method solves purpose. have mysql db datasouce. 3 main models. artist, album, songs. album , song related 2 each other n:n relationship through model " tracklist ". artist , tracklist connected through thorough model " tracklistartist ". wish list of albums , songs of particular artist through relationship. though achieved patches returns duplicate list , same time want unique record list. please help. i mentioning model relation object here instead of complete model-object. artist.json { "name": "artist", "relations": { "tracklists": { "type": "hasmany", "model": "tracklist", "foreignkey": "", "through": "tracklistartist" } } } album.json { "name" : "album", &quo