Posts

Showing posts from February, 2010

Want to put MySql limit on each where condition -

i want refine mysql condition putting limit on each parameter. current query select * product name "%abc%" or name "%xyz%" limit 50 i got result having 50 rows both condition. want result on base of each condition such as select * product name "%abc%" limit 50 select * product name "%xyz%" limit 50 i want wrap both above queries in 1 got 50 records first query , 50 next one. you can try use union all select * product name "%abc%" limit 50 union select * product name "%xyz%" limit 50

Facing issue with MFA while adding account to Yodlee -

i getting error while adding account yodlee, below steps doing add site based account. 1.i adding account calling addsiteaccount1. 2.after adding account able mfa account calling getmfaresponseforsite api 3.when putting mfa calling putmfarequestforsite api getting error in json response and responses getting 1.response addsiteaccount1 is {"siteaccountid":12803756,"iscustom":false,"credentialschangedtime":1442572129,"siterefreshinfo":{"siterefreshstatus":{"siterefreshstatusid":1,"siterefreshstatus":"refresh_triggered"},"siterefreshmode":{"refreshmodeid":1,"refreshmode":"mfa"},"updateinittime":1442572129,"nextupdate":1442573029,"code":801,"suggestedflow":{"suggestedflowid":2,"suggestedflow":"refresh"},"noofretry":0,"ismfainputrequired":true,"siteaddstatus":...

PulpSolverError: PuLP: Error while trying to execute glpsol in Python 2.7 -

i'm running pulp on os x via ipython notebook , python 2.7. glpk installed using brew install homebrew/science/glpk , pulp installed via pip install pulp . however i'm getting error in python: --------------------------------------------------------------------------- pulpsolvererror traceback (most recent call last) <ipython-input-15-689fef0dd94f> in <module>() 1 # solve problem ----> 2 status = prob.solve(glpk(msg=0)) 3 /users/x/anaconda/envs/data/lib/python2.7/site-packages/pulp/pulp.pyc in solve(self, solver, **kwargs) 1641 #time 1642 self.solutiontime = -clock() -> 1643 status = solver.actualsolve(self, **kwargs) 1644 self.solutiontime += clock() 1645 self.restoreobjective(wasnone, dummyvar) /users/x/anaconda/envs/data/lib/python2.7/site-packages/pulp/solvers.pyc in actualsolve(self, lp) 364 stderr = pipe) 365 ...

webview - iOS UIWebView leaked -

class myviewcontroller: uiviewcontroller { @iboutlet weak var webview: uiwebview? override func viewdidload() { super.viewdidload() let url = nsurl(string: urlstring) let request = nsurlrequest(url: url!) svprogresshud.show() webview?.loadrequest(request) webview?.scrollview.header = mjrefreshnormalheader(refreshingblock: { [weak self] in if let strongself = self { strongself.webview?.reload() }}) } override func viewdiddisappear(animated: bool) { super.viewdiddisappear(animated) svprogresshud.dismiss() } } extension myviewcontroller: uiwebviewdelegate { func webviewdidfinishload(webview: uiwebview) { webview.scrollview.header.endrefreshing() svprogresshud.dismiss() } func webview(webview: uiwebview, didfailloadwitherror error: nserror?) { webview.scrollview.header.endrefreshing() svprogresshud.dismiss() } } the view controller pushed navigation controller, when...

c++ - Using numpy module in pythonQt -

i want use python(especially numpy pkg) in qt, use pythonqt purpose. since need numpy python module use flags initial pythonqt. pythonqt::init(pythonqt::externalhelp); for testing numpy use simple sample test can see below int main(int argc, char *argv[]){ qcoreapplication a(argc,argv); pythonqt::init(pythonqt::externalhelp); pythonqtobjectptr context=pythonqt::self()->getmainmodule(); context.evalscript(“import numpy\ndef mul(a,b):\n return a*b”); qvariantlist args; args<<42<<2; qvariant result=context.call(“mul”,args); qdebug()<<result.tostring(); return a.exec(); } when run above simple code, raise error : file "/usr/local/lib/python-64bit-3.4.3/lib/site-packages/numpy/core/ init .py", line 5, in importerror: no module named multiarray i create simple project in c++ , add python.h header file , python lib directory project in order test numpy. result ok , work correctly, in pythonqt doesn’t work....

Store email on session in AngularJS -

so, today make simple login page angularjs . , purpose of login want store email form session . this login: <label class="item item-input"> <input type="email" placeholder="email" ng-model="data.email" required> </label> <label class="item item-input"> <input type="password" placeholder="password" ng-model="data.password" required> </label> if can refer php programming language, can use $_session['email'] , store email session . read several article $sessionstorage sample example what's best approach store session in angularjs ? thanks :) you can try make service based on window.sessionstorage or window.localstorage keep state information between page reloads. use in web app partially made in angularjs , page url changed in "the old way" parts of workflow. web storage supported ie8. here angular-webstor...

c# - Violating polymorphism by having base ViewModel class determine current type? -

i have base viewmodel has public method. things pretty simple @ first , role same of derived classes, want viewmodel different things depending on derived class calls it. so example have: public void domethod() { dothismethod(); } we want like public void domethod() { if (this.gettype().name == "thisname") dothismethod(); else doanothermethod(); } is wrong this? yes, solution propose wrong design point of view. base class should agnostic of inherited type "thisname". using naming resolve problem implementing in way: public class viewmodel { public virtual void domethod() { doanothermethod(); } public void doanothermethod() {...} } public class thisname: viewmodel { public override void domethod() { dothismethod(); } public void dothismethod() {...} }

android - Why does the ui not load till the while loop ends? -

even though while loop in thread, ui not load till while break condition. want ui load inspite of infinite while loop running. how handle such situation ? public class mainactivity extends appcompatactivity { protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); /* runonuithread th=new runonuithread(new textchange());*/ new thread() { public void run() { try { runonuithread(new runnable() { @override public void run() { runonuithread(new runnable() { @override public void run() { // change ui elements here textview tv = (textview) findviewbyid(r.id.tv); while (true) { int y = 10; ...

c++ - How I can dynamically change font in Qt application? -

i have qt 5.5 application lot of widgets. each widget has self font family draw text. of them defined in qss file, set directly qpainter. application has localization languages. 1 of language should change font family widget dynamically (all widgets should have 1 font family) , revert changes other languages. you can use qapplication::setfont() set default font multiple widgets @ once, can either use set default font everything, or set specific widget class, if pass class secont parameter. note can not used @ same time stylesheets. if want set default font 1 specific widget, can use widget's setfont() function well. note if widget setting font have stylesheet attached, in case of conflicting properties values stylesheet used.

javascript - How to register Polymer behavior with ES6? -

if polymer({ is: 'pp-app', behaviors: [playplan.helperbehavior], scrollpagetotop() { document.getelementbyid('maincontainer').scrolltop = 0; }, ondatarouteclick() { var drawerpanel = document.queryselector('#paperdrawerpanel'); if (drawerpanel.narrow) { drawerpanel.closedrawer(); } } }); the behavior here works fine, in es6 class playplanapp { beforeregister() { this.is = 'pp-app'; this.properties = {}; this.behaviors = [playplan.helperbehavior]; } scrollpagetotop() { document.getelementbyid('maincontainer').scrolltop = 0; } ondatarouteclick() { var drawerpanel = document.queryselector('#paperdrawerpanel'); if (drawerpanel.narrow) { drawerpanel.closedrawer(); } } } polymer(playplanapp); the behavior not works, how specify behaviors when using es6 ? this caused registercallback:...

python - Why some tweets are in search api and not in streaming api and vice versa -

i have script stores incoming tweets phrase (e.g. "python") database table "a" using twitter streaming api . later, script searches same phrase using twitter search api , stores results table "b". question why there tweets in "a" not in "b" , vice versa. i can think of 1 reason have tweets in "b" , not in "a": "a" contains tweets posted after streaming api started while search api returns results last week. if streaming api has been running more week, there must not tweet in "b" not in "a". i know 2 reasons have tweets in "a" , not in "b": search api returns results last week while streaming api returns everything search api returns portion of results , not focus not on completeness. i'd make sure if got correct or not. for "b" not in "a" correct. big indication of search api link included: it allows queries aga...

c# - Byte array to brush Windows 8.1 -

i found lot of answers on stackoverflow or internet, noone of them solved problem. closest solution found mix of , resulted in this: inmemoryrandomaccessstream stream = new inmemoryrandomaccessstream(); using (datawriter writer = new datawriter(stream.getoutputstreamat(0))) { writer.writebytes(foto.foto_byte); writer.storeasync().getresults(); } bitmapimage image = new bitmapimage(); image.setsource(stream); imagebrush brush = new imagebrush(); brush.imagesource = image; preview.background = brush; the second part works, because used in application , did it, in windows 8.1 have problem converting byte[] inmemoryrandomaccessstream . anyway appreciated. ps: new writeablebitmapimage(bitmap); doesn't work in wp 8.1 :( thanks all. edit: preview canvas, may wrong way fill it? how initialize it <grid x:name="rootview"> <grid.rowdefinitions> <rowdefinition height="*"></rowdefinition> <rowdefinit...

apache - How to redirect to lowercase when specific url contains at least one capital letter -

i need redirect possible combinations of lower/uppercase url lowercase, 1 specific url example-url . sample: /example-url => /example-url /example-url => /example-url /example-url => /example-url rewriterule ^example-url(.*)$ /example-url$1 [nc,r=301,l] cause redirect loop... thanks help! you can use lookahead make sure @ least 1 uppercase letter there (?i) flag make ignore-case after lookahead: rewriteengine on rewriterule ^(?=[^a-z]*[a-z])(?i)example-url(/.*)?$ /example-url$1 [r=302,l] (?=[^a-z]*[a-z]) positive lookahead ensure there @ least 1 uppercase letter. (?i) making rest of pattern ignore case. an alternative without lookahead: rewritecond %{request_uri} [a-z] rewriterule ^example-url(/.*)?$ /example-url$1 [r=302,l,nc]

c# - vs2012 IIS Express:sessionState Mode SQLServer or StateServer throws runtime error -

i want store session using stateserver or sqlserver mode,so add node in web.config file.but error happened.how do? started project vs2012 debug mode. runtime error description: exception occurred while processing request. additionally, exception occurred while executing custom error page first exception. request has been terminated. <system.web> <sessionstate mode="sqlserver" sqlconnectionstring="data source=localhost;user id=sa;password=123456" cookieless="false" timeout="10" /> <system.web>

c++ - Building log4cplus for Windows x64 -

i supposed build existing windows 32bit project windows 64bit. (and linux 64bit too). the project uses log4cplus library. 1 contains 32bit .lib files @ moment , shining example of why hate using libraries in c++ - there's bunch of source files , linux bash scripts. install file entirely configure bash script doesn't work on windows. configure passes arguments gcc, don't known ones. i downloaded mingw in hope i'll able use mingw32-make on project , work, no such thing happened. so have experience making linux projects on windows? not first time tackle problem - third viewed question broken boost build . judging view count, i'm not 1 has problems building linux project on widnows. log4cplus maintainer here. the master branch of log4cplug git repository c++11 only. because of this, requires visual studio 2015 , msvc14 directory there. branch 1.2.x , releases come visual studio project files version 2010. however, might able build using cm...

ember.js - ember JSONAPIAdapter fails to load data properly into store -

i using ember-cli , ember-data 1.13.7 , jsonapiadapter. use http-mock mock data during local testing. worked when used restadapter, ran problem when switching jsonapiadapter. the problem records data not loaded store , error reading undefined property. the adpater looks this: import ds 'ember-data'; export default ds.jsonapiadapter.extend({ namespace: 'api', }); the ajax call this: http://localhost:4200/api/users/1 the http-mock looks this: usersrouter.get('/:id', function(req, res) { res.send({ 'users': { id: req.params.id, firstname: "john", lastname: "doe", email: "johndoe@example.com", mobile: "12345678", nextappointment: 1 } }); }); the response looks this: {"users":{"id":"1","firstname":"john","lastname":"doe","email":"johndoe@example.com","mobile":"1...

Loading php page using jquery/ajax to open specific links to display pages in a Div -

i have mysql table id/name/desc fields .i'm displaying in div using php select query <div class="show_name"> while( $row = $data->fetch_array(mysqli_assoc)) { ?> <div><?php echo $row['id'];?></div> <div><?php echo $row['name'];?></div> <?php } ?> </div> <div id="content"></div> jquery/ajax code $('.show_name').on('click',function(){ $('#content').load('name.php'); }); i've name.php page want display description of clicked name link for example id name 1 abc 2 xyz if click on abc name link should able open name.php abc desc if click on xyz name link should able open same name.php xyz desc etc.. please appricated thanks! put class , user defined data attribute storing id // add clickme class // , add data-id attribute <div class="clickme" data-id="<?php ...

spring - real life scenarios for Transaction propagation -

there various transaction propagation like required - case dml operation. supports - case querying database. mandatory - ? requires_new - ? not_supported - ? never - ? nested - ? what real life scenarios use these transaction propagation? why these perfect fit situation? there various usages , there no simple answer i'll try explainatory mandatory (expecting transaction) : typically used when expect "higher-context" layer started transaction , want continue in it. example if want 1 transaction whole operation http request response. start transaction on jax-rs resource level , lower layers (services) require transaction run within (otherwise exception thrown). requires_new (always create new transaction) : creates new transaction , suspends current 1 if exists. above example, level set on jax-rs resource example. or if flow somehow changes , want split logic multiple transactions (so code have mutliple logic operations should separated). require...

OpenLayers: Does not work in internet explorer -

i have simple code: <html> <head> <title>vector icon example</title> <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script> <link rel="stylesheet" href="../apidoc/styles/bootstrap.min.css"> <script src="../apidoc/scripts/bootstrap.min.js"></script> <link rel="stylesheet" href="../css/ol.css" type="text/css"> <script src="../build/ol.js"></script> </head> <body> <div id="map" style="width: 100%, height: 400px">ggg</div> <script> new ol.map({ layers: [ new ol.layer.tile({source: new ol.source.osm()}) ], view: new ol.view({ center: [0, 0], zoom: 2 }), target: 'map' }); </script> </body> </html> it works correctly in chrome, in ie 11 not appear anything. problem? this solved problem: ...

ionic - Cordova Camera not working in android phones after building apk with intel xdk -

when test camera project usb connected device works well. have decided build app generate apk file using intel xdk. after building , installing apk on device on click camera button, no event initiated. controller: .controller("icontroller", function($scope, $cordovacamera) { $scope.takepicture = function() { var options = { quality : 75, destinationtype : camera.dest inationtype.data_url, sourcetype : camera.picturesourcetype.camera, allowedit : false, encodingtype: camera.encodingtype.jpeg, targetwidth: 350, targetheight: 350, popoveroptions: camerapopoveroptions, correctorientation: true, savetophotoalbum: false }; $cordovacamera.getpicture(options).then(function(imagedata) { $scope.imguri = "data:image/jpeg;base64," + imagedata; }, function(err) { ...

How to use other shapes rather than rectangle, circle and svg in CustomShapeImageView in Android -

Image
i using customshapeimageview library. find here . unable use other shapes heart. there three(3) options app:shap attribute. circle, rectangle , svg. see below... how use other shapes. in advance. i think library can used make image. can use heart shape svg image make heart shape. can check there few sample images shown in example library these svg images in raw folder in resource directory.

file - sys_chmod not work (linux) -

its driver init code: int res; int gpio_major=102; struct class *device_class = class_create(this_module, "gpio"); gpio_direction_input(s5pv210_gpj2(7)); gpio_direction_input(s5pv210_gpj3(0)); gpio_direction_input(s5pv210_gpj3(1)); res = register_chrdev(gpio_major, "gpio", &gpio_fops); device_create(device_class, null, mkdev(gpio_major, 0) , null, "gpio"); sys_chmod("/dev/gpio", 777); return 0; i want add mod 777 driver file , compile with: crw------ default owner can access. why sys_chmod("/dev/gpio", 777) not works?

How to display a separate webpage for tablet devices than mobile devices -

so long story short, we've got mobile project our mobile users i.e. mobile & tablets we're looking @ implementing way show homepage based on if you're visiting mobile or tablet. is there anyway on application level we've got mobile redirect setup in iis picks if user on mobile device in general , redirects. thanks.

websphere - Retrieve password for a given user in wsadmin -

i using jython script - wsadmin - admintask command changing password. before need check current password of user in was. there way / command can retreive password of given user using wsadmin tool thanks there no way can form was( assuming here user referring in ldap).

How to display same computed value multiple times in AngularJs view by calling compute function only once -

in view want display computed property multiple times, if {{ctrl.compute()}} multiple times, compute function called multiple times. i have created plunkr demo question http://plnkr.co/edit/tcmcjuiplkk94dthnivu controller app.controller('maincontroller',function(){ var ctrl= this; var list = []; ctrl.count = function(){ console.log('invoked'); return list.length } ctrl.add = function(){ list.push(1) } }); view <body ng-controller="maincontroller ctrl"> <button ng-click="ctrl.add()">add</button> <br> list size: {{ctrl.count()}} <br> list size: {{ctrl.count()}} <br> list size: {{ctrl.count()}} <br> list size: {{ctrl.count()}} <br> </body> in view, can see calling {{ctrl.count()}} 4 times , means computation happening 4 times. how can computation once , display value multiple times.? please don't suggest, ideas like, m...

html - How to give different content to every td in the table -

i'm struggling giving different content (icons in case) every <td> using nth-chid() method. if i'm adding css rule, see on every <td> 1 type of icon: .help-block .css-context-explorer-orientation-widget td:before { font-family: icons; content: "\e04f"; position: absolute; } at stage, want overwrite rule above, see no changes, icons same. .help-block .css-context-explorer-orientation-widget td:before:nth-child(1) { font-family: icons; content: "\e04e"!important; } if give !important rule, shouldn't overwrite rule above? ps: how overwrite rule when second row? the problem here not important . your selector wrong. :before should used @ end of selector. .help-block .css-context-explorer-orientation-widget td:nth-child(1):before { first select first child element , use before on it.

ng-repeat not working as expected -

i started learning angularjs, trying out different examples. due reason ng-repeat not working appreciate help. code demo <!doctype html> <html> <head> <meta charset="utf-8" /> <title></title> <script data-require="angular.js@*" data-semver="2.0.0-alpha.31" src="https://code.angularjs.org/2.0.0-alpha.31/angular.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script> var app = angular.module('myapp', []); app.controller('myctrl', function ($scope) { $scope.fname = "joe"; $scope.lname = "mathew"; $scope.fullname = function () { return $scope.fname + " " + $scope.lname; } }); </script> </head> <body> <div ng-controller="myctrl" ng-app="myapp"> ...

jquery - Chaining trigger after $(document).on() -

when binding event element old way, chaining trigger right after declaring binding easy: $('#button').click(...).trigger('click'); but i'm binding events this: $(document).on('click', '#button', function() { ... }); and attaching .trigger('click') not target specific element. there way solve 1 liner instead of having use: $('#button').trigger('click'); on separate line right after? you can find , trigger on document. $(document).on('click', '#button', function() { ... }) .find('#button').trigger('click'); `$(document).on('click', '#button', function(){})' not needed in case because needed if elements dynamically added. if dynamically added, cannot trigger click. so can first option question. $('#button').click(...).trigger('click'); or can use $('#button').on('click', function(){ } ).trigger('click...

Fast way for matrix multiplication in Python -

Image
does know fast way compute matrices such as: z{i,j} = \sum_{p,k,l,q} \frac{a_{ip} b_{pk} c_{kl} d_{lq} e_{qj} }{a_p - b_q - c} for normal matrix multiplication use numpy.dot(a,b), got divide elements $a_p$ , $b_q$ . any suggestions? any suggestions on how compute $$ c_{i,j} = \sum _p = \frac{e_{i,p} b_{p,j}}{m_p} $$ will of great well. note (e[i, p] * b[p, j]) / m[p] equal e[i, p] * (b[p, j] / m[p]) , can divide m b before calling np.dot . def f(e, b, m): b = np.asarray(b) # matrix m = np.asarray(m).reshape((b.shape[0], 1)) # row vector return np.dot(e, b / m) # m broadcasted match b

javascript - ajax inconsistent on Safari -

-edit- i have tried add error handling failing function error: function(jqxhr, status, error) jqxhr.responsetext empty guess i'm still not handling errors properly. -/edit- i new ajax , have modify existing site these 2 existing ajax functions, both of working fine in chrome, ie , ff first works in safari. second 1 fails error handler (which guess wasn't set properly?) doesn't tell me much: // works in each browser $.ajax({ cache: false, type: 'get', url: apibaseurl + 'getcountries', datatype: 'xml', success: parsecountries, error: function(){ $('.errormessage').append('<p>' + errormessage + '</p>'); } }); // not work in safari $.ajax({ cache: false, type: 'get', url: apibaseurl + 'getstandardtexts?page=login', datatype: 'xml', success: displayregisteredalert, error: function(jqxhr, status, error){ var err = e...

Wordpress meta_query / Sort array in php for autocomplete -

i have autocomplete plugin in wordpress website. results shown in alphabetical order (limit 10) query : 'foo' shows me : a...foo.. a.. foo... a..... foo a. foo.... a.. foo... a.... foo. b.... foo. b. foo.... b.... foo. b. foo.... b.... foo. this php array $suggestions[] = apply_filters( 'yith_wcas_suggestion', array( 'id' => $product->id, 'value' => strip_tags($product->get_title()), 'url' => $product->get_permalink() ), $product ); i want have in suggestion array similar string "foo product"(which 43st in php array) , not other product contain word "foo". how can sort $suggestions show closest value 'foo' in first result ? thank much.

Detect if Jquery Noty notification has been closed -

is there way detect if jquery noty notification has been closed using jquery itself? i have noty notification on homepage. detect when notification has been closed. can this? noty: var n = noty({ layout: 'topcenter', theme: 'relax', type: 'information', force: false, text: 'this 1 worked', animation: { open: 'animated zoomin', // animate.css class names close: 'animated zoomout', // animate.css class names } }); there method called 'callback' in noty. how used detect on close: var n = noty({ layout: 'topcenter', theme: 'relax', type: 'information', force: false, text: 'this 1 worked', animation: { open: 'animated zoomin', // animate.css class names close: 'animated zoomout', // animate.css class names }, callback: { onclose: function() { cookies.set('shownoty', false); }, }, });

mysql - PHP Grouping an Array with Multiple Dimensions from database results -

Image
i have array result of database query. lines include 2 dimensions , metrics. metrics must summed dimension groups. here example raw data array in table view: here exact array: array(13) { [0]=> array(6) { ["source_name"]=> string(8) "a" ["week"]=> string(2) "10" ["picks"]=> int(1) ["won"]=> int(0) ["lost"]=> int(1) ["draw"]=> int(0) } [1]=> array(6) { ["source_name"]=> string(8) "a" ["week"]=> string(2) "10" ["picks"]=> int(1) ["won"]=> int(1) ["lost"]=> int(0) ["draw"]=> int(0) } [2]=> array(6) { ["source_name"]=> string(8) "a" ["week"]=> string(2) "11" ["picks"]=> int(1) [...

scala - slick 3.0 select then insert -

i want insert new row different status value if row exists , return new instance some caller. if not exist, nothing happens , return none . have def revoke(name: string, issuefor: string): future[mylicense] = { val retrievelicense = slicklicenses.filter(l => l.name === name && l.issuefor === issuefor). sortby(_.modifiedon.desc).result.headoption val insertlicense = { licenseoption <- retrievelicense } yield { licenseoption match { case some(l) => some(slicklicenses += l.copy(status = revokedlicense)) case none => none } } db.run(insertlicense).map {r => r.map { dblicense => mylicense(dblicense.name, dblicense.status) } } how fix this? edit 1 i changed code override def revoke(name: string, issuefor: string): future[string] = { val retrievelicense = slicklicenses.filter(l => l.name === name && l.issuefor === issuefor). sortby(_.modifiedon.desc).result.headoption val insertlicenseact...

javascript - Adding an array of collections to the Previously added collection in Backbone JS -

hi new backbone js , playing around , trying learn. stuck quite time now. appreciated, in advance! this model var human = backbone.model.extend({ defaults: { name: 'fetus', age: 0, child:'noname' }, }); var human = new human(); human.set({ name: "thomas", age: 67, child: "ryan"}); //works fine this collection var person = backbone.collection.extend({ model: human }); var human1 = new human({ name: "khaleesi", age: "37", child: "drogon" }); var human2 = new human({ name: "rahul", age: "25", child: "rita" }); var human3 = new human({ name: "seema", age: "26", child: "maruti" }); var thepeople = new person([ human1, human2, human3]); document.write("</br>"); document.write(json.stringify( thepeople.models )); // works fine i want add these data previous array var sm = this.person.add(new human([ { name: ...

Simplest way to populate class from query in C# -

i want populate class query. example class: private class tvchannelobject { public string number { get; set; } public string title { get; set; } public string favoritechannel { get; set; } public string description { get; set; } public string packageid { get; set; } public string format { get; set; } } how can fill class database query? there way automatically far table column names identical class attributes? as others have suggested, orm best way go. could, however, implement functionality using reflection: void main() { var connectionstring = "..."; var records = new query(connectionstring).sqlquery<tvchannel>("select top 10 * tvchannel"); } private class tvchannel { public string number { get; set; } public string title { get; set; } public string favoritechannel { get; set; } public string description { get; set; } public string packageid { get; set; } public string format { get;...

sqlite - Laravel php artisan migrate not working -

when try use 'php artisan migrate' in laravel 2 errors: [illuminate\database\queryexception] sqlstate[hy000]: general error: 26 file encrypted or not database (sql: select * sqlite_master type = 'table' , name = migrations) [pdoexception] sqlstate[hy000]: general error: 26 file encrypted or not database i created storage/database.sqlite file before attempting migration. edited config/database.php, making default=sqlite . using windows , have sqlite3 installed. has encountered this/know how past it? i had same results, in case /database/database.sqlite file not empty. i deleted contents reran php artisan migrate , migration table created successfully.

Multiple css rules for an html node -

can please me css syntax having multiple css rules html node data attributes. here code work: <html> <head> </head> <div class='css_rule_red css_rule_size'> test text </div> <style>.css_rule_red { color: red; } .css_rule_size { font-size: 500px; } </style> </html> here current code: <html> <head> </head> <div data-custom-css='css_rule_red css_rule_size'> test text </div> <style>[data-custom-css='css_rule_red'] { color: red; } [data-custom-css='css_rule_size'] { font-size: 500px; } </style> </html> both 'css_rule_red' , 'css_rule_size' work individually, however, above code not display either of 'css_rule_red' or 'css_rule_size' css rules when combined together. how possible have multiple css rules, when using data attributes? https://amcss.github.io/ more info attribute se...

android - Unable to make build with Soomla State & Economy Sync plugin -

Image
i integrated grow compete, grow spend , grow ultimate modules unity project. when tried make build project, receive 2 errors says : commandinvokationfailure: failed re-package resources. see console details. c:\users\halil.cosgun\desktop\adtbundle\adt_bundle\sdk\build-tools\21.1.1\aapt.exe package --auto-add-overlay -v -f -m -j gen -m androidmanifest.xml -s "res" -i "c:/users/halil.cosgun/desktop/adtbundle/adt_bundle/sdk\platforms\android-21\android.jar" -f bin/resources.ap_ --extra-packages com.google.android.gms -s "c:\users\halil.cosgun\desktop\soomlaworkout\soomlaworkout\temp\stagingarea\android-libraries\google-play-services_lib\res" stderr[ res\drawable\common_signin_btn_icon_dark 1.xml: invalid file name: must contain [a-z0-9_.] res\drawable\common_signin_btn_icon_dark 2.xml: invalid file name: must contain [a-z0-9_.] res\drawable\common_signin_btn_icon_light ... ... res\drawable-mdpi-v4\common_si...

php - PHPMailer - OpenSSL Error -

based on example phpmailer provides have script below, date_default_timezone_set('etc/utc'); require './phpmailerautoload.php'; $mail = new phpmailer; $mail->issmtp(); $mail->smtpdebug = 2; $mail->debugoutput = 'html'; $mail->host = 'smtp.gmail.com'; $mail->port = 587; $mail->smtpsecure = 'tls'; $mail->smtpauth = true; $mail->username = "myemail@example.com"; $mail->password = "********"; $mail->setfrom('mymail@example.com', 'first last'); $mail->addreplyto('myemail@example.com', 'first last'); $mail->addaddress('toemail@example.com', 'first last'); $mail->subject = 'phpmailer gmail smtp test'; $mail->body = "example"; $mail->altbody = 'this plain-text message body'; if (!$mail->send()) { echo "mailer error: " . $mail->errorinfo; } else { echo "message sent!"; } even if same ...

c++ - Why does the error C3505: "cannot load type library" occur? -

i have compiler error: "error c3505: cannot load type library". i have com 32/64 bit component, compiled msvc 2012 in both configurations. have test application loads com component during start lines: #define id_string "libid:c734d1af-8cbe-4cae-b501-165099037e41" #import id_string version("0.1") no_namespace in 32bit variant works fine. in 64bit see above-mentioned compiler error. says here problem in wow bitness stuff. i've checked registry. corresponding type library found in both nodes: hkey_classes_root\typelib\{c734d1af-8cbe-4cae-b501-165099037e41} hkey_classes_root\wow6432node\typelib\{c734d1af-8cbe-4cae-b501-165099037e41} so wrong? up: i've found problem. compile tries load type library 32bit dll (only in compilation stage, in runtime program uses 64bit version). question how made compiler use 64bit type library while compilation.

html - CSS animation/transform going off screen -

i'm animating text each corner of screen. in every corner text rotated. problem here in top right , bottom left corner text goes off screen. i'm thinking has somethig rotation. my question how can keep full text on screen correct position? jsfiddle #lorem { font-size: 50px; color: red; position: absolute; top: 5%; left: 5%; animation: switch 10s linear infinite; } @keyframes switch { 0% { bottom:auto; top:3%; left: 3%; right: auto; animation-timing-function: steps(1, end); } 25% { left:auto; right:3%; bottom: auto; top: 3%; animation-timing-function: steps(1, end); transform: rotate(90deg); } 50% { top:auto; bottom:3%; right: 3%; left: auto; animation-timing-function: steps(1, end); transform: rotate(180deg); } 75% { right:auto; left:3%; top: auto; bot...

ASP.NET MVC: unity and HierarchicalLifeTimemanager -

i have simple asp.net mvc application. added unity project , tested different lifetime managers. know hierarchicallifitememanager containercontrolledlifetimemanager (singletone) unity creates different instances each child unity container. created class single guid property set in constructor, injected class in controller using hierarchicallifitememanager , show guid in view. , every time press f5 see new guid. how hierarchicallifitememanager work? it works fine. see different guid because create new root container each request (f5). try this: class hierarchicalservice { public guid value {get;set;} public hierarchicaservice() { value = guid.guid.newguid(); } } register it: ... container.registertype<hierarchicalservice>(new hierarchicallifitememanager()); ... class mycontroller { mycontroller(hierarchicalservice servicea, hierarchicalservice serviceb) { //...compare values both services } } , compare this: class my...

python - Remove specific JSON oobjects from a File and then store this file -

this part of json file looks like: "network_lo": "127.0.0.0", "ec2_block_device_mapping_root": "/dev/sda1", "selinux": "false", "uptime_seconds": 127412, "ec2_reservation_id": "r-cd786568", "sshdsakey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "ec2_block_device_mapping_ami": "/dev/sda1", "memorysize": "3.66 gb", "swapsize": "0.00 kb", "netmask": "255.255.255.192", "uniqueid": "24wq0see", "kernelmajversion": "3.2", i have python scipt download file.. want parse file , remove number of objects "swapsize","sshdsakey" sqs = boto.sqs.connect_to_region("ap-west-1") q = sqs.get_queue("deathvally") m = q.read(visibility_timeout=15) if m == none: print "no message...

Can we create a Java variable with : operator? -

is ther way declare variable this: private string xmlns:xsi; resulting following error: syntax error on token ":", , expected but, want have ':' in variable name. mandatory. it mandatory because using jaxb api unmarshal xml file java. in xml have element attribute named xmlns:xsi. now, in pojo have use attribute variable store value. that's why mandatory me have variable name this. every programming language has own set of rules , conventions kinds of names you're allowed use, , java programming language no different. rules , conventions naming variables can summarized follows: variable names case-sensitive. variable's name can legal identifier — unlimited-length sequence of unicode letters , digits, beginning letter, dollar sign "$", or underscore character " ". convention, however, begin variable names letter, not "$" or " ". additionally, dollar sign character, convention, never used @ ...

php - How to input condition in yii find()? -

i have 2 tables account , user . account table contains account_id , username , password while user table contains user_id , account_id , first_name , last_name . what want yii display contents of user table of 1 logged in used code $user= yii::app()->user->id; //to account_id of user logged in $usermodel = user::model()->find(array('condition'=>'account_id' == $user)); //to find data in user table account_id similar //account_id of 1 logged in print_r($usermodel); //to check if got correct data but reason, no matter logs in, print_r($usermodel) returning data account_id == 1 please :/ if using yii 1 can try findbyattribute $usermodel = user::model()->findbyattributes(array('account_id'=>$user));

HTTP(S) Request With Javascript and receive JSON data -

since i'm new on http(s) request case, have 1 case here must written on javascript, hope me because i've searched everywhere , couldn't find answer. here case: however, when connection rate goes 5, have wait until 1 of them finished corresponding before sending request, 2 or more of them not on 5. in addition, when response code not 200, retry 3 times. if response code still not 200 after retrying 3 times, error function pursue. must receive json data of response body argument function. <!doctype html> <html> <head> <script> function loadxmldoc() { var xmlhttp; if (window.xmlhttprequest) { xmlhttp=new xmlhttprequest(); } else { xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("mydiv").innerhtml=xmlhttp.responsetext; } else if (xmlhttp.readystate==4 && xmlhttp.sta...

ibm rad - Rational Application Developer 9.1.1, unable to add runtime Websphere Portal runtime -

Image
i unable add websphere portal 8.5 cf07 installation runtime in rational application developer 9.1.1 client. selecting 8.5 installation without fixpacks works expected. for 8.5cf07 runtime dialog gives no errors, finish button stays grayed out. both installations 8.5 , 8.5cf07 installed on local machine on same drive. any idea how solve or debug issue? need server adapter? if so, can download newer adapters? have checked eclipse market place , several ibm repositories. i using windows 10 os. did installed portal server adapters when installing rad? did installed rad via installation manager? if so, launch im , modify installation include portal adapters.

mobile - Im using Appium for Android Automation. Android app is closing while debugging the code. -

i have written below code opening app , clicking on link on app. when debugging code android app closing unexpectedly. when trying verify elements in list in debug mode saw app getting closed on mobile. please find code below: file classrootpath = new file(system.getproperty("user.dir")); file appdir = new file(classrootpath, "//apps//"); file app = new file(appdir, "base.apk"); desiredcapabilities capabilities = new desiredcapabilities(); capabilities.setcapability(capabilitytype.browser_name, ""); capabilities.setcapability(mobilecapabilitytype.device_name, "xt1033"); capabilities.setcapability(mobilecapabilitytype.platform_version, "5.0.2"); capabilities.setcapability(mobilecapabilitytype.platform_name, "android"); capabilities.setcapability(mobilecapabilitytype.app, app.getabsolutepath()); capabilities.setcapability(mobilecapabilitytyp...

c# - Web API - Get progress when uploading to Azure storage -

the task want accomplish create web api service in order upload file azure storage. @ same time, have progress indicator reflects actual upload progress. after research , studying found out 2 important things: first have split file manually chunks, , upload them asynchronously using putblockasync method microsoft.windowsazure.storage.dll . second, have receive file in web api service in streamed mode , not in buffered mode. so until have following implementation: uploadcontroller.cs using system.configuration; using system.net; using system.net.http; using system.threading.tasks; using system.web.http; using microsoft.windowsazure.storage; using microsoft.windowsazure.storage.blob; using webapifileuploadtoazurestorage.infrastructure; using webapifileuploadtoazurestorage.models; namespace webapifileuploadtoazurestorage.controllers { public class uploadcontroller : apicontroller { [httppost] public async task<httpresponsemessage> uploadfile()...

javascript - Accessing array / scope of variable -

this question has answer here: how wait until jquery ajax request finishes in loop? 6 answers how return response asynchronous call? 21 answers i attempting populate array , use later. getting "undefined" result when try accessing objects @ indexes. $(document).ready(function() { var streamers = ["freecodecamp", "geoffstorbeck", "terakilobyte"]; var cb = '?client_id=5j0r5b7qb7kro03fvka3o8kbq262wwm&callback=?'; var url = 'https://api.twitch.tv/kraken/'; var result = {}; streamers.foreach(function(stream) { $.getjson(url + 'streams/' + stream + cb).success(function(data) { var streaming = (data.stream === null) ? false : true; result.push(stream + " - " + stream...