Posts

Showing posts from August, 2012

algorithm - How to stop the virus-like program from corrupting memory -

i asked question in recent technical interview. suppose there program generates random memory addresses , manipulates contents. scheme should employ prevent happening. my answer having pre-shared key our processes , whenever process submitted there separate process asks psk. if correct entry pid made in hash table stored in memory marking legitimate process. dont know how far correct , scheme requires changes processes. how going achieve had no idea. think correct solution. the scheme called protected memory , implemented memory management unit inside cpu, programmed os.

c# - HttpWebRequest to avito.ru -> error -

need html add out of these: https://www.avito.ru/moskva/kvartiry?user=1 i have following code: httpwebrequest request = (httpwebrequest)webrequest.create(url); request.protocolversion = httpversion.version11; request.useragent = "mozilla/5.0 (windows nt 6.1; wow64) applewebkit/537.36 (khtml, gecko) chrome/43.0.2357.134 safari/537.36"; request.accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*;q=0.8"; request.headers.add(httprequestheader.acceptlanguage, "ru-ru,ru;q=0.8,en-us;q=0.6,en;q=0.4"); request.method = "get"; request.timeout = 10000; using (httpwebresponse response = (httpwebresponse)request.getresponse()) { ...;} it used work fine untill today. apparently have changed @ web-site , last line of code throw error, says: system.net.webexception: base connection closed: inexpected error @ transfer. ---> system.io.ioexception: connection error be...

html - How to carry href link information forward from page 1 to page 2's PHP form? -

i have number of different pages want lead same form page, carry information page user clicked on form page once form has been filled out. specifically, want property name carried forward , emailed along other form information. how information contained in search bar ?property=68yorkville show in email thats sent via php form inbox? edit: i realized better if share code directly make things easier: page 1: http://agentboris.com/listings/test-listing-page.php page 2 (with form): http://agentboris.com/listings/test-form.php?property=68yorkville701 separate php file form code: <?php if(!isset($_post['submit'])) { //this page should not accessed directly. please use form. echo "error, please return last page."; } $property = $_get['property']; $name = $_post['name']; $visitor_email = $_post['email']; $tel = $_post['tel']; $message = $_post['message']; $spambot = $_post['spambot']; if ($sp...

hdfs - HMaster node disappeared while execute hbase shell command -

i new in hbase. started work hbase recently,in ubuntu server standalone hbase work fine zookeeper. however, while trying work pseudo-distributed local, it's having strange don't understand. have configured hbase conf/hbase-site.xml according below: <name>hbase.cluster.distributed</name> <value>true</value> <name>hbase.rootdir</name> <value>hdfs://localhost:9000/hbase</value> <name>hbase.zookeeper.property.datadir</name> <value>/home/username/zookeeper/new</value> and have setup hdfs single node cluster of pseudo-distributed operation. tricky part when run hbase,zookeeper , hadoop(hdfs) , "jps" command show below information. 8998 hregionserver 8066 resourcemanager 8229 nodemanager 7456 namenode 7852 secondarynamenode 7045 quorumpeermain 9269 jps 8815 hmaster in addition after executing "hbase shell" command ask hbase operation. hbase(main):0...

.net - Updating a Password in RackSpace using C# -

i'm trying change password of main account , sub user in rackspacecloud using c# keep running usernotauthorized exception. weird because can else without error, reset api keys, list users , userid's(etc.). sample code net.openstack.core.domain.cloudidentity cloudidentity = new cloudidentity()//admin credits { username = "me", apikey = "blahblahblah", }; cloudidentityprovider cloudidentityprovider = new cloudidentityprovider(cloudidentity); cloudidentityprovider.setuserpassword("correctuserid", "newp@ssw0rd", cloudidentity); and error confusing because methods like, cloudidentityprovider.listusers(cloudidentity) cloudidentityprovider.resetapikey("userid", cloudidentity); work perfectly. or ideas appreciated. oh , btw addition info on exception same. "unable authenticate user , retrieve authorized service endpoints" this bug. have opened issue 528 in meantime here workaround. var c...

How to browse remote Neo4j database? Is there any REST client? -

neo4j server has own browser. allows browse local database. need browse remote database. remote neo4j database provides rest api. know url, login , password. how can browse database via neo4j server browser or other means? usually, if rest api exposed, browser ui too. assuming rest endpoint https://user:pass@somehost:7474/db/data/ , opening https://user:pass@somehost:7474/ open browser ui. can accessed remotely local computer. in fact, @ graphenedb host remote instances our users , how access browser. if reason (don't know why), can't use built-in browser remotely, there other options: if cli tool enough can use py2neo . comes cli tool called cypher able run queries against remote server secured http basic authentication. if looking @ visual tools explore remote dataset there multiple options: linkurious popoto.js

javascript - Node.js callbacks hell -

i'm learning node.js right , i'm having troubles calling back. i looked @ event emitter doesn't seems relevant me. this i'm calling: exports.search = function(lat, lng, arr, callback) { //something geocoder.reverse({ lat: lat, lon: lng }, function(err, res, callback) { //finding area if (area !== "null") { pool.getconnection(function(err, connection, callback) { if (err) { } else { connection.query("some sql code", function(err, rows, fields, callback) { if (found im looking for) { connection.query("some sql code", function(err, rows, fields, callback) { //looking else if (err) { callback(true); } else { if (...

struct - Learn C the hard way excercise 16 -

i inexperienced programmer working through learn c hard way , stuck on credit exercise. http://c.learncodethehardway.org/book/ex16.html i trying adapt code , making struct on stack instead of heap code giving me segmentation fault , unsure why or how proceed. advice appreciated. #include <stdio.h> #include <stdlib.h> #include <string.h> struct person { char *name; int age; int height; int weight; }; void person_create(struct person p,char *name,int age,int height,int weight) { p.name = name; p.age = age; p.height = height; p.weight = weight; } void person_print(struct person who) { printf("name: %s\n", who.name); printf("\tage: %d\n", who.age); printf("\theight: %d\n", who.height); printf("\tweight: %d\n", who.weight); } int main(int argc, char *argv[]) { // make 2 people structures struct person joe; struct person frank; person_create( joe...

C++ - static meaning for variables in global scope -

what significance of defining variable static when define in global scope? aren't global variables "static" anyway? i.e: there difference between code? : int var1 = 0; int main() { return var1; } static int var1 = 0; int main() { return var1; } i know static variable not accessible other translation unit, that's not i'm concerned with. aren't global variables "static" anyway? global variables indeed placed in static memory. however, global in translation units, linker sees names. is there difference between code? [...] if decide link first code translation unit has var1 , going link error. second code compile correctly, if var1 in other translation unit global. i know static variable not accessible other translation unit, that's not i'm concerned with. internal or external scope difference. 1 argue misuse of keyword static , way in c standard.

How do I use collections in MongoDB and sails.js? -

problem: i want attribute 1 model nested in another. my solution: i have 2 models in application, 1 users , other events: user: attributes: { name: 'string', email: 'string', events: { collection: 'event', via: 'author' } } event: attributes: { date: 'string', time: 'string',, other: 'string', author: { model: 'user' } } one user should able create multiple events, 1 event may have 1 author. don't know how should make queries creating events , showing them. for creating event query: var newevent = { date: req.param("date"), time: req.param("time"), other: req.param("other"), author: req.user } event.create(newevent).exec(function(err, model){ console.log("new event created"); console.log(model); return res.redirect("/account"); }); this setting author users...

EXCEL conditional formatting based on 3 different dates. Once passed each of the dates X column changes word -

i trying build shipping lineup. have eta etb , etd date column each ship. have status column display either expected,waiting,loading,sailed. if today's date pre eta date want status column display "expected". once pass eta date, want status column display "waiting". once pass etb date status should "loading". , once pass etd date status should saying "sailed". idea how on excel 2010 ? thanks. assume eta in column a, etb column b, , etd column c. put formula in column d, starting in d1 , drag down. =if(today()>c1, "sailed", if(today()>b1,"loading",if(today()>a1,"waiting","expected"))) this works testing each successive criteria - if today() [which automatic excel function brings day's date] later etd date, , if not, if larger etb date, , if not, if larger eta date [if not, automatically becomes "expecting"]. this not 'conditional formatting'. conditional...

csv - How to mock file to test file upload in rails 4.2.1 -

i'm trying test action import products csv. i'm being able first test pass. params[:file] goes controller string "#<stringio:0x007fc0d40a0bd0>" doesn't make test fail isn't correct behaviour. the second test i'm getting following error private method `gets' called #<actiondispatch::http::uploadedfile:0x007fd391de0a00> here's spec (content csv content) # spec/controllers/products_controller_spec.rb describe 'post import file' before post :import, file: file end context 'with invalid data' subject { spree::product.count } let(:file) { stringio.new("") } { is_expected.to eq 0 } end context 'with valid data' subject { spree::product.count } let(:file) { actiondispatch::http::uploadedfile.new(params) } let(:params) { original_filename: 'file.csv', content_type: 'text/csv', ...

asp.net mvc - MVC4 application - configure as a web application under root site -

i have mvc4 application. when deploy website in iis 7, works. when deploy under root website application fails map route , gives http 404 on second get/post. http error 404.0 - not found localhost/home/login ideally should go on url - localhost/mvcapp/home/login

Java - Change the value in a HashMap -

i have hashmap this: hashmap<uuid, customclass> . customclass has lot of properties make meaningfully unique. need able update value of key in map new instance of customclass. need call method called "customclass.clearinfo()" clears/nulls/zeros out values of properties accordingly. the problem "put" method changes reference of value refer new instance, when call clearinfo(), hashed value cleared. i need keep values before call clearinfo(). you can remove object using hashmap.remove(key) method. can put new object in key have removed. see documentation remove() .

oop - What's the correct way to make a Model that's not a table In Cake 3.0? -

i have constants and/or functions don't belong particular table , want put them in model accessible other models , controllers. how this? in cake 2 simple setting $usetable = false; a model less form way process model less data. check manuals chapter that.

regex to extract values within parentheses and the word before parentheses using python -

i extract values within parentheses , word starting before it. example, in given text file, have below details: total db read time : tdbt(56) tdto(78) tdtc(567) ton(567) tot(345) expected output tuple or list: tdbt 56 tdto 78 tdtc 567 ton 567 tot 345 split on : , replace () spaces using str.translate s = "total db read time : tdbt(56) tdto(78) tdtc(567) ton(567) tot(345)" spl = s.split(":")[1].translate({ord("("):" ",ord(")"):" "}).split() ['tdbt', '56', 'tdto', '78', 'tdtc', '567', 'ton', '567', 'tot', '345'] or use str.replace : s="total db read time : tdbt(56) tdto(78) tdtc(567) ton(567) tot(345)" spl = s.split(":")[1].replace("("," ").replace(")"," ").split() print(spl) if want pairs can use re: s="total db read time : tdbt(56) tdto(78) tdtc(567)...

How to remove the extra padding at the beginning and end of android viewpager? -

i want remove padding/margin @ viewpager. see attached image here https://www.dropbox.com/s/gsqzae28mvihy96/screenshot_2015-07-22-17-59-30.png?dl=0 xml: <android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/pager" android:layout_width="fill_parent" android:layout_height="match_parent" tools:context="com.masterscroll.masterscroll.communityactivity2" android:padding="0dp"> </android.support.v4.view.viewpager> check out this answer. can try these methods on viewpager. setpagemargin(int marginpixels) setpagemargindrawable(drawable d) setpagemargindrawable(int resid)

java - Apache Camel RSS module with basic authentication -

i trying use apache camel's rss module use basic authentication protected rss feed endpoint . however, can't find documentation how pass user credentials . know how this? workarounds appreciated! i think it's not possible @ moment. camel-rss uses rome read rss feeds. take code of org.apache.camel.component.rss.rssutils : public static syndfeed createfeed(string feeduri, classloader classloader) throws exception { classloader tccl = thread.currentthread().getcontextclassloader(); try { thread.currentthread().setcontextclassloader(classloader); inputstream in = new url(feeduri).openstream(); syndfeedinput input = new syndfeedinput(); return input.build(new xmlreader(in)); } { thread.currentthread().setcontextclassloader(tccl); } } to use basic authentication there must like public static syndfeed createfeed(string feeduri, classloader classloader) throws exception { classloader tccl = thread.curr...

javascript - Rails; display modal after an action and page reload -

i have following code... controller ... session[:registration_modal] = true redirect_to(event_path(@event)) _main.html.erb ... <!-- modal --> <div class="modal fade" id="registration-modal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">registration notice!</h4> </div> <div class="modal-body"> thank registering event. not receive $200 , not pass go! </div> <div class="modal-footer"> <button type="button" cl...

angularjs - Difference between using jQuery and angular element reference in angular directive -

i want wrap jquery in angular. in link function $('#slider').slider(); but wondering difference to.... $(elem).slider(); because second 1 'sort of' works. the 'elem' variable in link function 'made' angular using jqlite. from docs: jqlite tiny, api-compatible subset of jquery allows angular manipulate dom in cross-browser compatible way. jqlite implements commonly needed functionality goal of having small footprint.

Play Framework / Scala: abstract repository and Json de/serialization -

this question maybe more scala play, here is: trying achieve abstraction of repository common db operations. trait entity { def id: uuid } trait repository[t <: entity] { val json_key_id = "_id" def collection: jsoncollection def insert(t: t): future[either[string, t]] = { collection.insert(t).map(wr => if (wr.ok) right(t) else left(wr.getmessage())) .recover { case t => left(t.getmessage) } } def update(t: t): future[either[string, t]] = { val selector = json.obj(json_key_id -> t.id.tostring) collection.update(selector, t).map(wr => if (wr.ok) right(t) else left(wr.getmessage())) .recover { case t => left(t.getmessage) } } } then have objects use with: case class userdao(id: uuid) extends entity[userdao] object userdao { val json_key_id = "_id" implicit val userdaowrites: owrites[userdao] = new owrites[userdao] { def writes(user: userdao): jsobject = json.obj( json_key_id -> ...

javascript - Titanium Alloy - unable to disable Label inside Tabbedbar using id -

i have tabbedbar contains labels , inside have label enable property need change in .js file through coding. have tried setting id of particular label , have used. $.lblprof.enabled = false; in .js file. throwing error: undefined not object(evaluating '$.lblprof.enabled = false') demo.xml <tabbedbar id="tabbedbar" platform="ios" backgroundcolor="#369" top="44dp" height="30dp" width="300" index="0" onclick="tabbarclick"> <labels> <label>details</label> <label>photos</label> <label>documents</label> <label id="tabprofile">profile</label> </labels> </tabbedbar> demo.js $.tabprofile.enabled = true; if trying disable directly i.e <label id="lblprof" enabled="false"> its working fine. as @visola mentioned, label...

javascript - AngularJs Beginner, how to call a function -

i'm using first time angularjs. want make year scrollbar 1960 2010. need recover value of ng-bind, in order call function updatedata(year) when move scrollbar. have problem... i guess script uncorrect. can me? <div ng-app> <input id='slider' type='range' min=1960 max=2010 ng-model='year' width=200> <span ng-bind='year'></span> <script> updatedata({{year}}) </script> <div id='' class='rchart datamaps'></div> </div> html : <div ng-app="myapp" ng-controller="personctrl"> <input id='slider' type='range' min=1960 max=2010 ng-model='year' width=200> <div> {{updatedata()}} </div> </div> js : var app = angular.module('myapp', []); app.controller('personctrl', function($scope) { $scope.year = "2000"; $scope.updated...

office365 - Importing Office 365 liscense data into an Access database -

i'm looking tie in office 365 info access database know licenses assigned each user. i've looked using sharepoint appears dead end. i'm sure there way api. unfortunately there isn't way automate that. can manually create table , name office 365, add corresponding columns , track licenses via sophisticated queries.

php - How to Set facebook follower button in my site? -

i have created site using php , html. have plan set facebook section on page on site. have create following on site. 1. following number 2. show followers 3. follow button click how integrate facebook follower button on site? example , demo ? you can generate custom facebook follower html code here .

python - Django Web Development Server Not Working -

i'm trying hands upon django , started , frankly speaking i'm beginner @ this. encountered problem linked settings guess i'm not able understand , solve problem. whenever write python manage.py runserver on command line, following error. traceback (most recent call last): file "c:\python34\lib\site-packages\django-1.9-py3.4.egg\django\contrib\auth\p assword_validation.py", line 162, in __init__ common_passwords_lines = gzip.open(password_list_path).read().decode('utf-8' ).splitlines() file "c:\python34\lib\gzip.py", line 52, in open binary_file = gzipfile(filename, gz_mode, compresslevel) file "c:\python34\lib\gzip.py", line 181, in __init__ fileobj = self.myfileobj = builtins.open(filename, mode or 'rb') filenotfounderror: [errno 2] no such file or directory: 'c:\\python34\\lib\\site -packages\\django-1.9-py3.4.egg\\django\\contrib\\auth\\common-passwords.txt.gz' during handling of abov...

version control - How do I search the content of tag annotations in git? -

i release first version of first git-managed project , going tag annotated tag ("first alpha release"). later on, find out first alpha release, search contents of tag annotations "first alpha". how do so? i know git log --grep search contents of commit messages , git show tell me contents of tag annotation, can't figure out manpages or google command search on tag annotations. have dump records tag annotations stored , search using tool? envisioning git show $(git tag)|grep "first alpha" , hoping there better way. this use external grep seems more elegant parsing output of git show: git tag -l -n | grep "first alpha" and nicely output: test_1.2.3 first alpha note -n flag, here assume annotation 1 line long. longer messages need give number after -n (lets -n99) , more complicated regarding grep flags. https://www.kernel.org/pub/software/scm/git/docs/git-tag.html one way search multiline annotations gawk (...

mysql - Is there any way to optimize this stored procedure? -

so have wicked long , complex stored procedure have constructed based on tutorials "pivoting". wondering if on here proficient in mysql mind discussing me, how make cleaner, and/or perform better. also, when query returns no results between dates specified, produces mysql syntax error in "call reading_pivot(...)" clause. here code: delimiter $$ create definer=`csonet_web_user`@`%` procedure `reading_pivot`( in begin_date datetime, in end_date datetime, in node_string varchar(255), in sensor_string varchar(255) ) begin set session group_concat_max_len = 4096; set @sql = null; select group_concat(distinct concat('max(if(sensorid = ''', sensorid, ''', collectedvalue * multiplier + offset, null)) ''', sensorid,'''')) @sql ( select inodes.id nodeid, from_unixtime(300 * round(unix_timestamp(inodes_data.time)/300)) datecollected, trim(inodes.descr) parentid, 1 sensornumber, ...

python - Reading binary file in two dimension -

matlab code: binary = 'binaryfile.png'; fid = fopen(binary , 'rb'); data2d(:,:) = fread(fid, [10,10], ['int16=>','double']) i looking python equivalent of above code. can use numpy.fromfile function read doesn't allows me read in 2 dimension. or idea how can 1 in python. although possible want, wouldn't in python because don't need to. want this: binary = 'binaryfile.png' data2d = np.fromfile(binary, count=10*10, dtype='int16').reshape(10, 10).astype('double') reshape in numpy takes no time , no memory, unlike matlab expensive operation. because in numpy reshape doesn't copy data in matlab, different way of looking @ same underlying data. so in numpy, best way want do. matlab functionality looking workaround limitations in matlab language. numpy doesn't have limitations, allowing simpler function. considered programming practice split tasks series of simple, well-defined operat...

Get the text between two characters in sql server -

i have tried using charindex function unable it. text :- offshore/blr/in i want blr" out of this. please help. presuming asking how text between forward-slashes, using charindex . see following example: declare @text varchar(100) set @text = '- offshore/blr/in' print charindex('/', @text) print charindex('/', @text, charindex('/', @text) + 1) this output 11 , 15 , respectively, shows position of first , second forward-slash. the second position found searching text occurs after first position. following it's case of using substring extract text middle of slashes: print substring(@text, charindex('/', @text) + 1, charindex('/', @text, charindex('/', @text)+ 1) - charindex('/', @text) - 1) this gets text between first slash (+1 position exclude slash), position of second slash minus position of first slash minus 1 (to remove first slash). basically: print substring(@text, 11 ...

schema - Create and change to new keyspace with Cassandra cqlengine? -

let's connect cassandra cluster: cqlengine.connection.setup('hostname', 'some_keyspace') the method requires know @ least 1 existing keyspace. if don't? what if wish check if keyspace exists , create otherwise? we create keyspace this: cqlengine.management.create_keyspace('keyspace_name', some_other_args) so there 3 questions here: how connect without supplying keyspace? what correct way create new keyspace (what other arguments besides name of keyspace)? how switch keyspaces using cqlengine? you need 'default' keyspace. can exists. think cassandra have default keyspaces. the correct way create keyspace using create_keyspace_simple command: from cassandra.cqlengine.management import create_keyspace_simple create_keyspace_simple(keyspace_name, replication_factor) to change keyspace: from cassandra.cqlengine import models models.default_keyspace = keyspace_name assuming connection imported , have defined k...

Using values from PHP in JavaScript -

i use value php in javascript, it's not working. fetch data database , store in php variable , conditional formatting. need use data in javascript validation. the value required me $date = date('y-m-d'); if pass value json encode alert function not working... $(document).ready(function() { alert("hi"); var array = php print(json_encode($date)); }); whereas if alert function without... var array = php print(json_encode($date)); ; ...it works fine. <script type="text/javascript" src="assests/js/jquery-1.10.2.js"></script> <script type="text/javascript"> $(document).ready(function() { alert("hi"); var array = '<?php print(json_encode($date)); ?>'; }); </script> </head> <body> <form action="majorprocess.php"> <?php $dbconn = mysql_connect('localhost', 'root','' ); if(!$dbconn) { die(mysql_error()); } else { $date = date...

Using IF Statements on Vectors in R -

so i'm trying code fraud detection algorithm using r. have numerical value (fraudval) proportional how user committing fraud in vector. how create new column state if it's high, medium, or low, given sensitivity of 'fraudval' (i.e. if 0.6 > 'fraudval' > 0.3, it's low, if in between 0.6 , 0.8 med, , and high if it's 0.8 or higher. here input , expected output sensitivities are: low - 0, low - 0.3, medium - 0.6, high - 0.8 input (df) : id fraudval 1 0.4 2 0.8 3 0.2 4 0.6 output (df) : id fraudval test 1 0.4 low 2 0.8 high 3 0.2 low 4 0.6 medium thanks in advance! :d i use cut : r> df$test <- cut(df$fraudval, c(0,.3,.6,.8,inf), + c("very low", "low", "med", "high"), right=false) r> d id fraudval test 1 1 0.4 low 2 2 0.8 high 3 3 0.2 low 4 4 0.6 med

c# - TransformToAncestor doesn't always work -

i'm working on first wpf app. i'm getting data xml file , based on file populate stackpanel dynamically created buttons. later on need retrieve x coordinate specific button use method: private double getstationcoordinates(int stationidx) { foreach (button station in stationmap.children) { if (stationidx != convert.toint16(station.tag)) continue; var relativepoint = station.transformtoancestor(application.current.mainwindow).transform(new point(0, 0)); //console.writeline(stationidx + " " + relativepoint.tostring()); return relativepoint.x; } return 0; } and use coordinates paint points in other panel under buttons. worked fine until set main window property sizetocontent="widthandheight" now - when paint points first time after launching app (and after populate stackpanel buttons) (points) receive same x coordinate - 11. when hit refresh button ok.but first ...

java - JVM EXCEPTION_ACCESS_VIOLATION after few hours -

jboss crashes abruptly @ regular interval. below crash report generated jboss.. debug issue appreciated.. hs_err_pid207996.log # fatal error has been detected java runtime environment: # exception_access_violation (0xc0000005) @ pc=0x000000006db02f8e, pid=207996, tid=183144 jre version: 6.0_39-b04 java vm: java hotspot(tm) 64-bit server vm (20.14-b01 mixed mode windows-amd64 compressed oops) problematic frame: v [jvm.dll+0x242f8e] --------------- t h r e d --------------- current thread (0x0000000012fcd800): javathread "rmi tcp connection(4)-10.150.42.92" daemon [_thread_in_vm, id=183144, stack(0x000000000dbf0000,0x000000000dcf0000)] siginfo: exceptioncode=0xc0000005, reading address 0x0000000000000025 stack: [0x000000000dbf0000,0x000000000dcf0000], sp=0x000000000dcee050, free space=1016k native frames: (j=compiled java code, j=interpreted, vv=vm code, c=native code) v [jvm.dll+0x242f8e] [error occurred during error reporting (printing native...

java - Connection refused to localhost with Spring Rest-Template -

i want use spring rest-template connect rest-service. application looks more or less example here: https://spring.io/guides/gs/consuming-rest/ but when try connect service on localhost i/o error connection refused. plain curl call same url there no problem. can be?

c# - Line element doesn't get properly focus when selected -

Image
i have .xaml file, looks like: <resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:lineelement="clr-namespace:...lineelement" xmlns:mvvmwpfbehavior="clr-namespace:gno.libraries.wpfmvvm.behaviors.focus;assembly=gno.libraries.wpfmvvm"> <datatemplate datatype="{x:type lineelement:lineelementviewmodel}"> <grid> <line stroke="darkblue" x1="{binding px1}" y1="{binding py1}" x2="{binding px2}" y2="{binding py2}" strokethickness="3" visibility="visible" stretch="fill"> </line> </grid> </datatemplate> </resourcedictionary> if have set coordinates in l...

java - How do I use layered pane? -

i wanted have backround image , on top of wanted have image user can click on , stuff. how use properly? b.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent e) { p.setvisible(false); p2.setvisible(false); jlayeredpane lp2=new jlayeredpane(); jlayeredpane lp=new jlayeredpane(); imageicon image=new imageicon(getclass().getresource("800x800.jpg")); jlabel lbl=new jlabel(image); imageicon image2=new imageicon(getclass().getresource("imageyea.jpg")); jlabel lbl2=new jlabel(image2); lp2.add(lbl2); lp.add(lbl); add(lp2); add(lp); } }); first off think don't need 2 layered panes. make 1 , on pane draw 2 pictures. overlapping predefined offset. can see how it's done in official oracle tutorial here: layeredpanedemo.java . if want m...

jquery - jqvmap - onRegionClick changes color of country -

so far plugin works quite nice...got no probs @ all. noticed "onregionclick" changes color of choosen country , prevent that. ^^ config: jquery('#vmap').vectormap({ ... backgroundcolor: '#ffffff', ... color: '#f3f3f3', hovercolor: '#fcd452', selectedcolor: '#397acb', multiselectregion: true, ... after loading map every selected country got nice #397acb blue after clicking on it, changes #f3f3f3...how prevent that? thx! ok, got kind of workaround. onregionclick: function (event, code, region) { jquery('#jqvmap1_'+code).css('fill', '#397acb'); } this way prevent him altering color, although still know why changes color on click. ^^ maybe 1 day.....

c++ - GCC 4.9 ambiguous overload template specialization -

i'm running issue gcc 4.9.2 (with -std=c++11) not compiling piece of code error message being call of overloaded 'insertdataintoinputmap(int&, boost::shared_ptr&)' ambiguous the code compile msvc 2013 #include <iostream> #include <map> #include <boost/shared_ptr.hpp> struct proxy { typedef std::map<int, int> inputdatamap; int a; }; template<class c, class d> void insertdataintoinputmap( const typename c::inputdatamap::key_type& key, const d val) { std::cout << "not shared\n"; } template<class c, class d> void insertdataintoinputmap( const typename c::inputdatamap::key_type& key, const boost::shared_ptr<d> val) { if (val) { std::cout << "shared\n"; } } int main() { int a; boost::shared_ptr<double> x(new double(4.5)); insertdataintoinputmap<proxy>(a, x); } while following compile both gcc , ...

Expose music library using http on iOS -

anybody know how expose iphone music library using http server on ios? how path music files on iphone? you can : mpmediaitem *item = musicplayer.nowplayingitem; avurlasset *song_asset = [avurlasset urlassetwithurl: [item valueforproperty: mpmediaitempropertyasseturl] options:nil];

javascript - Why are anonymous, self-executing function used instead of just writing the commands -

i have searched similar questions on site dont answer particular query. hey, wondering why use: (function(){a+b;})(); instead of: a+b; thing see used in tutorial i'm following: link edit: " real code better context": (function() {var requestanimationframe = window.requestanimationframe || window.mozrequestanimationframe || window.webkitrequestanimationframe || window.msrequestanimationframe; window.requestanimationframe = requestanimationframe; })(); edit: didn't know called iife, thank links. just encapsulation.for not visible in outer scope.

html - Opacity when hovering DIV or other Element -

i want apply opacity: 1; paragraph when hovering on (i have figured out) and when hover header above it. this css .testh { font-family: impact; text-align: center; font-size: 50px; transition: 1s; } .testp { text-align: center; opacity: 0.5; font-size: 18px; transition: 1s; } #testhdiv:hover { opacity: 1; } .testp:hover { opacity: 1; } my html <div id="testhdiv"><h1 class="testh"><b>< ></b></h1> <p class="testp">text , text, more text<br>bla bla bla bla</p> </div> so, can see try opacity paragraphs current 0.5, 1 when hovering div - idea is: being able hover "box"/the div, , text becomming less transparent. though think opacity on hover of div not work div defined div, not text, , therefor can't transparent? i have been struggling while now. wanting this: http://demo.web3canvas.com/themeforest/flathost/onepage/...

android - Can I use private API in my application then upload to Google play market? -

in application, used snippet code below public static void setmobiledataenabled(context context, boolean enabled) { try { final connectivitymanager conman = (connectivitymanager) context.getsystemservice(context.connectivity_service); final class<?> conmanclass = class.forname(conman.getclass().getname()); final field iconnectivitymanagerfield = conmanclass.getdeclaredfield("mservice"); iconnectivitymanagerfield.setaccessible(true); final object iconnectivitymanager = iconnectivitymanagerfield.get(conman); final class<?> iconnectivitymanagerclass = class.forname(iconnectivitymanager.getclass().getname()); final method setmobiledataenabledmethod = iconnectivitymanagerclass.getdeclaredmethod("setmobiledataenabled", boolean.type); setmobiledataenabledmethod.setaccessible(true); setmobiledataenabledmethod.invoke(iconnectivitymanager, enabled); } catch (exception e) { e.printstacktrace(); } can know when used co...

ios - Obj C - NSUserDefaults won't give back values to calculate, after loading the view -

i stuck little problem. have basic calculating app. viewcontroller.m #import "viewcontroller.h" @interface viewcontroller () <uitextfielddelegate, uialertviewdelegate> @end @implementation viewcontroller -(void)textfielddidendediting:(uitextfield *)textfield { self.currentsettings = _currentsettings; [self calculatetheprice]; } -(void)calculatetheprice { float wynik = self.currentsettings.kwh * self.currentsettings.price; self.pricelabel.text = [nsstring stringwithformat:@"%.02f %@", wynik , self.currentsettings.currency]; } settingsvc.m #import "settingsvc.h" @interface settingsvc () <uitextfielddelegate> @end @implementation settingsvc #pragma mark - userdefaults implementation -(void)viewwillappear:(bool)animated { [self createcurrencyarray]; nsuserdefaults *pricedef = [nsuserdefaults standarduserdefaults]; nsstring *pricedeftext = [pricedef stringforkey:@"pricecall"]; _pricetextfi...

arduino - ble peripheral coded for exclusive central / master use -

being of newbie wondering if there way hard-code on peripheral allow single unique central/master connect.....? i.e. / eg have ‘simple chat’ arduino app on redbearlab blend-micro (which intensive purposes same arduino uno ble shield) , want 1 single / unique phone able connect , therefore work it. my understanding gap handles security features during ble connection. therefore, there way ‘code’ peripheral device in / below 1 of following includes: spi.h ? boards.h ? eeprom.h ? rbl_nrf8001.h (or similar) ? other? didn't quite answer restricting ble peripheral device connect 1 master or am stuck connecting coding peripheral in other way in gatt profile (i think) predefined unique central/master (how/where code?). many thoughts in advance being of newbie wondering if there way hard-code on peripheral allow single unique central/master connect.....? theres "advertising filter policy" specified in bluetooth core v4.0 specification....

actionscript 3 - How can debug in Flash Develop? -

Image
i installed flash develop , made new project in as3. when press f5 receive error: the project doesn`t have valid sdk defined.please check sdk tab in project properties how install sdk? he happened problem? you show me tutorial how can solve problem? develop flash sdk not come installed with? thanks in advance! you may not have installed sdk when installed program. when install flash develop menu should appear allows install pieces needs in order run (including sdk). best bet uninstall flash develop , reinstall , see if window pops let install sdk. if don't want uninstall flash develop, when open flash develop, click "project" on top of window , click "properties" on drop down menu. click "sdk" tab , see if have sdk in "installed sdk(s)" window. i, instance, have "default (flex 4.6.0, air 17.0)" in "installed sdk(s)" window. if it's not showing sdk, have download , install 1 , apply on "s...

java - Remove HTML tags from a String with content -

i have string = "195121<span class="up">+432</span>" . need regex remove tags content (result string = "195121" ) you may try below capturing group based regex. string.replaceall("(?s)<(\\w+)\\b[^<>]*>.*?</\\1>", "");

c# - AvalonEdit : How to modify the xshd file to change elements atrribute -

i try modify xshd file change attribute foreground of element color programmatically in c#. tried used xmlatrribute have access to , change didnt work. how can change ? thats xshd file below <?xml version="1.0"?> <syntaxdefinition name="boo" extensions=".boo" xmlns="http://icsharpcode.net/sharpdevelop/syntaxdefinition/2008"> <color name="string" foreground="red" /> <color name="comment" foreground="green" /> <!-- main ruleset. --> <ruleset> <span color="comment" begin="//" /> <span color="comment" multiline="true" begin="/\*" end="\*/" /> <span color="string"> <begin>'</begin> <end>'</end> <ruleset> <!-- nested span escape sequences --> <span begin="\\" end="." /> </ruleset> </span...

php - Remove duplicate data from database -

i new in php. have fetch large amount of data database of duplicate data removed. here database: http://i.imgur.com/n6ixlaf.png output : http://i.imgur.com/yqitox7.png here start time 10 3 pm , rest end time. when start/end time 2 data found fast data counted i supose know mysql query... in php do: $mysqlresult = query (....,' select distinct ac_no ?¿?¿? order stime desc '); foreach ($mysqlresult $key=>$var){ query(...' delete ?¿?¿? t t.ac_no = '.$var['ac_no'] .' , t.stime != '.$var['stime']); now have deleted database everything. analyst code, please correctly on php (and please, log , comment something)

android - Fragment's onDestroyView not called on back button press -

i have 3 fragments in application: fragment a, b , c. steps: i replacing b , keeping in backstack. i replacing b c , not keeping b in backstack. i pressing button, on pressing button a's oncreateview , onstart called (as on stack) the problem fragment c's onstop, ondestroyview etc not called , fragment not visible on screen , fragment c visible (as it;s view not destroyed). i believe there misunderstanding of stack. when replace b, put transaction a->b in stack, not fragment. stack knows when user presses button, have rollback transaction: destroy b , recreate a. in case, replacing c b , you're pressing button: recreated , b cannot destroyed since doesn't exist. maybe can find solution listening stack events using fragmentmanager.addonbackstackchangedlistener() , don't know if fits requirement.

Receiving phone calls in Swift iOS -

is there way receive phone calls app , decline sending sms progmatically? or receive calls , switch on autospeaker? pseudo code of want like: if (someone calling) { if (someone = father) { autoreply("dad, i'm on meeting. call in 1 hour") } } there lot of information how phone call, less receiving it. response appreciated! sorry perhaps silly question :) i'm newbie in ios swift development. unless working on jailbroken app, this not possible in way . have understand ios development limited apple's restrictions , guidelines. apps sandboxed , can't affect system's behavior in way (excepted through ios public api's, , none of them offers hook phone call events).