Posts

Showing posts from August, 2011

python - Weird behavior on when replacing timezone using pytz timezones vs timezone strings -

i expect replacing tzinfo using 'us/central', give same result using timezone object ( pytz.timezone('us/central') ), apparently it's not: in [5]: import arrow in [6]: d = arrow.get() in [7]: cst = pytz.timezone('us/central') in [8]: d.replace(tzinfo=cst) out[8]: <arrow [2015-07-22t17:40:30.947579-06:00]> in [9]: d.replace(tzinfo='us/central') out[9]: <arrow [2015-07-22t17:40:30.947579-05:00]> note how output of line 8 has different utc offset output of line 9. which way correct way of replacing timezone using arrow , pytz? this seems bug. guessing seeing issue 154 - .to() incompatible pytz.timezone you may seeing same thing .replace() method. issue still open. i use arrow one, seems arrow , pytz not compatible.

caching - Spring JAAS Authentication with database authorization -

i using spring security 4.0. login module configured in application server have authentication using jaas user details stored in database, once authenticated user object created querying database. please let me know how achieve i.e. ldap authentication , load user details database. how cache user object using eh-cache, user object can accessed in service / dao layer. this can achieved using customauthentication provider. below codes. import java.util.arrays; import java.util.list; import org.springframework.security.authentication.authenticationprovider; import org.springframework.security.authentication.badcredentialsexception; import org.springframework.security.authentication.usernamepasswordauthenticationtoken; import org.springframework.security.authentication.dao.daoauthenticationprovider; import org.springframework.security.authentication.jaas.jaasgrantedauthority; import org.springframework.security.core.authentication; import org.springframework.security.core.a...

ios - Swift Delegate in own class -

i trying write first swift mac application. have hard times refactoring code class. current status: import cocoa class testclass: nsobject, nstextstoragedelegate { @iboutlet var codetextview: nstextview! var syntaxparser:trexsyntaxkitparser? var textstorage : nstextstorage! init(syntaxparser:trexsyntaxkitparser, textview:nstextview) { self.syntaxparser = syntaxparser super.init() if let textviewstorage = textview.textstorage { self.textstorage = textviewstorage self.textstorage.delegate = self } } func textstoragedidprocessediting(notification: nsnotification) { let inputstring = self.textstorage.string let wholerange = nsmakerange(0, count(inputstring)) self.textstorage.removeattribute(nsforegroundcolorattributename, range:wholerange) let attributes = self.syntaxparser!.parse(inputstring) print("attributes: \(attributes)") attribdict...

java - Android local unit test - new View(null) returns null -

i'm experimenting local android tests (the ones run on local jvm, not on device). understand classes in android.jar can't used unless mocked, reason when try instantiate new view (or own class inherited view)- null. totally breaks belief "new" never returns null in java. here's test code ( src/test/java/com/example/footest.java ): package com.example; import android.view.view; import org.junit.test; public class footest { @test public void testview() { view v = new view(null); system.out.println("view = " + v); } } this code prints in test report output view null. here's build.gradle (the rest of project generated android create project , of no interest): buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3+' } } apply plugin: 'android' android { compilesdkversion 'android-22' buildtoolsversion...

c++builder - How can I find the number of elements of a multidimentional dynamic array -

my pointer declared in header file: int (*array)[10]; i pass argument function initializes array: void __fastcall tform1::initarray(const int cnt) { try { form1->array = new int[cnt][53]; } catch(bad_alloc xa) { application->messageboxa("memory allocation error sel. ", mb_ok); } form1->zeroarray(); } //--------------------------------------------------------------------------- i set element of array "0": void __fastcall tform1::zeroarray() { __int16 cnt = sizeof_array(array); // here notice problem. cnt not correct size of first level of array. if(cnt) { for(int n = 0; n < cnt; n++) { for(int x = 0; x < 53; x++) { form1->array[n][x] = 0; } } } } //--------------------------------------------------------------------------- this d...

c++ - SFINAE to enable cast operator only from derived to base class -

i have class template cfoo<t> . want allow implicit casts other instantiations of cfoo , template argument base class of t . i tried use sfinae, neither of attempts worked on compiler tried (vc 2012 or gcc): #include <type_traits> template <class t> class cfoo { public: template <class q> operator // typename std::enable_if<std::is_base_of<q, t>::value, cfoo<q>&>::type // should work? // typename std::enable_if<1, cfoo<q>&>::type // should work? cfoo<q>& // compiles, doesn't restrict on q want () const { return *(cfoo<q>*)this; } }; class {}; class b : public {}; int main(int argc, char* argv[]) { cfoo<b> b; cfoo<a>& = b; return 0; } why don't either of commented out attempts @ sfinae work here? in both cases error invalid initialization of a , if operator didn't called. according...

forms - Outputting to Convertto-html Cmdlet Powershell -

evening everyone, i've spent while having play on google learning how create basic form powershell. i'm having problem coming grips how basic form output html file @ click of button have managed work services ie - get-service | convertto-html | out-file "location" however i'm wanting input data on form , once submit button pressed, puts data table , outputs html file. add-type -assemblyname system.drawing add-type -assemblyname system.windows.forms $form = new-object system.windows.forms.form $form.text = "basicform" $form.width = 800 $form.autoscroll = $true #vrn label $objlabel = new-object system.windows.forms.label $objlabel.location = new-object system.drawing.size(50,75) $objlabel.text = "num:" $objlabel.autosize = $true $form.controls.add($objlabel) #vrn textbox $objtextbox = new-object system.windows.forms.textbox $objtextbox.location = new-object system.drawing.size(100,75) $objtextbox.size = new-object system.drawing...

image processing - does recognizing the affablepeople in the photos are related to machine learning? -

i novice in field of image processing Ùˆ , i'm learning common concepts between machine learning , image processing . suppose there camera in store , take movies people shop , what want movie : give me number 1 if see affable person , related machine learning or no it's image processing consecutive images ؟؟ extracting relevant information images(movie frames in case) image processing. for example in case find person face on image. accomplish need filtering , image segmentation extract face image. part pure image processing. next need define relevant descriptors characteristic face points lips corners etc. , perform classification based on chosen descriptors in field of machine learning.

java - Linux set -x when run from a process on Azure -

i have bash script sets environment , runs java process. script calls "set -x". have init.d service runs guard java program kinds of guarding tasks including identifying process dead , running shel starts it. on aws works perfect. moved azure , bash script works perfect when run command line, doesn't work when run guarding java process. taking down "set -x" solved , runs on azure. idea can cause issue? thanks, nir what os version using on azure. not able reproduce issue. ran init.d service runs sample java program in turn invokes shell script has set -x inside it. is set -x important run script?, because provide verbose of each statement being executed in script.

asp.net mvc - Partial View Dialog Events Do Not Work in Chrome -

a partial view page (cshtml) opened dialog angularjs window click in parent view page (cshtml), embedded component in dialog not respond mouse inputs - eg not respond clicks in chrome although in ie11. specifically, have fileultimate file browser control in partial view page opened dialog. cshtml is: @using gleamtech.fileultimate @model filemanager @using mycompany.owl.website.helpers @{ layout = null; } <head> <title>file browser</title> @html.rendercss(model) @html.renderjs(model) </head> <div class="overlay" id="filebrowser"> <h1>file manager<a href data-icon="&#x00d7;" data-ng-click="close()"></a></h1> <div> <div style="width:800px"> @html.rendercontrol(model) </div> </div> </div> it opened angularjs controller parent page $scope.openfilemanager = function () { var modali...

sql - Does SqlConnection processes queries in parallel? -

if open sqlconnection sql server, , issue multiple queries multiple background threads, using 1 connection - queries executed sequentially (don't care order)? specifically, if @ beginning of 1 query change isolation level , restore @ end of query - there chance isolation level may apply other queries? i think not, want confirm. sql server 2008 r2 and talking system.data.sqlclient.sqlconnection loaded question, definitive answer impossible because @lassev.karlsen has stated sqlconnection not thread safe behavior going unpredictable. attempted similar scenarios in past , failed. here think happen parameters in question. does sqlconnection processes queries in parallel? no, not know how because wasn't designed task. though fact it's possible build process use in manner tempting. will queries executed sequentially yes. queries executed sql engine in order received. though connection object not know thread pass results , you'll dreaded ...

CakePHP 3 events -

i want create entry in notifications table if particular find method has return value on contacts table. so in contactstable create event. use cake\event\event; public function checkduplicates() { //... code here $event = new event('model.contacts.afterduplicatescheck', $this, [ 'duplicates' => $duplicates ]); $this->eventmanager()->dispatch($event); } i have created contactslistener.php @ /src/event namespace app\event; use cake\event\event; use cake\event\eventlistenerinterface; use cake\log\log; class contactslistener implements eventlistenerinterface { public function implementedevents() { return [ 'model.contacts.afterduplicatescheck' => 'createnotificationaftercheckduplicates', ]; } public function createnotificationaftercheckduplicates(event $event, array $duplicates) { log::debug('here am'); } } in notificationstable....

debugging - Grails 3 set remote debug ip:port -

i remotely debug grails 3 application. didn't found how can change implicit debugger port. there way grails run-app --jvm-debug --debugger-port=9999 --debugger-addr=10.0.50.55 ? you run grails application directly starting application class located in grails-app/init . has static void main , run regular application. can run ide debug profile of choice.

Python embedded in HTML returns error when there is no input -

i've written code: http://pastebin.com/e3azzqvb loading page: nimasa.heliohost.org/rj/ the problem comes no-input returns error, although there no problem on interpreter seen at: repl.it/v88/2 waiting suggestions, what should change/or add/ make not return error on no-input? thanks, nima form.getvalue("b") return none if there's no value b in request. trying slice none (at line 19 : s = b[35:] ) - or apply string method or function fwiw - (obviously) raise typeerror . for record, took me 30 seconds find out: # python python 2.7.3 (default, jun 22 2015, 19:33:41) [gcc 4.6.3] on linux2 type "help", "copyright", "credits" or "license" more information. >>> import cgi >>> f = cgi.fieldstorage() >>> f.getvalue("foo") none true

c# - Asp.NET Web API throwing 404 instead of 400 -

i have built service in .net 4.5 , entity framework 6, using asp.net web api template. when make request service , omit required parameter, returning 404 - not found, instead of 400 - bad request. tried checking see if required parameters null, it's not reaching code inside method (see code below). question how change default response or make return 400 missing required parameters. thanks! [route("item")] [httpget] public ihttpactionresult getitem(string reqparam1, string reqparam2) { if (reqparam1 == null || reqparam2 == null) throw new httpresponseexception(httpstatuscode.badrequest); //remainder of code here } here webapi.config file. don't think have modified default. public static class webapiconfig { public static void register(httpconfiguration config) { // web api configuration , services // web api routes config.maphttpattributeroutes(); config.routes.maphttproute( na...

javascript - How to use limitTo with math expression (angular) -

i'm trying develop pagination buttons using ng-repeat this: <li ng-repeat="(indexn, item) in objsch[indexo].nit | limitto: (math.ceil(indexn+1/10))"><a href="#">{{(math.ceil(indexn+1/10))}}</a></li> this code checks how many items there in array, divide 10 , create tag match.ceil result on it. unfortunaly, not work properly. ps.: in controller put piece of code: $scope.math = window.math; someone have idea how solve using code way? thanks! ok, found solution. not sure if it's best solved problem. the fixed code: <li ng-repeat="(indexn, item) in objsch[indexo].nit | limitto: (math.ceil(objsch[indexo].nit.length/10))"><a href="#">{{indexn+1}}</a></li> i set limitto using length of array instead of index , return index inside each button.

c++ - Does "potentially-evaluated" means the same as "odr-used" in C++03? -

given example: #include <iostream> class { public: static const int numberofwheels = 4; }; // const int a::numberofwheels; int main() { std::cout << a::numberofwheels << std::endl; } is formally undefined behavior( ub ) since a::numberofwheels used without definition? (see here ). c++03 states: the member shall still defined in namespace scope if used in program , namespace scope definition shall not contain initializer. i found definition of used in c++03 rather confusing, points potentially-evaluated expression: an object or non-overloaded function used if name appears in potentially-evaluated expression. from wild guess excludes expressions such as: sizeof(a::numberofwheels) ; typeid(a::numberofwheels).name() ; but not expression overloaded << operator above. from these 2 defect reports seems intent should similar odr-used: defect report 48: definitions of unused static members says ( emphasis mine ...

drupal - How to merge two nginx configurations -

i have 2 nginx configurations. both of them work alone. 1 of them drupal (frontend) , 1 of them backend. @ end have mydomain.com/ = frontend & mydomain.com/backend = backend. unfortunately don't know have make work. here both configs: //drupal upstream fcp { server unix:/var/run/php-fpm.sock; } server { listen 80; server_name www.example.com; root /usr; location / { index index.php; } location ~ \.php$ { fastcgi_pass fcp; fastcgi_index index.php; fastcgi_param script_filename /usr$fastcgi_script_name; fastcgi_param path_info $fastcgi_script_name; include /usr/local/nginx/conf/fastcgi_params; } } // ====== // // backend-software upstream backend{ server unix:/var/run/php-fpm.sock; } server { [...] server_name www.example.com; root /usr/backend/wwwroot; #generic definition ...

bolt cms - Composer install: your requirements could not be resolved to an installable set of packages -

trying install bolt v2.2.4 following commands: git clone git://github.com/bolt/bolt.git bolt cd bolt git checkout v2.2.4 composer install then following error: $ composer install loading composer repositories package information installing dependencies (including require-dev) requirements not resolved installable set of packages. problem 1 - installation request m6web/symfony2-coding-standard dev-master@dev -> satisfiable m6web/symfony2-coding-standard[dev-master]. - m6web/symfony2-coding-standard dev-master requires squizlabs/php_codesniffer ~1.0 -> no matching package found. potential causes: - typo in package name - package not available in stable-enough version according minimum-stability setting see <https://groups.google.com/d/topic/composer-dev/_g3aseiflrc/discussion> more details. read <https://getcomposer.org/doc/articles/troubleshooting.md> further common problems. i ran same issue under bolt 2.1.9 i 'fixed' me ...

javascript - Ajax call in different web application -

i've 2 web applications. want make ajax call 1 web application(say application1) web application(say application2). i'm doing this var ajax_url = "http://localhost:50224/common/isuseronline"; $.ajax({ url: ajax_url, datatype: "json", type: "post", data: { customerid: '@model.userid' }, success: function (response) { var data = response.data; if (data.isuseronline == false) { $("#isuseractive").val('false'); } else { $("#isuseractive").val('true'); } } }); if ($("#isuseractive").val() == "false") { window.location.href = '@url.action("sessionexpired", "home")'; } however following error. no 'access-control-allow-origin' header present on requested resource. there way can make h...

c# - Indexer created to look at array doesn't see changes made to array -

i new c#, , i'm creating serial port class board have designed. in class contains methods open/close serial port connected board. should read messages board , write messages ui board (i using forms application input , display values). i read internal input buffer , place bytes own software buffer, when message complete, prompt form analyse message... for have created indexer point array (from form) , take bytes desires. uint[] serialportreceivebuffer = new uint[3]; public delegate void del(); del promptformaction = form1.msgreceived; public void serialport1_datareceived(object sender, serialdatareceivedeventargs e) { (int = 0; <= 2; i++) { serialportreceivebuffer[i] = (uint)serialport1.readbyte(); } promptformaction(); } public uint this[uint i] { { return serialportreceivebuffer[i]; } } this code within pcbserialport class, , code related in form1 class follows: ...

sql - How to dynamically select inside a procedure -

i have dilemma creating procedure uses table database inside it. say: create procedure uspretrievecurrentpropertydate ( @internalentityid varchar(10) ,@internaluserid varchar(10) ,@internalsiteid varchar(10) --this database need table ) begin ... ... select top 1 arsdailyctldate @internalsiteid..accountssetting end but of course return error. the original script uses like: set @csql = 'select top 1 arsdailyctldate s' + @siteid + '.dbo.accountssetting (nolock)' exec(@csql) to accomplish task. wanted rewrite code. there anyway can way done? without using exec(@csql)? thanks, sherwin there 1 way can need without dynamic sql, maintenance nightmare. can this: if @internalsiteid = 'databasea' select top 1 arsdailyctldate databasea..accountssetting else if @internalsiteid = 'databaseb' select top 1 arsdailyctldate databaseb..accountssetting else if @internalsiteid = 'databasec' select top 1 arsdailyctldate databa...

javascript - Break out of 1 frame from within a frame -

i writing code inside portal. have searched high , low 2 days no luck. portal writing code in, uses iframes, , top frame. when "app" clicked, portal, displays program. without telling long story, have use iframe. page displays iframe take credit card, , listens response of approved or declined. pass return url code in iframe. consequently, when transaction complete, redirected url passed....but in iframe on page. know can use this: <script language="javascript" type="text/javascript"> function breakout_of_frame() { if (top.location != location) { top.location.href = document.location.href; } } </script> however code breaks out top frame, taking me out of portal. need break out of frame parent, , not top. have tried changing code using parent, , not work. have used target="_parent" , not work situation. (because i'm not submitting form, i'm sending return url) appreciated. th...

javascript - $destroy is not being called when element is removed from DOM -

i have directive that's added forms, , need know when form removed dom. i'm trying detect $destroy event, when call .remove() on element $destroy event not triggered. am doing wrong? there correct way tell when it's removed dom? relevant code: the html: <form id="myform" form-watch> in controller: var form = document.getelementbyid('myform'); // not trigger $destroy form.remove(); // trigger $destroy //angular.element(form).scope().$destroy(); the directive: app.directive('formwatch', function () { return { restrict: 'a', link: function(scope, element) { scope.$on('$destroy', function() { alert('destroyed'); }); } }; }); here's plunker edit: here's more accurate picture of i'm working with: new plunker i'm not sure concerned actual destroy event itself, rather way in app know when form exists or not. this should monitored th...

java - DateTimeFormat - Unparsable date format -

can me right patter date format: 20150722t112009,64+02 (which "22 july 2015 11:20:09" < enough) i have no idea **,64** nor **+02** stands can me java date object of string? my current pattern far: yyyymmdd't'hhmmss',' the logical conclusion 64 , +02 64 milliseconds , gmt+02 timezone. so, pattern be "yyyymmdd't'hhmmss,ssx" that give proper date.

android - ProgressDialog with progress and secondProgress -

Image
i'm using asynctask in app downloading several pictures. asynctask implemented in separate class, , use interface update ui thread. progressdialog shown while task executed , progress updated. far can either show current download progress, or number of pictures allready downloaded , both @ same time. here asynctask class : public class downloadpicturestask extends asynctask<string ,integer , boolean> { /** * interface updating ui thread methods */ public downloadpicturesresponse handler = null; private activity callingactivity = null; private string message; public downloadpicturestask(activity activity){ attach(activity); } public void attach(activity activity){ this.callingactivity = activity; } public void detach(){ this.callingactivity = null; } @override protected void onpreexecute() { handler.picturespreexecute(); } /** * each picture, store downloaded file in historic folder <br/> * ff pictures downloaded, return true <br/>...

html - javascript form validate not preventing css .submitted from actioning -

i have form class="myfrm" , contains fieldset made of input fields. after fieldset tag have div tag , assigned class="ack-msg" contains acknowledgement message. in css have .myfrm.submitted fieldset { display: none; } .myfrm.submitted .ack-msg { display: block; } when form submitted fieldset replaced acknowledgement. works fine when form completed expected when form validation fails message displayed acknowldgement class="ack-msg" kicks in , replaces fieldset if passed. the validation carried out javascript function called onsubmit on form. javascript listed below , keep things simple have shorted version of script passes validation if provided parameter value = 24. function validateform(v) { if(v.value != '24') { alert("oops! try agan!"); return false; } else { return true; } } also, if inspect page after validation fails , acknowledgement gets diaplayed form declaration has been updated ...

xslt - Removing XML Node In Matching Context -

i want remove element bar from <data><foo>1</foo><bar><bla /></bar></data> <data><foo>2</foo><bar><bla /></bar></data> <data><foo>3</foo><bar><bla /></bar></data> but if foo matches 2 . result should looks like: <data><foo>2</foo></data> i use following code: <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*" /> </xsl:copy> </xsl:template> <xsl:template match="bar[../foo = 2]" /> is there better way? this way, not sure if make difference because matching condition quite simple in first place : <xsl:template match="data[foo = 2]/bar" />

sql server - Database based table with manually added column - maintaining values positions -

let's consider simple excel table associated sql server's table: id some_data 0 1 b 2 c i'd extend manually added column (not present in sql server's table): id some_data my_column 0 some_data_for_0 1 b some_data_for_1 2 c some_data_for_2 however, when source data changed (rows inserted / deleted / updated) relation between my_column , id column not preserved. example, when new row (3, d) added: id some_data my_column 0 some_data_for_0 1 b some_data_for_1 2 c 3 d some_data_for_2 is there excel built-in solution allow me specify how my_column rows should ordered in relation id column or need implement myself using vba? you use order clause in sql statement, that's not reliable. reliable way store additional data in own table , use formula relate sql data. on separate worksheet, put id my_column 0 some_data_...

shell - Run Python in Android Terminal -

i have android 5.1 cm12 (rooted, supersu, busybox) , try access python android (pythonforandroid_r5.apk) android terminal. i have followed tutorial: http://lifepluslinux.blogspot.de/2015/01/installing-python-on-android-50.html this script use (python2): export external_storage=/mnt/sdcard pythonpath=${external_storage}/com.googlecode.pythonforandroid/extras/python pythonpath=${pythonpath}:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynload export pythonpath export temp=${external_storage}/com.googlecode.pythonforandroid/extras/python/tmp export python_egg_cache=$temp export pythonhome=/data/data/com.googlecode.pythonforandroid/files/python export ld_library_path=/data/data/com.googlecode.pythonforandroid/files/python/lib /data/data/com.googlecode.pythonforandroid/files/python/bin/python "$@" python2 , sh located in system/bin/ but when execute these script get: c:\users\bla>adb shell python2 : n...

sql - Working out a percentage group -

i'm trying work out percentage value (e.g. 1 100) range of numbers fall into. for example, if have simple table of 500 records: declare @temp table (id int, percentage int) insert @temp (id) select number master..spt_values type = 'p' , number between 1 , 500 select * @temp then i'd work out first 1% of records (i.e. id 1 5) be percentage number 1, second 1% of records (i.e. id 6 10) number 2 etc. i'm seen of more recent versions on sql server have percentage based functions percentile , percent_rank think might have been possibility, i'm using sql server 2005 not sure if options limited? is there easy way i'm missing? thanks! try this, number of rows 502, first 2 percentage groups of data include "extra" row: declare @temp table (id int, percentage int) insert @temp (id, percentage) select number, ntile(100) on (order number) master..spt_values type = 'p' , number between 1 , 500 select * @temp resu...

ios - Swift days between two NSDates -

i'm wondering if there new , awesome possibility amount of days between 2 nsdates in swift / "new" cocoa? e.g. in ruby do: (end_date - start_date).to_i the accepted answer won't return correct day number between 2 dates. have consider time difference well. example if compare dates 2015-01-01 10:00 , 2015-01-02 09:00 , days between dates return 0 (zero) since difference between dates less 24 hours (it's 23 hours). if purpose exact day number between 2 dates, can work around issue this: // assuming firstdate , seconddate defined // ... let calendar = nscalendar.currentcalendar() // replace hour (time) of both dates 00:00 let date1 = calendar.startofdayfordate(firstdate) let date2 = calendar.startofdayfordate(seconddate) let flags = nscalendarunit.day let components = calendar.components(flags, fromdate: date1, todate: date2, options: []) components.day // return number of day(s) between dates swift 3 version let calendar = nscalendar.c...

ios - UIView position does not respect NSLayoutConstraint when altered from viewDidLoad -

Image
i have 2 views, one visible (grey) and one hidden (red) . visible view constraint superview top constant of 32 , , other constraint superview top constant of 16 . the top of visible view constrained bottom of hidden view, constant of 8 . constraint has priority of 749 , because unsatisfiable. the idea visible (grey) view should 32 points below superview normally, when hidden (red) view made visible, original (grey) view should 8 points below other view (red). i'm achieving keeping strong reference 32 -point constraint, , making active/inactive i'm hiding/unhiding view (red). here's picture of layout: this works normally, i've been trying set constraint.active = no , redview.hidden = no in viewdidload , need textfield display error if condition has not been met. reason, not work. red view displayed expected, second view (grey) not move down should (it not respect 749 constraint, if main constraint no longer active). here's picture of result: ...

binding - Add extra column to WPF DataGrid which is not in the collection -

i'm using datagrid control display content of datatable. therefore data table set itemssource of datagrid. following columns of datagrid represent columns of data table: type, name, domain, subdomain now dynamic column, called "properties" should contain specific information, depending on value of "type" column. this: switch (type) case abc: content="row.field1" case def: content="row.field2" case xyz: content="row.fieldx" where field1 .. fieldx columns data table. i'm using datagrid bindinglistcollectionview. best if solution build on this. i tried multivalue binding , multivalue converter have more freedom , not having pre-select fields: var bind = new multibinding(); bind.bindings.add(new binding("protocol")); bind.bindings.add(new binding("path1")); bind.bindings.add(new binding("path2")); bind.bindings.add(new binding("path3")); bind.bindings.add(n...

cakephp 3.0 - Cakephp3 Routes, no action name in url -

i wanted ask, hou create route in cakephp3, want no action name in url. now have localhost/pages/contact , want localhost/contact. my link looks like: echo $this->html->link(__('kontakt'), ['controller' => 'pages', 'action' => 'contakt']); i have created route: $routes->connect('/pages/:action/', ['controller' => 'pages']); this doesnt work, link have pages controller in content. thanks reply. $routes->connect('/contact', ['controller' => 'pages', 'action' => 'contact']); and view: echo $this->html->link(__('kontakt'), 'contact');

python - Associate role to a Crossbar component -

i run component role. each time set "role" argument component crossbar server runs there infinite loop in : first time on page, work if refresh or open window same page or if client open page, page loading on , over... then if stop crossbar server have message multiple times in logs : [controller 4422] waiting 4433 exit... here conf.json: { "controller": { }, "workers": [ { "type": "router", "options": { "pythonpath": [".."] }, "realms": [ { "name": "realm1", "roles": [ { "name": "anonymous", "permissions": [ { "uri": "*", "publish": true, "subscribe": true, "call": true, ...

Rails, pagination of a matrix -

i have huge (in number of rows) matrix (double array) , paginate it, on first page first 10 elements seen. example: arraya = [["a",1,2,3],["b",5,7,8],["c",4,7,3],["d",1,2,9],["e",4,2,6]] on first page first 2 elements of arraya seen: ["a",1,2,3] ["b",5,7,8] i not sure can standard will_paginate gem. and how display in view? have following structure display matrix: <% mat = @mat mat.each |line| %> <tr> <td> <% line.each |el|%> <td class ="table_column_width"> <%=el%> </td> <% end %> </td> </tr> <% end %> will_paginate adds paginate method onto array (see https://github.com/mislav/will_paginate/blob/master/lib/will_paginate/array.rb ). may need require 'will_paginate/array' if it's not available....

javascript - How to prevent particular <div> action on clicking button in angularjs? -

how prevent particular <div> action on clicking button in angularjs? i have tried event.preventpropagation on on-click . this should work preventdefault <div ng-click="prevention($event)">div</div> $scope.prevention = function($event) { // our function body $event.preventdefault(); $event.stoppropagation(); }

Android Webview shows loader and none of webview methods gets called -

i'm facing strange issue in app. i'm using webview in detail pages. when open detail pages, web view loads web page. sometimes, webview doesn't load , shows loader. on debugging call goes loadur() , after none of webview methods called. , after web pages goes blank loader. i'm not getting callback onrecieveerror() too. i'm not getting causing issue. i tried these things: ` vwebview.getsettings().setjavascriptenabled(true)`; vwebview.getsettings().setdomstorageenabled(true); vwebview.setbackgroundcolor(color.parsecolor("#ffffff")); vwebview.setwebviewclient(new webviewclient() { @override } if (mcontenturl != null) { vwebview.clearcache(true); vwebview.loadurl(mcontenturl); } it's happening randomly. , when switch off , on wifi, starts loading pages normally. i'm not getting creating problem. because other native sections downloading stream , there no connectivity issue. w...

asp.net - Binding ICollection to edit form in MVC asp .NET -

i have 2 models: student , course . want create simple form edits course information, e.g. name of course, , adds or removes students to/from course. this, course model has property public virtual icollection<student> students { get; set; } . create form this: @using (html.beginform()) { @html.antiforgerytoken() <div class="form-horizontal"> <h4>create course</h4> <hr /> @html.validationsummary(true) @html.hiddenfor(model => model.id) <div class="form-group"> @html.labelfor(model => model.coursename, new { @class = "control-label col-md-2" }) <div class="col-md-10"> @html.editorfor(model => model.coursename) @html.validationmessagefor(model => model.coursename) </div> </div> <div class="form-group"> @html.labelfor...

hibernate - Binding actual column name inside of the child class: possible? -

i have several table sharing n columns, think best strategy making abstract class inheritancetype=table_per_class. problem that, though columns same, go different name. for example: t1 --name varchar(100) --surname varchar(50) t2 --person_name varchar(100) --person_surname varchar(100) columns same, type same..but name different! so, there way define abstract parent class: @entity @inheritance(strategy = inheritancetype.table_per_class) public class parent{ private string name; private string surname; } and then, inside of children entities, specify actual column name? what need add following child entity: @attributeoverrides({ @attributeoverride(name="name", column=@column(name="person_name")), @attributeoverride(name="surname", column=@column(name="person_surname")) })

rest - Controller not rendering the template -

i using fos bundle implement rest api in symfony. i have controller called termscontroller in have implemented routes rest api. the routes put,get,post , delete return array want function newtermaction (whose route /terms/new ) render template. that route should direct form il make post call but template not getting rendered , output raw html code here function public function newtermsaction() { return $this->render('default/termform.html.twig'); } config.yml file sensio_framework_extra: view: { annotations: false } router: { annotations: true } fos_rest: param_fetcher_listener: true body_listener: true format_listener: true view: view_response_listener: 'force' formats: xml: true json : true templating_formats: html: true force_redirects: html: true failed_validation: http_bad_request default_engine: twig rou...

How to connect to a server running on my pc using my app on my android device -

i have written server-side program using java running on pc using pc server, , using client program had written using java able connect server program using "localhost" ip name , using port had specified in server-socket object in server-side program. now have transformed client program android app , i'm running on phone, how can connect server program running on pc? need change socket defined in android app or work same way desktop app? as desktop version works can use in android . notes keep in mind add permission in manifest <uses-permission android:name="android.permission.internet" /> do network operations in background thread using asynctask

c++ - How to add multiple tray icons in the same application (winapi)? -

it possible application have more 1 tray icon? (kind of thunderbird does: 1 main application , when receive email , there's envelope in notification area) i tried using shellnotify_icon twice in row return false second time. i've tried using 2 different notifyicondata structures still nothing. adds one. i haven't been able find in documentation or on google saying if possible or not. any ideas?

javascript - Meteor - two components subscribe the same publication -

Image
i'm working on meteor project , meet problem pub/sub of meteor. intend separate view components, each components has owned subscribes data render, use iron:route manage app's flow. problem : i've publication: meteor.publishrelations('applications', function (opt) {..} at homepage components, subscribe applications in 2 places : 1 used display count , group applications , other used display top 10 new applications. the issues come when click in group, change route , run subscribe('applications') options filter application collection. , top 10 new applications goes wrong : display one. i think because separate components lack of knowledge manage data in client via pub/sub. please me pub/sub correctly in case.