Posts

Featured post

ASP.NET session vs session state and cookies vs cookie less -

please me whether understanding right. asp.net sessions stored on web server , no cookies whatsoever used this. asp.net if configured use session webconfig->session state: can configure either stateconnection or sqlconnection. asp.net if configured use session state (either stateconnection or sqlconnection) when user uses sessions in code cookies on client machine used unless specify in webconfig cookieless=true if use <sessionstate cookieless="true" /> default stateconnection set localhost when talking session in many dynamic web sites want store user data between http requests (because http stateless , can't otherwise associate request other request), don't want data readable / editable @ client side because don't want client play around data without passing through (server side) code. the solution store data server side, give "id", , let client know (and pass @ every http request) id. there go, sessions implemented. or

Swift - UITableView scroll event -

i wondering how detect if uitableview scrolled (up or down). want hide keyboard when uitableview scrolled self.view.endediting(true) . thanks in advance you can add uiscrollviewdelegate . after can implement scrollviewdidscroll method.

python - Indent Error with my battleship.py script -

i'm trying create simple 2 player game classic battleship. hence i'm beginning learn python , i'm keeping simple. have created 5x5 grid , want players (2) able place 1 ship 1x1 anywhere on board. take turns guessing other person placed ship. when compiled code got indent error on line 61 "else: " . i'm aware "h" , "m" hit , miss overlap since i'm outputting same playing board. i guess need while loops in code. import sys #////////////////////////////setting board//////////////////////////////////// board = [] x in range(5): board.append(["o"] * 5) def print_board(board): row in board: print " ".join(row) #///////////////////////////getting input////////////////////////////////////////// def user_row(): get_row = raw_input("enter ship row between 1 , 5") #not shure if best way of checking input int if int(get_row) == false: print "you must enter integer

c++ - Calculate the function F(n) with recursion -

read topic not know saying: function f (n) determined on non-negative integers follows: f (0) = 1; f (1) = 1; f (2n) = f (n); f (2n + 1) = f (n) + f (n + 1) calculated f (n) recursion. , code: #include<iostream.h> double tinh_f(int n) { if(n == 0) { return 0; } if(n == 1) { return 1; } return (f(n+1) - f(2*n+1)); } this incorrect. recursive function calls itself , includes stopping condition: #include<iostream.h> double tinh_f(int n) { if(n == 0) { return 0; } if(n == 1) { return 1; } // note function name change return (tinh_f(n+1) - tinh_f(2*n+1)); } what should function if integer passed in negative? recursion still work? or should throw exception indicate callers contract broken?

javascript - Angular looping multi dimensional json object not working -

i'm practicing angular , thought cool make shopping cart, have downloaded pre-made site template displays items in categories way layed out pretty like <div class="row"> <ul> <li>item1</li> <li>item2</li> <li>item3</li> </ul> </div> so every row in category grid div containing un ordered list of 3 items here angular code: <div ng-app="categoryloader" ng-controller="catloader"> <div ng-repeat="row in items"> <ul> <li class="new" ng-repeat="item in row"> <div class="catthum"><img src="http://cart.asccio.net/images/oxo---homepage_39.jpg" alt="" /><div class="new"></div></div> <div class="catdetail"> <h4><a href="#">{{item.name}}</a></h4> <p

javascript - C3js - Uncaught TypeError: Cannot read property 'data' of null -

Image
the error message re-created in demo: http://plnkr.co/edit/6tok16u287skhqpsramx?p=preview var chart = c3.generate({ data: { "columns": [["b1", 1], ["b2", 2]], "type": "donut", onclick: onclick, }, donut: { "title": "iris petal width" } }); function onclick(){ chart.load({ columns: [['a_b1', 1], ['b_b1', 2]], unload: ['b1', 'b2'] }); } the documentation function here: http://c3js.org/reference.html#api-load do think i'm using wrong or it's bug in library? --reponse comment-- error occurs in fiddle when section of donut clicked. if watch transition animation closely can see hesitate when rendering different sections of donut. these errors occur after rendering.

backbone.js - Passing variables into Handlebars template when rendering Marionette/Backbone View -

i'm using handlebars backbone , marionette. i'm compiling handlebars templates , storing them in object can referenced view definitions. i'm using layoutview , regions display various items need in ui. what want pass (boolean) variables view such handlebars make decisions (via block helper {{#if varname}} ) render. clarity don't want persist data i'd rather not make them part of model i'm passing in rendered. so i'm doing defining backbone.model , marionette.itemview normal, , trying pass in additional variables via initialize: var newuser = new app.userview({ model: new app.usermodel(), initialize: function(){ this.isnewdoc = true } }); // display view in region using app.regions.maun.show(newuser); // ...etc. what want able pass in , able refer variables such isnewdoc in handlebars template, ideally via {{#if isnewdoc}}...{{/if}} . i've tried various permutations line this.isnewdoc = true such isnewdoc: true i'm not ge