Let me explain first what I'm trying to do. Because if there's a better way to achieve this, I'm all ears (or eyes actually).  I've built a (html) template parser of sorts. What I can do is write html templates for webpages and include pieces of code from other templates. Something like this:    &lt;div id="banner"&gt;   %include ads.tmpl bannerad% &lt;/div&gt;     Dis will insert a section (bannerad) from the template file ads.tmpl. And the section in ads.tmpl looks something like this:    &lt;bannerad&gt;   &lt;div style="width:640px;height:60px"&gt;     &lt;img src="getbanner.cgi?type=genericad"&gt;   &lt;/div&gt; &lt;/bannerad&gt;     That way I can include the same banner code on multiple pages and if I ever want to change the look/feel of the banners, there's only one place I have to chance it. This all works fine.  But now I need to be able to identify where a banner is requested. For obvious reasons, I would like to distinguish between say for instance the top of the home page, and somewhere in between text on a sub page.  My idea was to add some identification to the parent container. Something like this:    &lt;div id="banner" data-banner_position_id="MAINPAGE_TOP"&gt;   %include ads.tmpl bannerad% &lt;/div&gt;     And then with inline script in the bannercode, iterate through the banners' parentNodes until it finds data-banner_position_id. Something like this:    &lt;bannerad&gt;   &lt;div style="width:640px;height:60px"&gt;     &lt;img id="bannerimg"&gt;   &lt;/div&gt;   &lt;script&gt;     var el = this;     while( el ) {       var id = el.dataset.banner_postition_id;       if( id ) {         document.getElementById("bannerimg").src = "getbanner.cgi?type=genericad&amp;id=" + id;         break;       } else {         el = el.parentNode;       }     }   &lt;/script&gt; &lt;/bannerad&gt;     Now this doesn't work obviously (for several reasons). But is there a way to get this to work? Or is there a better way to do this? It is BTW, completely likely that a page will display more than one banner on a single page...
How can I reference the script element that loaded the javascript that is currently running?  Here's the situation. I have a "master" script being loaded high in the page, first thing under the HEAD tag.  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; &lt;head&gt; &lt;script type="text/javascript" src="scripts.js"&gt;&lt;/script&gt;   There is a script in "scripts.js" which needs to be able to do on-demand loading of other scripts. The normal method doesn't quite work for me because I need to add new scripts without referencing the HEAD tag, because the HEAD element hasn't finished rendering:  document.getElementsByTagName('head')[0].appendChild(v);   What I want to do is reference the script element that loaded the current script so that I can then append my new dynamically loaded script tags into the DOM after it.  &lt;script type="text/javascript" src="scripts.js"&gt;&lt;/script&gt; loaded by scripts.js--&gt;&lt;script type="text/javascript" src="new_script1.js"&gt;&lt;/script&gt; loaded by scripts.js --&gt;&lt;script type="text/javascript" src="new_script2.js"&gt;&lt;/script&gt;
What is the difference between the memory usage report in System Monitor and the one by free? Exporting Data From Salesforce - REST or SOAP? We have a requirement where we need to export records from salesforce tables into our application programmatically. I am reading on the various API's for data integration from salesforce mainly SOAP vs REST API's.  From what I understand, REST should be used when the web service requests are from mobile devices or browser based clients (since they understand JSON). Is that true? If that's the case how do Bulk REST API's fit the bill (since they are meant for bulk data transfers)?  I would like to get your thoughts on what are pros and cons in using SOAP or REST API's to export data records. Note that the requests are being made a java ee server application programmatically. After retrieving the records (probably in batches) from salesforce records we process (validate, filter etc) them and load them in our internal tables.  Thanks. How to calculate number of days between two given dates? If I have two dates (ex. '8/18/2008' and '9/26/2008'), what is the best way to get the number of days between these two dates? How does one actually show from associativity that one can drop parentheses? How do I execute PHP that is stored in a MySQL database? I'm trying to write a page that calls PHP that's stored in a MySQL database. The page that is stored in the MySQL database contains PHP (and HTML) code which I want to run on page load.  How could I go about doing this? map to drive on server with bat file I have a web server that I want to map a drive to it. I want to do this in a .bat file. Pseudo ->   Check if a drive at an ip address has been mapped to a local drive.  If it has then progress with a reference to the drive If not map to a local drive and then progress with a reference to the drive  Is this possible and if so how can I achieve it? Is it worth it to upgrade a Toshiba Satellite C55-A5300 laptop given the latest productivity software requirements? I would like to upgrade a Toshiba Satellite C55-A5300 laptop so it can be as useful as it can be nowadays. I haven’t needed to use much software for a few years now, and I’m not able to gauge whether a maxed out upgrade of this laptop would be up to running the latest versions of MS Office and Acrobat smoothly. Maybe even run some Photoshop and Lightroom? I want to install the best CPU that will work optimally within the parameters of this laptop, including the laptop’s cooling capabilities. I ultimately want improved performance, but I want the performance to be as smooth as possible. From what I gather the Pentium 2030M is the best processor this motherboard will accept. Am I on the right track? I also plan to fully upgrade the memory and the hard disk speed with respective upgrades. What is the max memory per RAM slot (2 total)? What is the fastest speed of RAM I can use?  Copied from the Toshiba spec sheet:  Processor and Graphics Intel® Celeron® Processor 1037U o (2M Cache, 1.80GHz) Mobile Intel® NM70 Express Chipset Mobile Intel® HD graphics with shared graphics memory Memory Memory Configured with 4GB DDR3 1333MHz (max 16GB) 2 main memory slots. One slot is occupied Storage Drive 500GB (5400 RPM) Serial ATA hard disk drive Power 45W (19V 2.37A) 100-240V/50-60Hz AC Adapter Change all file type associations from one program to another Am trying to Update Leads.  When Lead converted flag is true.  Lead Status is Contacted. I have to update all the contacted leads to Converted.  Am Getting this error on the data loader:     ERROR: cannot reference converted lead   Maybe because converted leads cannot be updated because they are locked out once they are converted?  Is there a workaround to update Lead Status to Converted from Contacted? Proving $\frac{\sin x}{x} =\left(1-\frac{x^2}{\pi^2}\right)\left(1-\frac{x^2}{2^2\pi^2}\right) \left(1-\frac{x^2}{3^2\pi^2}\right)\cdots$ Why did a Dementor try to take Harry's soul in the train? In "Harry Potter and the Prisoner of Azkaban" - when Harry and his friends were travelling to Hogwarts by train, the train stopped in between and Dementors were searching for Sirius Black. Why did one of the Dementors try to take Harry's soul? Circuit tester trips new GFCI I replaced a non-protected receptacle with a GFCI type and now my circuit tester trips the GFCI as soon as it is plugged in.  The receptacle tested fine before replacement, ground, neutral, hot, etc.  I've double checked the hot/neutral/ground connections.  I've also tried it with the downstream load disconnected.   The GFCI trips the moment I plug in my circuit tester (before pushing the test button).  Otherwise things check out OK.  I can plug in a power tool without it tripping.  Also, the integrated test/reset button work correctly.   I've read that the integrated test button is the only one that truly matters. Is this correct or should I be concerned? I'm sure a home inspector will red flag this if their tester has the same result.  Update  My tester is by "Commercial Electric".  The tester is one of the palm sized three prong type with three leds to indicate the condition of the circuit and a button on top to test GFCI. It's new from the local box store. I have this file:  sometext1{ string1 }  sometext2{ string2 string3 }  sometext3{ string4 string5 string6 }   I want to search this file for a specific string and print everything before this string up to the opening { and everything after this string up to the closing }. I tried to achieve this with sed but if I try to print everything in the range /{/,/string2/ for example sed prints this:  sometext1{ string1 }  sometext2{ string2 sometext3{ string4 string5 string6 }   If I search for the string "string2" I need the output to be:   sometext2{ string2 string3 }   Thanks. Time dependent Schrödinger equation with time independent potential and separation of variables suppose we have a potential that's independent of time $V(x,t) = V(x)$ so in Schrödinger equation we get: $$i\hbar \frac{\partial \Psi (x,t)}{\partial t}=-\frac{\hbar^2}{2m}\frac{\partial^2 \Psi (x,t)}{\partial x^2}+V(x)\Psi(x,t)$$ since the LHS involves a variation of $\Psi$ with $x$ and the LHS involves a variation of $\Psi$ with $t$ can we say that a basis for the solutions will be with the form $\Psi(x,t)=\psi(x)T(t)$? Solving an ODE in power series Changing content of footline in beamer I would like to get the multi pattern match with implicit AND between patterns, i.e. equivalent to running several greps in a sequence:  grep pattern1 | grep pattern2 | ...   So how to convert it to something like?  grep pattern1 &amp; pattern2 &amp; pattern3   I would like to use single grep because I am building arguments dynamically, so everything has to fit in one string. Using filter is system feature, not grep, so it is not an argument for it.    Don't confuse this question with:  grep "pattern1\|pattern2\|..."   This is an OR multi pattern match. Combinatorial proof of summation of $\sum\limits_{k = 0}^n {n \choose k}^2= {2n \choose n}$ I was hoping to find a more "mathematical" proof, instead of proving logically $\displaystyle \sum_{k = 0}^n {n \choose k}^2= {2n \choose n}$.  I already know the logical Proof:  $${n \choose k}^2 = {n \choose k}{ n \choose n-k}$$  Hence summation can be expressed as:  $$\binom{n}{0}\binom{n}{n} + \binom{n}{1}\binom{n}{n-1} + \cdots + \binom{n}{n}\binom{n}{0}$$  One can think of it as choosing $n$ people from a group of $2n$  (imagine dividing a group of $2n$ into $2$ groups of $n$ people each. I can get $k$ people from group $1$ and another $n-k$ people from group $2$. We do this from $k = 0$ to $n$. the weak form of 'on' I am confused at whether or not there is a weak form at preposition's 'ON'. I've checked at some dictionaries at Cambridge and Oxford dictionary, they don't mention on the weak form's pronunciation. However, I, am a Japanese, checked at English-Japanese dictionaries, they mention on the weak form as /ən/.  For example, is there the difference of pronunciation between 'It goes on' and 'There is an apple on the table' in connected speech?  Does it exist?  Thanks Yuichi  *It's Edited Find all functions $f$ such that $(x+y)f(x)+f(y^2)=(x+y)f(y)+f(x^2)$ Find all functions $f$ that assign a real number $f(x)$ to every real number $x$ such that $$(x+y)f(x)+f(y^2)=(x+y)f(y)+f(x^2)$$  I've tried subbing in heaps of values but I keep getting things like $f(0)=f(0)$ and other such useless results.  Any help would be hugely appreciated.