Posts

javascript - AngularJS - ng-repeat to display empty cell/s when data is not available when using slice twice -

i have simple ng-repeat loops through json file list of countries , details country e.g. currency, population particular set of months (24 in case) my ng-repeat loops through first 12 months successfully, , displaying corresponding text when ng-switch criteria met. additionally, first 12 months, if there no data available, 'empty' displayed in cell. however, using 2 ng-repeats , slice , cant seem getemptycells function work/display empty months greater 12. html: <div ng-app=""> <div ng-controller="eventcontroller"> <table> <tr ng-repeat="country in countries"> <th>{{country.countryname}}</th> <td ng-repeat="countrydetails in country.details.slice(0, 12)" ng-switch="countrydetails"> <span ng-switch-when="11">medium</span> <span ng-switch-when="22">large</span> <span ng-s...

indexing - jquery get instance of parents class -

i'm dynamically adding links page each link launches modal. i need find instance of link launched modal display right info. so have <div class='linkholder'><a href='#' data-toggle='modal' data-target='#mymodal' class='modallink'>view</a>" i'm trying find link on page getting occurance of class linkholder. with this: function testindex() { var test = ($(this).parent('.linkholder').index()); alert(test); } clicking link launches alert -1 / not found thanks as adding these links dynamically, attach click event using on in document load such: $(document).on('click', 'a.modallink', function(e) { e.preventdefault(); alert($(this).parent('.linkholder').index()); }); example the problem function have not passed this doesn't know $(this) is edit as per comment, if looking index linkholder can in div try this: $('.linkhold...

Sqlite Full Text Search Query Puzzle -

i have data in format yyyy-mm-dd hh:mm:ss. stored text. i want query matches given day( yyyy-mm-dd ). e.g select * test test match '2014-03-30*' when try that, returns data excluding of march 2014. if try select * test test match '2014-04-30*' it returns data excluding of april 2014. i puzzled!...i getting opposite of want! any reason strange behavior? this full code....testing date pattern public list <transactions> gettransactionsvirtual(string token) { list<transactions> trans = new arraylist<transactions>(); sqlitedatabase db; string sql= " select " + message + "," + tdate + ","+ service_provider + " " + table_name_virtual + " "+ table_name_virtual + " match " + "?" + " order " + tdate + " desc"; //check entered string...if date string strip .. string pattern="^(19|20)\\d\\d[- /.](0[1-9]|1[012])...

c# - ASP.NET: Buttons not working after inserting 'namespace' -

using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.data.sqlclient; using system.configuration; using system.data; namespace localhost_54355 { public partial class ui : system.web.ui.page { protected void page_load(object sender, eventargs e) { sqlconnection con = new sqlconnection("server=pc\\sqlexpress;data source=dbo\\employeedatabase;integrated security=true;"); sqlcommand cmd = new sqlcommand("insert tableemployees(username,email,password,job,firstname,lastname,location,phone) values (sdfsd,sdfsdfds, 123456, xcvxcv, xcvxcvcxvx, dfgdfgd, cvbcbcbcb, 123645);", con); cmd.commandtype = commandtype.text; try { con.open(); cmd.executenonquery(); } catch (exception ex) { response.write("er...

c# - Multiple distinct instances of object graph in Castle Windsor -

Image
this simplified version of setup. have application consumes library, , library provides client accessing web service. application wraps in xyzservice provides higher level operations. the library provides parameterised windsor installer, registers webapiclient , dependencies. installer takes configuration object (amongst other things) specifies uri web service. this fine long ever want talk single instance of web service. in case there 2 different instances of web service, , not interchangeable. @ startup want app constructed references 2 distinct instances of xyzservice, first object-graph configured access (say) http://server.green/ , second object-graph configured access (say) http://server.red/ . here's diagram: on left if have 2 constructor parameters of type ixyzservice. 2 instances of webapiclient (since it's got transient lifetime), both share same configuration (since installer created instance , registered that). on right want. i'm not sure how pr...

Bootstrap Collapse/Expand with image -

collapse/expand work not properly. once collapse , expand 1 item , if expand one, first 1 gets collapsed again. images - + , vice versa not working. please help. <div class="panel panel-default"> <div class="panel-heading"> <div class="panel-title"> <a data-toggle="collapse" data-parent="#accordion" href="#info2"> <div class="row"> <div class="col-md-12"> <label class="bold">info 2 </label> <label class="aa-dark-red"> deferred 300300 sta dfw 24 mar 14 </label> <span class="pull-right"> <i class="glyphicon glyphicon-minus"></i></</span> </div> </div...

code metrics - Does McCabe formula consider data flow? -

when using mccabe formula m = e-n + 2c does take consideration if data restricted flowing in 1 direction? seems graphs show data flowing in many directions, regardless if happens or not. a codebase has 1 direction of data flow vs (very similar) code base in data can go , forth less complex. this article facebook, mvc , flux great example of i'm asking about: http://www.infoq.com/news/2014/05/facebook-mvc-flux . had data going forth mvc (from view model , vice versa). once switched out mvc flux, data flowed in 1 direction. the article linked replacing 1 (misapplied) architectural pattern another. concept of "data flow" not defined, doesn't matter question. the mccabe formula examines program flow - informally see measure of number of decisions made. measured looking @ every control statement, scale of measures finer grained scale of architectural changes propose. let's go "the mccabe formula doesn't measure data flow"...