Posts

javascript - setting/getting/checking multiple cookies generated by user-input (textboxes) in one go -

i'm bashing head against wall , hoping can help. i've got include 3 text boxes users enter values following cookies: name, city, , hobby. need use single button onclick event call function create 3 cookies (with values). need further function check existence of each cookie when page accessed. if 1 or more of cookies not set, alert box should notify user set unset cookie(s). if 3 cookies set, alert box should display contents of each cookie. where hung (i think) on how pass value textbox , corresponding key arguments generic setcookie function. w3schools gives code template creating, getting , checking cookies (below) i've no idea how implement setting cookies via user-input or setting 3 @ once! thick brick, seems. my html textboxes , submit button: please enter name: <input type = "text" name = "name" id = "name"> <br> please enter city: <input type = "text" name = "city" id = ...

web scraping - Python web scrape with Beautiful Soup -

i able scrape sites tables no issue; however, access tables customize need login first scrape because if not default output. feel close, relatively new python. looking forward learning more mechanize , beautifulsoup. it seems logging in correctly due fact "incorrect password" error if purposely enter wrong password below, how connect login url want scrape? from bs4 import beautifulsoup import urllib import csv import mechanize import cookielib cj = cookielib.cookiejar() br = mechanize.browser() br.set_cookiejar(cj) br.open("http://www.barchart.com/login.php") br.select_form(nr=0) br.form['email'] = 'username' br.form['password'] = 'password' br.submit() #print br.response().read() r = urllib.urlopen("http://www.barchart.com/stocks/sp500.php?view=49530&_dtp1=0").read() soup = beautifulsoup(r, "html.parser") tables = soup.find("table", attrs={"class" : "datatable ajax"}...

events - How to properly block code execution in Python? -

i need block execution of greenlet till condition occurs, following: ... while not some_condition: gevent.sleep(0.00000000000001) ... this approach cpu intensive. if change gevent.sleep(0.000000000001) gevent.sleep(0.1) , cpu usage drops 1/10. time, in worst case scenario, code continue execution 0.1 seconds after some_condition occurs, not right after. so, how can make greenlet pause execution until condition occurs? using gevent.event.event solved problem: http://www.gevent.org/gevent.event.html

Display Popup Using Javascript After This Div is VIsible -

i want display "share popup" when specific div appears. using embedded quiz on website user has answer multiple choice questions gets result. result div class called result_screen_container . i have popup it's written triggered time. want trigger when result there after questions finished. #popup_box { display:none; position:fixed; _position:absolute; left: 50%; top: 50%; z-index:10001; background:#fff; box-shadow: 0px 0px 15px #000; border-radius: 8px; } #popup_box .inner1 { text-align: center; padding:0 40px; color:#000; padding:20px; } #popupboxclose { font-size:0; right:-22px; top:-14px; position:absolute; cursor: pointer; width: 38px; height: 37px; display: block; } /* popup ends */ #fbshare{width:275px;height: auto;overflow: hidden;} .inner-fbshare{width:275px;overflow: hidden;} .inner-fbshare h3{font-size: 19px;margin: 0 0 10px 0;} .inner-f...

ruby - Rails - How do I change any key that has a string for a value in a hash into arrays -

i have following form <% if (current_user.mod_of_game?(@guide) unless current_user.nil?) %> <%= form_for([@category, @page], url: update_pages_path) |f| %> <%= render 'shared/error_messages', object: f.object %> <%= select_tag 'content[key1]', options_for_select(['atk', 'def', 'hp', 'sing'], 'atk' ), { :multiple => true} %> <%= select_tag 'content[key2]', options_for_select(['atk', 'def', 'hp', 'sing'], 'atk' ), { :multiple => true} %> <%= select_tag 'content[key3]', options_for_select(['atk', 'def', 'hp', 'sing'], 'atk' ), { :multiple => true} %> <%= select_tag 'content[key4]', options_for_select(['atk', 'def', 'hp', 'sing'], 'atk' ), { :multiple => true} %> <%= f.submit "save" ...

javascript - Get back initial content of array -

i have function wich deletes elements array,is there way initial content of array when there no elements in ? know have use if(array.length=0){ } but beats me put inside curly braces.i've tried create array duplicate first one,and after implementing function assigning empty array duplicated one,but didn't work if want copy of array need called deep copy. var = [11,22,33,44,55,66,77,88,99]; var a_copy = a; var a_backup = []; console.log("original length = " + a.length) for(var = 0;i<a.length;i++){ a_backup[i] = a[i]; } for(var = 0;i<a.length;i++){ a[i] = undefined; } console.log("original = " + a.join(",")) console.log("copy = " + a_copy.join(",")) console.log("backup = " + a_backup.join(",")) console.log("original length = " + a.length) for(var = 0;i<a_backup.length;i++){ a[i] = a_backup[i]; } console.log("restored = " + a.join(","))...

java - Spring web MVC Hibernate File upload error -

i making spring project trying upload image editprofile.jsp <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <table> <tr> <td> <form:form action="${pagecontext.request.contextpath}/editprofilehandler" method="post" modelattribute="userform" enctype="multipart/form-data"> <table> <tr> <td> first name : </td> <td> <form:input path="firstname" value="${userdetails[0].firstname }" /> <form:errors path="firstname" class="error" /> </td> </tr> <tr> <t...