Posts

Showing posts from April, 2010

ssl - Redirect https://www to https:// -

i try redirect https://www.subdomain.website.com https://subdomain.website.com - have "your connection not private" petenetlive.com/kb/media/0000992/00001.png it's ok without www because it's managed cloudflare. know why ? server { listen 443; server_name www.irc.mywebsite.lol; return 301 https://irc.mywebsite.lol; ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; } server { server_name www.irc.mywebsite.lol; rewrite ^(.*) https://irc.mywebsite.lol$1 permanent; } server { # port listen 80; # hostname server_name irc.mywebsite.lol; # logs (acces et erreurs) access_log /var/log/nginx/irc.mywebsite.lol.access.log; error_log /var/log/nginx/irc.mywebsite.lol.error.log; location / { proxy_set_header host $host; proxy_set_header x-real-ip $

ios - AvAudioEngine tapping input node not working on iPhone 4s -

i'm using avaudioengine record audio on ios devices. i'm using following code start tapping input node self.forcedmonoaudioformat = [[avaudioformat alloc] initwithcommonformat:avaudiopcmformatint16 samplerate:44100 channels:1 interleaved:no]; [self.mmicrophonenode installtaponbus:0 buffersize:1024 format:self.forcedmonoaudioformat block:^(avaudiopcmbuffer *buffer, avaudiotime *when) { if(isrecording) { . . , } }]; this code works fine on devices except on iphone 4s. on iphone 4s block not called.. another interesting thing installtap line called twice: once on main thread on messengerqueue - @ point microphonenode nil although there 1 place in code beling called. this not happen on other type of device. if has insight on behaviour more appreciate it! thanks!

r - Why "object not interpretable as a factor" error coming in correct code? -

i running code in r , got stuck @ point showing me error "object not interpretable factor" again , again .i searched , @ stack overflow found similar problem asked else ,though in case typo using capital "c" instead of small "c" .but in case using correct still got error .why ?? here code in got error : roulette_vector <- c("losses" = 24, "losses" = 50, "winnings" = 100, "losses" = 350, "winnings" = 10) i not error. however, can try create vector , assign names , check if still error. roulette_vector <- c(24, 50, 100, 350, 10) names(roulette_vector) <- c("losses", "losses", "winnings", "losses", "winnings")

jquery - How to deal with lots of AJAX requests? -

i have twitter web app allows people follow/unfollow users clicking buttons. app shows 8 users on screen, , each button sends ajax request (using jquery) script on server stuff , follows/unfollows user chosen. after this, server sends response user. in way, showing 8 users people blocking server. example, if clicks buttons fast (15 request/second) server takes several seconds return each response. i need speed process because when server gets blocked, people have wait seconds follow/unfollow more users. how can it? need use framework?

c# - Draw directly to PictureBox -

im developing screen-sharing app runs loop , receives small frames socket. next step draw them picturebox. of course use thread because dont want freeze ui. this code: bitmap frame = bytearraytoimage(buff) bitmap;//a praticular bitmap im getting socket. bitmap current = (bitmap)picturebox1.image; var graphics = graphics.fromimage(current); graphics.drawimage(frame, left, top);//left , top 2 int variables of course. picturebox1.image = current; but im getting error: object in use elsewhere. in line var graphics = graphics.fromimage(current); tried clone it, create new bitmap(current) .. still no sucess.. invalidate() picturebox redraws itself: bitmap frame = bytearraytoimage(buff) bitmap; using (var graphics = graphics.fromimage(picturebox1.image)) { graphics.drawimage(frame, left, top); } picturebox1.invalidate(); if need thread safe, then: picturebox1.invoke((methodinvoker)delegate { bitmap frame = bytearraytoimage(buff) bi

Getting correct coordinates after pinch zoom (drawing line) Android Canvas -

Image
i trying draw line following users finger(touch). quite easy task implement if there no scaling. drawing without scaling works here screenshot works well. can see. but if scale canvas begins draw points margin/measurement error/tolerance. seems have not taken value in advance while calculating scaled touch points, have tried lot of different formulas, nothing helped. here result of zooming canvas. it seems problem in delta value have take consideration because if use version of scale function works scales left top corner. canvas.scale(mscalefactor, mscalefactor); with scaling canvas.scale(mscalefactor, mscalefactor, scalepointx, scalepointy); multitouch zoom (pinch) works coordinates not correct. please solve problem, seems have take these scalepointx, scalepointy variables when calculating scaled x , y. here code. highly appreciated. private void initworkspace(context context) { mpaint = new paint(); mscaledetector = ne

c# - ListView Item not moving -

i'm trying move selected listview item / down via buttons. item deleted , inserted @ same index. want add @ index+1 (down) or index -1 (up) i've got 4 items , tried move down item 2 (at index 1) here's example of down_click procedure private void down_click(object sender, eventargs e) { listviewitem selected = listview1.selecteditems[0]; int sel_index = listview1.selecteditems[0].index; int newindex = sel_index + 1; listview1.items.removeat(sel_index); listview1.items.insert(newindex, selected); } you should change view mode of listview list : listview1.view = view.list; i hope help.

ruby on rails - How does new method know the errors in the create method? -

a sample code taken http://guides.rubyonrails.org/getting_started.html controller def new @article = article.new end def create @article = article.new(article_params) if @article.save redirect_to @article else render 'new' end end private def article_params params.require(:article).permit(:title, :text) end new.html.erb <%= form_for :article, url: articles_path |f| %> <% if @article.errors.any? %> <div id="error_explanation"> <h2> <%= pluralize(@article.errors.count, "error") %> prohibited article being saved: </h2> <ul> <% @article.errors.full_messages.each |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <p> <%= f.label :title %><br> <%= f.text_field :title %> </p> <p> <%= f.labe

javascript - filtering drop down menu using value -

is possible in javascript filter drop down menu based on field menu using value attribute? i mean, have following code, built django-framework : <p><label for="id_country">country :</label> <select id="id_region" name="region"> <option value="" selected="selected">---------</option> <option value="1">usa</option> <option value="2">france</option> </select></p> <p><label for="id_region">region :</label> <select id="id_city" name="city"> <option value="" selected="selected">---------</option> <option value="1">california</option> <option value="2">new-york</option> <option value="3">oregon</option> <option value="4">tenessee</option> <option value="5">pa

c++ - How to pass an object's address on the heap from a function using a pointer -

i'm trying create object on heap, pass it's address calling function, can't work! if function called main, why can't store address of object in new pointer? feline newfeline(int height, int weight) { feline *myfeline = new feline(height, weight); return *myfeline; } int main() { feline *f2; *f2 = newfeline(10, 100); //cout << f2->getheight() << endl; return 0; } when run bus error: 10. oh , cats. there multiple problems code. first of all, newfeline function return temporary feline. , method has memory leak (the allocated feline not deallocated). normally, temporary disappear after statement called newfeline function. second, filling in memory contents f2 pointing to. f2 not initialized, pointing random memory address. copying temporary feline memory address crash application. to solve it, need change newfeline returns address of allocated feline, not copy of it, this: feline *newfeline(int height, int weight) {

c# - WP8.1 TextBox in PanoramaItem -

Image
this general question , looking workaround. there way create textbox item inside panoramaitem? panoramaitem: <phone:panoramaitem x:name="panorama2" header="ringtones"> <!--double line list image placeholder , text wrapping using floating header scrolls content--> <phone:longlistselector margin="0,-38,0,100" itemssource="{binding items2}" tap="longlistselector_tap"> <phone:longlistselector.listheadertemplate> <datatemplate> <grid margin="12,0,0,38"> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="*"/> </grid.rowdefinitions> </grid>

collision in android not detected -

i developing android game in bird should able dodge objects approaching using accelerometer sensor. this code should detect collision, isn't. can tell problem is? do{ random(); //for generating random no.k//moving objects using animations. translateanimation animation_plane = new translateanimation(0.0f, 0.0f, 0.0f, 800.0f); animation_plane.setduration(4500); animation_plane.setrepeatcount(i); translateanimation animation_superman = new translateanimation(0.0f, 0.0f, 0.0f, 800.0f); animation_superman.setduration(3000); animation_superman.setrepeatcount(i); translateanimation animation_space = new translateanimation(0.0f, 0.0f, 0.0f, 800.0f); animation_space.setduration(2500); animation_space.setrepeatcount(i); if (answer % 2 == 0) //answer random int being generated plane.startan

How do I write a bash script to copy files into a new folder based on name? -

i have folder filled ~300 files. named in form username@mail.com.pdf. need 40 of them, , have list of usernames (saved in file called names.txt). each username 1 line in file. need 40 of these files, , copy on files need new folder has ones need. where file names.txt has first line username only: (eg, eternalmothra), pdf file want copy on named eternalmothra@mail.com.pdf. while read p; ls | grep $p > file_names.txt done <names.txt this seems should read list, , each line turns username username@mail.com.pdf. unfortunately, seems last 1 saved file_names.txt. the second part of copy files over: while read p; mv $p foldername done <file_names.txt (i haven't tried second part yet because first part isn't working). i'm doing cygwin, way. 1) wrong first script won't copy over? 2) if work, second script correctly copy them over? (actually, think it's preferable if copied, not moved over). edit: add figured out how read lines txt f

python use bound method of a class created by string variable -

i have possible stupid question regarding python forgive me in advance. have following class in file check.py in folder checks: class check(object): def __init__(self): print "i initialized" def get_name(): return "my name check" and class loaded through variable string following function: def get_class( kls ): parts = kls.split('.') module = ".".join(parts[:-1]) m = __import__( module ) comp in parts[1:]: m = getattr(m, comp) return m i have reasons create class defined string variable don't try circumvent this. now when run following: from checks import * # __init__.py correct of 1 s="check" cl=get_class("checks."+s+"."+s.title()) a=cl() print str(a) print "name="+str(a.get_name) i following output: i initialized <checks.check.check object @ 0x0000000002db8940> name=<bound method check.get_name of <checks.check.check object @ 0x0

nat traversal - Is ICE Necessary for Client-Server WebRTC Applications? -

i have webrtc mcu ( kurento ) running on public ip address serving clients send or receive audio every clients directly connected mcu (not each other ) has public ip address . q1: there still necessity use stun , turn nat traversal ?? if why ?? q2: there hack in webrtc in browser remove need stun , turn ? in opinion : of client-server architectures not have difficulty clients behind nat .what's difference here webrtc? yes ice absolutely must webrtc. q1: there still necessity use stun , turn nat traversal ?? if why ?? for scenario don't need use stun or turn. let me explain why. every client in private network under kind of nat has public ip address. outside world doesn't know client's private ip address , if knew can't connect client without knowing public ip address. stun server used gather public ip address. so if server wants initiates connection needs client send nat's public ip. client use stun server know public ip , s

java - Kafka Log4j appender not sending messages -

i quite new ot apache kafka , log4j. trying send log messages kafka. here log4j properties file log4j.rootlogger=info, stdout log4j.appender.stdout=org.apache.log4j.consoleappender log4j.appender.stdout.layout=org.apache.log4j.patternlayout log4j.appender.stdout.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-5p %c{1}:%l %% %m%n log4j.appender.kafka=kafka.producer.kafkalog4jappender log4j.appender.kafka.brokerlist=localhost:9092 log4j.appender.kafka.topic=kfklogs log4j.appender.kafka.serializerclass=kafka.producer.defaultstringencoder log4j.appender.kafka.layout=org.apache.log4j.patternlayout log4j.appender.kafka.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss} %-5p %c{1}:%l %% - %m%n log4j.logger.loggen=debug, kafka however, not able receive messages in consumer. have tested consumer other producer code , works fine. also, warning log4j:warn no such property [serializerclass] in kafka.producer.kafkalog4jappender. edit and here code generates log messages

windows - How to remove comments from text file -

my text file contains 1 line comments being "// ". 2 forward slashes , space. these may either take whole line or last part of line. each comment not extend beyond line it's on. no /* */ type comments crossing multiple lines. in simple terms, comments start "//space" anywhere on line. starting "//space" should removed , trailing spaces on line should removed. leading spaces should stay. blank lines should removed. sample file: // comment x = 1 // comment after double slash x = 2 x = 3 // above blank line // comment on record nothing precedes it, should deleted. y = 4 // line leading spaces should kept. z = "//path"; // first double slashes not comment since space missing after "//" // last comment line. result file (no trailing spaces, keep leading spaces.: x = 1 x = 2 x = 3 y = 4 z = "//path"; i can remove blank lines using gc file.txt | where-object { $_ -ne ''} > resul

html - Jquery IF hover (execute) ELSE fadein/out -

i'm trying add if statement script. script supposed fade out when there no mouse movement & fade in when there is. i'm trying make stays faded in regardless of mouse movement if hover on div running script. http://jsfiddle.net/2kyaj/1098/ $(function () { var timer; var fadeinbuffer = false; $(document).mousemove(function () { if (('.fade-object').mouseover) { $('.fade-object').fadein(); } else { if (!fadeinbuffer) { if (timer) { console.log("cleartimer"); cleartimeout(timer); timer = 0; } console.log("fadein"); $('.fade-object').fadein(); $('html').css({ cursor: '' }); } else { fadeinbuffer = false; } timer = settimeout(function () { console.log("fadeout");

kubernetes - Strategies for using rolling updates on multi-container replication controllers? -

is there way rolling-update replication controller has 2 or more containers? for example, have jenkins setup automatically rolling update on rep controller in our dev environment once successful build takes place using --image flag specifying new container's image stored in gcr. method doesn't work when there 2 containers in same pod , there no "-c" flag specify container wish update on rolling-update command there on other commands such "exec" or "logs". the reason i'm looking have multiple pods implement logging sidecar in: https://github.com/kubernetes/contrib/tree/master/logging/fluentd-sidecar-es the alternative can think of bake fluentd config each container, feels decidedly 'un-kubernetes' me. you right in saying kubectl rolling-update frontend --image=image:v2 not give way provide more details container when updating pod has more 1 container. gives error image update not supported multi-container pods

vb.net - List(of String()) contains String() -

i trying find out if array of strings exists in list of arrays of strings, running confusion. here code: dim listresults list(of string) dim liststringarrays list(of string()) dim string() = {"foo", "bar", "stuff"} dim otherthing string() = {"foo", "bar", "stuff"} liststringarrays.add(something) if liststringarrays.contains(otherthing) listresults.add("true") else listresults.add("false") end if if liststringarrays(0).equals(otherthing) listresults.add("true") else listresults.add("false") end if listresults contain 2 "false". strangely: something(0) = otherthing(0) something(1) = otherthing(1) something(2) = otherthing(2) these evaluate true. how can find out if liststringarrays contains otherthing if contains not work? bonus question: why contains not work in instance? two arrays same contents still not same array. something = otherthing false. that

java - Issue with Deserialization -

i have method in program reads file, , have associated both fileinputstream variable , objectinputstream variable. however, not know how many objects serialized in file when run program, not know how many objects deserialize using method readobject(). method project: public void importresults(file file) throws filenotfoundexception, ioexception, classnotfoundexception { testentry entry = null; try(fileinputstream fis = new fileinputstream(file)) { objectinputstream ois = new objectinputstream(fis); tests.clear(); entry = (testentry)ois.readobject(); tests.add(entry); ois.close(); } } the variable entry store testentry objects deserialize file. problem is, if try deserialize many objects, eofexception. how program figure out how many objects there serialized in file can deserialized right amount? appreciated! thank you. just read in loop until eofexception, thrown when there no more objects read.

php - wpdb->prepare() returns NULL -

i can't figure out why returning "null". i've hardcoded date/time string in $scheduleddates variable. in practice that's user input. works fine when don't prepare query. $scheduleddate = "2015-09-01 00:00:00"; $querystring = "select * schedules event_start > %s , event_start < %s + interval 1 day"; $scheduled_blocks = $wpdb->get_results( $wpdb->prepare( $querystring, $scheduleddate ) ); the code below works fine, whether hard code date/time or not... $scheduleddate = $_post['scheduleddate']; $scheduled_blocks = $wpdb->get_results('select * schedules event_start > "' . $scheduleddate . '" , event_start < "' . $scheduleddate . '" + interval 1 day'); use $wpdb->print_error() see errors get. of code though, think number of placeholders have same amount of values you're supplying prepare method. alter call this: $wpdb->prepare($querystrin

python - How to split string of multiple lists into individual lists? -

after trying reply below seems lists not string bunch of lists separated "\n" because when try replace quotes triple quotes attributeerror: 'list' object has no attribute 'replace'. change question, how individual lists following apparently not string? x = [u'tonight'] [u'partly', u'cloudy.', u'clearing', u'this', u'evening.', u'wind', u'west', u'20', u'km/h', u'gusting', u'to', u'40', u'becoming', u'light', u'this', u'evening.', u'low', u'9.'] [u'31', u'aug'] [u'increasing', u'cloudiness', u'near', u'noon.', u'wind', u'becoming', u'southwest', u'30', u'km/h', u'early', u'in', u'the', u'afternoon.', u'high', u'19.', u'uv', u'index', u'4

javascript - Jquery $('input[name=""]').change(function WILL NOT FIRE in Chrome unless there is an uncaught error after it -

so, here's script i've written make inputs dependent on affirmative answer input. in case, 'parent' input radio button. you can see hides parent divs of inputs when document ready, , waits pertinent option changed before firing logic. if you'll @ comment near bottom of javascript, you'll see what's been stumping me. if remove if statement, change function not fire. if set variable there not error logged in console, change event not fire. if change jquery selector $('select').change... event fires, won't work on radio button. changing $('input').change... fails. <script type="text/javascript"><!-- $(function(ready){ $('#input-option247').parent().hide(); $('#input-option248').parent().hide(); $('#input-option249').parent().hide(); $('#input-option250').parent().hide();

android - Sending Coordinates to Google App engine -

i working on android side project have set website on google cloud platform, using google app engine , setup database on google datastore. my website consists of map can create fences , send coordinates of fences app. have maps activity on android app , trying figure out how send gps location / coordinates of mobile server every few mins. so can able see location of mobile on website map. how track user. can please let me know if there way this? thanks. you have 2 options here independent of underlying architecture using currently: polling sending broadcast in first strategy server (google app engine) shall poll mobile devices @ specific time interval. can find code online in choice of language. fetch location of mobile devices can store in datastore , display on map of website. in second strategy can put sendbroadcast() code/method in android code. enable device send location server , can store them in datastore , display them on map. hope helps!!

javascript - firebase how to query on firebase-util -

i want filter data firebase, im using firebase-util scroll scrolling, i have following code var baseref = new firebase(urltofirebasedata).orderbychild("name").equalto("john_doe"); var scrollref = new firebase.util.scroll(baseref, '$priority'); // establish event listener firebase ref scrollref.on('child_added', function(record) { console.log('added child', record); }); this gives me error error: first argument firebase.util.scroll must valid firebase ref. cannot query (e.g. have called orderbychild()).require.18.r.scroll how can query using firebase-util, have tried putting query in different places no avail the error message pretty explicit: first argument firebase.util.scroll must valid firebase ref. cannot query the reason firebase.util.scroll needs build own query able implement scrolling on location , firebase handles 1 query per location. if want use firebase.util.scroll scrolling, you'll have

grid - How to estimate the computational time of a program -

i doing project need estimate computational time of running program given input specific configuration of mobile device. more precisely, suppose have program out of m instructions n instructions can executed in parallel. suppose computer has following configurations: processor: 2.5ghz core 5 ram: 4gb 1600 mhz ddr3 cache: 2mb based on above configuration or additional information (if required) there equation whereby can tell how time might require run program? second question: suppose know executing program in above mentioned configuration need t seconds. based on can estimate how time might take device has different configuration 2 ghz core i5 3gb ddr3 ram , 1 mb cache? thanks such question pretty impossible answer. there far more variables number of instructions (running serially or in parallel). instance, virtual memory in play? if so, never know when program going have 1 of pages ejected. , when program need page again. worst case scenario pages start thrashin

string - Flexible replace substring - Scheme -

is there, in scheme, way replace substring of string string, length of vary? looking similar this: (replace-all string pattern replacement) (replace-all "slig slog slag" "g" "ggish") => "sliggish sloggish slaggish" sure, take @ documentation of scheme interpreter find suitable procedure. instance, in racket have string-replace works this: (string-replace "slig slog slag" "g" "ggish") => "sliggish sloggish slaggish"

html - Why is a float necessary? -

simple 1 here. i'm aware when creating fluid layouts need float elements, why? tried removing float , space appears in-between elements. space coming from? why float necessary? *{ box-sizing: border-box; } .box{ display: inline-block; width: 50%; border: solid 1px red; /*float: left;*/ } http://codepen.io/anon/pen/wqnvbz because inline-block means "treat element inline on outside , block on inside", browser treats newline between div elements actual literal space character, shows in between elements. by using floats, change behavior of inline flow, , divs go flush against each other. here article on how "fight" space between inline-block divs, if space counter design. tl;dr version can (1) remove spaces/newlines between closing , subsequent opening tags, (2) use negative margins, (3) set font size 0 (so space doesn't show up), (4) float them instead, suggested, or (5) use flexbox.

php - CodeIgniter controller functions not triggered -

in codeigniter, url someurl.com/test/ not execute inside controller class. please take , tell me if there's can think of might prevent execution of ci_controller here or should look. for example following some.testurl.com/test/hi/bob some.testurl.com/test some.testurl.com/test/hi all show: above class below class edit: believe issue how i'm trying run 2 separate applications. 1 @ testurl.com , other some.testurl.com directory some.testurl.com subfolder of directory testurl.com held. what's right way both work? update: moving subdomain outside other codeigniter application's directory hasn't changed behavior in way. codeigniter controller not anything. here's code: <?php if (!defined('basepath')) exit('no direct script access allowed'); echo "above class<br>"; class test extends ci_controller { public function __construct() { parent::__construct(); $this->load->mo

Inspect With JarSpy not working in Intellij IDEA -

i new intellij idea. have installed jarspy plugin on intellij idea plugin repository. however, when trying view content of jar (ex. gradle-wrapper.jar) right clicking on , selecting "inspect jarspy", nothing has happened. else should view jar content ? lot. jarspy hasn't been updated on decade, possible not compatible intellij 14. since goal browse through classes in jar, can straight intellij if have added jar project . can click in project structure , expand package.

.htaccess - 500 server error when denying access to subdirectory -

i trying deny direct access subdirectory using .htaccess: # deny direct access <directory "/cron"> deny </directory> the above code in .htaccess file of public_html directory. subdirectory trying block located @ public_html/cron. when enter address within /cron folder directly in browser, 500 server error instead of 403. idea why? you can't use <directory> in .htaccess files. http://httpd.apache.org/docs/2.2/en/mod/core.html#directory context: server config, virtual host use in /cron/.htaccess file: deny

c - Why this sin cos look up table inaccurate when radian is large? -

i want create sin cos table optimization, using array index 0 uchar_max , 0 radian index 0, pi/2 radian uchar_max/4 : sincos.h #include <limits.h> #include <math.h> int sini[uchar_max]; int cosi[uchar_max]; #define magnification 256 #define sin(i) sini[i]/magnification #define cos(i) cosi[i]/magnification void inittable(){ for(int i=0;i<uchar_max;i++){ sini[i]=sinf(i*2*m_pi/uchar_max)*magnification; cosi[i]=cosf(i*2*m_pi/uchar_max)*magnification; } } the reason of using uchar_max max want make use of unsigned char overflow simulates radian thats varies 0 2*pi : example, if value of radian 2*pi , index of array becomes uchar_max , because overflows, automatically becomes 0 , no mod required (if use 0 360 domain may need calculate index%360 every time). test radian values: float rad[]={2.0f,4.0f,6.0f,8.0f,10.0f,-2.0f,-4.0f,-6.0f,-8.0f,-10.0f}; like following: #include "sincos.h" #include <stdio.h> int main(){

Problems with Symfony embedded forms -

i trying achieve following scenario: auction , category entities (many-to-one). category entity has one-to-many relationship categoryattribute entity allows unlimited number of attributes of various types added category. let's cars category have make , year attributes. categoryattribute entity has widgettype property defines how render attribute (input, select etc.), attributevalues data attribute (populating select etc.) , isrequired property tell whether property required or not. far good. managing attributes piece of cake but: on auction side of things want when user selects given category list render attributes category filled in. translated related auctionattribute entity (many-to-one auction in attributes property in class). auctionattribute has reference categoryattribute, attributevalue hold input or selected value. well, whole ajax request , fill in of attributes selected category not problem. problem(s) arise when submit form. there 2 issues. how bind attribu

asp.net web api - WebApi returns 417 exception on android HttpUrlConnection(post) -

im trying send , recieve data web server post method in android . this url call method : inputstream input = null; outputstream output = null; dataoutputstream printout; httpurlconnection connection = null; try { url url = new url(surl[0]); connection = (httpurlconnection) url.openconnection(); connection.setreadtimeout(180000); connection.setconnecttimeout(180000); connection.setdoinput(true); connection.setdooutput(true); connection.setrequestproperty("content-type", "application/json"); connection.setrequestproperty("accept", "application/json"); connection.setrequestmethod("post"); connection.connect(); jsonobject jsonparam = new jsonobject(); jsonparam.put("imei",imei); packagemanager manager = this.context

Spring cloud Eureka server is NOT replicating each other, displaying warning -

i using 2 eureka server in spring cloud replicate each other, when open page @ http://localhost:8761 , saw message: renewals lesser threshold. self preservation mode turned off.this may not protect instance expiry in case of network/other problems. the eureka application.xml this: server: port: ${server.instance.port:5678} spring: application: name: nodeservice sidecar: port: ${nodeserver.instance.port:3000} health-uri: http://localhost:${nodeserver.instance.port:3000}/health.json eureka: instance: hostname: ${nodeserver.instance.name:localhost} preferipaddress: ${preferipaddress:false} leaserenewalintervalinseconds: 5 #default 30, recommended keep default metadatamap: instanceid: ${spring.application.name}:${spring.application.instance_id:${random.value}} client: serviceurl: defaultzone: http://localhost:8761/eureka/,http://localhost:8762/eureka/ so if go http://localhost:8761 , see services registered, if go http://localho

c# - Filter list of objects based on condition -

public class car { public string name {get;set;} public string color {get;set;} } car1 = new {"ford", "white"} car2 = new {"ford fiesta", "blue"} car3 = new {"honda city", "yellow"} car4 = new {"honda", "white"} var carobj = new list<car>(); carobj.add(car1); carobj.add(car2); carobj.add(car3); carobj.add(car4); i need filter output based on car names, if name subset of names present, remove them. output: car2 = new {"ford fiesta", "blue"} car3 = new {"honda city", "yellow"} here writing this, not giving me desired output. // remove duplicare records. var carobjnew = new list<car>(); carobjnew = carobj; carobj.removeall(a => carobjnew.any(b => a.name.contains(b.name))); any on how fix this. as pointed out in comment have simple mistake. need remove item if list has item contains first item substring: carobj.rem

ios - UIContainerView with intrinsic size placeholder values for AutoLayout doesn't receive events? -

this xcode 7.0 beta 6 (7a192o). seems specifying intrinsic size placeholder values uicontainerview causes not receive events. create standard single view application. in view, insert uicontainerview (center auto layout) embed simple button uicontainerview. run simulator , observe if click on button can see responds (dims) stop the simulator , add intrinsic size placeholders uicontainerview. run simulator , observe if click on button no longer see responds (dims). stop simulator , either remove intrinsic size placeholders or set them none. run simulator , observe if click on button can see responds again. no warnings/errors appear in log. i've uploaded video of behavior here . doing wrong or bug? i'm rather new auto-layouts want check if doing wrongly before filing bug apple.

java - Exectuing JDBC bulk operation -

Image
i have bulk jdbc operation exectuing concurretly ( postgresql 9.4 jdbc driver ). operation run 20-30 seconds. need understand happens thread operation being executed in. thought slept or being await until db-server start sending data jvm. so, tried check in debugger , i'm not sure that. here's example wrote test (i used spring simplicity): public static void main(string[] args) { applicationcontext context = new classpathxmlapplicationcontext("classpath:/applicationcontext.xml"); final dao dao = (dao) context.getbean("dao"); thread t = new thread(new runnable() { public void run() { thread.currentthread().setname("bulk operation"); dao.executebulk(); //1, bulk operation } }); t.start(); } i set breakpoin @ //1 , after resuming saw following in debugger: so seems bulk thread neither asleep nor awaiting . what thread while sql-serve

Bootstrap img-circle for embedded Google map in Safari not working -

Image
currently using bootstrap build wordpress theme. now, i've embedded google map via jquery loads within specified div: <div id="map" class="img-responsive img-circle"></div> i've applied img-responsive , img-circle said div map appears circle , responsive when scaled down across devices. map beautiful , works fine , dandy in chrome , firefox not in safari (8.0.8). it looks this: this code verified on safari,chrome,mozila etc. <!doctype html> <html> <head> <meta charset="utf-8"> <title>untitled document</title> <style type="text/css"> iframe{ -moz-border-radius:250px; -webkit-border-radius:250px; -o-border-radius:250px; -ms-border-radius:250px; border-radius:250px; } </style> </head> <body> <div class="map-image"> <iframe src="https://www.google.com/maps/embed?p

Better site compare to remaining for java -

how go same statement in java.(if exception arise want execute :: system.out.println("enter initial balance"); statement. try{ system.out.println("enter initial balance"); bal=scan.nextdouble(); } catch(exception e){ system.out.println("enter numbers" ); } one possible solution put in while loop , use boolean check exception: boolean exception; { exception = false; try { system.out.println("enter initial balance"); bal = scan.nextdouble(); } catch (exception e) { exception = true; scan.next(); //discard input } } while (exception);

android - How to get user data after Login with LinkedIn -

i have implemented login linkedin , getting access token after successful login session.getaccesstoken().tostring() . need complete user profile , connection list in account. unable retrieve information linkedin. i calling rest client api call stated in official document this https://api.linkedin.com/v1/people/~ in passing access token oauth2_access_token got after login. in response getting <?xml version="1.0" encoding="utf-8" standalone="yes"?> <error> <status>401</status> <timestamp>1440998578838</timestamp> <request-id>p6gdchj13p</request-id> <error-code>0</error-code> <message>unable verify access token</message> </error> i have tried various solutions stated here: linkedin oauth2: "unable verify access token" https://github.com/lepture/flask-oauthlib/issues/35 how retrieve possible information linkedin account ? (api usin

php - MySQL Query debugging -

i have query creating table user , it's not executing in phpmyadmin of xampp. here query, create table user (#user_id bigint unsigned primary key not null auto_increment, email text not null, phone text primary key not null, gcm_id bigint unsigned, name text, age_group text, landmark text, appartment text, country text, adults int, kids int, workstation text, lati decimal(9,6), longi decimal(9,6), pincode text, brand_id bigint unsigned, branch_id bigint unsigned, app_money decimal(7,2), member boolean, checked_in boolean, index user_table_index1(email(50), phone(20)) ); it's showing #1170 - blob/text column 'phone' used in key specification without key length. since text datatype ,why key length needed? what key length here means? text datatype cannot used primary key need use varchar leng

windows runtime - Text sharing not working as expected -

protected void ondatarequested(datatransfermanager sender, datarequestedeventargs e) { e.request.data.properties.title = "title"; e.request.data.properties.description = "description"; e.request.data.settext("description"); } i sharing app link link this. what expect do: when sharing text message app message: description when sharing email app subject: title message: description what doing: when sharing text message app message: title description when sharing email app subject: title message: description i want share description when user share using message. appending title also.

html - Better way to do this in CSS? -

i'm looking improve css , wondered if take quick on have far , explain improve. demo: http://jsfiddle.net/42txfuru/ .author div { width: 35%; float: left } .author div.img { width: 30% } .date { text-align: right } <div class="author"> <div class="img"> <img src="http://placehold.it/70x70" /> </div> <div> <p><span class="vcard">barry rooney</span> </p> </div> <div> <p class="date"><span>today's date</span> </p> </div> </div> it's not practice omit ; @ end of last css definition in selector block. also, i'd recommend sort css definitions alphabetically. then, keep html short necessary. see suggestions below. don't omit mandatory attributes on elements (in case alt on img ). .author { font-size: 0; /* fixes u

javascript - Google Conversion tracking success callback -

i calling google conversion tracking code on success of ajax call. have change window location on success of ajax , track conversion @ same time. is there way receive callback of conversion tracking success, can change window location on tracking success? my code looks : tracking works when : var oreq = getxmlhttprequest(); if (oreq != null) { oreq.open("post", "http://www.example.com/index.php?r=user/create-mobile-user", true); oreq.onreadystatechange = function handler() { if (oreq.readystate == 4) { if (oreq.status == 200) { window.google_trackconversion ({ google_conversion_id: 946425313, google_conversion_language: "en", google_conversion_format: "3", google_conversion_color: "ffffff", google_conversion_label: "7p62cprgtl4q4zulwwm", google_remarketi

scala - Running only a specific Spec from SBT that has constructor parameters -

i have specs2 specification test database related things against multiple databases. therefore gets database configuration test against via constructor parameters. instantiated , used bigger spec tests against databases. now want test against lets mssql in sbt if use test-only f.q.d.n.myspec(databaseconfig.mssql) no tests run because not match tests. if leave parameter off tries instantiate class , rightfully fails because cant instantiate without parameters. is there way run specific specification specific set of constructor parameters sbt without changing bigger spec calls it? when use test:only need pass expression matching class name (using * if needed). specs2 try instantiate constructor parameters if have constructor 0 arguments. not case if pass object. can try have class 0 argument constructor instead?

jquery - Dynamically Set data-filter-reveal Attribute in Filtering Table in JqueryMobile -

i adding data-filter-reveal attribute dynamically using javascript based on logic. can please me how refresh table / enhance widget when dynamically attribute set / changed. i have tried below no luck. $('.tableselector').table('refresh'); $('.tableselector').trigger('create'); please refer snippet in jsfiddle you can use filterable widget options: http://api.jquerymobile.com/filterable/#option-filterreveal $('#togglerevealtrue').click(function () { $( "#movie-table" ).filterable( "option", "filterreveal", true ); }); $('#togglerevealfalse').click(function () { $( "#movie-table" ).filterable( "option", "filterreveal", false ); }); updated fiddle

Is there usage limit for styled map feature on google maps api v3? -

i going use google maps api v3 , researching pricing. whats api key in google maps api v3? i found answer in above link. it saying, up 25,000 map loads per day each api. up 2,500 map loads per day have been modified using styled maps feature. is there still limit styled maps feature? i not find original source page on google site. styled maps feature in google maps javascript v3 api. so quota applies javascript v3 api, not using styling feature