Posts

Showing posts from June, 2011

How to create a time series plot in the style of a horizontal stacked bar plot in r -

Image
i create horizontal ‘stacked bar’ type plot in date runs along x-axis , samples appear bars on y-axis. in simple example below, have 3 samples (a, b, c) each containing 3 values (0, 1, 2). horizontal bar coloured based on value @ each time step along x-axis, end 3 horizontal bars (one each sample) run first last time point , contain series of blocks colours relate different values. for example, want value 0 blue, value 1 yellow , value 2 red: sample a, first 2 days of trace blue, next 2 days yellow, followed single blue , on…… example data: df <- structure(list(date = c("30/04/2011", "01/05/2011", "02/05/2011", "03/05/2011", "04/05/2011", "05/05/2011", "06/05/2011", "07/05/2011", "08/05/2011", "09/05/2011", "10/05/2011", "11/05/2011", "12/05/2011", "13/05/2011", "14/05/2011", "15/05/2011", "16/05/2011", &q

c# - Using Entity Framework app.config how to switch between environments Dev, Stage and Production -

Image
i have windows application accessing dev database using datamodel.edmx , works fine. access stage environment database have added stagedatamodel.edmx. there 2 connection strings in app.config: , how switch between databases in app.config based on environment? thanks in advance! normally should other way around - create 1 ef edmx model , 2 (or more) configuration files every environment. at work, have 3 environments: release = production stage = before go live (copy of production, final tests) debug = new development, dev team tests for 3 environments, have 3 databases, (almost) similiar each other. create our model dev database. every project communicates database has 3 connection strings different credentials. in order achieve this, need to: 1) create different build platforms using visual studio configuration manager (in example, there 3 build configurations - dev/stage/release): 2) extract connection string configuration app.settings file. inste

sql - Oracle Hierarchical Query - Get records in hierarchy wich children are in a list -

Image
i have table parent,child relationship. on table have list of members leafs in first table. have first table filtered members parents of member in second table, or members of second table. hope problem clear, if not please ask. database oracle 10g. let's have hierarchy in table th , in members table tm there 3 rows 'gc carl', 'pt mike', 'pt mary' (marked green). to find parents, grandparents etc. (marked yellow) need simple hierarchical query: select distinct id th connect id = prior pid start id in (select id tm) sqlfiddle demo if looking parents , need in hierarchical way then: select distinct id th connect id = prior pid , level <= 2 start id in (select id tm) (martin eliminated, because not parent member , absent in tm ). if not wanted should precise query, add sample input data , desired output.

Setting up Pycharm to aid in learning python itself. -

can pycharm configured learn python itself? have pycharm setup right , i'm trying see possible set me learn more language. example, , simple example, lets created empty list: list = [] if highlight on [] or control-click on it, pycharm tells me nothing lists or brackets. possible set can official python documentation talks lists or indicates list in first place? see official python documentation not added pycharm's default external documents under pycharms settings. if add it, how pull objects, sequence types, methods , other things makes python tick? pycharm awesome ide , have believe possible set language easier learn when working in it. at time pycharm able provide library functions; doesn't have features providing on language features such list literals.

iis - URL Rewrite rules appear to be redirecting instead of rewriting -

i using iis url rewrite 2.0 module create url points latest version of app. have configured follows: <rule name="latest" stopprocessing="true"> <match url="^latest(.*)" /> <action type="rewrite" url="1.1{r:1}" /> </rule> the intention if goes /latest/* of urls rewritten /1.1/* . example /latest/index.html should become /1.1/index.html . this working when request file, example: /latest/index.html - works /latest/js/app.js - works however not work: /latest since index.html default document, expect rewrite /1.1/index.html , in fact seems redirect . example, if type following in browser address bar: http://<domain>/latest and press enter, changes to: http://<domain>/1.1 as if redirected. still works, don't want url change (hence why i'm using rewrite rather redirect ). idea why? there wrong rule? this problem you're experiencing: iis generate

php - Random row selection using MySQL returns NULL -

i trying random row mysql table 3 attemps: $query = "select cid table limit 1 offset ".rand(1,$num_rows); $query = "select cid table offset random() * (select count(*) table) limit 1"; $query = "select * table order rand() limit 1"; give null result in mysql_query($query). higher php code obtain row same table ok specifying where, don't understand why can't retrieve random one. here code snippet: $query = "select uid,clu uable un = '$un'"; $result = mysql_query($query) or die(sqlerror(__line__,mysql_errno(),mysql_error())); $resultid = mysql_fetch_assoc($result); $uid = $resultid['uid']; file_put_contents('debugging.txt',__line__.' - $uid = '.var_export($uid,true).php_eol,file_append); $query = "select * table uid = $uid , cn = '$cn'"; $result = mysql_query($query) or die(sqlerror(__line__,mysql_errno(),mysql_error())); $cr = mysql_fetch_assoc($res

android - How to initiate the call onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)? -

i need upgrade android sqlite database version 1 version 2. not understand how call public void onupgrade(sqlitedatabase db, int oldversion, int newversion) is initiated? how , when method called? don't understand pass version number 2? [edit] think need clarify question. here class: public class mysqliteopenhelper extends sqliteopenhelper { public mysqliteopenhelper(context context){ super(context, constants.db_name, null, 1); } public mysqliteopenhelper(context context, int version){ super(context, constants.db_name, null, version); } public mysqliteopenhelper(context context, string name, cursorfactory factory, int version) { super(context, constants.db_name, factory, version); // todo auto-generated constructor stub } public mysqliteopenhelper(context context, string name, cursorfactory factory, int version, databaseerror

sql - Subquery on outer query -

update: please @ second query, more representable example i'd create query uses different subqueries each column. subqueries based on list obtained outer query. for example: consider tablea table 30 columns , 5 million records select a, b, c, (select count(a) values (r = 12 , u = 'to') or (r = 16 , u in ('tb', 'tu')) first, (select count(a) values (r = 16 , u = 'te') or (r = 76 , u in ('te', 'tg')) second, (select count(a) values (r = 564 , u = 'hg') or (r = 788 , u in ('vd', 'bf')) third, (select count(a) values (r = 383 , u = 'rt') or (r = 35 , u in ('gr', 'ez')) fourth tablea values i know query not execute since can't call values subqueries, there solution make query run fast? in subqueries, i'd need join table, still possible use values, or have subquery on tablea again? following query more representable example: select col1, col2, (select count(col3)

outlook add on visual studio 2013 with visual c++ -

Image
i freaking out creating add-on outlook in visual c++. visual studio 2013 not possible create implementation of _idtextensibility2. got different errors! installed office tools vs 2013 won't help. vs2013 running on win 7 enterprise. last error was: "error in onfinish: failed return new code element. possibly syntax error. new element name: _idtextensibility2". happens when try add implemetation atl interface. ideas? nice...:-) thanks! mc stdapi dllcanunloadnow(void) { return _atlmodule.dllcanunloadnow(); } // returns class factory create object of requested type. stdapi dllgetclassobject(_in_ refclsid rclsid, _in_ refiid riid, _outptr_ lpvoid* ppv) { return _atlmodule.dllgetclassobject(rclsid, riid, ppv); } // dllregisterserver - adds entries system registry. stdapi dllregisterserver(void) { // registers object, typelib , interfaces in typelib hresult hr = _atlmodule.dllregisterse

caching - Cache miss on a multilevel cache -

there 2 levels of cache l1 , l2. if there cache miss on both levels, data being read memory. during reading data main memory, data first entered l2 , l1 cache first , processor reads data l1 cache or updation l1 , l2 , read processor happen simultaneously? i believe depends on hardware implementation. think depends on whether or not write-through or write-back cache. write through have same data @ levels because updates @ same time. put write buffer written cache, in case happen @ same time read. if there no write buffer, processor might stall allow cache updated.

objective c - Applying the same test to all members of a collection -

in test have nsarray several objects. must pass same test. is there better or more elegant way express doing for-in , applying same macro each element? that's judgement call, consider -indexesofobjectswithoptions:passingtest: , maybe -enumerateobjectsusingblock: alternatives.

python extract ip-addresse cidre/-ranges into individual ip-addresses -

i new in python. scan ip-addresses in python , want read file ip-addresses in different notation cidr or ranges , script should extract ip cidr/ranges individual ip-addresses. file_in = open("test.txt", "r") file_out = open("ip-test2.txt","w") = 1 line in file_in: #take line , if individual ip , if not make block of ip- addresses , write them new file_out file_out.write(str(i) + ": " + line) = + 1 file_out.close() file_in.close() any idea how? or tool use that? i think you'll find python-iptools package you're looking for. so: with open("test.txt", "r") file_in: ips_and_ranges = iprangelist(file_in.readlines()) open("ip-test2.txt","w") file_out: ip in ips_and_ranges: file_out.write(ip) assuming file_in reasonable size, otherwise might need read in chunks. update: initial code needed "splat" unpack list args, , remove newlin

c++ - Communication cost of MPI send and receive -

i'm new mpi , want measure communication cost of mpi_send , mpi_recv between 2 nodes. have written following code purpose: /*============================================================== * print_elapsed (prints timing statistics) *==============================================================*/ void print_elapsed(const char* desc, struct timeval* start, struct timeval* end, int numiterations) { struct timeval elapsed; /* calculate elapsed time */ if(start->tv_usec > end->tv_usec) { end->tv_usec += 1000000; end->tv_sec--; } elapsed.tv_usec = end->tv_usec - start->tv_usec; elapsed.tv_sec = end->tv_sec - start->tv_sec; printf("\n%s total elapsed time = %ld (usec)\n", desc, (elapsed.tv_sec*1000000 + elapsed.tv_usec)/numiterations ); } int main(int argc, char **argv) { int nprocs, nelements; /* command line args */ int my_id; long double* buffer, *rec_buffer; /* gettimeofday stuff */ st

android - Custom action bar is overlapping other elements -

Image
i trying implement custom action bar in activity. have done below, getting custom action bar overlapped another. have attached screen shot below. public class mainactivity extends actionbaractivity { private textview actionbartitle; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.main); actionbar actionbar = getsupportactionbar(); view customview=getlayoutinflater().inflate(r.layout.actionbar_layout, null); actionbar.setcustomview(customview); actionbartitle =(textview)findviewbyid(r.id.actionbar_text); actionbartitle.settext("action bar"); } } manifest: <application android:name="myapplication" android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name&quo

c# - How can I check if the same Date is already in a List? -

i have list of datetimes (with times , dates) , need mothod unique days out of seperate list example: [1.1.2015 12:34] [1.1.2015 12:34] [1.1.2015 12:34] [1.2.2015 4:34] [1.2.2015 2:34] [1.2.2015 1:34] [1.3.2015 8:34] [1.3.2015 1:34] [1.6.2015 2:34] needs turned into: [1.1.2015 0:0] [1.2.2015 0:0] [1.3.2015 0:0] [1.6.2015 0:0] how do this? you can group them on date property , project keys: var dates = dateandtimes.groupby(x=> x.date) .select(x=>x.key).tolist();

rest - How to enable CORS in an EmberJS application? -

i have emberjs application uses ember-data access data via rest api. rest api running on same machine on different port (although applies rest api's served domain. when go url localhost:4200/items following error in firefox console: content security policy: page's settings blocked loading of resource @ http://localhost:7654/api/items ("connect-src http://localhost:4200 ws://localhost:35729 ws://0.0.0.0:35729 http://0.0.0.0:4200 "). i tried installing ember-cli-cors nothing changed. tried solution @ http://discuss.emberjs.com/t/ember-data-and-cors/3690 , didn't work either. discussion 2013, that's not huge surprise. the rest api written in python using flask , flask-cors. using network tab can see request being sent, , data being sent back, error still there. header access-control-allow-origin set http://localhost:4200 in response, expected. app/router.js import ember 'ember'; import config './config/environment'; var

android - Can't get device token using Cordova Push Notifications Plugin -

i'm building push notification app using ionic framework, try following sample app: https://github.com/hollyschinsky/pushnotificationsample the problem when try run sample in android device doesn't retrive device token. replaced senderid in register function 1 own google application, doesn't work. what doing wrong? here versions i'm using: ionic --version 1.3.20 cordova --version 5.0.0 phonegap --version 4.2.0-0.24.2 android device: htc 1 s android version: 4.1.1 htc sense 4+ the problem think in here in notificationreceived function: // register $scope.register = function () { var config = null; if (ionic.platform.isandroid()) { config = { "senderid": "1034029444859" // replace yours gcm console - in project url like: https://console.developers.google.com/project/434205989073 }; //alert("el senderid es: " + senderid); } else if (ionic.platform.isios()) { confi

Why is Git ignoring commits when merging? -

Image
we have made changes 1 file in 2 branches. here file commit history on branch a: and here commit history of same file on branch b: now when merge branch branch b, end exact same commit history branch a. commit 56dfe991 has gone missing: obviously, disturbing. since don't know causing this. have idea? there no such thing "file commit history" in git. there's history, , files. the history considered @ git repository granularity, i.e. each commit has set of parents. see when run git log , or more visual output git log --graph --oneline --decorate . now, can ask git filter history on per-file basis, e.g. git log -- file . hides commits not touch file, but history simplifications hide commits not contribute file history. documented in details in "history simplification" section of git log's documentation . essentially, when reaching merge commit, if 1 of parent of merge commit not introduce change file, parent ignored. as result,

Is it possible in Python to write a sort of truth table to simplify the writing of if statements? -

let's i'm trying print out orientation of tablet device using accelerometer provides acceleration measurements in horizontal , vertical directions of display of device. know such printout done using set of if statements in form such following: if abs(stableacceleration[0]) > abs(stableacceleration[1]) , stableacceleration[0] > 0: print("right") elif abs(stableacceleration[0]) > abs(stableacceleration[1]) , stableacceleration[0] < 0: print("left") elif abs(stableacceleration[0]) < abs(stableacceleration[1]) , stableacceleration[1] > 0: print("inverted") elif abs(stableacceleration[0]) < abs(stableacceleration[1]) , stableacceleration[1] < 0: print("normal") would possible codify logic of in neater form? sort of truth table constructed such orientation lookup value of table? way this? edit: following a suggestion @jonrsharpe, have implemented logic in way following: tableorientations =

angularjs - How can I show filtered results based on button click? -

i have array created .csv file show of on initial page load, after button click, display results of name of building user clicks on. here html code: <div class="row" data-ng-controller="stafflistctrl"> <div class="small-12 columns" > <h1 class="">the public schools of petoskey staff</h1> <header ng-include="'pages/header.html'"></header> <div class="row"> <div class="small-2 columns"><h4>building</h4></div> <div class="small-3 columns"><h4>name</h4></div> <div class="small-2 columns"><h4>phone</h4></div> <div class="small-4 columns"><h4>email</h4></div> </div> &

java - Show a spinner while the listview loads with data -

i'm gathering lot of files, , showing them in listview. of workload within constructor of adapter. there way use asynctask , show spinner till data gathered. mean i'd have instantiate adapter's constructor within doinbackground method? how go doing this? also, list contained within tab. i'm using viewpager. due work being done in constructor, scrolling particular tab major stutter. you can instanciate adapter using empty list before starting asynctask. in onpostexecute of asynctask, can update list data , call notifydatasetchange method of adapter. add progressbar , hide in onpostexecute.

unity3d - Unity - move 3d object in an AR scene -

Image
i have ar scene has 1 ar camera, image target , 3d object below as. i create .cs file , attach arcamera. want move ar object mouse click position. tried many codes this. couldn't success it. know input.mouseposition returns screen position. convert screentoworldposition , put 3d object on position. 3d object moved, not mouse click position. don't know moved. how can move mouse click position? code here : camera cam; vector3 target = new vector3(0.0f, 10f,0.5f); // use initialization void start () { if (cam == null) cam = camera.main; } void update() { if (input.getmousebuttondown(0)) { debug.log("mousedown"); vector3 mousepos = input.mouseposition; mousepos = cam.screentoworldpoint(mousepos); gameobject.find("car1").gameobject.transform.position = mousepos; } } edit 1 if add plane scene, can move position of mouse click on plan

php - I want to store image into remote database -

i have tried , found server side coding this. don't know write in client side. want store image on image view remote database. <?php $host="localhost"; // host name $username="root"; // mysql username $password=""; // mysql password $db_name="q"; // database name \ // connect server , select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select db"); // username , password sent form $myusername=$_get['id']; //$mypassword=$_get['email']; $target1="login/".$_files['sr']['name']; move_uploaded_file($_files['sr']['tmp_name'], $target1); //$passport=$target1; $fe=$_files['sr']['name']; $qu="insert q(q)values('$fe')"; $res=mysql_query($qu);

How to do trace logging in Go with very low cost for disabled log statements -

it useful leave low-level debug/trace logging statements in critical paths can enabled runtime configuration. idea never turn such logging on in production (it cripple performance) can turn on in production environment (e.g. production system taken offline debugging or test system set production system.) this type of logging has special requirement: cost of hitting disabled log statement on critical path must very low: ideally single boolean test. in c/c++ log macro not evaluate of arguments until has checked flag. if enabled call helper function format & deliver log message. so how in go? using io.discard log.logger non starter: formats log message every time before throwing away if disabled. my first thought type enabledlogger struct { enabled bool; delegate *log.logger;... } // implement log.logger interface methods as: func (e enabledlogger) print(...) { if e.enabled { e.delegate.output(...) } } this close. if say: myenabledlogger.printf("foo %v: %v

c# - Add text from QR Code next to generated PNG -

Image
i have made application generates me qr code in png image, have insert text qr code next qr code image. i don't have experience using zxing library i'm thinking may contain option this... example: code: namespace qr_code_with_wfa { public void createqrimage(string inputdata) { if (inputdata.trim() == string.empty) { system.windows.forms.messagebox.show("data must not empty."); } barcodewriter qrcoder = new zxing.barcodewriter { format = barcodeformat.qr_code, options = new zxing.qrcode.qrcodeencodingoptions { errorcorrection = zxing.qrcode.internal.errorcorrectionlevel.h, height = 250, width = 250 } }; string tempfilename = system.io.path.gettemppath() + inputdata + ".png"; image image; string data = inputdata; var result = qrcoder.write(inputdata);

mysql - joomla Database connection error (2) after fix configuration.php -

i installed joomla on server , worked 2 days ago. 3 job: clean trash folder in cpanel delete error_log in root folder upload google webmaster authentication file . these 3 jobs don't have logical relevance problem afterwards see error : database connection error (2): not connect mysql this website i tried fix configuration.php problems there isn't issues. changed user of db privilege , apply changes file. checked db tables. disabled .htaccess , re enable that. cant fix problem... my 2 bets are: permissions: change configuration.php file 644 or feel correct db password expired : don't know how you're accessing server try renew password

javascript - Angular problems chaining $resource promises -

i trying chain promises service have $stateprovider resolves without waiting $q. results in controller getting result object empty array, , object gets filled later on. promise chain going wrong? my $stateprovider: .state('somestate', { resolve: { neededvalue: function(anotherservice) { return anotherservice.getdata(); //this 1 works pretty , doesn't use chaining }, finalvalue: function(myservice, neededvalue) { return myservice.startchain(neededvalue); } } } my service: app.factory("myservice", ['$resource', '$q', function ($resource, $q) { var firstapi = $resource("api/somewhere/first", {}, { "getdata": { method: "post" } }); var secondapi = $resource("api/somewhere/second", {}, { "getdata": { method: "post" } });

php - Display multiple rows as an array -

i want able display table list of people in 1 column , string of orders in another. people ======== person_id fname lname orders ======== order_id person_id product_id products ========= product_id productname i have following code: select people.fname, people.lname, products.productname people inner join orders on people.person_id = orders.person_id inner join products on products.product_id = orders.product_id order lname ... $rows = $result->num_rows; while($row = $result->fetch_assoc()) { echo "<tr><td>edit</td> <td>".$row["lname"].", ".$row['fname']."</td> <td>".$row['productname']."</td></tr>"; } this displays: smith, bob | item 1 smith, bob | item 2 smith, bob | item 3 roberts, jill | item 2 etc.. want display: smith, bob | item 1, item 2, item 3 roberts, jill | item 2 how show name (based on pe

delphi - TVirtualStringTree highlight of searching result -

Image
i highlight text node of virtualstringtree according search criteria example bellow: any suggestion please? thanks tlama answer ( how underline or highlight part of node caption ) adjust bit code in order highlight text in middle. procedure tform_main.vt_maindrawtext(sender: tbasevirtualtree; targetcanvas: tcanvas; node: pvirtualnode; column: tcolumnindex; const text: string; const cellrect: trect; var defaultdraw: boolean); var backmode, position: integer; begin // if rendered node's text contain text written in tedit control // called edit, then... position:= pos(ansilowercase(edit_search.text), ansilowercase(text)); if position > 0 begin // store current background mode; need use windows api here because // vt internally uses (so tcanvas object gets out of sync dc) backmode := getbkmode(targetcanvas.handle); // setup color , draw rectangle in width of matching text targetcanvas.brush.color := clyellow; targetcanvas.fi

mysql - Parameter RowsAffected is not reliable. Why? -

i using unidac , perform update instruction on mysql server. doing simultaneously 2 clients. wanted know updated record in first place, checking parameter rowsaffected , thought if 1 peer perform before second 1 rowsaffected>0 on first peer. problem rowsaffected>0 on both clients. how omit problem? https://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_row-count : ...the row_count() value similar value mysql_affected_rows()...

c# - Multiple Joins with multiple conditions -

i trying list out grid view of cities have respective country , area status true. here hierarchy country -> area -> city .here's code. somehow shows error joins:- the type of 1 of expression in join clause incorrect.type inference failed call join what missing? protected void fn_fill_city() { ef_dv.dbentities city_context = new ef_dv.dbentities(); try { var row_city = (from city_table in city_context.dv_tbl_city join country_table in city_context.dv_tbl_country on new { c_id = city_table.city_country_id, c_status = true } equals new { c_id = country_table.country_id, c_status = country_table.country_status } join area_table in city_context.dv_tbl_area on new { area_id = city_table.city_area_id,

How to get a list of all non imported names in a Python module? -

given module containing : import stuff foo import foo bar import * cst = true def func(): pass how can define function get_defined_objects can do: print(get_defined_objects('path.to.module')) {'cst': true, 'func', <function path.to.module.func>} right solution can imagine read original module file, extract defined names re.search(r'^(?:def|class )?(\w+)(?:\s*=)?' import module, , find intersection __dict__ . is there cleaner ? here start using ast . note code not cover possible cases, although should handle e.g. multiple assignment properly. consider investigating ast 's data structures , api more closely if access compiled code, example. import ast open('module.py') f: data = f.read() tree = ast.parse(data) elements = [el el in tree.body if type(el) in (ast.assign, ast.functiondef, ast.classdef)] result = {} el in elements: if type(el) == ast.assign: t in el.targets: if

copy sqlite database from assets folder to android persistentpath in unity3d -

i have squlite database in assets folder name mydatabse.s3db , want copy android application.persistentdatapath. have used following code string filepath = application.persistentdatapath + "/mydatabase.s3db"; if (!file.exists (filepath)) { www loaddb = new www("jar:file://" + application.datapath + "!/assets/mydatabase.s3db"); debug.log("yield done"); while(!loaddb.isdone) {} file.writeallbytes(filepath, loaddb.bytes); debug.log("copy done"); } the database created in application.persistentdatapath path empty.

amazon ec2 - What is the recommended AWS service for SAAS apps? -

i'm looking @ various offerings form amazon managing cloud based app , in short unsure whether best attempt accomplish need using ec2 & ebs, beanstalk, or opsworks or cloudformation. to elaborate want offer customers of our web/tomcat based app cloud based trial version upon sign up, running on custom domain (via route53) data stored on ebs volume. directorys on file system need created upon instance creation. my intention make appropriate calls using java aws sdk upon successful sign provision system user, notified of url access custom site. i'm not looking @ multi-scaling number of concurrent users never high each customers version should running in isolation. so i'm looking @ beanstalk api.. saw opsworks api, , cloudformation templates. if use beanstalk api, launch 'environment' each customer, means customers part of same beanstalk 'application', meaning if update app version.. receive update sounds positive, seems wrong doing environ

jquery - Dynamically adding fields on HTML Form -

Image
i working on simple form where, user can input text , assign tags (optional) text, user can select multiple tags decided use select tag "multiple" attribute. works expected first row, move add new element dynamically multiple select box not behave 1st row. i using sumoselect / bootstrap-select jquery plugins make multi select box better with bootstrap-select manage add row , element on newly added row working independently of row above adds 2 of such multi select boxes. with sumoselect, newly added multi select box not responsive its bit complicated explain, below code , screen shot html code: <div class="tab-pane fade active in" id="summary"> <br> <a href="#"> <span id="add_something" class="glyphicon glyphicon-plus" title="add summary" aria-hidden="true"></span> </a> <br><br> <div id=

ios - WatchKit : handleWatchKitExtensionRequest stops working after x amount of time -

i building watch extension uses handlewatchkitextensionrequest iphone app refresh data populates shared prefs (app group). so each time load app calls handlewatchkitextensionrequest on iphone app , works fine 15 minutes, stops responding? the watch app still working, iphone app goes sleep? whats point of handlewatchkitextensionrequest if not ask iphone something. are doing work in background task? check out answer bit of explanation: https://stackoverflow.com/a/29848521/3704092

android - Set onClickListener on the RelativeLayout contained by CardView -

i trying set onclicklistener on each of cardview elements. since not able set onclicklistener on cards (see here ), thought setting relativelayout contained cards. right using native cardview library , applied this tutorial. here's mainactivity 's oncreate : @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); recyclecardview = (recyclerview) findviewbyid(r.id.cardlist); recyclecardview.sethasfixedsize(true); linearlayoutmanager llmanager = new linearlayoutmanager(this); llmanager.setorientation(linearlayoutmanager.vertical); recyclecardview.setlayoutmanager(llmanager); data = createlist(9); contactadapter ctadapter = new contactadapter(data); //... recyclecardview.setadapter(ctadapter); this item_card_view xml: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.cardview xmln

java - AndroidLauncher libgdx Application errors? -

i used able run in android no problem, default launcher application has errors ( bundle , super.oncreate ). also, says class needs abstract or implement methods, used able run in android without opening file. need able run in android now, suggestions? public class androidlauncher extends androidapplication {//error on line, wants abstract protected void oncreate (bundle savedinstancestate) {//error here on bundle super.oncreate(savedinstancestate);//error here on oncreate androidapplicationconfiguration config = new androidapplicationconfiguration(); initialize(new movement(), config); } } you getting these error because have not declared oncreate method override annotation. not own method. code should public class androidlauncher extends androidapplication { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); androidapplicationconfiguration config = new androidapplication

jquery - How to connect phonegap app to database -

can explain how phonegap app can connected database in described manner. i designed app using html, css , jquery mobile. problem how can access database using this? heard need use server side code access database. don't know server side code. i understand want perfectly, have answer question - should database situated , how manage it. actually, there 2 options - manual installation , cloud service. first option requires add server side code, because none of major sql , nosql databases expose http interface directly managing data. that's why server side layer should exist. there libraries of dbs allow expose rest interfaces work with, still need integrate them first, it's simple task. second option use cloud solutions provide intermediate layer , expose http interfaces mobile services. (azure, amazon, everlive etc). here need learn how manage 1 before using it.

c# - Show MHTML content with CSS-styled negative margin in WebBrowser -

my application receives mhtml content external service , displays it. elements in mhtml styled via css , have negative margin, one: <style type="text/css"> .csae6e0f4d{margin-left:-49.9pt} </style> webbrowser , obviously, starts render these elements outside of client area boundaries, , elements partially visible user. is there way set document margin or scroll document show elements entirely? can't change external service easily.

Java 8 Optional<?> validation unwrapper in Spring -

in spring boot project when using following validation rules in dto @length(max = 70) @unwrapvalidatedvalue private optional<string> vendorname; i getting following exception javax.validation.validationexception: hv000182: no validation value unwrapper registered type java.util.optional<java.lang.string> i can't find anywhere how register custom validation value unwrapper in spring you should register validatedvalueunwrapper validator. the validator configured via localvalidatorfactorybean : <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/util ht

angularjs - Opening Bootstrap modal dialog from javascript not working -

can tell why modal dialog not opening on button click? error message: "document.getelementbyid(...).modal not function". please :) here html: <body ng-app='modaldemo'> <div ng-controller='myctrl'> <button ng-click ="open()">open</button> <div class="modal custom-modal fade" id="mymodal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="vertical-alignment-helper"> <div class="modal-dialog custom-modal-dialog vertical-align-center"> <div class="modal-content custom-modal-content"> <div class="modal-body custom-modal-body"> <div class="custom-modal-inside"> <p>calculating rates, price & fees ...</p> <p>