Posts

Showing posts from July, 2013

c - Why are we having argv[2][0] -

i came across program in c, once used argv[1] , argv[3] , , once argv[2][0] . issue not i'm not able differentiate between 1-dimensional arrays , 2-dimensional arrays, issue here use of argv[2][0] . argument such dimensions? why wasn't argv[2] used instead? thanks. argv[2] pointer whole argument while argv[2][0] first character of argument.

android - How to delegate touch events for ScrollView in background? -

i have specific requirement add 2 scrollviews framelayout. scrollview in background should display list of images , scroll along user touch feedback. the scrollview on top should scrolled programmatically using smoothscrollto(x, y) method based on background scroll view position. for this, must disable scroll event scrollview on top , allow background scrollview scroll along user touch event. i disable scroll event scrollview on top unable scroll scrollview in background. need here. i'hv pasted sample layout , java code below. activity layout <framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity"> <scrollview android:id="@+id/scrollview" android:layout_width="match_parent"

ruby on rails - FactoryGirl doesn't save objects in DB -

i have code in spec/requests: describe "with valid data" let(:player) { factorygirl.create :player } let(:player2) { factorygirl.create :player2 } @player = player.new(firstname: "tom", lastname: "greg", nickname: "jimi21") @player.save @players = player.all p @players.count end output in console is: 1 why code don't create object in test db? mean line: let(:player) { factorygirl.create :player } i want write more tests based on players saved in db. how can smartly using rspec , factorygirl? code factorygirl file: factorygirl.define factory :player firstname "john" lastname "smith" nickname "smithy99" avatar { file.new(rails.root.join('spec/images/1.png')) } end factory :player2 firstname "tom" lastname "marlow" nickname "marlowy11" avatar { file.new(r

sql server - Management Studio error while generating Scripts -

i tried generate scripts our companies azure sql-database. did 2 weeks before connected db management studio client , run "generate scripts"-wizard in context of concerned db. wizard failed @ "getting list of objects 'db'." , pointed out following stack trace: microsoft.sqlserver.management.sqlscriptpublish.sqlscriptpublishexception: error occurred while scripting objects. ---> system.invalidcastexception: die angegebene umwandlung ist ungültig. @ microsoft.sqlserver.management.smo.table.microsoft.sqlserver.management.smo.ipropertydatadispatch.setpropertyvalue(int32 index, object value) @ microsoft.sqlserver.management.smo.propertydispatcher.setvalue(int32 index, object value) @ microsoft.sqlserver.management.smo.propertycollection.setvalue(int32 index, object value) @ microsoft.sqlserver.management.smo.sqlsmoobject.addobjectpropsfromdatareader(idatareader reader, boolean skipifdirty, int32 startcolidx, int32 endcolidx) @ microsoft.sqlserver.managem

javascript - JQuery - Mouseleave not working -

i have replicated problem here - jsfiddle . on mouseleave, reverse animate effect disappears. i think has "display" property, i'm not sure how resolve this. guess reason happens due "display:block" on hover, reverts display:none? if force "display:block" on submenu element, shows submenu options @ once. html <nav> <ul class="level-2"> <li class="has-child"> <a href="/clients/">clients</a> <ul class="sublevel level-3 submenu"> <li class="nav-item"> <a href="/clients/test1/">test1</a> </li> </ul> </li> <li class="has-child"> <a href="/services/">services</a> <ul class="sublevel level-3 submenu"> <li class="nav-item"> <a href="/services/test2/">test2</a> </li> &l

Rails tire(elasticsearch) search through has_many association -

i have 2 associations belongs_to :author has_many :favorites i'm wondering why example works: tire.search(load: {include: [:author, :comments]}, page: params[:page], per_page: 8) query { string params[:query], default_operator: "and" } if params[:query].present? filter :term, author_id: ['111'] sort { :created_at, 'desc' } end and 1 doesnt: tire.search(load: {include: [:author, :comments]}, page: params[:page], per_page: 8) query { string params[:query], default_operator: "and" } if params[:query].present? filter :term, favorite_ids: ['567'] sort { :created_at, 'desc' } end can me? foreign keys stored in child table, rails joining of 2 tables you. so in model, there attribute author_id because model belongs to author. foreign keys favorites relationship stored in favorites table. while can model.first.favorites , corresponding favorites , because of value stored in latter table. model.fi

c++ - Throw Exception in Bison and catch in main() -

is possibile throw exception in .y file , catch in .l yyparse() launched? let's write example code. part of .y file: %{ #include <stdio.h> #include <string> #include <cstring> using namespace std; extern int yylex(); extern void yyerror(char*); typedef enum { zero_division = 0, var_duplicate_name = 1, ... general = 100 } e_errors; const char* e_errnames[] = {"zero_division","var_duplicate_name",...,"general"}; ... %} //symbols %union { ... }; %token ... %start x1 %% x1: begin .... end ; { ... if(mycheck(i)>=0) throw var_duplicate_name; ... } ; ... %% and how i'm trying catch var_duplicate_name in wrong way in .l file: %{ #include <string.h> #include "proxydata.tab.h" void yyerror(char*); int yyparse(void); char linebuf[500]; //for output row in case of syntax error %}

android - How can i set text to text view in the base adapter? -

i'm beginner in android ,write simple adapter: public class customadapter extends baseadapter{ public customadapter(mainactivity mainactivity, string[] prgmnamelist, string[] prgmimages) { //do something... , dont write code } @override public view getview(final int position, view convertview, viewgroup parent) { //want write code>>>>textview1.settext("hello"); } } , call adapter in main activity line: lv=(listview) findviewbyid(r.id.mylist); lv.setadapter(new customadapter(mainactivity.this, prgmnamelist,prgmimages)); want when custom adepter call , process thing,write result main activity text view.how can this?thanks. try this, 1 method, can find different methods also. create function in activity class public void refreshdata(){ //code set text } and call function adapter using context. eg: in adapter class, call this. ((mainactivity)context).refreshdata();

php - Error including files after editing httpd-vhosts.conf -

i have edited apache httpd-vhosts.conf on windows to: <virtualhost *:80> documentroot "/applications/mamp/htdocs/mysite/" servername mysite.local </virtualhost> and /etc/hosts on windows ## # host database # localhost used configure loopback interface ## #... 127.0.0.1 mysite.local so access xampp pc. before editing above files, working fine after editing, im getting error there error accessing file have included. using following code include file: $root = realpath($_server["document_root"]); require_once($root."/mysite/models/login.php"); i noticed using require_once("../mysite/models/login.php") works , other times have use require_once("../../mysite/models/login.php") work yet requiring them on same code. problem? can 1 me on how should include files after editing apache file , windows etc/hosts file?

java - Why I receive wrong chunk size after setting setChunkedStreamingMode? -

on client side ( android ) sent file using following code: public string sendfiletoserver(string filename, string targeturl) { string response = "error"; log.e("image filename", filename); log.e("url", targeturl); httpurlconnection connection = null; dataoutputstream outputstream = null; // datainputstream inputstream = null; string pathtoourfile = filename; string urlserver = targeturl; string lineend = "\r\n"; string twohyphens = "--"; string boundary = "*****"; dateformat df = new simpledateformat("yyyy_mm_dd_hh:mm:ss"); int bytesread, bytesavailable, buffersize; byte[] buffer; int maxbuffersize = 1 * 1024; try { fileinputstream fileinputstream = new fileinputstream(new file( pathtoourfile)); url url = new url(urlserver); co

java - Throttling method calls using Guava RateLimiter class -

i trying throttle number of calls method per second. tried achieve using guava ratelimiter. ratelimiter ratelimiter = ratelimiter.create(1.0);//max 1 call per sec ratelimiter.acquire(); performoperation();//the method calls throttled. however methods call not limited 1 per second continuous. the throttling can achieved using thread.sleep() wish use guava rather sleep(). i know right way achieve method call trottling using guava ratelimiter. have checked documentation ratelimiter , tried use same not achieve desired result. you need call acquire() on same ratelimiter in every invocation, e.g. making available in performoperation() : public class ratelimitertest { public static void main(string[] args) { ratelimiter limiter = ratelimiter.create(1.0); (int = 0; < 10; i++) { performoperation(limiter); } } private static void performoperation(ratelimiter limiter) { limiter.acquire(); system.out.pr

Java/Android - Doesn't add the two values of RatingBar? -

suppose set first value of ratingbar 1 , second value 1,it doesn't add 2.instead shows 1.01.0 .what's wrong here? ratingbar r1,r2; button submit; r1 = (ratingbar) findviewbyid(r.id.ratingbar1); r2 = (ratingbar) findviewbyid(r.id.ratingbar2); submit = (button) findviewbyid(r.id.submit); submit.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { toast.maketext(myactivity.this, string.valueof(r1.getrating())+string.valueof(r2.getrating()), toast.length_short).show(); //shows 1.01.0 } }); it because using + string objects , int. + operator string has meaning of concatenation. want achievable summing values , converting string. change from string.valueof(r1.getrating())+string.valueof(r2.getrating()) to string.valueof(r1.getrating() + r2.getrating())

vb.net - OracleCommand StoredProcedure returning "null" instead of DBNull -

i have stored procedure in situations returns null. when tostring() null returns "null" string instead of empty string, if don't use .tostring() method causes error. public function returnvalue(byval lngid long) string dim adocmd new oraclecommand dim strreturn string = "" adocmd .commandtext = "bus_test.returnvalue" .commandtype = commandtype.storedprocedure .parameters.add("return", oracledbtype.char, 256, strreturn, parameterdirection.returnvalue) .parameters.add("lngid", oracledbtype.double, lngid, parameterdirection.input) end objsalutil.execfunc(ocewbconnection, adocmd, "returnvalue") return adocmd.parameters(0).value.tostring end function the above code returns "null" public function returnvalue(byval lngid long) string dim adocmd new oraclecommand dim strreturn string = "" adocmd .commandtext = "

Php mysql query syntax error (Unknown field) -

this question has answer here: when use single quotes, double quotes, , backticks in mysql 10 answers include("db_connector.php"); $soru = "asdasds"; $tip = 1; $soruid = 0; $sql = "insert sor (anketid,sorumetni,tip) values (".$_session['anket'].",".$soru.",".$tip.")"; $islem = mysql_query($sql)or die(mysql_error());; if(isset($islem)) { $soruid = mysql_insert_id(); }else { header("refresh:2;sorular.php"); } this code give error : unknown column 'asdasds' in 'field list' i add ' before , after every variable in query. cannot pass string query without adding single quote ' . change from: $sql = "insert sor (anketid,sorumetni,tip) values (".$_session[&

class - Does the order of declaring functions and methods in C++ matter -

in c when use function before declaring compiler assumes takes no parameters , returns , int. if function returns type or takes parameters compiler produces error. same happen in c++ if make object of class declared later on in code? the order matter. if reference function has not been declared (just signature , return type, no implementation) compiler throw error. definition of function can wait until link time. afaik, there not implicit declaration in c++. usually put declarations of functions in header files. traditionally, symbols exported translation unit (usually stand-alone source file e.g., hello.cpp ) made available through similarly-named header file (e.g., hello.h ). implementation follows in source file. every translation unit can include header files other translation units (e.g. other.h ). every translation unit gets compiled individually (i.e. source file such hello.cpp ; #include preprocessing statements replaced actual contents of files included). @

ruby - error during running Cronjobs in Rails whenever -

i've got cronjobs rails application. defined them in schedule.rb when running got error: /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.9.4/lib/bundler/spec_set.rb:92:in `block in materialize': not find minitest-5.7.0 in of sources (bundler::gemnotfound) /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.9.4/lib/bundler/spec_set.rb:85:in `map!' /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.9.4/lib/bundler/spec_set.rb:85:in `materialize' /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.9.4/lib/bundler/definition.rb:132:in `specs' /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.9.4/lib/bundler/definition.rb:177:in `specs_for' /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.9.4/lib/bundler/definition.rb:166:in `requested_specs' /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.9.4/lib/bundler/environment.rb:18:in `requested_specs' /usr/local/rvm/gems/ruby-2.0.0-p643/gems/bundler-1.9.4/lib/bundler/runtime.rb:13:in `setup' /usr/l

asp.net - sync execution in async c# -

i want run multiple transactions parallel using async call in transaction want process task in sequence because sequence matters. use async call doesn't help, makes whole transaction async make conflict. suppose want process data of multiple companies parallel, data of company in sequence, need productid of product detail of product first have products , detail of product using productid against company. cant product detail without productid. task wrappedintask = task.run(() => companyasync(companyid)); public static async task companyasync(int companyid) { string[] products=getallproducts(compnyid); for(int i=0; i<products.length>i; i++) { //get product detail here using products[i] } } i want execute getallproducts(compnyid) , execute loop if loop , getallproducts(compnyid) method exicute asynchronously there conflict. suggestion this if getallproducts(compnyid) asynchronous method too, can wait fini

java - Use lombok with @XmlElement -

how can use lombok in conjunction @xmlelement tags can unmarshall object? i have 20 properties, i'm looking not write explicit getter , setter each xmlelement tags on setters. this gets job done: @data @xmlrootelement(name = "root") @xmlaccessortype(xmlaccesstype.field) // update: need or else exception public class data { @xmlelement(name = "test") public double testdata; }

ios - How to pass value to initWithCoder of second view controller? -

i using pushviewcontroller method. want check condition in initwithcoder method in second view controller, use instantiateviewcontrollerwithidentifier in first controller initwithcoder called before setting property of second view controller. how can check condition? when create instance of viewcontroller @ time initwithcoder method called. used singleton class boolean variable set in prepareforsegue method , used in initwithcoder method works me.

Using Jenkins CI with Velocity for testing Meteor apps -

Image
i have looked around answer can't working. have both meteor app , jenkins running locally on os x. followed this answer but build fails following output my lack of knowledge of both jenkins , meteor @ fault here, can't find solution online. i had use /usr/local/bin/meteor rather meteor because seemed jenkins user not find meteor command. maybe going wrong there. i'm not jenkins expert, in order access installed executables jenkins user call !/bin/bash -l #!/bin/bash -l @ beginning of script. way able call meteor . i assume when run meteor run --test on local machine runs without problems, correct? i ssh jenkins instance , check if there's process using port 3001, error suggest. maybe there running meteor process?

javascript - Angular - Set up a path variable that changes per page -

i ng-including partials in different portions of site, @ different folder levels. because of that, need able set, per page, root relative folder path assets such partials , images can found. example, this, correctly: index.html: <div class="homepage"> <ng-include src="'patterns/header.html'"> </div> but able access same partial below: /individuals/header/index.html <div class="individual"> <ng-include src="'../../patterns/header.html'"> </div> is there method setting like pathis = '../../patterns/' that used on individual page so: <ng-include="{{pathis}} + 'header.html'"> and if so, that? directory structure below: index.html | patterns/ --------header.html | individuals/ --------header/ ----------------index.html (i including header.html in both index.html in individuals/header/index.html) there many ways that, 1 way s

java - How to sort only specified columns in JTable? -

i have table columns | name | start | finish | time | place | points | , want keep place , points isolated when sorting table time. there way without creating 2 tables? so, came using tablecellrenderer place , points columns manu suggested sharing this link . firstly, created customtablecellrenderer , used method set values: public class customcellrenderer extends jlabel implements tablecellrenderer{ ... @override public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int row, int column) { if(column==this.columnplace){ // set place settext(integer.tostring(row+1)); } else{ // set points depending on competitorscount , row settext(integer.tostring(points[competitorscount-1][row])); } return this; } } and set custom renderer these columns: customcellrenderer customrenderer = new customcellrenderer(co

python - How to test other thread that access database -

it seem database used django during tests isn't shared other thread for example: inside testcase class : def my_test(self): print(mymodel.objects.all()) my_function() inside class : def worker(): print(mymodel.objects.all()) def my_function(): thread = thread(target=worker) thread.start() console result : [<mymodel object>, <mymodel object>, <mymodel object> ... ] [] so first call, inside thread, doesn't use test db anymore. i looked @ : django: using same test database in separate thread , tried use same db "name" , "test_name" doesn't work me what test threads if accessing db ? django's testcase runs each test class in single transaction. changes not committed, other threads cannot read effects of changes. the solution use transactiontestcase . run queries in default autocommit mode, , changes available other threads.

angularjs - How to access a function defined in a ui-router state controller -

i have angular ui-router state controller follows. $stateprovider.state('contacts', { template: '<h1>{{title}}</h1>', controller: function($scope){ $scope.title="mytitle"; $scope.myfunction= function(){ //do }; }, data:{ list:[ { item:"item1", callback:{{myfunction}} } ] } }) as shown in code above, state controller has function attached scope called "myfunction". have directive accesses state. in directive, want call myfunction callback when item1 clicked(i have button corresponding item1 mentioned in data section). please let me know how can call myfunction method directive.

asp.net - AJAX TabContainer not showing up in IE -

i'm using ajax control toolkit v15.1, asp.net v4.5.1 vs.net 2012 vb code. up-to-date. i'm using tabcontainer tool ajax toolkit. , when run web app in localhost mode, works fine in chrome , ie. i publish code iis web server & view in chrome. runs great! happy! must test in ie fire ie 11. when ie 11 launches top part of web app loads. bottom 75%, houses tabcontainer , 11 tabs, not show up. i've been reading changing asp:scriptmanager ajaxtoolkit:toolkitscriptmanager (which doesn't work way. doesn't recognize tag @ all. throws error! think may have been fix 4+ years ago because that's when fix posted not apply today.) here code on think of value in troubleshooting: (in .aspx file) <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="cc1" %> the beginning of tabcontainer code: <cc1:tabcontainer id="tabcontainer" runat="server" width=

r - Is it possible to control the speed of the lapply function? -

i wrote script geocode list of addresses using r , google maps, exceeds google's 10 queries per second speed limit. slow down 5 queries per second. my function constructs url, , call functions using do.call, rbind, , lapply create geocoded dataset. geoc <- function(address){ out <- trycatch({ url <- "http://maps.google.com/maps/api/geocode/json" response <- get(url,query=list(sensor="false",address1=address)) json <- fromjson(content(response,type="text")) loc <- json$results[[1]]$geometry$location return(c(address1=address, long=loc$lng, lat=loc$lat)) }) return(out) } result <- do.call(rbind,lapply(as.character(sample$location),geoc)) is there way slow down 5 queries per second? works great if i'm geocoding 5 or 10 @ time, on there throws google errors. thanks! use sys.sleep wait given time, proceed. not able use r session else, can have multiple r sessi

php - How to use IN dynamically with mysqli prepare statement -

this question has answer here: pdo binding values mysql in statement 8 answers preparedstatement in clause alternatives? 25 answers i trying use in mysqli prepare statment $user_in = "'28','22'"; $stmt = $this->connection->prepare("select `id` `$this->table_name` `user_id` in (?) "); if($stmt){ $stmt->bind_param('s',$user_in); if($stmt->execute()){ $result = $stmt->get_result(); if($result !== false && $result->num_rows >= 1){ $row = $result->fetch_all(mysqli_assoc); $stmt->close(); var_dump($row); }

java - How to compare String to all elements in an array? -

this question has answer here: how can test if array contains value? 24 answers i looking way compare string (which in case line text file) every element in array , see if there match. @ high level overview, have string array (about 100 elements) full of strings contained somewhere in file need deleted. reading file stringbuffer , writing each line, except skipping on lines match element in array. have far: //main class calling method public class testapp { public static void main(string[] args) { compareanddelete.removeduplicatelines("c:/somelocation", 2darray); } } public class compareanddelete { static string line_of_text; static stringbuffer localbuff = new stringbuffer(); static filereader buffer; static bufferedreader user_file; public static void removeduplicatelines(string local, string[][] duplicates) throws ioexcep

ios - EXC_BAD_ACCESS when swizzle popViewControllerAnimated: -

for logging navigation between controllers, use swizzling of -popviewcontrollersanimated: method. , causes strange crash exc_bad_access. can reason? - (void)sw_popviewcontrolleranimated:(bool)animated { //1. top controller before pop //2. pop //3. top controller after pop //4. log nsstring *controllerfromidentifier = @""; __block nsstring *controllertoidentifier = @""; nsdictionary *controllerfromadditionalparams = @{}; uiviewcontroller *topcontroller = ((uinavigationcontroller*)self).topviewcontroller; [self sw_popviewcontrolleranimated:animated]; uiviewcontroller *topcontrollerafterpop = ((uinavigationcontroller*)self).topviewcontroller; }

javascript - Blockly text input blur -

i have small problem blockly. i need call event (for example alert('hello world') ) when blurs text input. i used blockly.addchangelistener , function not called when create blur event on text input. you can create onchange event input block. this: onchange: function(event) { var text = blockly.javascript.valuetocode(this, 'textbox', blockly.c.order_atomic); if (text == "") { alert("hello world"); } else { alert(text); } } where this makes reference input block , textbox makes reference name have set yours input box.

Matlab Legend Rejecting Cell Array of Strings for Input -

i have believe valid cell array of strings (prn_leg) input legend @ end of plot. prn_leg = columns 1 through 6 '3' '7' '8' '9' '16' '19' columns 7 through 10 '23' '27' '31' '32' however, when attempt legend(prn_leg) i following warning: warning: error updating legend. index exceeds matrix dimensions. > in defaulterrorcallback (line 12) in tec_plotting (line 46) and blank legend appears in figure. i've looked on solutions , none of them seem work. thanks much! tom the legend() function expects column separated list of strings or cell array of strings, not vector of strings. therefore easiest way fix change input vector cell array, , legend should work, each element is: prin_leg{1} = '3'; prin_leg{2} = '7', etc. or per comments more efficiently: prin_leg = {'3','7',...};

Importing an adjacency matrix (csv) containing strings and floats in R -

Image
this question has answer here: r - column names in read.table , write.table starting number , containing space 1 answer i have co-occurrence adjacency matrix this: https://dl.dropboxusercontent.com/u/73950/matrix_added_cats.csv where rows , columns may contain strings special characters ("(", "-", " ", etc.) when import data r visualize ggplot2 , this: mydata <- read.csv("/matrix_added_cats.csv") which returns: name ngo gov..institutions industry..farming. industry..mining. academia.research aboriginal.groups 1 ngo 0.00 0.00 0 0.00 0.01 0.00 2 gov. institutions 0.00 0.01 0 0.04 0.03 0.01 3 industry (farming) 0.00 0.00

javascript - Accessing variables in the parent class -

i've been stumped on problem few hours now, , can't seem find solution. have class extends parent class, cannot seem access variables declared in parent's constructor. i borrowed inheritance technique . uses "extend" function create subclass: //in functions.js function extend(base, sub, methods) { sub.prototype = object.create(sub.prototype); sub.prototype.constructor = sub; sub.base = base.prototype; for(var name in methods) { sub.prototype[name] = methods[name]; } return sub; } i create class called stimulus serves function: //in classes.js function stimulus(module_id, unit_id, attributes) { this.attributes = attributes; this.module_id = module_id; this.unit_id = unit_id; //create other class variables based on this.attributes, this.module_id, , this.unit_id } stimulus.prototype = { _getstimulus: function() { //retrieve database } //other functions here } and have subclass. technique use create borrowe

node.js - Heroku R10 (Boot Timeout) error with Node app - but not using an HTTP server? -

i have simple node.js app hosted on heroku consumes twitter stream. works fine sometimes, when review logs, see has begun crash regularly r10 error code . i've done deal of googling other questions on topic, like one , , consensus seems heroku requires listen process.env.port instead of explicitly setting own port. fair enough. but i'm not setting port anywhere in code, , nor set http.createserver can .listen one. how can solve error? ideas? here's code reference: var config = require('./config'); var count = require('./count'); var twit = require('twit'); var t = new twit(config); port = process.env.port; // reference, not used anywhere var stream = t.stream('user', {track: "@isitoveryet2016"}); stream.on('connect', function (request) { console.log("opening twitter stream..."); }); stream.on('connected', function (response) { console.log("connected , streaming on port: &quo

Android: How to remove the Wifi Network by using removeNetwork() correctly (Android 5.0 Asus Zenfone ) -

first, i'm using addnetwork() add ssid configuration list. okay(ssid has been added configuration list successfully). second, i'm using removenetwork() remove configured network. when execute method, acts should. wifi disconnects , ssid doe not appear in list of configured netowrks... but, when using addnetwork() add same ssid configuration list again. return value(networkid) -1. the way solve problem restart wifi function.

javascript - How to draw circle or rectangle on tile images leaflet.js -

i know possible draw circle or rectangle on tile images when using leaflet.js. here 1 link http://jsfiddle.net/tridip/p6ssbvqj/ leaflet has function called circle() polygon() etc my interface have 4 button 1 circle,rectangle,load image, save image. when page load first time show image leaflet.js , when user click on circle or rectangle button have allow user draw circle or rectangle on image. the question jquery or javascript library should use allow draw circle or rectangle on image ? next need store coordinate of circle or rectangle @ client side because later save info in db. 3rd 1 when reload images again need show drawn circle or rectangle on same image , in same location user has drawn. please guide me how achieve it. have never done before no idea have. please me. thanks edit 1 var drawnitems = new l.featuregroup(); map.addlayer(drawnitems); 1) meaning of l.featuregroup() ? l.featuregroup() do? 2) code below do? var drawcontrol = new l.control.draw(

spring - How to handle HttpMediaTypeNotAcceptableException by writing error content to the response body using exception handler annotation? -

when client request resource producing application/json content accept header of application/xml. request fails httpmediatypenotacceptableexception exception , wrapped error message body in response entity object using exception handler annotation mentioned in below code. however, receive httpmediatypenotacceptableexception again when return values written response httpmessageconverter. because checks producible content type response acceptable request type, trying communicate client using error message. how workaround issue ? btw, other exceptions parsing fine error message. please advise. @controlleradvice public class restexceptionhandler extends responseentityexceptionhandler { @override protected responseentity<object> handleexceptioninternal(exception ex, object body, httpheaders headers, httpstatus status, webrequest request) { // setting response content type json headers.setcontenttype(mediatype.application_json);

Getting exception when creating AlertDialog android -

i getting error: java.lang.illegalstateexception: need use theme.appcompat theme (or descendant) activity. and appears when errordialogfragment doing builder.create(); here errordialogfragment code: public class errordialogfragment extends dialogfragment { @override public dialog oncreatedialog(bundle savedinstancestate) { alertdialog.builder builder = new alertdialog.builder(getactivity()); layoutinflater inflater = getactivity().getlayoutinflater(); string title = getarguments().getstring("title"); string message = getarguments().getstring("message"); view dialogview = inflater.inflate(r.layout.dialog_error, null); textview tvtitle = (textview) dialogview.findviewbyid(r.id.tvtitle); textview tvmessage = (textview) dialogview.findviewbyid(r.id.tvmessage); button btnok = (button) dialogview.findviewbyid(r.id.btnok); tvtitle.settext(title); tvmessage.settext(message); btnok.setonclicklistener(new view.oncli

assembly - What is the means of ( __ ) "double underscore" used in c program like , ie: __asm__ , how we or compiler use them -

this question has answer here: what double underscore ( __const) mean in c? 4 answers what means of ( __ ) "double underscore" used in c , ie: __asm__ every found reserved compiler . means , how or compiler use them, better if sombody explain use case. know reserved how compiler interprets these symbols specific purpose. the implementation may define number of symbols (function names, variable names, macros, etc.) internal use. avoid collisions user-defined symbols, naming patterns reserved these internal symbols, such leading __ . iow, if name variable __foo__ , run risk of compile-time or link-time error if implementation has defined __foo__ different purpose. apart that, have no special meaning.

javascript - JSF components not parsed inside a <script> block -

i had change <script> ... </script> in jsf page , tried evaluate jsf component inside of script. el evaluated tag untouched. what reason behaviour? example: <script type="text/javascript"> //<![cdata[ function dosomething() { $('.usernode').droppable({ activeclass : 'ui-state-active', hoverclass : 'ui-state-highlight', tolerance : 'intersect', drop : function(event, ui) { <h:panelgroup rendered="#{mybean.usethis}"> alert("code a"); </h:panelgroup> <h:panelgroup rendered="#{!mybean.usethis}"> alert("code b"); </h:panelgroup> } }); }; //]]> </script> the el #{!mybean.usethis} evaluated true/false <h:pa

How to get my all friends using spring social facebook template? -

i developing project on spring boot , using spring social facebook api in order user profile , friends. code is facebook facebook = new facebooktemplate(socialauthtoken); org.springframework.social.facebook.api.user facebookuser = facebook.useroperations().getuserprofile(); above code works fine , gives me profile when try friends profile gives 8 user via paging want users . code friends list<string> friendsids = facebook.friendoperations().getfriendids(); for(string id : friendsids){ org.springframework.social.facebook.api.user user = facebook.useroperations().getuserprofile(id); system.out.println(user.getemail()); system.out.println(user.getfirstname()); } it's not possible friends, using app. , no, there no workaround. see https://developers.facebook.com/docs/apps/changelog#v2_0 the list of friends returned via /me/friends endpoint limited list of friends have authorized app.

c# - Windows 10 UWP app - Setting window size on desktop -

i've started learning uwp app development on windows 10 pro using visual studio 2015 community edition. tried modify c# version of official "hello, world" sample setting width , height attributes of page tag in mainpage.xaml. interestingly, when start app, size different. moreover, if resize window , restart it, app seems remember previous window size. is possible force uwp app have predefined window size, @ least on desktop pcs? try setting preferredlaunchviewsize in mainpage 's constructor this. public mainpage() { this.initializecomponent(); applicationview.preferredlaunchviewsize = new size(480, 800); applicationview.preferredlaunchwindowingmode = applicationviewwindowingmode.preferredlaunchviewsize; } update as @kol pointed out, if want size smaller default 500x320 , need manually reset it. applicationview.getforcurrentview().setpreferredminsize(new size(200, 100));

javascript - jQuery DataTable responsive doesnt work with Boostrap 3 -

i having problems responsive layout when use datatable js plugin. wont show if there responsive: true. tried manipulate css (white-space: nowrap) isnt solution. here preview of code. html <table id="example1" class="table table-bordered table-striped"> <thead> <tr> <th class="no-sort"></th> <th>product</th> <th>product category</th> <th>views</th> <th>average view time</th> </tr> </thead> <tbody> <tr> <td class="text-center">1</td> <td>accu-pass suture shuttle</td> <td>suture shuttle</td> <td>1,500 views</td> <td>8:38 minutes</td> </tr> </tbody> </table> js $('#example1').datatab

migration - Detached head branch after SVN-CLONE -

in company, have moved svn git. did not use third party tools this. ran git svn clone --stdlayout --no-metadata --authors-file=authors.txt temp_name. seemed suffucient wanted. pushed repos bitbucket. noticed after pushing is, in 1 of repos, branch missing in bitbucket. so, did checkout of branch, got message "you in detached head state. can around, make experimental changes , commit them, , can discard commits make in state without impacting branches performing checkout." googled resolving detached head problem none of posts talks detached head after git svn clone. main thing want achieve want detached branch pushed remote master after git svn clone. not know i'm missing don't worry detached head message itself. long needed revisions in working copy, push want them be: git push <your_bit_bucket_remote> <revision>:refs/heads/<branch_name_at_bitbucket> where <revision> can head , svn/branch_name or explicit sha1.

windows installer - ACTION property and custom actions -

i'm confused understanding of using administrative installation custom actions , custom dialogs. my installation package displays special dialog accept configuration data user, , calls custom action write data configuration file. as understand, in specific situation, dialog , custom action called if action=install. don't call when action=admin|advertise. right?

asp.net - ASP DevExpress libraries undefined after server migration -

i'm having trouble migrating devexpress elements of asp web application 1 server another. copied files , database on new server location , made adjustments web.config file connected new database. got of site working , pulling data correctly, devexpress pieces coming undefined. as far can tell, references in web.config file , on respective pages correct , dll files listed in bin directory i'm rather stumped why aren't working. web.config sample <compilation debug="true" strict="false" explicit="true"> <assemblies> ... <add assembly="devexpress.web.aspxgridview.v10.1, version=10.1.6.0, culture=neutral, publickeytoken=b88d1754d700e49a" /> <add assembly="devexpress.web.v10.1, version=10.1.6.0, culture=neutral, publickeytoken=b88d1754d700e49a" /> ... , on dashboard.aspx sample ...at top of page... <%@ register assembly="devexpress.web.aspxgridview.v10.1, version=1