Posts

Showing posts from January, 2013

c++ - Need chars to void function its address? -

need specify address of char array opcodes (&opcodes)? i'm casting void pointer, see indeed specify again address (fp points address opcodes -> points opcodes). char opcodes[] = "\x41\x41..."; void main() { void(*fp) (void); fp = (void *)&opcodes; // opcodes or &opcodes fp(); } perhaps. the c standard nor c++ standard have answer this. both of them, it's undefined behavior. might vary implementation implementation, if it's possible. if give specific compiler, might able answer it.

404 while using Spring cloud FeignClients -

this setup: first service(flightintegrationapplication) invoke second service(baggageserviceapplication) using feignclients api , eureka. project on github: https://github.com/idanfridman/bootnetflixexample first service: @springbootapplication @enablecircuitbreaker @enablediscoveryclient @componentscan("com.bootnetflix") public class flightintegrationapplication { public static void main(string[] args) { new springapplicationbuilder(flightintegrationapplication.class).run(args); } } in 1 of controllers: @requestmapping("/flights/baggage/list/{id}") public string getbaggagelistbyflightid(@pathvariable("id") string id) { return flightintegrationservice.getbaggagelistbyid(id); } flightintegrationservice: public string getbaggagelistbyid(string id) { uri uri = registryservice.getserviceurl("baggage-service", "http://localhost:8081/baggage-service"); string url = ...

Why does perl only dereference the last index when the range operator is used? -

i have array, @array , of array references. if use range operator print elements 1 through 3 of @array , print @array[1..3] , perl prints array references elements 1 through 3. why when try dereference array references indexed between 1 , 3, @{@array[1..3]} , perl dereferences , prints out last element indexed in range operator? is there way use range operator while dereferencing array? example code #!/bin/perl use strict; use warnings; @array = (); foreach $i (0..10) { push @array, [rand(1000), int(rand(3))]; } foreach $i (@array) { print "@$i\n"; } print "\n\n================\n\n"; print @{@array[1..3]}; print "\n\n================\n\n"; @{@array[1..3]} strange-looking construct. @{ ... } array dereference operator. needs reference, type of scalar. @array[ ... ] produces list. this 1 of situations need remember rule list evaluation in scalar context. rule there no general rule. each list-producing operator own thin...

java - How to add library to Vert.x's FatJar? -

i building app using vert.x ver. 2.1m6. , i'm using vert.x's fatjar feature have app portable. question is...how add additional libraries lib folder vert.x creates upon running fatjar? the simple way create fatjar use maven shade plugin. here sample of how can used. http://vertx.io/blog/my-first-vert-x-3-application/

Python TCP Sockets Not Working Properly -

not long ago asked this question. surprised no 1 came answers, pretty sure issue rare. yesterday, self-diagnosing issue, began connecting dots. twisted tcp server won't work, idle fails @ startup because of "socket error" , returns message: "idle subprocess: socket error: no connection made because target machine actively refused it", , same error when try running (local) tcp client connecting (local) tcp server. so came conclusion yesterday, these weren't individual issues, rather larger issue creating , running tcp endpoints using python sockets. keep in mind, udp servers , clients run both on local network , locally work, don't think it's problem socket module whole, tcp side of things. some info on computer: windows 64bit, running python 2.7.9 (for reason, 32bit), laptop connected network via (built in) wireless card. isp comcast (if makes difference), , router/modem (it's all-in-one) technicolor provided comcast (again, if makes dif...

Append in Python clearing list -

i have piece of code: bincounts = [] in range(len(bins)): bincounts.append(0) where bins array looks this: ['chry', '28626328', '3064930174', '28718777', '92449', '49911'], ['chry', '28718777', '3065022623', '28797881', '79104', '49911'], ['chry', '28797881', '3065101727', '59373566', '30575685', '49912']] when run range(len(bins)) in python's interactive mode, get: [0, 1, 2] but when test whole piece of code, i'm getting [0,0,0] i believe should getting [0, 1, 2, 0] this resulting in division 0 error later on down line. why happening? how can fix it? appreciate guidance! you receiving list of zeros because of line: bincounts.append(0) each time through loop, append 0 bincount if goal put 0 @ end of list, pull line out of for loop for in range(len(bins)): # logic bincounts.append(0)...

c# - How to bind a dictionary value to a column in asp.net mvc -

i using active directory authentication library list of users in active directory. view bound user class in library. @using microsoft.azure.activedirectory.graphclient @model ienumerable<user> @{ viewbag.title = "index"; layout = "~/areas/globaladmin/views/shared/_layoutglobaladmin.cshtml"; } <h2>usuarios</h2> <div class="wrapper wrapper-content animated fadeinright"> <div class="row"> <div class="col-lg-12"> <div class="ibox float-e-margins"> <div class="ibox-title"> <h5>lista de usuarios</h5> <div class="ibox-tools"> @html.actionlink("create new", "create", null, new { @class = "btn btn-primary btn-xs" }) </div> </div> <div c...

java - jdbc connectivity error with hive2 -

i trying test connectivity hive2 using jdbc. getting authentication failled error credentials correct. the error is: java -cp .:/users/apps/ewbeiu/wbeeappp/hivejdbcclient/* hivejdbcclient slf4j: failed load class "org.slf4j.impl.staticloggerbinder". slf4j: defaulting no-operation (nop) logger implementation slf4j: see http://www.slf4j.org/codes.html#staticloggerbinder further details. not able connect database pls check settings java.sql.sqlexception: not open connection jdbc:hive2://edbd.corp.com:10000/wbe: peer indicated failure: error validating login exception in thread "main" java.lang.nullpointerexception @ hivejdbcclient.executequery(hivejdbcclient.java:49) @ hivejdbcclient.main(hivejdbcclient.java:58) the complete code folllows import java.sql.*; import java.text.parseexception; public class hivejdbcclient { private static final string driver_name = "org.apache.hive.jdbc.hivedriver"; pri...

sql - Implode separate date of birth values from php form -

ok i'm out of ideas , have reached end point in research. have registration form birthdate select fields example below: <div class="row"> <div class="col-xs-2"> {!! form::selectmonth('dob_month', 1, ['class'=> 'form-control']) !!} </div> <div class="col-xs-2"> {!! form::selectrange('dob_date', 1, 31, 1, ['class'=> 'form-control']) !!} </div> <div class="col-xs-2"> {!! form::selectyear('dob_year', 1930, 1997, 1991, ['class'=> 'form-control']) !!} </div> </div> of course in laravel's blade template. as can see 3 separate select forms dob_month, dob_date , dob_year , values onto mutator thats in user model private function setdobattribute($dob){ $dobstring = ['dob_year', 'dob_month', 'dob_date']; $this-...

Django request.data dictionary returns last item instead of list for post data from a form with checkboxes -

i have form contains checkboxes so: <form action="#" method="post"> <input type="checkbox" name="languages" value="">all<br> <input type="checkbox" name="languages" value="en">en<br> <input type="checkbox" name="languages" value="de">de<br> <input type="checkbox" name="languages" value="ru">ru<br> <input type="submit" value="preview"> </form> when send it, can check , see data under request.data looks this: mergedict(<querydict: {u'languages': [u'', u'en', u'de']}>, <multivaluedict: {}>) i managed selected language list using: dict(request.data.dicts[0].iterlists())['u'languages'] but seems ridiculous. trying different way strange behavior. example when try access request...

.net - What is the default location of edmx file VS 2013 -

i generated models using entity framework 6, visual studio 2013, mvc 5. have since changed of fields in database , update models. i'm trying follow instructions here , realize .net 4, not able find different 4.5. the real problem unable locate .edmx file, after searching solution. if try add new ado.net item named default('model1') wizard states there file name. where should looking .edmx file? or on entirely wrong path finding model update wizard? the .edmx file hidden default. clicking 'show files' icon has made accessible.

Small Tabs appear using android.support.design.widget.TabLayout -

i'm trying create multiple tabs fragment each tab. have managed 2 tabs appear @ corner of layout. i'm unable divide width of tab layout equally tabs. code : activity_main.xml <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity" android:id="@+id/mainlayout"> <android.support.design.widget.tablayout android:id="@+id/sliding_tabs" style = "mycustomtablayo...

sql - Elasticsearch Join columns from different index with condition -

i have 2 different indexes in elasticsearch, indx1 , indx2 have indexed sql database using river plugin. indx1 ---------- id | amt 1 2 2 3 3 2 1 9 2 4 ---------- indx 2 ---------- id | name 1 alex 2 joe 3 mary ---------- i want create new index calculate average amount indx1 , join in single index. final structure of index should indx_final ---------- id | name | avg amt | status 1 alex 5.5 high 2 joe 3.5 med 3 mary 2.0 low ---------- the status set according average amount , if avg amt > 4 , status = high, if avg amt >3, status = med, if avg amt <2.5 ,status = low. possible in elasticsearch only? if not possible have calculation in sql , index data again. any appreciated. thanks!

javascript - JQGRID , get all rows after filtering -

i not able rows { paginated } after filtering jqgrid . tried > var mydata = grid.jqgrid('getgridparam', 'data'); var mydata = grid.jqgrid('getrowdata'); but first option gives rows , these unfiltered rows. second 1 returns filtered rows first page. in fiddle example if type test in client columns there 6 filtered results, first option returns 7 records , , second 1 returns 5 records { ie first page}. need show 6 filtered records. results logged in console. here fiddle the solution of problem depend on fork of grid use. free jqgrid fork based on jqgrid 4.7 (see readme , wiki additional information). current version of free jqgrid 4.9. free jqgrid supports lastselecteddata parameter can use instead of data informational need. see the demo . if have use old jqgrid version , can't update free jqgrid can follow the answer . shows how 1 can "subclass" select method of internal $.jgrid.from class of jqgrid. after sub...

Parameters needed to connect to a MySql Database using C# -

when want connect database using c# visual studio 2013, provide following parameters "connectionstring" using "mysqlconnection": string server="localhost"; string database="database123"; string uid = "*****"; string password = "******"; string port = "3306"; but noticed if don't provide "database" or "port" works fine too. question should 1 provide establish proper connection? or considered sufficient info establish connection? i use this. sqlconnection connection = new sqlconnection("server=somthing; database=something; user id=******; password=******");

javascript - Emscripten: emmake generating .js files -

according emscripten docs make generates linked llvm bitcode. not automatically generate javascript during linking because files must compiled using same optimizations , compiler options — , makes sense in final conversion bitcode javascript. which great , want do. however, running emscripten compile openjpeg .jp2 library generates 4 uncompressed ( -o0 ) .js files in 5-6mb range, , 3 identical bytecode .so files of 514kb, don't seem contain code need. when run them through emcc come out 141kb, without _main function or recognizable, , don't behave same other .js files. what need change generate correct bytecode emmake command rather .js files? emcmake cmake completes ok , emmake make works, don't have option try various optimizations or of options emcc give. i'm attempting compilation on lubuntu 15.04 in vbox under win 8. first emscripten project other tutorials. i'm not familiar c or c++ or compilation in general (though can compile proje...

javascript - How to create dynamic href in react render function? -

i rendering list of posts. each post render anchor tag post id part of href string. render: function(){ return ( <ul> { this.props.posts.map(function(post){ return <li key={post.id}><a href='/posts/'{post.id}>{post.title}</a></li> }) } </ul> ); how do each post has href's of /posts/1 , /posts/2 etc? use string concatenation: href={'/posts/' + post.id} the jsx syntax allows either use strings or expressions ({...}) values. cannot mix both. inside expression can, name suggests, use javascript expression compute value.

java - Separating JPA information from POJO -

i working on project have entities persisted database using jpa. using maven project management framework. wondering if possible create 1 project pojos , persistence definitions , "combine" 2 single output contains pojos , persistence information. basically trying separate code pojos persistence definition. because pojos may reused several different projects may or may not need persist them , may or may not want change persistence information. (similar not quite same is possible build jpa entity extending pojo? ) i have 2 ideas on how might able it. if use pojos in web application provide persistence.xml , map classes in project , add dependency project containing pojos. if wanted create single jar file containing persistence information , pojos, think use shade plugin? is there other way merge 2 maven projects single output , reasonable thing want do? if remember correctly, annotations not have on classpath if you're not using them. annotated classes c...

echo several rows and column of mysql query with php -

i echo rows , column mysql query search, here current php: <?php header("content-type: text/plain"); mysql_connect('localhost','root','') or die('cannot connect mysql server'); mysql_select_db('dbchemalive') or die('cannot connect database'); $inputdata=(isset($_get["data"])) ? $_get["data"] : null; $data=mysql_real_escape_string(filter_var($inputdata, filter_sanitize_special_chars)); $q=mysql_query("select comptype, method, base geoandenergies smiles='".$data."' ") or die(mysql_error()); $n=mysql_num_rows($q); //not mysql_fetch_row, not return count array if($n>0) { // $info=mysql_fetch_row($q); $val=''; while($info=mysql_fetch_row($q)) { if($val!='') $val.=' < '; $val.= $info[0]; } echo $val; } ?> it echoing row1col1 < row2col1 < .... rowncol1, row1col1 < row1col2 ...

ios - Custom Tab Bar in Xcode/Swift with 3 rounded buttons detached from the bottom of the screen -

Image
so i'd create tab bar isn't tab bar, work tab bar in way send user other pages when clicking on , present design different. 3 tabs / buttons detached bottom of screen unlike regular ios tab bars , button 3 circles icons in it. possible such thing in ios ? or aps have follow apple's standards lot!

mysql - How can I get the latest two dates from a single column, in a single table, for two separate results of a WHERE clause? -

i have query returns 5 columns. one of columns shows latest date value row 1 column contains either string "seller-contact" or "buyer-contact". the original code works fine, , looks this. select trim(p.title) `property address`, trim(us.name) `staff`, date_format(from_unixtime(max( n.datecreated)), '%d-%m-%y') `last contact note`, datediff( date_format(from_unixtime(unix_timestamp(now())), '%y-%m-%d'), date_format(from_unixtime(max(n.datecreated)), '%y-%m-%d') ) `days since last note` ias_property `p` left join ias_note_stream `ns` on ns.target_id = p.id left join ias_note `n` on ns.note_id = n.id left join ias_user_staff `us` on p.user_staff_id = us.id p.status = 'sold' , p.isarchived = 0 , us.position = 'sp' , (n.data '%buyer-contact%' or n.data '%seller-contact%') group p.id order max(n.datecreated) asc i tried achieve above using 2 subqueries each result. not fail or result ...

java - Variable has not been initialised -

public class color { private int red; private int green; private int blue; /** * turns color equivalent gray value. */ public void turngray() { int red = (int)(0.2126*red + 0.7152*green + 0.0722*blue); int green = red; int blue = red; } when try compile program returns variable red might not have been initialised. why dosn't code reassign red value on lhs of equation? you re-declaring red , green , blue variables local variables in method, hiding instance variables having same names. local variable has no default value , can't accessed before initialized. since have instance members same names, i'll assume meant use them : public void turngray() { red = (int)(0.2126*red + 0.7152*green + 0.0722*blue); green = red; blue = red; } in code, instance variables used. now, hope initialize these variables in code didn't show us. otherwise they'll have default value of 0, , stay 0 when execute turngray .

Getting this error android.view.InflateException: Binary XML file line #2: Error inflating class <unknown> -

am new android one facing error after adding linear layout fragment in main layout. before working fine fragment using 5.5" device test app. 07-22 19:48:01.775 28504-28504/com.milkywaygalaxy.mymaps e/androidruntime﹕ fatal exception: main process: com.milkywaygalaxy.mymaps, pid: 28504 java.lang.runtimeexception: unable start activity componentinfo{com.milkywaygalaxy.mymaps/com.milkywaygalaxy.mymaps.mapsactivity}: android.view.inflateexception: binary xml file line #2: error inflating class <unknown> @ android.app.activitythread.performlaunchactivity(activitythread.java:2198) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2247) @ android.app.activitythread.access$800(activitythread.java:141) @ android.app.activitythread$h.handlemessage(activitythread.java:1210) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.mai...

javascript - animation Flip div when clicked -

i trying make divs flip whenever click on them. i'm not sure why doesn't work. please help. here demo of code. http://langbook.co/testicles-1-2-flashcards/ <!doctype html> <html> <head> <style type="text/css"> #flip3d{ width:240px; height:200px; margin:10px; float:left; } #flip3d > #front{ position:absolute; transform: perspective( 600px ) rotatey( 0deg ); background:#fc0; width:240px; height:200px; border-radius: 7px; backface-visibility: hidden; transition: transform .5s linear 0s;} #flip3d > #back{ position:absolute; transform: perspective( 600px ) rotatey( 180deg ); background: #80bfff; width:240px; height:200px; border-radius: 7px; backface-visibility: hidden; transition: transform .5s linear 0s;} </style> <script> function flip(el){ el.children[1].style.transform = "perspective(600px) rotatey(-180deg)"; el.children[0].style.transform = "perspective(600px) rotatey(0deg)";} var vlib = document.g...

cloudfoundry - Setting up a windows VM in Cloud Foundry -

Image
my company evaluating cloud foundry pass solution. morning watching “why picked cf basis our public cloud multi-tenant platform” presentation on cfsummit.com. during presentation showed . image showed split there cf environment 3 sections, warden container, bosh managed vm’s , other vm’s. in other vm’s had windows vm. understanding cf vm’s had ubuntu. can setup windows vms in cloud foundry? the presentation can found http://www.cfsummit.com/sites/cfs2015/files/pages/files/cfsummit15_jeroen.pdf . image on slide 5. as thank help! the next major release of cloud foundry, code named diego, support deployment of containers use operating systems other default ubuntu. out of box, diego support containers running windows server 2012 underlying operating system, , support containers can deploy , run docker images. there's fantastic talk describes technology in detail here: https://www.youtube.com/watch?v=ssxi9eonbvs

Strongloop: Polymorphic HasAndBelongsToMany relation with uuids -

i try use polymorphic hasandbelongstomany relation while using uuids, too. problem is, can't teach strongloop use id's string type instead of number in necessary many-to-many-table. leads sql-errors while creating new relations. let me explain example: i have 2 models: cartcollection , cart. collection should have different kind of carts including cart itself. cart , cartcollection have uuids instead of simple ids. defining property in model-json works far. problem polymorphic many-to-many-relation between them. try use polymorphic hasandbelongstomany relation realize that. in table try override id-type well. this json-code: { "name": "salecartcollection", "plural": "salecartcollections", "base": "persistedmodel", "idinjection": true, "options": { "validateupsert": true }, "properties": { "id": { "type": "string...

sql - Adding a value to a 'datetime2' column caused an overflow -

i know why i'm seeing error, it's because of locationdeletiondate '9999-12-31 00:00:00.0000000', , adding 90 days locationdeletiondate (as in query) causes error in title: ...where (bpj.jobstatus = 'live') , (l.locationeffectivedate <= sysdatetime()) , (dateadd(d,90,l.locationdeletiondate) >= sysdatetime())... i guess need conditional case in clause ensure date not error if 90 days added? or there more elegant way? you can use approach solve issue ...where (bpj.jobstatus = 'live') , (l.locationeffectivedate <= sysdatetime()) , (l.locationdeletiondate >= dateadd(d, -90, sysdatetime())... in case solve performance issue. predicate becomes sargable.

ruby - Rails join, need both tables in result -

Image
i have 2 tables users (id, name ...) , user_group_users (user_id, usergroup_id) i try join on both tables, need in result user.id user.name user_group_users.user_id, user_group_users.user_group_id tried this: @users = current_client.users.joins('left inner join user_group_users on user_group_users.user_id = users.id') but in result user_group_users.user_id, user_group_users.user_group_id missing how can solve that? models: class usergroupuser < activerecord::base belongs_to :user_group belongs_to :user end class usergroup < activerecord::base has_many :user_group_users has_many :users, :through => :user_group_users end class user < activerecord::base has_many :user_groups has_many :user_group_users, :through => :user_group_users end i want generate list, users: and need user_id , usergroup_id usergroupusers set switcher on if user in group. you're trying , not letting rails work it's intended you. should re...

How to make console view part of Eclipse frame -

Image
i accidentally detached console view eclipse frame separate window. i've been trying figure out how make them part of same frame again can't figure out life of me. searched through eclipse pages , couldn't find answer either. how this? this might help: 1. find current perspective. 2. right click on it. 3. click reset.

arrays - python: creating numpy nonzero index, value pair -

i can index of non-zero numpy arrays follows: a = np.array([0., 1., 0., 2.]) = np.nonzero(a) this returns (array([1, 3]),) . can corresponding values as: v = a[i] now create list each of (index, value) tuples. guess 1 way write for loop follows; l = list() x in range(0, len(v)): l.append((i[0][x], v[x])) however, wondering if there better way without writing loop. you use list comprehension l = [(x, v[x]) x in i[0]] or use zip other answers suggest

Add a textbox to a wpf canvas in a position chosen by the user (C#) -

i add functionality wpf c# app allows user following: when press button, textbox created in corner of canvas, when you're done typing , press button again, next click set new position of textbox on canvas. i tried writing code doesn't solid, plus error explained below: int = 0; system.windows.point currentpoint = new system.windows.point(); private void button1_click(object sender, routedeventargs e, system.windows.input.mouseeventargs e2) { = + 1; if (i == 1) { textblock tb = new textblock(); tb.text = "successfull"; tb.background = brushes.white; tb.name = "textb"; mycanvas.children.add(tb); canvas.setleft(tb, 10); canvas.settop(tb, 10); } if (i == 2) { thread.sleep(500); while (e2.leftbutton != mousebuttonstate.pressed) { thread.sleep(50); } if (e2.leftbutton == mousebuttonstate.pressed) { c...

laravel php artisan not working -

i'm working on project laravel. today php artisan didn't work anymore. gives me error: [symfony\component\debu\exception\fatalerrorexception] syntax error, unexpected end of file already googled lot can't realy find answer. today i've removed "public" url perhaps has changed index.php this: require __dir__.'/local/bootstrap/autoload.php'; and in public folder moved root.

ios - How do I create an RGB CIImage from 3 8-bit gray images? -

i have 3 ciimage objects gray 8-bpp images meant 8-bit r, g, , b channels of new image. aside low-level image pixel data operations, there way construct ciimage (from filters or other easier way) i realize can looping through pixels of new rgb image , setting gray channels have -- wondering if there more idiomatic way work channels. for example, in pillow python, it's image.merge([rchannel, gchannel, bchannel]) -- know how code pixel access way if there no built in way. the book, core image swift , covers how , provides code here: https://github.com/flexmonkey/filterpedia/blob/master/filterpedia/customfilters/rgbchannelcompositing.swift the basic idea need provide color kernel function in gpu shader language , wrap in cifilter subclass. note: code not copied here because it's under gpl, incompatible license stackoverflow answers. can follow link if want see how it's done, , use if it's compatible license.

Javascript or PHP to display data? -

i'm using php display data on page using echo , thought faster javascript. i'm wondering though if should passing data page via json , have javascript show data instead. think give me more flexibility. current code: <span class="label">variable: </span><?php echo $model->variable ?> with advancement in js frameworks, more practical render data via javascript these days? i advise separating javascript , html php , go structuring application in restful design. this gives high level of flexibility treating server side code api javascript on front end can make calls (using ajax) in order retrieve data. make program easier expand can work on server side , client side separately , not accidentally adversely affect other parts of application.

ubuntu - Azure: managing multiple VMs in the same availability set -

recently learned not advised use single vm run server applications because microsoft can take vm offline when updating causing services unavailable time. instead microsoft advises use multiple vms , place these in same cloud service , availability set. microsoft ensure @ least 1 vm stay online while updating. (correct me if wrong far). like said use 1 vm. use git deploy updates of applications , can use ssh check if on vm running expected. locally run db self contained easy manage. vm use simple ubuntu 14.10 server. how work when have multiple vms? need log in using ssh every server make change? need push several git repositories in order update application? how work if 1 of vms offline (due scaling settings want use)? so question more of "what's opinion on should do?" there number of ways can solve problem. going suggest take @ puppet or chef handle deployments. allows manage code , configuration way of "recipes". if configuration changed o...

ios - Assigning variable with return value -

i new ios, if @ following code, expect both x , y "hello" - (void)viewdidload { [super viewdidload]; nsstring *x,*y; y= [x getstring]; }//viewdidload -(nsstring *)getstring{ return @"hello"; } yet, error: no visible @interface nsstring declares selector 'getstring' i tried many things, defined getstring in .h file your x variable type on nsstring ant there no method getstring defined there. i believe want call [self getstring] instead: y = [self getstring];

qt - Setting the style of QFrame -

Image
i have qframe, titled 'bannerframe' embedded in dialog, other widgets. i want dynamically change background of frame. if use stylesheet defined in top level dialog (messagedlg), appears correctly, this: - the stylesheet defined as #bannerframe { background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(195, 40, 9, 255), stop:0.7 rgba(225, 121, 113, 255), stop:1 rgba(237, 154, 152, 255)); } however, if remove , add style directly bannerframe widget, gradient doesn't seem work properly: - the same effect seen, regardless of setting stylesheet in designer, or in code: qstring style = qstring("background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,\ stop:0 rgba(%1, %2, %3, 255),\ stop:1 rgba(%4, %5, %6, 255));").arg(red1).arg(green1).arg(blue1)....

java - track change of nodes bound in javafx -

i want same thing asked in post track changes of nodes bound in javafx i have : (edited) sscce: public class floatcircle { node node; circle rectangle; bounds localtoscreen; static arraylist<objectbinding> list = new arraylist<>(); private objectbinding<bounds> boundsinscene ; pane root ; public floatcircle(node node,pane root) { this.node = node; this.root =root; this.rectangle = new circle(); this.rectangle.setmanaged(false); initsetting(); } public circle getfloatcircle() { return rectangle; } public void initsetting() { boundsinscene = bindings.createobjectbinding( () -> node.localtoscene(node.getboundsinlocal()), node.localtoscenetransformproperty(), node.boundsinlocalproperty()); boundsinscene.addlistener(new changelistener<bounds>() { @override public void changed(observablevalue<? extends bounds> observable, bounds oldvalue, bounds newvalue) { ...

javascript - complex java-script manipulation, array object sorting for new object -

i have array of objects need reshape 1 other work. need manipulation convert 1 function. have created plunker https://jsbin.com/himawakaju/edit?html,js,console,output main factors month, country , "ac" value. var actual = [ {"country":"uk","month":"jan","sr":"john p","ac":"24","pr":"2","tr":1240}, {"country":"austria","month":"jan","sr":"brad p","ac":"64","pr":"12","tr":1700}, {"country":"italy","month":"jan","sr":"gim p","ac":"21","pr":"5","tr":900}, {"country":"uk","month":"feb","sr":"john p","ac":"14","pr":"4","tr":540}, {...

asp.net mvc - MVC 5 RouteConfig trouble -

i have such action: [objectrequired] public actionresult campaign(int? id, someclass object = null) { ... } what need route action: a) int parameter (.../campaign/12345) b) no parametes (optionally) (.../campaign) mvc error says, there no nonparametric constructor (if delete "object" parameter - it's ok). cant delete "object" parameter, because need check values , pass value [objectrequired] attribute this: filtercontext.actionparameters["object"] = _someobject; i don't want use constructions viewdata. where's right way? i'm not 100% on i'm i'll if am... you can't pass object through get . pass parameters , use custom route handler build object you. you hold object in data , use entity framework model. you use tempdata , that's similar viewdata . you hold in session .

c++ - Updating a variable from a file in loop -

sorry grammar\spelling. i'm romanian. i using code::blocks edit in c++ , notepad edit in batch. i can't find better title this. i'm trying use program: #include <iostream> #include <fstream> #include "windows.h" #include <string> #include "g:\other.h" using namespace std; char message[500],from[20]; int interm; int main() { ofstream wait1("errorlevel.f"); wait1<<0; wait1.close(); fstream wait2("errorlevel.f",ios::in); wait2>>interm; cout<<"another window waiting you..."; system("start options_load-new.bat"); while (interm==0) { wait2>>interm; sleep(10); } st(); //and program continues... } where st(); function declared in other.h as void st() { system("cls"); } and options_load-new.bat file this: @echo off echo want do? echo [l] load pre-made message echo [n] make new 1 choice /c ln echo %errorlevel% > erro...

android - Recyclerview - how to disable vertical scrolling on item swipe (fling) -

simple question - how disable recyclerview scrolling while swiping item? created ontouchlistener inside recyclerview item view holder, catches swipe events if user makes straight horizontal line. otherwise recycler list scrolling. ideas? i'm facing opposite problem. if using itemtouchhelper, this mitemtouchhelper.startswipe(myviewholder); this force swipe instead of scroll.

ios - MMDrawerController pan gesture behaviour when center controller has Scroll View -

i'm looking have used mmdrawercontroller . i've downloaded example project , has table view center view controller. pan gesture works correctly - starts open drawer if gesture horizontal. drawer not open when scroll table view. desired behavior me. but when set own project , there's scrollview or tableview - scrolling them , down opens drawer if scrolling gesture has slightest horizontal component confusing , barely usable. i've tried understand makes difference in example project looking through code, no success. didn't find gesture recognizer callback overrides or changing gesture behavior. i've looked through threads on considering mmdrawercontroller , didn't find similar. i know can override things in mmdrawercontroller subclass change gesture recognition , achieve desired behavior way, don't want reinvent wheel here. there easy answer overlooked. i've found origin of problem. has nothing mmdrawercontroller. in project,...

javascript - Send multiple variable with PHP AJAX GET onclick of a button -

i have 2 dynamically loaded dropdowns: 1 containing golf course holes information , holding users- information used generate scorecard. when course selected , user selected want click button , generate scorecard. below code 'course' dropdown <?php $db_host = 'localhost'; $db_user = 'root'; $db_pass = ''; $db_name = ''; $con = mysqli_connect($db_host,$db_user,$db_pass, $db_name); if (!$con) { die('could not connect: ' . mysqli_error($con)); } $sql = "select courseid, name courses"; $result = mysqli_query($con, $sql) or die("error: ".mysqli_error($con)); while ($row = mysqli_fetch_array($result)) { $courses[] = '<option value="'.$row['courseid'].'">'.$row['name'].'</option>'; } ?> below code 'user' dropdown <?php $db_host = 'localhost';...

c++ - g++ template error Small_size -

i working on latest revision of c++ programming language (think it's 5) , run problem g++ version 5.2. my code variation of small_size template chap 24. #include <iostream> template<int n> bool is_small () { std::cerr << sizeof(n) << std::endl; std::cerr << n << std::endl; return n <= 255; } bool ism (int i_n) { return i_n <= 255; } int main () { std::cout << "hallo welt" << std::endl; std::cout << 0 << " " << is_small<0> << std::endl; std::cout << 255 << " " <<is_small<255> << std::endl; std::cout << -4100000000 << " " << is_small<-4100000000> << std::endl; std::cout << 256 << " " << is_small<256> << std::endl; std::cout << 256 << " " << ism(256) << std::endl; std::cout << 256 <<...

android - How to rotate floating action button without rotaing shadow? -

i rotate fab in such simple way: fab.startanimation(animationutils.loadanimation(this, r.anim.rotate)); rotate.xml : <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <rotate android:fromdegrees="0" android:todegrees="360" android:pivotx="50%" android:pivoty="50%" android:duration="1000"/> </set> this works, fab shadow rotates. need fab rotate (or src image, if there's difference). did try animate method provided compat library? had same problem when using animation utils final overshootinterpolator interpolator = new overshootinterpolator(); viewcompat.animate(fab). rotation(135f). withlayer(). setduration(300). setinterpolator(interpolator). start();

Host-only VirtualBox vboxnet1 IP belongs to host -

Image
i'm trying connect server running on guest os in virtualbox. virtualbox configured assign static ip guest. i'm pretty sure ip assigns belongs host. if have nginx server running on host requests vboxnet1 ip intercepted host serve , never reach guest. both host , guest debian. also, same result , without virtualbox dhcp server enabled. here's virtualbox network settings (can't embed images <10 rep...sigh): and vm network settings: i've tried different ip addresses host, no change. ifconfig on host: $ ifconfig eth0 link encap:ethernet hwaddr 00:90:f5:e8:b0:e0 broadcast multicast mtu:1500 metric:1 rx packets:0 errors:0 dropped:0 overruns:0 frame:0 tx packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 rx bytes:0 (0.0 b) tx bytes:0 (0.0 b) lo link encap:local loopback inet addr:127.0.0.1 mask:255.0.0.0 inet6 addr: ::1/128 scope:...