Saturday, 15 September 2012

html - Table - vertical numbering using PHP for cycle -


I have to do something in PHP for "cycle" which will generate a table with vertical counting cells. Here's the image:

Looking back again: < / P>

  & lt ;? Php $ col = 4; Number of columns you want $ line = 5; The number of the desired lines // resonates is "table"; \ n "; For {$ I = 1; $ i & lt; $ RA + 1; $ i ++} {resonant " \ n"; ($ C = 0; $ c & lt; $ col; $ c ++) {resonant "& lt; td> ($ I + ($ c * $ line)). "& Lt; / td> \ n"; } Echo "& lt; / tr & gt; \ n"; } Echo " \ n"? & Gt;  

jquery - Prevent click event to fire when clicked within element, including any and all of its children elements -


I have a script that opens a certain element and closes an overlay where there is a black background (such as When clicking on the video) and when the user clicks anywhere on the black, the overlay will be closed. However, if the user clicks on the inner container, or any element should be open.

If I click any child, the internal container stops in my script. How to stop it?

  docu = $ (document), quot = $ ('. Quot;), quot_over = $ ('. Quote_overlay '), quot_cont = $ ('. Quote_container '); Quot.click (function) {quot_over.toggle (1, function) {docu.click (function) {var target = $ (event.target); if (! Target.is (quot_cont)) {quot_over Hide (); docu.unbind ('click');}});});});  

I'm not sure why you are in this line:

< P> quot_over.toggle (1, function)

But before clicking, clicking on it immediately closes, so you have to remove it.

Second, you are only checking if the click is on quote_container , and is not checked whether it is on any children of quote_container .

Working JSFined:


php - Why am I not getting the dates I have chosen? -


I have a form that allows the user to input two dates but date 1970-01-01 . Any help?

Date1:

  here & lt; Td> & Lt; Label = "date_1" & gt; Date as Date / MM / yyyy (date_1) & lt; / Labels & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input name = "date_1" type = "text" class = "big" id = "date_1" value = "" size = "12" />  

Here's my PHP:

  $ first = $ _REQUEST ["date_1"]; $ Sec = $ _REQUEST ["date_2"]; $ F_date = Date ('Y-M-D', stratoum ($ first)); $ S_date = Date ('Y-M-D', Straighttoem ($ sec)); If (isset ($ _ GET ["submit"])) {echo $ f_date; Echo & lt; Br / & gt; '; Echo $ s_date;  

use

  echo date time :: createFromFormat ('D / m / y', $ date) - & gt; Format ('ym-d');  

Error reading value of Google sheets cell using python module gspread -


सेल खोलने तक मेरा कोड है:

  आयात करें gspread gc = gspread। लॉगिन ('xxxxxx.xxxxx@google.com ',' xxxxxxxxx ') sh = gc.open_by_url (' https://docs.google.com/xxxxxxxx ') वर्कशीट = sh.sheet1  
< P> सबकुछ यहां तक ​​ठीक लगता है:

  val = worksheet.acell ('C4')  

जो इस त्रुटि को देता है:

  ट्रेसबैक (सबसे हाल का कॉल अंतिम): फ़ाइल "& lt; pyshell # 14" gt; लाइन 1, & lt; मॉड्यूल & gt; Val = worksheet.acell ('C4') फ़ाइल "सी: \ पायथन 34 \ lib \ site-packages \ gspread \ models.py", पंक्ति 307, acell return self.cell (* (self.get_int_addr (label)) में) फ़ाइल "C: \ Python34 \ lib \ site-packages \ gspread \ models.py", पंक्ति 323, सेल में self._cell_addr (पंक्ति, कॉल)) फ़ाइल "C: \ Python34 \ lib \ site-packages \ gspread \ client .pi ", लाइन 262, get_cells_cell_id_feed r = self.session.get (url) में फ़ाइल" C: \ Python34 \ lib \ site-packages \ gspread \ httpsession.py ", पंक्ति 79, वापसी प्राप्त करें self.request (' GET ', url, ** kwargs) फ़ाइल "C: \ Python34 \ lib \ site-packages \ gspread \ httpsession.py", पंक्ति 71, में स्वयं। कनेक्शन [uri.scheme + uri.netloc] .request (विधि , Url, data, headers = request_headers) फ़ाइल "C: \ Python34 \ lib \ http \ client.py", पंक्ति 1088, अनुरोध self._send_request (विधि, url, body, headers) फ़ाइल "C: \ Python34 \ lib \ Http \ client.py ", लाइन 1116, _send_request self.putrequest (method, url, ** skips) फ़ाइल में" C: \ Python34 \ lib \ http \ client.py ", पंक्ति 9 64, पुटरेक्स्ट बढ़ाएं CannotSend अनुरोध (स्वयं .__ राज्य) http.client.CannotSendRequest: अनुरोध-भेजा गया  

सेल पढ़ने पर कोई भी युक्तियां?


javascript - How do I submit user-inputted data and reflect it in a vertical table? -


I am making a beginning and I am trying to write a simple program based on the previous invoice amount Calculates late fees on / payments. I have been stumped in the initial part of this project and basically where I am trying to start, the user is assuming the inverted and showing me in my table below, for some reason I can not understand this I am You can see what I have done so far:

This is the code I'm away from:

   & Lt; Meta http-equiv = "content-type" content = "text / html; charset = UTF-8" /> & Lt; Meta name = "viewport" content = "width = device-width, initial-scale = 1" /> & Lt; Link rel = "stylesheet" type = "text / css" href = "style.css" & gt; & Lt; Script & gt; Function addRow () {var table = document.getElementByID ("result"); Var line = document.createElement ("tr"); Var td1 = document.createElement ("td"); Var td2 = document.createElement ("td"); Var td3 = document.createElement ("td"); Td1.inner HTML = document.getElementByID ("Invoice Amount"). Values; Td2.innerHTML = document.getElementByID ("Previous Balance"). Values; Td3.innerHTML = document.getElementByID ("Payment Adjustment") value; Row.appendChild (TD1); Row.appendChild (TD2); Row.appendChild (td3); Table.children [0] .appendChild (line); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div & gt; & Lt; Form & gt; Invoice amount: & lt; Br> & Lt; Input type = "number" id = "invoice mount" & gt; & Lt; Br> & Lt; Br> Last balance: & lt; Br> & Lt; Input type = "number" id = "previous balance" & gt; & Lt; Br> & Lt; Br> Payment / Adjustment: & lt; Br> & Lt; Input type = "number" id = "payment adjustment" & gt; & Lt; Br> & Lt; Br> & Lt; Input type = "submit" value = "submit" onclick = "addRow ()" & gt; & Lt; / Form & gt; & Lt; / Div & gt; & Lt; Br> & Lt; Div & gt; & Lt; Table range = "1" id = "result" & gt; & Lt; TR & gt; & Lt; Th & gt; Total Invoice Amount & lt; / Th & gt; & Lt; TD & gt; Data & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Th & gt; Previous balance & lt; / Th & gt; & Lt; TD & gt; Data & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Th & gt; Payment / Adjustment & lt; / Th & gt; & Lt; TD & gt; Data & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Th & gt; Late fees & lt; / Th & gt; & Lt; TD & gt; Data & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Th & gt; Balance (amount set) & lt; / Th & gt; & Lt; TD & gt; Data & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

OK, there are two reasons.

First of all, the "Document.getElementByID" call should be "document. GetElementById" (lower-case D).

However, in order to actually stop submitting your application and reloading the page (and table in clearing data in your case), you can add a 'return false;' At the end of your addRow () function, it will look like this:

  function addRow () {var table = document.getElementById ("result"); Var line = document.createElement ("tr"); Var td1 = document.createElement ("td"); Var td2 = document.createElement ("td"); Var td3 = document.createElement ("td"); Td1.innerHTML = Document. GetElementById ("invoicemount"). Values; Td2.innerHTML = document.getElementById ("Previous Balance"). value; Td3.innerHTML = document.getElementById ("payment adjustment"). Values; Row.appendChild (TD1); Row.appendChild (TD2); Row.appendChild (td3); Table.children [0] .appendChild (line); return false; }  

Then your input tag will look like this:

  & lt; Input type = "submit" value = "submit" onclick = "return addRow ();" & gt;  

Hope that helps!


math - Reducing equations using R -


I got this small snippet to reduce a large system:

  # Set up Multiplier g1 = (s + 9) / (s) * (s + 6) * (s + 12) * (s + 14)) g2 = ((6) * (s + 9) * (s + 17)) / / ((S + 12) * (s + 32) * (s + 68)) h1 = 13 h2 = 1 / (s + 7) # System s1 = (g2) / (1 + (g2 ) * (H1)) S2 = (S1) * (G1) S3 = (S2) / (1 + (S2) * (H2)) # Now we have Unity Response G = S 3 Show (g)  

g should low operation should be done with the above action However, when I run the code The I get a bunch of errors:

  error: object 'not found' error: object 'not found error: object' not found error: object 'g2' not found Error: object 's1 'Not found error: object' s2 'not found error: object' 3 'not found error: error in evaluating argument' object 'in the method to select function' show ': Error: object' g 'was not found  

am I Although I am not correctly using equations?

Edit: As my intent should be s free variable

To evaluate your first line of code, one object must be s it is already defined.

It seems that your goal is to create a function that outputs an input s to g . make_g :

  make_g & lt; - Function (s) {# Multipliers to set up g1 = (9 + 9), / (S) * (S +6) * (S +12) * (S +14)) G2 = (( 6) * (S + 9) * (S + 17)) / ((S + 12) (S + 32) * (s + 68)) h1 = 13 h2 = 1 / (s + 7) # System s1 = (G2) / (1 + (g2) * (h1)) in s2 = (S1) * (g1) s3 = (s2) / (1 + (s2) * (h2)) now we have unity feedback = S3g}  

Now, you can call the function using whatever value for s :

  Make_g (s = 1)  

javascript - SOLVED - Not getting a response on MDN AJAX example -


I used to first interact with PHP using AJX (for the first time using Javascript for any significant degree) Tried and did not get any success, so I tried to start the basics using a Mozilla Developer Network example as a test:

Example -

This or So it does not work, though I stick it directly by copying it from the site Only one change (setting URL on my test page, running on XAMPP) When I click on the button to run the MDN script, the resulting output is a problem with the "request" warning.

I am using Fayrbg for test results, and it displays a "200 OK" code to the position if I do not script I understand correctly, is it an error message needed?

The code from the example (with the code being used with the Foundation framework, this case is in any way):

   Doctype html & gt; & Lt; Html class = "no-js" lang = "en" & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" /> & Lt; Meta name = "viewport" content = "width = device-width, initial-scale = 1.0" /> & Lt; Title & gt; Foundation | Welcome & lt; / Title & gt; & Lt; Link rel = "stylesheet" href = "css / foundation.css" /> & Lt; Script src = "js / vendor / modernizr.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Span id = "ajaxbutton" style = "cursor: indicator; text-decoration: underline" & gt; Request & lt; / Span & gt; & Lt; Script src = "js / vendor / jquery.js" & gt; & Lt; / Script & gt; & Lt; Script src = "js / foundation.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; (Function () {var httpRequest; document.getElementById ( "ajaxbutton"). Onclick = function () {makeRequest ( 'http: // localhost: 8000 / pages / test.html');}} function Mekandest (url) { If (window.XMLHttpRequest) {// Mozilla, Safari, ... httpRequest = new XMLHttpRequest ();} if (window.ActiveXObject) {// IE {httpRequest = new ActiveXObject ( "Msxml2.XMLHTTP");} catch (e) {httpRequest = new ActiveXObject ( "Microsoft.XMLHTTP");} catch (e) {}}} if (! HttpRequest) {alert ( 'Hoist :( can not create an XMLHTTP instance'); return false; } httpRequest.onreadystatechange = alertContents; httpRequest.open ( 'GET', url); httpRequest.send ();} function alerts the contents () {if (httpRequest.readyState === 4) {if (httpRequest.status == = 200) {Warning (ht tpRequest.responseText);} else had a problem with {alert ( 'request.');}}}}) (); & Lt; / script & gt; & Lt; / body & gt;  < / Pre> 

And here I have created the code for the test HTML page:

   doctype html> gt; & lt; html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Untitled document & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; Test & lt; / Body & gt; & Lt; / Html & gt;  

Where am I going?

Edit - Referring to the basic PHP script I tried to use a modified version of the MDN script originally on it but could not get it working:

< Pre> & lt ;? Php required ('include / config.inc.php'); Requirement (MYSQL); $ U = Null; $ P = NULL; $ U = mysqli_real_escape_string ($ dbc, $ _GET ['username']); $ P = mysqli_real_escape_string ($ dbc, $ _GET ['password']); $ Q = "Select user from user where user name (user name = '$ U' and password = SHA1 ('$ p')) is active and"; $ R = mysqli_query ($ dbc, $ q) or trigger_error ("query: $ q \ n
MySQL error:". Mysqli_error ($ dbc)); If (@misschool_num_roose ($ r) == 1) {// a match was made $ A = 'true'; Print json_encode ($ a); } And {// no match was made $ A = 'false'; Print json_encode ($ a); }? & Gt; Second Editing - Thanks for the suggestion about console logs, this did what I needed to do to enable everyone and now it works fine.