Posts

I want to know how to repeat a process in python? -

print "you've entered wording system!" print "what words want?" while false: word1 = raw_input('enter word:') word2 = raw_input('enter word:') print word1 print word2 if len(word1)>len(word2): word_difference = len(word1) - len(word2) print word1, "is", word_difference, "letters longer than", word2 elif len(word2)>len(word1): word_difference = len(word2) - len(word1) print word2, "is", word_difference, "letters longer than", word1 elif len(word1) == len(word2): print word1, "has same number of letters as", word2 repeat = raw_input("would enter 2 more words?(y/n)") if repeat == "y": y == false so want create code repeat word1 = raw input repeat = raw_input(asking fort 2 more words) if question ask "would enter 2 more words" == y , if no == bye! just put all code in loop, iterates long repeat (ini...

Random inputs and loops in python -

from random import randint r x = r(1, 100) y = r(1, 10) def rannum(x,y): if (x==y): m = 2*y else: z = x * y print z rannum(x,y) i have value of x , y randomly generated , have function has 2 condition. how construct loop meet x==y condition? how know home many times ran loop meet condition. new programming , got stuck point. please suggest/recommend me way achieve result. have made range of smaller there high probability of selecting same number.thankyou i don't know why doing it, below understand question. from random import randint r def rannum(x,y): if (x==y): m = 2*y print m else: z = x * y print z count=0 while true: count=count+1 x = r(1, 100) y = r(1, 10) if (x==y): print "x equal y after count=",count rannum(x,y) break

how do i populate data on table using dropdown in Rails 4.1 -

i have following dropdown: <%= select_tag 'category', options_from_collection_for_select(@categories, "id", "name"), prompt: "select category"%> i new in rails.i want show data on table when click on category dropdown.is there way in ruby code. make following changes in view: <%= form_tag search_path, :method => 'get' %> <%= select_tag 'category', options_from_collection_for_select(@categories, "id", "name"), prompt: "select category"%> <%= submit_tag "search", :name => nil %> <table> <% @object_for_table.each |object| %> ----your table data here--- <% end %> </table> changes action responsible above view: def search @object_for_table = params[:category].blank? ? model.all : model.where(category_id: params[:category]) end finally make changes in js submit form on category selection. $(document).ready...

php - Optimistic Locking with Laravel 4 -

we kicking new project , starting use laravel 4. know if has support optimistic locking out of box? seems not found no reffrences , talkback on http://www.sitepoint.com/whats-new-in-laravel-4/ if has added , can share guidelines implementation great. thanks, avi still doesn't support. had issue on github, issues down laravel: https://www.google.com.br/search?sourceid=chrome-psyapi2&ion=1&espv=&ie=utf-8&q=laravel%20optimistic%20locking%20github

php - using static variable in different controller -

i'm making application i'm saving user information in user controller of code igniter application inside static variable, want access static variable in other controller, how can approach that? code here <?php class user extends ci_controller{ public static $user_data = array(); public __construct() { parent::__construct(); self::$user_data = array('value'); // values model } } // can user static variable view in controller class friends extends ci_controller{ public __construct() { parent::__construct(); if(user::$user_data->isfriends) { redirect('person/'.user::$user_data->id); } } } // how can access functionality in codeigniter? gives error undefined class user not found static::$user_data = array('value') shouldn...

calling asmx service from php using cURL or similar? -

i call webservice page : http://badmintonpeople.dk/dbf/holdturnering/stilling/ through php, can id's of teams present in sportsclub. the service url is: http://badmintonpeople.dk/sportsresults/components/webservice1.asmx/getleaguestanding and if push "søg" button on page, see variables send are: {"callbackcontextkey":"a99dadc1f9e901007e51592e8c0838916cf337e7613986982b4649b3efba0844d2dc6b4a5be1fa47827e6036cb6a819e","subpage":"6","seasonid":"2014","leaguegroupid":"","agegroupid":"","regionid":"","leaguegroupteamid":"","leaguematchid":"","clubid":"1617","playerid":""} i've tried fetch data returned service through curl , soapclient, can't seem figure out :-( can solve puzzle me, grateful, cause me looks have give :-/ thank in advance! seems there...

jquery - glyphicon for facebook not showing up -

i want use glyphicon facebook, how do that? have: <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> html: <ul> <li><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=http://myurl" ><span class="glyphicon glyphicon-facebook"></span></a></li> </ul> but nothing shows up. i downloaded free glyphicons, include facebook, don't know how include them. edit - right i'm using free glyphicons http://glyphicons.com/ site , using them in img tag. glyphicon-facebook not native bootstrap icon, calling though one. see bootstrap icons @ http://g...