Posts

Showing posts from May, 2010

opengl - Libgdx - Custom Created 3d Mesh causes java.nio.BufferOverflowException -

i using libgdx generate 3d mesh in code. right attempting generate flat plane many vertices in middle test things out, received exception in thread "lwjgl application" java.nio.bufferoverflowexception when called mesh.setindices(indices); variable indices short array. i not having trouble if have less 180-150 indices. wasn't able figure out exact number trail , error, exception thrown if have more 180 indices. here code creating mesh: firstly how generate vertices (i don't think problem, ill put them in anyways) *note vertex attributes (vertexattribute.position(), vertexattribute.normal(), vertexattribute.colorunpacked()) private float[] generatevertices(int width, int height) { int index = 0; float vertices[] = new float[width*height*10]; for(int = 0; < width; ++) { for(int j = 0; j < height; j++) { //vertex coordinates vertices[index] = i; vertices[index+1] = 0; vertices[index+

Pass data from modal to another page in angularjs -

i need pass data modal page. please me accomplish task? $scope.productdetails = function (size,selectedproduct) { var modalinstance = $uibmodal.open({ templateurl: 'productdetails.html', controller: function ($scope, $uibmodalinstance, product) { $scope.product = product; $scope.buynow = function (path) { $uibmodalinstance.close($scope.product); $location.path(path); // need pass $scope.product new page }; $scope.cancel = function () { $uibmodalinstance.dismiss('cancel'); }; }, size: size, resolve: { product: function () { return selectedproduct; } } }); be sure read docs on $uibmodal : https://github.com/angular-ui/bootstrap/tree/master/src/modal/docs the open() method return object useful stuff in it. you're not doing object, that's magic is. to pass data controller

I am having trouble of setting my TextVIew in java using android studio -

my java class written public class musicalactivity extends appcompatactivity { private textview speedtextview; private textview pacetextview; private textview calburnttextview; private runnerinformation runnerinformation; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_musical); speedtextview = (textview) findviewbyid(r.id.speed_text_view); speedtextview.settext("current speed" + "6m/s"); pacetextview = (textview) findviewbyid(r.id.pace_text_view); pacetextview.settext("current pace" + "60/min"); calburnttextview = (textview) findviewbyid(r.id.calburnt_text_view); calburnttextview.settext("current calories burnt" + "1000"); } } and xml file like <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical&qu

vba - Allow only additions and hide existing records in access form -

Image
i have form in access linked table. when user opens form, not want user access or view existing records , able submit new entry. i have given following values allowadditions, allowdeletions , allowedits shown in image below gives button navigate through records in table. allowadditions - yes allowdeletions - no allowedits - no

firebase - Using Custom Tokens to make REST requests to FB DB as an admin -

i'm migrating new database , 3.0 client libs. i'm updating part generates custom auth token (on our server) patch update resource in firebase db. these patch requests used made our server firebase using admin claims based on this: https://www.firebase.com/docs/rest/guide/user-auth.htm for new db, i'm generating jwt token (using ruby-jwt ) this: payload = { aud: "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.identitytoolkit", claims: custom_claims.merge({ admin: true }), exp: now_seconds + (60 * 60), # maximum expiration time 1 hour iat: now_seconds, iss: service_account_email, sub: service_account_email, uid: uid } jwt.encode(payload, private_key, "rs256") a patch request token firebase db fails with: missing claim 'kid' in auth header . here equivalent of michael bleigh's answer using ruby googleauth module: require 'googleauth' scopes = [ 'https://www.googleap

rabbitmq - Azure Traffic Manager Endpoints show Degraded Even when 200 is Returned -

i have azure traffic manager profile 2 endpoints (linux vm's running rabbitmq). the endpoints of type " azure endpoint " , target resource type " public ip address ". when @ traffic manager profile reports status of profile " enabled ", , monitor status " degraded ". on each of endpoints reports status "enabled" , monitor status "degraded". i have traffic manager profile configured protocol "http" , port 15672 , path "/index.html". the problem can't tell why reporting "degraded" because if wget command. wget <vmname1>.cloudapp.azure.com:15672/index.html resolving <vmname1>.cloudapp.azure.com... <ip address> connecting <vmname1>.cloudapp.azure.com|<ip address>|:15672... connected. http request sent, awaiting response... 200 ok length: 1419 (1.4k) [text/html] all "documentation" (which azure frustratingly blog posts) says if returns

python - Efficient Way to Recursively Multiply -

i'm creating n_mc paths of simulated stock prices s n points in each path, excluding initial point. algorithm recursive on previous value of stock price, given path. here's have now: import numpy np import time n_mc = 1000 n = 10000 s = np.zeros((n_mc, n+1)) s0 = 1.0 s[:, 0] = s0 start_time_normals = time.clock() z = np.exp(np.random.normal(size=(n_mc, n))) print "generate normals time = ", time.clock() - start_time_normals start_time_prices = time.clock() in xrange(n_mc): j in xrange(1, n+1): s[i, j] = s[i, j-1]*z[i, j-1] print "pices time = ", time.clock() - start_time_prices the times were: generate normals time = 1.07 pices time = 9.98 is there more efficient way generate arrays s , perhaps using numpy's routines? nice if normal random variables z generated more quickly, too, i'm not hopeful. it's not necessary loop on 'paths', because they're independent of each other. so, can remove

python - skip an error row in a for loop -

i iterating through each row in csv file , choose/calculate rows meet condition. however, when there error in row, stops loop. there way tell python skip error , move next row? use try function did not work. code is try(row['bas'] = float(row['close ask']) - float(row['close bid'])) the error 1 of cell string , cannot converted float you want like: for row in csv_file: try: x = float(row['close ask']) - float(row['close bid']) except valueerror: continue else: # keep going doing x ...

php - PyroCMS Tags in Arrays -

i using codeigniter pyrocms in work website developer. colleagues have used pyro longer have using pyro tags lot. seem extremely useful, if don't have clue how work yet. anyway, trying use tags in php array, pyro doesn't seem that. the code in question: {{ eods }} <tr> <td value="{{ user_id }}" class = "span1">{{ user_id }}</td> <td value="{{ eod }}" class = "span2">{{ eod }}</td> <td value="{{ mit_id }}" class = "span2"><?php echo $this->db->get_where('mit', array('id' => {{ mit_id }})); ?></td> <td value="{{ date }}" class = "span2">{{ date }}</td> <td value="{{ time }}" class = "span2">{{ time }}</td> </tr> {{ /eods }} i error: parse error: syntax error, unexpected '{' in c:\repos\mit-eod\addons\shared_addons

javascript - How would you convert Binary field of type 4 to type 0? -

how convert binary field of type 4 type 0 using shell script ? i thought running simple script this db.places.find({}).foreach(function(data) { // how data ? print(data.id); // db.places.update(....) }); but couldn't figure out how binary data can construct new binary. object.keys() shows there 2 fields: type , len you can not force type. don't quite understand why want this, can rewrite document force new type: db.places.insert( { id: new bindata( 0x04, "sevmte8=" ) } ); db.places.find(); { "_id" : objectid("5204c4f252d346a74dd17755"), "id" : bindata(4,"sevmte8=") } so script, can this: db.places.find({}).foreach(function(data) { bindata = data.id.base64(); db.places.update( { _id: data._id }, { $set: { id : new bindata(0, bindata) } } ); });

javascript - Firebase Web SDK 3.x ServerValue timestamp? -

i trying figure out alternative firebase.servervalue.timestamp sdk v 2.x in sdk v3.x does know what's new way firebase server timestamp in web sdk? it firebase.database.servervalue.timestamp

reactjs - React input onChange renders all components working so slow -

i have react + redux application , running webpack. in application have small components developed me. in cases should render grid kind of components hundreds of data. reasons can not use paging. , when user clicks edit button on grid line item open small dialog. in window have input text element , if user edits input elements value each key down causes render page data , components. each keypress there lag 1 second. how can deal this? i not using , devtools problem rendering of components need time. in case normal think. can not remove onchange input because become readonly. have tried use defaultvalue fill props after render component because data coming api. code geteditsubwindow(){ var griddata = this.props.stocks.filter(s=>{ return s.isselected; }); var windowcommandbuttons=[ {text:'cancel', classname:'cancel', onclick:null }, {text:'save', classname:'save&#

how to get loaded html download file with javascript/jquery -

im trying use library https://github.com/hrikrishnankr/pdf2html upload pdf , download html file. have been able download html file using function download(filename, text) { var element = document.createelement('a'); element.setattribute('href', 'data:text/html;charset=utf-8,' + encodeuricomponent(text)); element.setattribute('download', filename); element.style.display = 'none'; document.body.appendchild(element); element.click(); document.body.removechild(element); } then have html viewer var data=document.getelementbyid("viewer").innerhtml; and run function when button download button clicked <button id="download" class="toolbarbutton download hiddenmediumview" title="download" tabindex="34" data-l10n-id="download" onclick="downloadhtml()"> function downloadhtml() { var data=document.getelementbyid("viewer").innerhtml; download(&#

javascript - React - changing an uncontrolled input -

i have simple react component form believe have 1 controlled input: import react 'react'; export default class myform extends react.component { constructor(props) { super(props); this.state = {} } render() { return ( <form classname="add-support-staff-form"> <input name="name" type="text" value={this.state.name} onchange={this.onfieldchange('name').bind(this)}/> </form> ) } onfieldchange(fieldname) { return function (event) { this.setstate({[fieldname]: event.target.value}); } } } export default myform; when run application following warning: warning: myform changing uncontrolled input of type text controlled. input elements should not switch uncontrolled controlled (or vice versa). decide between using controlled or uncontrolled input element lifetime of component i believe

database - Manually making wp_options table -

so, got rid of wp_options db table accident , trying recreate or table back. is there way of doing without reset whole wp db? thanks! you can't restore it, unless have backup of it. check service provider in case have automated backup copy. otherwise, try re-creating table following queries. , activate plugins again. create table `wp_options` ( `option_id` bigint(20) unsigned not null auto_increment, `option_name` varchar(191) collate utf8mb4_unicode_ci not null default '', `option_value` longtext collate utf8mb4_unicode_ci not null, `autoload` varchar(20) collate utf8mb4_unicode_ci not null default 'yes', primary key (`option_id`), unique key `option_name` (`option_name`) ) engine=innodb auto_increment=1 default charset=utf8mb4 collate=utf8mb4_unicode_ci put site url , run following queries insert wp_options values ('1', 'siteurl', 'your_site_url', 'yes'); insert wp_options values ('2', &#

c# - How to accepting negative floating numbers with TextBox UWP? -

i have requirement. 1) accept positive , negative floating numbers 2) accept numbers values represent latitude,longitude coordinates. from answers posted got how accept positive floating numbers private void floattextbox_textchanging(textbox sender, textboxtextchangingeventargs args) { try { if (!regex.ismatch(sender.text, "^\\d*\\.?\\d*$") && sender.text != "") { int pos = sender.selectionstart - 1; sender.text = sender.text.remove(pos, 1); sender.selectionstart = pos; } } catch { } } i wanted know how accept negative numbers adding ^\- beginning of expression not working. tried other answers here none worked coordinates. try 1 @"^[-]?[0-9]*(?:\.[0-9]*)?$"

java - eclipse set global environment for all projects -

for each project, able set environment when select "run as" . can set global environment project inherit when run? you can set environment variables in script starts eclipse. these should inherited child processes. [edit] create small script contains this: export java_home=.... ....path-to-eclipse.../eclipse.exe not sure ".exe" on mac. put absolute path of eclipse executable in line below export , should work. make script executable, use chmod +x scriptname

java - REST API security - how to secure it instead of sessionid -

i got question security simple rest api application. implemented check security , on every attempt read/update data from/in database (this simple httpsession session= request.getsession(true); , check - if new session or old , if equals session id fro cookies). but thing - if valid user , valid session - got url make user ignore other user: http://localhost:8080/chatrest/rest/friendservice/ignorefriend/1/2 i change 2 users id (last 2 numbers) , send same request make other system user ignore else, example: http://localhost:8080/chatrest/rest/friendservice/ignorefriend/3/4 how can solve problem? googled lot (for example - restful authentication , related articles, including security questions). easiest way solve problem? quite beginner, i'll happy find simpliest solutions. thank you! any authentication mechanism allows handle this, provided users don't share same credentials. basic auth , you'll able determine authenticated. if logged in user id=1 ,

postgresql - Ignore/reconnect for closed connection in pool -

i have problem pool.acquire() , closed connection in pool. setting on pg server set connection timeout 120 second. when use pool.acquire() raise error because connection closed: sleep 150 traceback (most recent call last): file "test.py", line 21, in <module> loop.run_until_complete(test_select()) file "/usr/local/cellar/python3/3.5.1/frameworks/python.framework/versions/3.5/lib/python3.5/asyncio/base_events.py", line 337, in run_until_complete return future.result() file "/usr/local/cellar/python3/3.5.1/frameworks/python.framework/versions/3.5/lib/python3.5/asyncio/futures.py", line 274, in result raise self._exception file "/usr/local/cellar/python3/3.5.1/frameworks/python.framework/versions/3.5/lib/python3.5/asyncio/tasks.py", line 239, in _step result = coro.send(none) file "test.py", line 10, in test_select async pool.acquire() conn: file "/usr/local/lib/python3.5/site-packages/aiopg/uti

python - Pyinstaller Error - "setuptools distribution was not found" -

trying out build executable binary python project using pyinstaller. environment details: python - 2.7.6, pip - 6.1.1, setuptools - 21.2.1 i can able build project successfully. pyinstaller heatstackapp.py ...... ...... 83093 info: checking collect 83093 info: building collect because out00-collect.toc non existent 83094 info: building collect out00-collect.toc jayaprakash@cloudenablers:/opt/core/heatstack/heatstack$ whereas when execute binary throws below error message. jayaprakash@cloudenablers:/opt/core/heatstack/heatstack$ ./dist/heatstackapp/heatstackapp ...... ...... file "pbr/packaging.py", line 31, in <module> file "/usr/local/lib/python2.7/dist-packages/pyinstaller/loader/pyimod03_importers.py", line 389, in load_module exec(bytecode, module.__dict__) file "setuptools/command/develop.py", line 11, in <module> file "/usr/local/lib/python2.7/dist-packages/pyinstaller/loader/pyimo

mysqladmin - MySQL root@localhost, root@127.0.0.1 and root@::1 have different passwords - is it normal? -

Image
after setting password command: mysqladmin.exe --user=root password <my_password> i see 3 rows in user table "root" user: http://i.stack.imgur.com/y4rkd.jpg , root@localhost has password, while root@127.0.0.1 , root@::1 not have password. does mean need set password 3 times each of these rows? i.e.: mysqladmin.exe --user=root host=localhost password <my_password> mysqladmin.exe --user=root host=127.0.0.1 password <my_password> mysqladmin.exe --user=root host=::1 password <my_password> is normal? yes, different accounts. , yes, every account can have own password. can check details account names here . if don't set host mysql utilities (such mysqladmin), default connect localhost. so, connected under user root@localhost , changed password user only. 2 other root users must change password explicitly.

vb.net - “A cycle was detected in the set of changes” with Linq to SQL -

i developing application in experience exception "a cycle detected in set of changes" when calling datacontext.submitchanges(). know why exception thrown have not been able find fix situation. let me explain situation. have database table shown below access linq sql gets mapped classes in vb.net. device ------- id defaultgatewayid the defaultgatewayid device can same object or device. user uses gui datagrid alter , add new records. updating records no problem. id exists , defaultgatewayobject attached record (the id stored in database). however when try add new record , set defaultgatewayobject in same transaction 'cycle detected in set of changes'-exception. suspect caused linq sql because not know record add first, although same item in case. i not have option break insertion 2 parts , 1 device , adding defaultgateway because submit button bound xaml command executes submitchanges. ideally have option specify object created first, or that. think it'

resharper - Do redundant expressions, directives and qualifiers impact performance? -

i'm working else's code right , resharper giving me lot of warnings redundant code, such as: unused directives array creation expressions ( new string[]{xxx,xxx,xxx} instead of {xxx,xxx,xxx} ) explicit delegate creation ( new eventhandler(xxx) instead of xxx ) qualifiers ( system.windows.forms.form instead of form when directives used) there lot of code work with, i'm not sure if it's worth going through , removing redundant code. with in mind, wanted ask if these warnings there improve code style (for aesthetics) or pieces of code perform operations , impact performance little? it depends. unused using directives don't matter . abbreviated array initializers i'm pretty sure compile same cil explicit delegate creation i'm not sure, i'd expect same performance unneeded qualifiers i'm sure compile same cil. however the computer's time in general much less important your time, or time of else reading code. ta

html - center div in css but keep off of left nav -

i trying center #content div`` on page has position:absolute #nav on left side. #nav comes out 400px left side of page (accounting <body> margin ). here's code centering of both divs : #nav{ position: absolute; display: inline-block; width: 350px; height: 800px; } #content{ position: absolute; display: inline-block; left: 0; right: 0; margin: auto; width: 600px; height: 1000px; border: solid; border-width: 1px; } this works fine enough, unless is, window becomes quite narrow, in case #content slides on #nav . there way center #nav on page, relative window size, still put limit on how far left can move while window gets smaller? edit: see jsfiddle demo of situation here: jsfiddle.net/b2bcofyd/1/#&togetherjs=gti1uzdgxf [i've modified dimensions of divs make more legible in demo] you can add minimum width body. adding stylesheet: body { min-width: 950px; /*350 + 600*/ } this way, scro

c - Order of `static` definition and `extern declaration` in a translation unit -

i unable understand why doesn't work. extern int i; int main() { printf(" %d ", i); } static int =3; also, doesn't work: extern int i; static int =3; int main() { printf(" %d ", i); } but if static variable defined before extern declaration works: static int =3; extern int i; int main() { printf(" %d ", i); } as understand extern int i tells i present somewhere else , here how looks lik( int i ) but, somewhere else means: 1) maybe, later point in same translation unit global variable . 2) maybe, in other translational unit. i thinking (1) valid though static int = 3 has restricted i 's scope current translation unit defined. isn't static int =3 global ( mean atleast visible in translation unit) here though has restricted scope translation unit? why isn't compiler unable find it? when compile first 2 versions following compile time error: error: static declaration of ‘i’ fol

javascript - using a JS blur to bring focus to a div -

sorry i'm getting js functions have search box on our page , when call made (i think using ajax) populates search data div. used use jquery live search. within search query have number of link have class, class relates jquery modal. older version used work using blur function. trying port functionality on new search. what used have... the jquery search: <form method="post" action="<? echo constructurl($platform_name,"https") ?>/process/feedbackcreateuser" enctype="multipart/form-data" class="form-right"> <input name="q" type="text" placeholder="enter idea or feedback ... " name="title..." style="width:100%; " value="<? echo $captchamessage ?>"> <div id="jquery-live-search" style="display:none;"></div> <script src="<? echo $asset_url ?>/3rdparty/feedback/jquery.livesearc

python - How to transfer pre trained machine learning model to App Engine -

i have few machine learning models have trained (size in 300mb - 4 gb). want query them using rest api. build apis in flask require these models in memory. google app engine suitable it? or should use compute engine instead? it's unsuited appengine because of reasons like: appengine not have instances ram (unless use flexible same gce option). even if did, instance can go away requires reload data memory (thou on memcached) time restrictions on frontend instances make unlikely can time load data memory, less being able analyze data. backend type of instance it, harder doing regular vm. good luck loading libraries need, none should write file storage, temp file. thus compute engine correct place.

excel vba - How can I remove columns with red heading in VBA -

i have file red heading, , want delete whole column using vba code? can use loop find red heading , delete column instead of column countrt?? remove space in line if cells(1,icntr). font.colorindex = 3 then between cells(1,icntr). , font.colorindex change columns(icntr).entirecolumn.delete columns(icntr).delete ************* edit ************: assuming have data/text in headings (first cell of column) macro trick. remember when looping through rows or columns , deleting then, should reverse loop make sure rows or columns checked! sub deletecolumnswithredheader() dim ws worksheet dim lcolumn long dim long 'change sheet name!!!!!!!!!!!!! set ws = sheets("your_sheet_name") 'this give last column index data lcolumn = ws.cells(1, columns.count).end(xltoleft).column 'loop through column data - reverse loop check columns = lcolumn 1 step -1 'if first cell in column red delete column if ws.cells(1, i).interior.colorindex = 3 ws.colum

javascript - Show the correct tabs when Bootstrap Modal is called -

i have 3 buttons in homepage , modal 3 tabs. want fire correct tab when respective buttons clicked. how should go it? for example: want show "careers" tab if careers button clicked. likewise, same contact & partners too. <div class="row"> <div class="col-xs-4"><a data-toggle="modal" data-target="#mymodal"><span class="btn btn-primary">contact</span></a></div> <div class="col-xs-4"><a data-toggle="modal" data-target="#mymodal"><span class="btn btn-primary">careers</span></a></div> <div class="col-xs-4"><a data-toggle="modal" data-target="#mymodal"><span class="btn btn-primary">partners</span></a></div> </div> <!-- modal--> <div id="mymodal" class="modal fade" role="dialog"> &

asp.net web api - angular.js:13424 TypeError: $scope.entry.update is not a function. Updating the correct way with angularjs -

i trying make update existing object following error $scope.entry.update not function . i created service called 'budgetresource' "use strict"; angular.module("common.services").factory("budgetresource", ["$resource", "appsettings", budgetresource]) function budgetresource($resource, appsettings) { return $resource(appsettings.serverpath + "api/budget/:id", null, { 'update': { method: 'put', isarray: true }, 'delete': { method: 'delete', isarray: true }, 'save': { method: 'post', isarray: true } }); } herewith function in controller budgetresource service injected function $scope.updatebudgetamount being called. $scope.updatebudgetamount = function (categoryid) { $scope.entry = new budgetresource(); $scope.entry = { "budgetamount": $scope.budgetamount,

In C++, can I declare a template struct with a template parameter unused in the definition? -

recently i'm reading source code spirit-v2-json , , have been confused following code : template <typename tag> struct literal { bool operator==(literal const&) const { return true; } bool operator< (literal const&) const { return false; } }; typedef literal<struct tag_undefined> undefined; typedef literal<struct tag_null> null; question 1: what's meaning of tag parameter in template of literal ? unused. question 2: struct tag_undefined , struct tag_null haven't been defined declared, why can use them template parameters? the purpose of tag parameter differentiate between different types. there no requirement them display difference in functionality, need distinct classes. differentiation purpose of tag parameter , isn't used in way in template class itself, ok use incomplete in-situ types directly in typedef . why want this? in above use case code uses template define 2 distinct types, undefined , nul

php - 404 Not Found error when routing using silex -

i had following code, worked fine on php 5.6 , apache 2.2. think upgraded apache 2.4 , seems have stopped working. api -app -job -jobcontroller.php -jobfacade.php -jobfacadeprovider.php -src -batchautoscalingapplication.php -routes.php -app.php -index.php routes.php <?php require_once __dir__ . "/../job/jobcontroller.php"; $app->mount("/job", new jobcontroller()); ?> jobcontroller.php <?php require_once __dir__ ."/jobfacade.php"; class jobcontroller implements controllerproviderinterface { public function connect(application $app) { $controllers = $app['controllers_factory']; error_log("isnide cntroller",false); $controllers->get('/isacceptable', function (request $request) use ($app) { $id_contents = $request->query->get('id_contents'); $result =

postgresql - Why my liquibase modifySQL clause is not triggered? -

i'm trying define dbms schema liquibase (in spring-boot project). relevant part of project json storage i'm trying setup. even know relational dbms not able process json correctly or starting (as may 2016), want have kind of vendor agnostic schema. so, set blob (or else, advise appreciate) default datatype rdbms, , specialized able deal : famous jsonb postgresql , or least json h2 , mysql . as use spring-boot , don't have config (indeed none ;)) it seems modifysql clause not triggerred. i'm using following changeset. yaml liquibase changeset databasechangelog: - changeset: id: 1 author: jrevy changes: - createtable: tablename: recipe columns: - column: name: id type: uuid constraints: primarykey: true nullable: false - column: name: name type: v

android - How to do this query in background with AutoCompleteTextView? -

i've made code: public view oncreateview(final layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.fragment_search, container, false); button search = (button)view.findviewbyid(r.id.cerca); andata = (autocompletetextview)view.findviewbyid(r.id.andata); ritorno = (autocompletetextview)view.findviewbyid(r.id.ritorno); //set adapters parsequery<parseobject>query = parsequery.getquery("stations"); query.findinbackground(new findcallback<parseobject>() { @override public void done(list<parseobject> list, parseexception e) { if(e == null) { for(int = 0; i<list.size();i++) { string name = list.get(i).getstring("code"); stationnames.add(name); } string [] stradapter = new string[stationnames.size()

javascript - Full screen modal in materialize design -

Image
i using materialize design. , implementing full screen modal. width spend in full screen height not set in full screen. have seen 1 link want implement this. if plugin , other solution, let me know. http://joaopereirawd.github.io/animatedmodal.js/ $(document).ready(function(){ // "href" attribute of .modal-trigger must specify modal id wants triggered $('.modal-trigger').leanmodal(); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/css/materialize.min.css"> <!-- compiled , minified javascript --> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.6/js/materialize.min.js"></script> <a class="waves-effect waves-light btn modal-trigger" href="#modal1">modal</a> <!-- modal

javascript - How to access pagination in asp website using Node.js? -

i going grab data website build asp. i'm having problem it's pagination, don't know how next page. here have tried code var url = 'https://www.muvmarketplace.com/portal/cardetail.aspx?bid_date=20160525#this'; siterequest.post(url, {form:{pc$pageno:3}} , function(error, response, body){ if(!error && response.statuscode == 200){ var $ = cheerio.load(body); var links = []; $('table.sortable > tr:not(".mtbgreenbg")').each(function(){ links.push('https://www.muvmarketplace.com/portal/'+$(this).find('td').eq(12).find('img').attr('onclick') .replace(/'/g, '') .replace(/,/g, '') .replace(/[()]/g, '') .replace(/window.open/g, '') .replace(/resizable=yesscrollbars=yes/g,'')); }); console.log(links); } }); but did not

python - PySpark DataFrames - way to enumerate without converting to Pandas? -

i have big pyspark.sql.dataframe.dataframe named df. need way of enumerating records- thus, being able access record index. (or select group of records indexes range) in pandas, make indexes=[2,3,6,7] df[indexes] here want similar, (and without converting dataframe pandas) the closest can is: enumerating objects in original dataframe by: indexes=np.arange(df.count()) df_indexed=df.withcolumn('index', indexes) searching values need using where() function. questions: why doesn't work , how make working? how add row dataframe? would work later make like: indexes=[2,3,6,7] df1.where("index in indexes").collect() any faster , simpler way deal it? it doesn't work because: the second argument withcolumn should column not collection. np.array won't work here when pass "index in indexes" sql expression where indexes out of scope , not resolved valid identifier pyspark >= 1.4.0 you can add

r - Extract names of the levels of a factor -

this question has answer here: subsetting in data.table 4 answers i'm trying read huge matrix (2.8gb) in r, thus, far, best have found is require(data.table) dt<-fread("bigmatrix.csv") of know nothing! after i'm able tell matrix has 3 columns , 50 milion rows. each row of type object1 object 2 distance 1: kho.central_khoisan.gwi kho.central_khoisan.gwi 0.0000000 2: kho.central_khoisan.gwi kho.central_khoisan.gxana 0.2195843 3: kho.central_khoisan.gwi kho.central_khoisan.khoekhoegowab 0.6749363 4: kho.central_khoisan.gwi kho.central_khoisan.khwe 0.6089206 5: kho.central_khoisan.gwi kho.central_khoisan.korana 0.7163111 6: kho.central_khoisan.gwi kho.central_khoisan.kwadi 0.8017179 so it's comparing distances of 2 objects pairwise approx

string - put two concatenatend var in a command - shell bash -

i have problem script. have follow script: while read line; ifs=' ' #sostituisco in ifs il carattere di default con quello di spazio i=0 campo in $line; (( i++ )) if [[ $i -eq 1 ]] ; nome="$campo" elif [[ $i -eq 2 ]] ; cognome="$campo" fi done nome_file=$nome\_$cognome echo $nome_file j=$(find /home/ubuntu/scrivania/contatti -name 'nome_file*' | wc -l) echo $j done < $rubrica the file rubrica contains rows that: andrea bargnani 6956959388 2632634643 2012/05/19 chris bosh 87654323234 78675432334 2014/06/16 zlatan ibrahimovic 2937485929 1938472639 2003/06/30 andrea mantovani 3402948586 0459687124 2015/01/25 and

jquery - Call Ajax when click button submit with validationform.io -

i use plugin jquery : "validationform" in site : http://formvalidation.io/ . when click button submit, call ajax server. in here plugin validationform don't validate fields,but call ajax. code : html: <button type="submit" class"btn btn-success" id="#button"></button> validationform code: $('#form').bootstrapvalidator({ message: 'not valid', feedbackicons: { valid: 'glyphicon glyphicon-ok', invalid: 'glyphicon glyphicon-remove', validating: 'glyphicon glyphicon-refresh' }, fields: { phonenumber: { message: 'not null', validators: { notempty: { message: 'not null' }, stringlength: { min: 2,

Android Realm repalce refresh with waitForChange -

after v0.91.0, deprecated methods in realm removed including refresh() . i've used refresh() below make sure realm instance has up-to-date data. public static <t> t query(realmactionwithresult<t> runnable, t defaultvalue) { realm realm = realm.getinstance(getconfiguration()); try { realm.refresh(); return runnable.run(realm); } catch (exception e) { return defaultvalue; } { realm.close(); } } if replace refresh() waitforchange() , it's blocked until next change happens (of course in non-looper thread). how can make not block current thread, pass when current realm up-to-date 1 or block if there should wait? or if use realm above pattern (every time close it) in non-looper thread schedulers.io in rx, realm.getinstance() return newest snapshot because per-thread cached instance reference zero? you don't have call refresh right after calling getinstance() . realm returned getinstance()

javascript - Sum of array elements counted dynamic by JS/jQuery -

i have loop this: while((numbers[0]+numbers[1]+numbers[2]+numbers[3]+numbers[4]+numbers[5]+numbers[6] +numbers[7]+numbers[8]+numbers[9]+numbers[10]+numbers[11]+numbers[12]+numbers[13] +numbers[14]+numbers[15]+numbers[16]+numbers[17]+numbers[18]+numbers[19]+numbers[20] +numbers[21]+numbers[22]+numbers[23]+numbers[24]+numbers[25]+numbers[26]+numbers[27] +numbers[28]+numbers[29]+numbers[30]+numbers[31]) != 0 ) { x=math.floor((math.random() * 32) + 0); if (numbers[x]!=0) { $('.board').append('<div class="tile" data-icon="icon'+(numbers[x])+'" data-end="no"></div>'); numbers[x]=0; } } i wanna make while condition more sexy . need sum of 'numbers' elements. in loop, values of array elements changing, guess can't count for loop, dynamic counting necessary. function that? i'll grateful solution problem. use

javascript - Navigating to new page from controller using AngularJS and Onsen UI -

i have cross platform app developed using onsen ui, monaca , angularjs. i trying navigate new page controller when user clicks button on view. following solution this post keep getting error: typeerror: cannot read property 'pushpage' of undefined @ scope.$scope.getdateandpushpage i have view set display listview of dates using ng-repeat , when user clicks on of listview items, selected date item , and use in controller perform calculations. once done need segue next page display calculations. my listview looks follows , displays list of dates stored in data : <ul class="list"> <li ng-repeat="mydate in data" class="list__item list__item--chevron" ng-click="getdateandpushpage(mydate.date)")> {{mydate.date}} </li> </ul> in views controller try , push new page the example mentioned above per code below: var datereports = angular.module("datereportscontroller", []); datere

android - Progress bar sometimes change color -

i use progressbar in layout this: <progressbar android:id="@+id/progress" android:layout_width="@dimen/default_small_icon_size" android:layout_height="@dimen/default_small_icon_size" android:visibility="gone" style="@style/widget.appcompat.progressbar" /> it's inflated activity layout , thing calling setvisibility(...) either visible or gone . now issue... of times when enter app , progress bar shown, color set accent color (in case orange) every , when close app , reenter, it's gray ... when similar things have happend in past it's because applicationcontext has been used when creating view, hence not providing proper theme/style. in case defined in xml that's later used in setcontentview(r.layout.activity_layout) , should not context issue. anyone have clue why happening? app takes time load styles around 1-2 sec depends on device/firm

sql - How to query logicblox -

i have entity predicate eg. "person" related functional predicates storing attributes entity. eg. person(x), person:id(x:s) -> string(s). person:dateofbirth[a] = b -> person(a), datetime(b). person:height[a] = b -> person(a), decimal(b). person:eyecolor[a] = b -> person(a), string(b). person:occupation[a] = b -> person(a), string(b). what in terminal, equivalent of sql query: select id, dateofbirth, eyecolor person i aware of print command details of single functional predicate, combination of them. lb print /workspace 'person:dateofbirth' you can use "lb query" command execute arbitrary logiql queries against database. create temporary, anonymous, predicate results want see, , rule populating predicate using logiql language. in case like: lb query <workspace> '_(id, dob, eye) <- person(p), person:id(p:id), person:dateofbirth[p] = dob, person:eyecolor[p] = eye.'

ionic2 - Ionic 2 with Paper JS - Flickering canvas and white box -

i'm having issue ionic 2 (beta.7) , paper js: white box appears @ top left corner of canvas when start drawing. see example picture here .the canvas flickers when drawing. a short description i'm trying do: take picture device camera , draw image on canvas , allow user draw on image. any ideas i'm doing wrong? or suggestions on how fix this? my code: taking picture (using ionic native): public takepicture(): void { // options camera plugin let options = { quality: 20, destinationtype: camera.destinationtype.file_uri, sourcetype: 1, encodingtype: camera.encodingtype.jpeg, mediatype: camera.mediatype.picture, correctorientation: true }; camera.getpicture(options).then((imagedata) => { this.nav.push(drawpicturepage, { imagepath: imagedata }); }, (err) => { }); } drawpicturepage (picturedraw.ts): import {platform, page, navcontroller, navparams} 'ionic-angul

Android get gravity value of textView programmically -

i'm trying current gravity value of textview in android i searched lot on stackoverflow, found solutions how set gravity or how things margin, padding etc. so how can current gravity of textview? edit: it's getgravity() this textview : <textview android:id="@+id/textview" android:gravity="center" android:text="hello world!" android:layout_width="wrap_content" android:layout_height="wrap_content" /> this method how getting gravity. textview = (textview)findviewbyid(r.id.textview); switch (textview.getgravity()) { case gravity.center: toast.maketext(mainactivity.this, "center" , toast.length_short).show(); break; case gravity.top: toast.maketext(mainactivity.this, "top" , toast.length_short).show(); break; case gravity.bottom: t