Posts

Showing posts from August, 2012

javascript - webgl manipulating two textures on one square -

i saw yesterday @ http://www.buzzfeed.com/kellyoakes/space-pictures-that-will-actually-make-you-think#.lhw29d3bmv the first image has 2 textures can slide mouse , forth change boundary of 2 textures. thought looked interesting , wanted try it. my thoughts are, need draw 2 squares , update vertices every time mouse moves , reset buffer these new points? seems there might easier , more efficient way thought i'd see if had ideas. using plain html 1 way, suggested lj_1102, , needs, maybe simpler 1 too. the process create effect webgl follows: create canvas, draw 1 square (two triangles in total) on entire canvas, take mouse position on canvas , calculate percentage of how far left/right 1 of edges; , square use fragment shader similar 1 bellow. uniform float percentage; uniform vec2 canvas_size; uniform sampler2d left_image; uniform sampler2d right_image; void main() { vec2 uv = gl_fragcoord.xy/canvas_size; if ( uv.x<=percentage ) gl_fragcol...

ruby on rails - jQuery Event listeners not working on Heroku Production -

so have small problem driving me nuts. i have rails 4 app utilizes jquery event listeners. these working great on development , staging. when push production aren't getting set. it worth mentioning 'staging' cedar-14 app on heroku 'production'. the difference being rails_env = 'staging' instead of 'production'. if initialize listeners using console, work great. changing production rails_env 'staging' listeners work too. my production.rb , staging.rb identical. right assets not being uglified or , far can see, being served client in identical fashion. so question getting set rails_env in production preventing of '$.on' listeners getting set? the versions jquery 1.11.1 rails 4.1.4 ruby 2.2.0 turbolinks 2.3.o double check order of gems in application.js //= require jquery //= require jquery.turbolinks //= require jquery_ujs //= require turbolinks next step, make sure minification not causing issue. add g...

javascript - $rootScope is not defined -

i'm trying use cookie value in multiple places , within multiple controllers error saying $rootscope not defined here's code: capapp.controller('cookiectrl', ['$scope','$cookies', function($scope, $rootscope, $cookies) { // set variable nav $rootscope.cookieset = $cookies.user_id; }]); capapp.controller('maincontroller', function($scope, $location) { $scope.user_id = $rootscope.cookieset; // set global var }); is there better way this? want cookie value available site wide you missed add $rootscope dependency in both controllers code capapp.controller('cookiectrl', ['$scope','$rootscope', '$cookies', function($scope, $rootscope, $cookies) { // set variable nav $rootscope.cookieset = $cookies.user_id; }]); capapp.controller('maincontroller', ['$scope', '$location', '$rootscope', function($scope, $location, $rootscope) { $scope.user_id = ...

windows - How to set up / use git as (little more than) a simple backup system -

i'm single developer working on several small, unrelated projects written in c/c++. i tried using git (mostly because client asked me - think doesn't know dvcs must have heard git fashionable :) ) baffled documentation, , tutorials seemed tailored needs entirely different mine: large projects teams of programmers. i wanted start using git "backup system on steroids" first, learning new features later need them. thought setup , daily usage easy, after whole day of tutorials i've yet commit single project (and need bottle of maalox , aspirin :) ) to summarize: i'm solo programmer (no 1 else touch code). i use single windows laptop (no need work multiple pcs). no need branches (the projects small). i do need remote repository (only emergency measure against hd crashes / laptop theft. have private server can install need). i never need retrieve old versions of code (in 2014 did twice, in few minutes, using backups). the code well-commented (the ...

css - Remove 'x' Input Decoration In Microsoft Edge (formerly Project Spartan) -

in css of website i'm working on use following css hide 'x' button internet explorer 10 , 11 add input fields users clear contents: input::-ms-clear { display: none; } viewing same website in first build of microsoft edge (formerly codenamed "project spartan") on windows 10 build 10049 css has no effect. isn't surprising microsoft edge breaking away legacy of internet explorer, want achieve same effect. what equivalent css required microsoft edge not render this? it turns out css had been broken since written, , wasn't working in ie 10+ either. since fixing css, microsoft edge (formerly project spartan) behaving same ie10+ , not displaying 'x' in input fields.

httpserver - Can nginx handle duplicated HTTP headers? -

client sending requests duplicated headers server. this: get /somefile.txt http/1.1 host: example.com accept: */* if-modified-since: tue, 31 mar 2016 20:00:12 gmt if-modified-since: tue, 31 mar 2016 20:00:12 gmt if-modified-since: tue, 31 mar 2016 20:00:12 gmt apache handling requests concatenating duplicating headers ", ". resulting (handled) request like: get /somefile.txt http/1.1 host: example.com accept: */* if-modified-since: tue, 31 mar 2016 20:00:12 gmt, tue, 31 mar 2016 20:00:12 gmt, tue, 31 mar 2016 20:00:12 gmt but nginx returning code 400 (bad request). can not modify client's behaviour. need tmp solution on nginx server handle these request (as apache example) thanks. the uniqueness check header "if-unmodified-since" hardcoded (see [1] [2] ). cannot disabled or dismissed, because nginx validates headers during parsing, on stage of request processing before other handler or configuration option can intercept process. so, right...

javascript - jQuery throws uncaught error on smarty code -

i have following error message uncaught error: syntax error, unrecognized expression: [value={if isset($smarty.post.id_state)}{$smarty.post.id_state|intval}{/if}] which originating code: $('.id_state option[value={if isset($smarty.post.id_state) {$smarty.post.id_state|intval}{/if}]').prop('selected', true); i not sure why throws such error, since code following (literallly next line) works charm the following code works normally $('.id_state_invoice option[value={if isset($smarty.post.id_state_invoice)}{$smarty.post.id_state_invoice|intval}{/if}]').prop('selected', true); your code: {if isset($smarty.post.id_state) {$smarty.post.id_state|intval}{/if} needs be: {if isset($smarty.post.id_state)}{$smarty.post.id_state|intval}{/if}

java - Play 2.3.7 when fork in Test = false config options are ignored -

i'm using play 2.3.7 when fork in test := false in build.sbt conf files aren't loaded play when running tests. the line javaoptions in test += "-dconfig.file=conf/test.conf" in build.sbt should load test.conf when running tests that's not happening. the workaround run activator , pass above param on command line so: activator -dconfig.file=conf/test.conf "test-only test.integration.sometest" if remove fork in test := false , play finds conf resources - of course can't step through tests sucks. what missing in build.sbt ? bug in play? forking tests means run on separate jvm. not forking tests means run in same jvm sbt , cannot change parameters jvm started after has been started. the solution if not want fork pass flags jvm sbt runs on when start it, mention in end of question.

android - AR complex CAD model tracking -

i need 3d-cad model tracking. i have develop android application tracks predefined cad models parts of car, e.g. stand in front of car engine hood opened , application should tell have (perhabs refill fluid) visual support arrows or cicles. following youtube video describes intention https://www.youtube.com/watch?v=4le_iocfnl0 i have tried metaio sdk when try transform cad models metaiocreator edge , surface models cannot recognize part of model. think because models detailed (~400.000 polygons each). in addition test purpose reduced polygons lower count (~7.000 polygons), when create edge , surface model load models in test application test device (samsung galaxy tab s) laggs extremly , not possible track model. so ask if right way because don't think so.. perhaps give me advice tracking method should use of. so far used metaiosdk hybrid 3d tracking witch mix edgebased , featurebased trackingmethod. there annother method witch better reach goal? i've read opencv (w...

multithreading - UI Thread block when starting zxing-android-embedded -

so used https://github.com/journeyapps/zxing-android-embedded embedd barcode scanner app. problem takes while start, 2 4 seconds. in time ui hangs, added , asynctask , ui doesn't hang anymore, progressdialog added asychtask not show. when add thread.sleep doinbackground dialog show hangs again when thread.sleep over. have idea how let user know scanner loading? class loadscanner extends asynctask<void, void, void> { @override protected void onpreexecute(){ progress = new progressdialog(mainactivity.this); progress.settitle("loading"); progress.setmessage("wait while loading scanner..."); progress.setcancelable(false); progress.setindeterminate(true); progress.show(); } @override protected void doinbackground(void... params) { integrator = new intentintegrator(mainactivity.this); integrator.setdesiredbarcodeformats(intentintegrator.one_d_code_types); integra...

android - Refresh or relayout the new convertView like first time when listview call getView() -

i have listview use gesturedetector handle swipe left. each item, layout below: [framelayout] [linearlayout] hidden_menu [/linearlayout] [linearlayout] main_layout [/linearlayout] [/framelayout] , handle ontouchlistener. when move main_layout right, hidden_menu shown [sample image] . when move other item right, or moveup or movedown listview, hide hidden_menu of old (or opened) item using objectanimator (x) , @ end animation called main_layout.invalidate(). my problem when scroll listview, reuse row layout viewholder pattern, new row wrong layout (some hidden_layout visibled). 1) ideas refresh new item when getview() called? 2) or how refresh animated item first time i hope guys can understand me ! thanks , best regards! i found solution in case: if(holder.mhiddenmenu.getleft() != 0) { holder.mhiddenmenu.settranslationx(0); }

php - How to display data from tables and queries for each line of data from another table in Yii2 -

i have 2 tables - animals , animals_type. columns in animals_type: id , type columns in animals: id , name , animals_type i want render list of animals type , exists animals on same page. for render animals type create model animals_type, controller animals_typecontroller <?php namespace frontend\controllers; use yii\web\controller; use yii\data\pagination; use app\models\animals_type; class animals_typecontroller extends controller { public function actionindex() { $query = animals_type::find(); $pagination = new pagination([ 'defaultpagesize' => 10, 'totalcount' => $query->count(), ]); $animals_type = $query->orderby('id') ->offset($pagination->offset) ->limit($pagination->limit) ->all(); return $this->render('index', [ 'animals_type' => $animals_type, 'p...

Devtools for R 3.3.0 not working with Rtools 3.3? -

i updated latest devel version of r (3.3.0) , lastest devtools on cran (1.7), , got follow message. library("devtools", lib.loc="~/r/win-library/3.3") warning: rtools required build r packages, no version of rtools compatible r 3.3.0 found. (only following incompatible version(s) of rtools found:2.15,2.16,3.1,3.3) please download , install appropriate version of rtools http://cran.r-project.org/bin/windows/rtools/ , run find_rtools(). did mess up, or new else have encountered yet? seems rtools 3.3 ought fine devtools in r 3.3.0. i have faced same issue, resolved downloading rtools 3.3 link https://cran.r-project.org/bin/windows/rtools/ , installed in windows 8 machine. after ran find_rtools() in rstudio/r, return true. thats have resolved it. now try library(devtools), work :d :d

php - Extract sub array resulting key=id and value=name in CakePHP -

i have nested array: array ( [id] => 1 [name] => group 1 [0] => array ( [id] => 1 [name] => group 1 ) [1] => array ( [id] => 2 [name] => group 2 ) [2] => array ( [id] => 7 [name] => group 7 ) ) and extract sub arrays [0] , [1] , , [2] in 1 single array following format: array( [id] => [name] ) in other words have result: array ( [1] => group 1 [2] => group 2 [7] => group 7 ) *note: tried set::classicextract($my_array['group'], '{n}.name'); can't figure out how group.id key array. guidance appreciated. this should work you: (here first array_filter() values out, don't have numeric key. after array_combine() id column name column array_column() ) <?php $result = array_filter($arr, function($k){ return is_numeric($k);...

python - why variable doesn't store stuff when inside a def funct -

i'm new programming! when do: >>>x = "heyy" >>>def hello(): x = "hi" >>>hello() >>>print(x) heyy why x still "heyy"? there anyway can turn x = hi global variable? without using "return" , putting new variable? like: >>>x = "heyy" >>>def hello(): x = "hi" return x >>>y = hello() >>>print(y) hi basically want change contents of x hi instead of heyy when run hello() you can use global keyword so def hello(): global x x = "hi" but note bad practice , return should used ever possible. because there every chance of value of variable getting corrupted in of methods

forms - Could not load type "sonata_user_registration" -

when try override registration form in sonatauserbundle got error : "could not load type "sonata_user_registration"".i searched solution of problem of them doesn't me. override template now, need override registration form(add age field), added few code in //app/application/sonata/userbundle/entity/user.php /** * @orm\column(type="string", length=255) * * @assert\notblank(message="please enter name.", groups={"registration", "profile"}) */ protected $age; public function getage() { return $this->age; } public function setage($age) { $this->a=$age; } but if run php app/console doctrine:schema:update --force told nothing update registrationformtype: //app/application/sonata/userbundle/form/type/registrationformtype.php namespace application\sonata\userbundle\form\type; use symfony\component\form\formbuilderinterface; use fos\us...

java - How to use JFormattedTextField to allow only alphabets? -

i searched solution everywhere, found solutions allowing numbers, alphanumeric (using documentfilter ). but, need allow alphabets , intend use jformattedtextfield due advantages. so, how use jformattedtextfield allow alphabets (a-za-z) (no space, punctuation, letters)! since number variable, , if i'm not wrong jformattedtextfield uses masks fixed length of digits, more easy use litener change text event , validate text in element removing unallowed characters. something that: jtextfield f = null; f.getdocument().adddocumentlistener(new documentlistener() { @override public void insertupdate(documentevent e) { validateinputtext(); } @override public void removeupdate(documentevent e) { validateinputtext(); } @override public void changedupdate(documentevent e) { validateinputtext(); } });

html - Javascript dynamic array window with multiple answer options -

i'm working on multiple arrays , occured 1 problem. when have 1 question div generated can add additional questions without problem, if add question div, can't add additional questions neither of both windows(same applies other number too), error newdiv[counterq] undefined. can me issue? thanks! also, how can move div addoption below created new 1 option input? i'm new @ programming sorry if won't explain in correct terms. thanks! edit: updated new problem. didn't wanted create seperate topic. html : var counterq = 0; var limitq = 3; var countero = 0; var limito = 5; function addcontent(divname) { countero = 0; if (counterq == limitq) { alert("you have reached limit of adding " + counterq + " inputs"); } else { var newdiv = new array() newdiv[counterq] = document.createelement('div'); newdiv[counterq].classname = "contentwindow[" + counterq + "]"; newdiv[co...

c# - Parser Error with HIVE ODBC -

i'm writing code in c# invoke hive script via odbc. i'm using hortonworks hive odbc driver (though i've tried several others , same error). can connect fine via odbc , simple commands work (for example select * mytable limit 10; should). run trouble longer scripts have processing have multiple 'chunks' of sql (each terminated semi-colon). example, first statement creates temp table, next inserts it, maybe select different table, etc, typical sql. keep getting following error on line specifies s3 location file parser error: error while compiling statement: failed: parseexception line 8:85 missing eof @ ';' near ''s3n://somebucket/somefolder/etc' here's example of failing: create external table if not exists mytesttable( id int, anotherid int, name string ) row format delimited fields terminated '\t' lines terminated '\n' location 's3n://somebucket/somefolder/etc'; ...script continues here next chu...

stored procedures - Pass a date from datepicker to sql server database -

i have datepicker textbox below: <input type="text" id="txtdob" class="datepicker" style="width:154px"/> i not able pass value datepicker database table.everything works fine not going post entire code here.i passing value below: cmd.parameters.addwithvalue("@dob", txtdob.value); but says not find txtdob.any appreciated. try this cmd.parameters.add(new sqlparameter("@dob",data.sqldbtype.datetime)) cmd.parameters("@dob").value = txtdob.value;

reactjs - react-native: How to use asyncstorage with rocksdb? -

i want embed data react-native app. think have use asyncstorage. can use rocksdb storage asyncstorage. documentation not give example of this. wondering how use rocksdb. also, react-native docs mentions asyncstorage data being global. mean asyncstorage data accessible apps? asyncstorage core react-native api allows store key value pairs. it's global in accessible within anywhere in app not apps because of ios sandboxing. works on own, is, independently of other database systems. rocksdb native key-value store has native implementation. if want use in react-native project, or else have write api (bridge) can used through js. , have nothing asyncstorage. edit: apparently asyncstorage tries use rocksdb on native side if exists. otherwise, seems save data in text file. https://github.com/facebook/react-native/blob/master/react/modules/rctasynclocalstorage.m

excel - Using a countif to count cells that can equal two different criteria -

i looking use countif or countifs add set of 7 cells each cell trigger 2 different criteria. the cells contain numbers , need counter if see if cell greater 0 or lower other static cell. most tutorials , examples can find either describe , statements or end getting cell counted twice triggers both criteria if number between 2 comparison factors. here pseudo code of looking for. countif( balance , greater 0 or greater last months payment ) count cell once please ask questions , pre-thanks responses , time taken read question. -------------------edit------------------------- don't worry answered own question. all hail rubber duck method. --------------second edit 07/04/15---------------- thank-you responses. had solved issue 30 secs after posting question , did post edit "revised" user called mike? , removed. i realized ask if balance less since impossible balance go less 0 matter of checking lower last months payment. i busy trying build ...

Custom Visibility Modifiers in C++ -

i reading signals & slots | qt core 5.4 , had following code snipped. #include <qobject> class counter : public qobject { q_object public: counter() { m_value = 0; } int value() const { return m_value; } public slots: void setvalue(int value); signals: void valuechanged(int newvalue); private: int m_value; }; i have seen private , public , , protected before never this. what going on whole public slots: , signals: visibility modifiers (is called)? what mean , in standard talk this? when can / should use these in own code? slots signals evaluate empty strings or modifiers , defined implicitly including qobject.h . these markers qt moc (meta object compiler). q_object being expanded generic qt-class interface. the moc generate code header , these macros provide information 'these methods slots' or 'this going qt-ified class' you should use them in qt-projects , case develop class 'become' ...

dictionary - C++: Why my hash_map is giving me an ordered result like a map? -

since map implemented using tree , hash_map using hash, created code test if map give me ordered result , hash_map print examples in order registered map<string, int> mymap; hash_map<string, int> myhashmap; mymap["lucas"] = 1; mymap["abel"] = 2; mymap["jose"] = 1; myhashmap["lucas"] = 1; myhashmap["abel"] = 2; myhashmap["jose"] = 1; for(map<string, int>::iterator = mymap.begin(); != mymap.end(); it++){ cout << it->first << " " << it->second << endl; } cout << endl; for(hash_map<string, int>::iterator = myhashmap.begin(); != myhashmap.end(); it++){ cout << it->first << " " << it->second << endl; } but both results were: abel 2 jose 1 lucas 1 why hash_map gave me ordered result? there no order guarantee in hash_map - means can store results in any order, depending on implementation. ...

ios - How to add a UIImageView to a UIView without displaying the content of the UIImageView that is outside of the UIViewBorder -

i trying add uiimageview uiview, problem image view outside of uiviews frame, theoretically should hidden (the part of uiimageview situated outside of uiview). here code: - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. firstrectangle = [[uiview alloc] initwithframe:cgrectmake(0, [[uiscreen mainscreen] bounds].size.height, [[uiscreen mainscreen] bounds].size.width, [[uiscreen mainscreen] bounds].size.height)]; firstrectangle.hidden = no; firstrectangle.backgroundcolor = [uicolor yellowcolor]; [self.view addsubview:firstrectangle]; [firstrectangle setcontentmode:uiviewcontrollerhierarchyinconsistencyexception]; secondrectangle = [[uiimageview alloc] initwithframe:cgrectmake(0, -[[uiscreen mainscreen] bounds].size.height, [[uiscreen mainscreen] bounds].size.width, [[uiscreen mainscreen] bounds].size.height)]; secondrectangle.hidden = no; secondrectangle.backgroundcolor = [uicolor redcolor]...

powershell - Parsing robocopy log file to PSCustomObject -

i'm trying create pscustomobject robocopy log file. first piece pretty easy i'm struggling $footer part. can't seem find way split values. it nice if every entry has it's own property , it's possible use example $total.dirs or $skipped.dirs . thinking import-csv , because that's great on how allows have column headers. doesn't seem fit here. there's solution found here seems bit of overkill. code: function convertfrom-robocopylog { param ( [parameter(mandatory=$true,valuefrompipelinebypropertyname=$true,position=0)] [string]$logfile ) process { $header = get-content $logfile | select -first 10 $footer = get-content $logfile | select -last 7 $header | foreach-object { if ($_ -like "*source*") {$source = (($_.split(':'))[1]).trim()} if ($_ -like "*dest*") {$destination = (($_.split(':'))[1]).trim()} } $footer | ...

debugging - How to debug PHP in Notepad++ with DBGp plugin -

i using chrome , mozilla. editor notepad++. try setup debugger php. have followed this link , this link i found answers. steps are downloaded `php_xdebug-2.3.2-5.6-vc11-x86_64.dll` , placed inside `php\ext`. added following lines in `php.ini` zend_extension=php_xdebug-2.3.2-5.5-vc11-x86_64.dll xdebug.remote_enable=1 xdebug.remote_handler=dbgp xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.remote_mode=req xdebug.idekey=default xdebug.remote_log="c:\temp\xdebug\xdebug.log" xdebug.show_exception_trace=0 xdebug.show_local_vars=9 xdebug.show_mem_delta=0 xdebug.trace_format=0 xdebug.profiler_enable = 1 xdebug.profiler_output_dir ="c:\temp\xdebug" created xdebug folder in temp . system windows 64 bit. php version 5.6.2. [restarted apache - no error] then downloaded dbgp plugin , placed dll file inside plugins directory of notepad++; [restarted npp] plugins->dbgp -> config 127.0.0.1 empty htdocspath htdocs path ...

jdbc - Why java throws exception java.lang.ArrayIndexOutOfBoundsException: 1 -

i have code reads data file , inserts database. this code writes data file. public void save(collection<book> b) { try (printwriter print = new printwriter(this.file);) { (book book : b) { string str = book.getname() + "," + book.getauthor() + "," + book.getdate() + "\n"; print.println(str); } } catch (exception e) { } } this code writes data file , inserts db. try(reader reader = new filereader(this.file); bufferedreader br = new bufferedreader(reader)) { connection = drivermanager.getconnection( "jdbc:mysql://localhost:3306/mybook", this.username, this.pass); statement statement = connection.createstatement(); string str; while((str = br.readline()) != null){ string[] array = str.split(","); statement.executeupdate("insert mybook....

ios - How to use NSPredicate with Multidimensional array (where the predicateFormat exists at valueForKeyPath) -

i have array 'id' on want filter array exists @ valueforkeypath 'objectid' of each of dictionaries. how compare predicates in valueforkeypath . currently.. predicate nspredicate * objidpredicate = [nspredicate predicatewithformat:@"objectid = %@",obj]; nsarray * oneorder = [array filteredarrayusingpredicate:objidpredicate]; is considering key , values of array elements, not ones @ valueforkeypath=@"objectid" use "self"in code array element's valueforkeypath nspredicate *objidpredicate =[nspredicate predicatewithformat:@"(self.objectid = %@)",obj]; `

c# - Read excel file stored in SharePoint Document -

i have excel file stored in sharepoint document library. need read excel file , data programmatically file path. string rangename = "sheet1!d43"; string value = getrangevalue("abc.xslx", rangename); string url = "http://sharepoint1.net/excel/_vti_bin/excelrest.aspx/docs/" + workbookname + "/model/ranges('" + rangename + "')?$format=html"; here, when keep link in browser, desired value in html. now, how can in c# code. if specified query works, depending on preferences @ least following .net components available: httpwebrequest class webclient class httpclient class (.net >= 4.5) below provided example consuming sharepoint excel rest services based on webclient class . public class excelclient : idisposable { public excelclient(uri weburi, icredentials credentials) { weburi = weburi; _client = new webclient {credentials = credentials};...

Why eclipse creates two class files for Python? -

Image
this question has answer here: what __init__.py for? 9 answers i'm new in python loving it. i'm using eclipse ide, confused why creates 2 classes, please take @ screenshot can please tell used for? help appreciated! placing __init__.py file in folder tells interpreter/ide contain(may contain) python scrips. now in mentioned scenario, eclipse placed 2 __init__.py files 1 for/in com folder , 1 mypythonproject . means both folders contain(may contain) python files.

Java Object class and multiple inheritance -

this question has answer here: if 1 class derived derived object, “multiple inheritence” 7 answers it may very basic question didn't find answer far, asking here. default in java, every class extends object class far know. again how able extend other class multiple inheritance not possible in java. in advance. a class can't have more 1 direct super-class, can have multiple ancestors. for example, arraylist extends abstractlist extends abstractcollection extends object . though arraylist has 3 ancestors, has 1 direct super-class - abstractlist .

ajax - DataTables how to use multiple data from json objects -

so i'm trying call data json file fill table. instead of having lot of json files, i'd keep of data in single file. example, have 2 types of clients (person , company) , want keep them both in same json , different objects, because each 1 goes in different table. the problem is: can't access data in json file. i can use if use 2 type of clients in different files (person.json , company.json - works fine). i did tried these 2 examples, none of them worked me. https://www.datatables.net/examples/ajax/deep.html https://www.datatables.net/examples/ajax/objects_subarrays.html so, how can data file? here json , datatable code: { "clients": { "person": [ { "cd":0, "id":"c-0010", "nm_cliente":"name aaa", "dt_nasc":"02/11/1990", "info":"some basic info...

android - When is ACTION_USER_PRESENT sent except for the screen unlocking? -

the documentation says: broadcast action: sent when user present after device wakes (e.g when keyguard gone). are there cases when action_user_present sent except screen unlocking?

java - Updating a column value of type json failed with an exception -

i using postgresql , 1 of column of type json . i using rest api , response json string storing in json column. using hibernate, not able update column. note: using google gson make json , store db. example: gson gson = new gson(); mybean.setjsondata(gson.tojson(response)); myhomedao.attachdirty(mybean); //error here log: caused by: org.postgresql.util.psqlexception: error: column json_data" of type json expression of type bytea hint: need rewrite or cast expression. position: 247 @ org.postgresql.core.v3.queryexecutorimpl.receiveerrorresponse(queryexecutorimpl.java:2198) @ org.postgresql.core.v3.queryexecutorimpl.processresults(queryexecutorimpl.java:1927) @ org.postgresql.core.v3.queryexecutorimpl.execute(queryexecutorimpl.java:255) @ org.postgresql.jdbc2.abstractjdbc2statement.execute(abstractjdbc2statement.java:561) @ org.postgresql.jdbc2.abstractjdbc2statement.executewithflags(abstractjdbc2statement.java:419) @ org.postgresql....

javascript - How can one address two instances of the same application through osascript -

can think of workaround osascript index-by-name bottle-neck in reference multiple instances of same application ? if obtain 2 process ids – 1 each of 2 different instances of same application, osascript returns same instance in exchange either pid - if first maps pid application name, , retrieves first application process name. for example, start 2 different instances of vlc.app, playing 2 different video files, like: open -na /applications/vlc.app ~/filea.m4v open -na /applications/vlc.app ~/fileb.m4v then obtain 2 separate application process ids with, example: echo "$(ps -ceo pid=,comm= | awk '/vlc/ { print $1}')" we can use applescript or yosemite jxa javascript reference application object either pid. it turns out, however, whichever process id supply, returned reference same instance, running same video file, if osascript translates pid application name, , returns first process matches name. yosemite javascript applications: function run() ...

javascript - ExtJS - How to filter data from a DB based on what I type -

i have created extjs (extjs4) app have combo box , populate values database. this code. first store: var autocompletestore = new ext.data.jsonstore({ fields:['onomasia'], proxy: new ext.data.httpproxy({ url: 'autocomplete/getautocomplete.php', method: 'post' }), baseparams:{task: "onomasia"} }); the combo box definition: // define combo box autocomplete var nodeoikismoifield = new ext.form.combobox({ id:'nodeid', fieldlabel: 'insert nodeid', store: autocompletestore, mode: 'remote', displayfield: 'onomasia', allowblank: false, valuefield: 'onomasia', anchor:'95%', triggeraction: 'all', name: 'oikismos', labelalign : 'right', width: 200, ...

.htaccess - PHP URL Routing - Using Database Entries in Class -

orginal query - updated query below in process of building custom application in php. know there have been many questions asked routing etc. on here , have spent many of hours reading them all. how got routing elements work in first place. 1 thing cant fit project peoples suggestions on how route urls based on database entry. the application working fine , have url routing in place works how want it. issue have when add new products database have trigger generates seo friendly url , stores in field in database. all product urls structured in same way. /north/productdetails/productname /south/productdetails/productname /northeast/productdetails/productname etc. looking not have manually write new url route routes.php file every time product added. this .htaccess rewriteengine on rewritebase / rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.+)$ index.php?uri=$1 [qsa,l] and index.php file contains: <?php header("cache-...

javascript - How to change name of input text, when adding more inputs -

this form <form action="" method="post"> <input type="button" value="addmore" onclick="addrow('datatable')" /> <table id="datatable" class="tftable" border="1"> <tr> <td><label>should auto increment(like (name1, name2, name3 ...))</label> <input type="text" required="required" name="doninid[]" value=""></td> </tr> </table> <input class="submit" type="submit" value="confirm &raquo;" /> </form> this script add more => script.js: function addrow(tableid) { var table = document.getelementbyid(tableid); var rowcount = table.rows.length; if(rowcount < 20){ // limit user creating fields more limits var row = table.insertrow(rowcount); var colcount = table.r...

woocommerce variation/add to cart not showing -

Image
so, have coded wordpress theme , integrated woocommerce it. has used simple products time, , using simple product test codes, works fine. added variation product , then, add cart button gone ( variation select dropdown there, values not bonded drop down. if can give me hint, showing have done wrong, big favor. i got same issue , solved when manually entered price variable products. unfortunately didn't find out yet why have enter it, same value. fixed it. hope helps !

Android custom keyboard popup keyboard on long press -

Image
i have custom android keyboard: public class customkeyboard extends keyboard{...} public class customkeyboardview extends keyboardview{...} public class customkeyboardime extends inputmethodservice implements keyboardview.onkeyboardactionlistener{...} on keys, have popupkeyboard , popupcharacters : <key android:codes="144" android:keylabel="0" android:popupkeyboard="@xml/key_popup" android:popupcharacters=")" android:keyedgeflags="right"/> xml/key_popup.xml: <keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keywidth="10%p" android:horizontalgap="0px" android:verticalgap="0px" android:keyheight="@dimen/key_height" > </keyboard> but when longpress on "0" key popup ")" shows, stays there until press "x" button or ")" character. looks this: and wa...

Composing arbitrary JSON objects in embedded structs in Go -

i'm trying generate json objects in form of {{"s":"v1", "t":"v2"}, {"s":"v3", "t":"v4"}, etc} via embedded structs in go. it works out fine when problem items in type problems []problem known ahead of time, can seen in func one() below , in playground demo here. however, if k:v pairs contain empty values i'd avoid getting {{a},{},{c}} instead of desired {{a},{c}} , in func two() below , in demo. or alternatively, how can compose probs := problems{prob0, prob1, prob2, etc} below arbitrarily without knowing ahead of time whether prob item added or omitted? package main import ( "encoding/json" "fmt" ) type problem struct { s string `json:"s,omitempty"` t string `json:"t,omitempty"` } type problems []problem func main() { one() two() } func one() { prob0 := problem{s: "s0", t: "t0"} ...

objective c - How to solve this wrong ADBannerContentSizeIdentifierPortrait is Deprecated in IOS 6.0? -

i updating app in ios 8, adbanner shows wrong, how solve issue. 'adbannercontentsizeidentifierportrait'is deprecated:first deprecated in ios 6.0 , 'requiredcontentsizeidentifiers' deprecated :first deprecated in ios 6.0. code, please check one. adview.requiredcontentsizeidentifiers = [nsset setwithobject:adbannercontentsizeidentifierportrait]; adview.currentcontentsizeidentifier = adbannercontentsizeidentifierportrait; replace lines with: [adview setautoresizingmask:uiviewautoresizingflexiblewidth];

numpy - Pandas - Delete rows with two or more NaN values in dataframe -

i want delete column values contain many nan values; specifically: 2 or more. have dataframe column looks this. below column had 40 rows . want remove nan values 19th row (after 17.9 value). avgws 0.12 1 2.04 3.01 3.99 5 6 7 7.99 9 10 10.98 11.99 13 13.93 14.99 15.98 nan 17.9 nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan thanks you can call isnull() on column, return series boolean values, cast int , true values become 1 , false becomes 0 , call cumsum() , filter df cumumlative sum less 2 equates point nan count becomes greater 2: in [110]: df[df['avgws'].isnull().astype(int).cumsum() < 2] out[110]: avgws 0 0.12 1 1.00 2 2.04 3 3.01 4 3.99 5 5.00 6 6.00 7 7.00 8 7.99 9 9.00 10 10.00 11 10.98 12 11.99 13 13.00 14 13.93 15 14.99 16 15.98 17 nan 18 17.90

java - Spring classNotFound when creating spring bean -

when creating bean name usersevice, got classnotfound exception. i'm using spring web-mvc , spring-security this bean in servlet.xml <bean id="userservice" class="tr.com.xxx.service.userservice"></bean> this class want create it's bean public class userservice implements userdetailsservice { @autowired private accountrepository accountrepository; @postconstruct protected void initialize() { //accountrepository.save(new account("user", "demo", "role_user")); //accountrepository.save(new account("admin", "admin", "role_admin")); system.out.print("inside aouth"); } @override public userdetails loaduserbyusername(string username) throws usernamenotfoundexception { system.out.print("inside loadbyusername"); account account = accountrepository.findbyemail(username); if(account == null) { throw new usernamenotfoundexception(...

python - How to download a file from Mozilla Firefox using HTML? -

my task is, if user clicks download link download file, file should automatically downloaded. done task , got successful output in browsers chrome , ie.now problem is, code not working browsers mozilla firefox , safari. please me solve issue. ff = open('sample.html','a') ms = """<h2>product summary</h2> <center><table border = "1"> <tr> <th>product id</th> <th>product download</th> </tr>""" ff.write(ms) row in __builtin__.product_info: ff.write("<tr>") ff.write("<td> %s</td>" %str(row[0]).strip()) ff.write("<td>") ff.write("<a href= '%s' download>download</a>" %str(row[1]).strip()) #(the problem here..) ff.write("</td>") ff.write("</tr>") m = """</center></table> <br> </pre> </b...

java - Docker - Connect Apache Tomcat web server to MySQL server -

i trying connect web server runs in apache tomcat container mysql database runs container. in order using linking mechanism docker. docker run -it --name ${container_name} --link db:db -p 8080:8080 -d tomcat after running container can see containers linked , environment variables exposed properly. in order connect web application running in tomcat container database, using following configuration file: <context> <resource name="jdbc/mydb" type="javax.sql.datasource" auth="container" username="user" password="password" driverclassname="com.mysql.jdbc.driver" url="jdbc:mysql://${db_port_3306_tcp_addr}:${db_port_3306_tcp_port}/epcis?autoreconnect=true"> </resource> </context> now problem can't establish connection database because environment variables exposed docker not recognized @ tomcat environment. there way make these environment variable...

c++ - Boost geometry/interprocess : find_or_construct stops responding -

i storing r-tree in memory mapped file accessed several processes. each process instance of same program, different parameters. tree accessed in following way: std::cout << "reading index @ : " << idsfile.c_str() << std::endl; bi::managed_mapped_file file_id(bi::open_or_create,idsfile.c_str(), bf::file_size(idsfile.c_str())); allocator_m alloc_id(file_id.get_segment_manager()); std::cout << "constructing tree ... " << std::endl; rtree_m * id_ptr = file_id.find_or_construct<rtree_m>("rtree")(params_t(), indexable_m(), equal_to_m(), alloc_id); std::cout << "the index contains " << id_ptr->size() << " entries." << std::endl; (please note processes make no modification tree, queries.) this fragment of code works fine, , has never failed me until now, when running 1 process @ time. run 50 process simultaneously, works fine 12 of them, , others, remains stuck @ line ...