Search Results

Search found 1167 results on 47 pages for 'h1 visa'.

Page 4/47 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Java static method parameters

    - by Blitzkr1eg
    Why does the following code return 100 100 1 1 1 and not 100 1 1 1 1 ? public class Hotel { private int roomNr; public Hotel(int roomNr) { this.roomNr = roomNr; } public int getRoomNr() { return this.roomNr; } static Hotel doStuff(Hotel hotel) { hotel = new Hotel(1); return hotel; } public static void main(String args[]) { Hotel h1 = new Hotel(100); System.out.print(h1.getRoomNr() + " "); Hotel h2 = doStuff(h1); System.out.print(h1.getRoomNr() + " "); System.out.print(h2.getRoomNr() + " "); h1 = doStuff(h2); System.out.print(h1.getRoomNr() + " "); System.out.print(h2.getRoomNr() + " "); } } Why does it appear to pass Hotel by-value to doStuff() ?

    Read the article

  • What is the right way to do this HTML: header with icon linked

    - by Hell Awaits
    I know how to make these examples look and behave the same. But I would like to know which is the right way to build a HTML structure. <a><img><h1></h1></a> - looks wrong because an inline element is inside of a block element <a><img></a><h1><a></a></h1> - the same a-element is defined twice. Also I'm not sure about markup inside headers Any other solutions ?

    Read the article

  • Convert uploaded video files to mp4 using PHP [closed]

    - by Subin
    I created a PHP video uploading script. I need to convert these files to mp4 for HTML5 VIDEO PLAYER using PHP while uploading . How can I do that ? Here is the PHP code. <?php if(isset($_POST['submit'])){ $user=$_COOKIE['VisitorName']; include('config.php'); session_start(); $session_id='1'; //$session id $path = "/home/simsu/subins/videos/data/videos/"; $valid_formats = array("wmv", "ogv", "mp4", "3gp", "ogg"); if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['uploadedfile']['name']; $size = $_FILES['uploadedfile']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { if($size<(100024*100024)) { $actual_image_name = $path.time().".mp4"; $tmp = $_FILES['uploadedfile']['tmp_name']; $upurl="http://vtube.subins.com/files/video?vid=".time(); $title=$_POST['vn']; mysql_query("INSERT INTO videos(title,user,url,vid,ext) VALUES ('$title', '$user','$upurl',NOW(),'$ext')"); echo '<br><h1>'.$_FILES['uploadedfile']['name'] . " uploaded.</h1>"; } else echo "<br><h1>Video file size max 100 MB"; } else echo "<br><h1>Invalid file format.."; } else echo "<br><h1>Please select a video..!"; exit; } } ?>

    Read the article

  • Get Two row with multiple column in asp.net c#

    - by Gaurav Naik
    How to get data from database with two rows and multiple column with seperator will be there after the 1 row end as an example: <div class="_thum_bar"> <div class="box1"> <div class="_t1_box"><a href="#!/condom_details"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> <div class="box2"> <div class="_t1_box"><a href="#!/condom_details"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> <div class="box3"> <div class="_t1_box"><a href="#"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> </div> <div class="_t_spacer">&nbsp;</div> <div class="_thum_bar"> <div class="box1"> <div class="_t1_box"><a href="#!/condom_details"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> <div class="box2"> <div class="_t1_box"><a href="#!/condom_details"><img src="images/pack/pack1.png" border="0"></a></div> <div class="_t2_box"> <h1>Dotted Condom</h1> <p>Dotted condoms for additional friction. Pure ecstasy makes this a KamaSutra all time favourite.</p> <h2><a href="#!/condom_details">Add to cart</a></h2> </div> </div> </div> <div class="_t_spacer">&nbsp;</div>

    Read the article

  • issue in property file

    - by devuser
    I want to load the property file when tomcat is starting.so I'm using servletContextListener to do that and i can get values of property file to my web application. But i want to keep the same value after changing the property file once log into web application.But when i change the value of property file and log into system again it change the value to new one.I want to keep the same value that loaded when tomcat was starting.how can i implement this? My coding is as below import javax.servlet.*; import java.io.IOException; import java.util.Properties; import java.util.logging.Level; import java.util.logging.Logger; import java.io.*; import java.util.ResourceBundle; public final class sysProperties implements javax.servlet.ServletContextListener { private static Properties props = new Properties(); private static String file_name = "com/util/contact.properties"; public addSystemProperties() { } public void contextInitialized(ServletContextEvent servletContextEvent) { // Get the context ServletContext servletContext = servletContextEvent.getServletContext(); // Set a context attribute try { // props.load(servletContext.getResourceAsStream(file_name)); props.load(getClass().getClassLoader().getResourceAsStream(file_name)); System.out.println(" Application X is starting"); servletContext.setAttribute("h1",props.getProperty("home.h1")); servletContext.setAttribute("h2",props.getProperty("home.h2")); System.out.println("h1"+servletContext.getAttribute("h1")); System.out.println("h2"+ servletContext.getAttribute("h2")); ; } catch (Exception e) { System.out.println(" Error setting context attribute: " + e.getMessage()); } } public void contextDestroyed(ServletContextEvent servletContextEvent) { // Get the context ServletContext servletContext = servletContextEvent.getServletContext(); // Output the context variable we set earlier System.out.println(" Application X is shutting down"); System.out.println(" Value of h1 is: " + servletContext.getAttribute("h1")); System.out.println(" Value of h2 is: " + servletContext.getAttribute("h2")); // Clean up (not really necessary as the context is being destroyed, but let's be neat) servletContext.removeAttribute(props.getProperty("h1")); servletContext.removeAttribute(props.getProperty("h2")); } }

    Read the article

  • how can i return a string with jQuery from an input and write it to a different html element

    - by user1865231
    I am using this: var title = $('#input').val(); $('#titleset').click(function (){ $('#title').html('<h1>' + title + '</h1>'); alert(title); }); to try to get the value of an input box and then when the user clicks the button #titleset, overwrite the value from the input box to the <h1> element that is already there. i have been able to get the click to overwrite the <h1> element, but there is nothing in the title variable to write into the element. so how could i return a string from the #input id and write it to the #title id which is an <h1> element here is my html <h1 id="title">This Title Changes To What You Want It To Be</h1> <ul class="menu1"> <li>menu one <ul> <li id='inputbox'><input type ="text" id="input"/></li> <li id="titleset1"><input type="button" value="set title" id="titleset"/></li> </ul> </li> </ul>

    Read the article

  • Preventing endless forwarding with two routers

    - by jarmund
    The network in quesiton looks basically like this: /----Inet1 / H1---[111.0/24]---GW1---[99.0/24] \----GW2-----Inet2 Device explaination H1: Host with IP 192.168.111.47 GW1: Linux box with IPs 192.168.111.1 and 192.168.99.2, as well as its own route to the internet. GW2: Generic wireless router with IP 192.168.99.1 and its own route to the internet. Inet1 & Inet2: Two possible routes to the internet In short: H has more than one possible route to the internet. H is supposed to only access the internet via GW2 when that link is up, so GW1 has some policy based routing special just for H1: ip rule add from 192.168.111.47 table 991 ip route add default via 192.168.99.1 table 991 While this works as long as GW2 has a direct link to the internet, the problem occurs when that link is down. What then happens is that GW2 forwards the packet back to GW1, which again forwards back to GW2, creating an endless loop of TCP-pingpong. The preferred result would be that the packet was just dropped. Is there something that can be done with iptables on GW1 to prevent this? Basically, an iptables-friendly version of "If packet comes from GW2, but originated from H1, drop it" Note1: It is preferable not to change anything on GW2. Note2: H1 needs to be able to talk to both GW1 and GW2, and vice versa, but only GW2 should lead to the internet TLDR; H1 should only be allowed internet access via GW2, but still needs to be able to talk to both GW1 and GW2. EDIT: The interfaces for GW1 are br0.105 for the '99' network, and br0.111 for the '111' network. The sollution may or may not be obnoxiously simple, but i have not been able to produce the proper iptables syntax myself, so help would be most appreciated. PS: This is a follow-up question from this question

    Read the article

  • How to disable Cufon on certain elements?

    - by Shadi Almosri
    Hiya, I currently use Cufon accross our site with something similar to Cufon.set('fontFamily', 'DIN Medium').replace('h1'); Now for a single H1 tag i would like Cufon to be disabled, this is without changing the H1 tag to any other tag, it must remain as it is. I can add classes etc to the H1 tag if required, and can do any HTML/CSS/JS just not changing the actual tag. Anyone know if this is possible and if it is how? Thanks in advance, Shadi

    Read the article

  • Blackberry Storm - focus issue on bitmap field

    - by SWATI
    in my screen there are 3 managers h1 h2 bmpf = new BitmapField added in order like this as backgroundmanager.add(h1) backgroundmanager.add(bmpf) backgroundmanager.add(h2) add(background manager); protected boolesn navigationClick() { int index1 = h1.getFieldWithFocusIndex(); int index2 = h2.getFieldWithFocusIndex(); return true; } mow i get the focus index of all focussable fields in managers h1 and h2 but i cant get index of the bitnmapfield on focus i need to execute some code on its click what to do

    Read the article

  • Split html text in a SEO friendly manner

    - by al nik
    I've some html text like <h1>GreenWhiteRed</h1> Is it SEO friendly to split this text in something like <h1><span class="green">Green</span><span class="white">White</span><span class="red">Red</span></h1> Is the text still ranking well and is it interpreted as a single word 'GreenWhiteRed'?

    Read the article

  • Need help with tweaking a Dropdown with three options, user selects one - a hidden div appears with correct fields

    - by Jack
    Hello Again, I posted a question on here and got an answer within minutes I'm hoping the wizards on here can help me again. Okay so I'm using a script I found online to try and add this function to a shopping cart form. Here's the setup. I have a payment method dropdown with Visa, Mastercard and Bank Withdrawal as the options. For the credit cards I have one hidden div with a certain set of fields, and for the bank I have another hidden div. Each of the divs have named ID's - #payCredit and #payBank The css for both have margin: 0px and display: none; Here's a peice of javascript I used successfuly on a shipping address checkbox `function toggleLayer( whichLayer ) { var elem, vis; if( document.getElementById ) // this is the way the standards work elem = document.getElementById( whichLayer ); else if( document.all ) // this is the way old msie versions work elem = document.all[whichLayer]; else if( document.layers ) // this is the way nn4 works elem = document.layers[whichLayer]; vis = elem.style; // if the style.display value is blank we try to figure it out here if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined) vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none'; vis.display = (vis.display==''||vis.display=='block')?'none':'block'; }` I was hoping I could change it slightly to meet my needs. Here's the dropdown <label>Payment Method:</label> <select name="payment" id="payment" class="dropdown3" style="width:8em"> <option selected="selected">Select</option> <option value="Visa" onclick="javascript:toggleLayer('payCredit');">Visa</option> <option value="MasterCard" onclick="javascript:toggleLayer('payCredit');">Mastercard</option> <option value="Direct" onclick="javascript:toggleLayer('payBank');">Direct Withdraw</option> </select></li> The current result is that it kinda works. I can open the dropdown and select Visa and it appears, if I select Visa again it disappears, if I select Visa and then select bank, both appear. You can see what i'm working on here - http://test.sharevetcare.com/bestfriends/cart3.html

    Read the article

  • Add multiple payment options in Google Product feed XML

    - by crmpicco
    In my Google Product feed I have both Visa and MasterCard listed as accepted payment methods. Is it possible, and is there any benefit, in adding the remainder of my payment options; American Express, Delta, Maestro etc. <g:payment_accepted>Visa</g:payment_accepted> <g:payment_accepted>MasterCard</g:payment_accepted> I can't find anything in the specification that mentions the payment methods. My feed applies to the UK, US and EU.

    Read the article

  • Extending Database-as-a-Service to Provision Databases with Application Data

    - by Nilesh A
    Oracle Enterprise Manager 12c Database as a Service (DBaaS) empowers Self Service/SSA Users to rapidly spawn databases on demand in cloud. The configuration and structure of provisioned databases depends on respective service template selected by Self Service user while requesting for database. In EM12c, the DBaaS Self Service/SSA Administrator has the option of hosting various service templates in service catalog and based on underlying DBCA templates.Many times provisioned databases require production scale data either for UAT, testing or development purpose and managing DBCA templates with data can be unwieldy. So, we need to populate the database using post deployment script option and without any additional work for the SSA Users. The SSA Administrator can automate this task in few easy steps. For details on how to setup DBaaS Self Service Portal refer to the DBaaS CookbookIn this article, I will list steps required to enable EM 12c DBaaS to provision databases with application data in two distinct ways using: 1) Data pump 2) Transportable tablespaces (TTS). The steps listed below are just examples of how to extend EM 12c DBaaS and you can even have your own method plugged in part of post deployment script option. Using Data Pump to populate databases These are the steps to be followed to implement extending DBaaS using Data Pump methodolgy: Production DBA should run data pump export on the production database and make the dump file available to all the servers participating in the database zone [sample shown in Fig.1] -- Full exportexpdp FULL=y DUMPFILE=data_pump_dir:dpfull1%U.dmp, data_pump_dir:dpfull2%U.dmp PARALLEL=4 LOGFILE=data_pump_dir:dpexpfull.log JOB_NAME=dpexpfull Figure-1:  Full export of database using data pump Create a post deployment SQL script [sample shown in Fig. 2] and this script can either be uploaded into the software library by SSA Administrator or made available on a shared location accessible from servers where databases are likely to be provisioned Normal 0 -- Full importdeclare    h1   NUMBER;begin-- Creating the directory object where source database dump is backed up.    execute immediate 'create directory DEST_LOC as''/scratch/nagrawal/OracleHomes/oradata/INITCHNG/datafile''';-- Running import    h1 := dbms_datapump.open (operation => 'IMPORT', job_mode => 'FULL', job_name => 'DB_IMPORT10');    dbms_datapump.set_parallel(handle => h1, degree => 1);    dbms_datapump.add_file(handle => h1, filename => 'IMP_GRIDDB_FULL.LOG', directory => 'DATA_PUMP_DIR', filetype => 3);    dbms_datapump.add_file(handle => h1, filename => 'EXP_GRIDDB_FULL_%U.DMP', directory => 'DEST_LOC', filetype => 1);    dbms_datapump.start_job(handle => h1);    dbms_datapump.detach(handle => h1);end;/ Figure-2: Importing using data pump pl/sql procedures Using DBCA, create a template for the production database – include all the init.ora parameters, tablespaces, datafiles & their sizes SSA Administrator should customize “Create Database Deployment Procedure” and provide DBCA template created in the previous step. In “Additional Configuration Options” step of Customize “Create Database Deployment Procedure” flow, provide the name of the SQL script in the Custom Script section and lock the input (shown in Fig. 3). Continue saving the deployment procedure. Figure-3: Using Custom script option for calling Import SQL Now, an SSA user can login to Self Service Portal and use the flow to provision a database that will also  populate the data using the post deployment step. Using Transportable tablespaces to populate databases Copy of all user/application tablespaces will enable this method of populating databases. These are the required steps to extend DBaaS using transportable tablespaces: Production DBA needs to create a backup of tablespaces. Datafiles may need conversion [such as from Big Endian to Little Endian or vice versa] based on the platform of production and destination where DBaaS created the test database. Here is sample backup script shows how to find out if any conversion is required, describes the steps required to convert datafiles and backup tablespace. SSA Administrator should copy the database (tablespaces) backup datafiles and export dumps to the backup location accessible from the hosts participating in the database zone(s). Create a post deployment SQL script and this script can either be uploaded into the software library by SSA Administrator or made available on a shared location accessible from servers where databases are likely to be provisioned. Here is sample post deployment SQL script using transportable tablespaces. Using DBCA, create a template for the production database – all the init.ora parameters should be included. NOTE: DO NOT choose to bring tablespace data into this template as they will be created SSA Administrator should customize “Create Database Deployment Procedure” and provide DBCA template created in the previous step. In the “Additional Configuration Options” step of the flow, provide the name of the SQL script in the Custom Script section and lock the input. Continue saving the deployment procedure. Now, an SSA user can login to Self Service Portal and use the flow to provision a database that will also populate the data using the post deployment step. More Information: Database-as-a-Service on Exadata Cloud Podcast on Database as a Service using Oracle Enterprise Manager 12c Oracle Enterprise Manager 12c Installation and Administration guide, Cloud Administration guide DBaaS Cookbook Screenwatch: Private Database Cloud: Set Up the Cloud Self-Service Portal Screenwatch: Private Database Cloud: Use the Cloud Self-Service Portal Stay Connected: Twitter |  Face book |  You Tube |  Linked in |  Newsletter

    Read the article

  • Using JQuery to get text of a div that's a child of a header to replace a different header

    - by Stevie Jenowski
    Hello all, I'm trying to get the text contents of a .div('.child#') child of my event.target('h6.class'), and replace my other headers('h1.replacHeader#') using this script below... $('h6.class').click(function(event) { var $target = $(event.target); $('.replaceHeader1').replaceWith("<h1 class='replaceHeader1'>" + $target.children(".child1").text() + "</h1>"); $('.replaceHeader2').replaceWith("<h1 class='replaceHeader2'>" + $target.children(".child2").text() + "</h1>"); }); }); I've noticed that .text() apparently doesn't apply to an event.target... So how could I go about achieving this?

    Read the article

  • UIWebView not evaluating javascript properly

    - by jammur
    I'm trying to run some javascript against a UIWebView but it's doesn't seem to be working. For example, here is a snippet of html I'm using to test: <html><body><h1>Hello World!</h1><p>It's me.</p></body></html> If I run the following javascript against it, the return value is 0, when it should be 1. var elements = document.getElementsByTagName("h1"); elements.length; Here's the objc code I'm using for the webview. 'parser' is a string containing the above javascript: [webView loadHTMLString:@"<html><body><h1>Hello World!</h1><p>It's me.</p></body></html>" baseURL:nil]; NSString *markupResult = [webView stringByEvaluatingJavaScriptFromString:parser];

    Read the article

  • Writing an optimised and efficient search engine with mySQL and ColdFusion

    - by Mel
    I have a search page with the following scenarios listed below. I was told there was a better way to do it, but not how, and that I am using too many if statements, and that it's prone to causing an error through url manipulation: Search.cfm will processes a search made from a search bar present on all pages, with one search input (titleName). If search.cfm is accessed manually (through URL not through using the simple search bar on all pages) it displays an advanced search form with three inputs (titleName, genreID, platformID) or it evaluates searchResponse variable and decides what to do. If simple search query is blank, has no results, or less than 3 characters it displays an error If advanced search query is blank, has no results, or less than 3 characters it displays an error If any successful search returns results, they come back normally. The top-of-page logic is as follows: <!---SET DEFAULT VARIABLE---> <cfparam name="variables.searchResponse" default=""> <!---CHECK TO SEE IF SIMPLE SEARCH A FORM WAS SUBMITTED AND EXECUTE SEARCH IF IT WAS---> <cfif IsDefined("Form.simpleSearch") AND Len(Trim(Form.titleName)) LTE 2> <cfset variables.searchResponse = "invalidString"> <cfelseif IsDefined("Form.simpleSearch") AND Len(Trim(Form.titleName)) GTE 3> <!---EXECUTE METHOD AND GET DATA---> <cfinvoke component="myComponent" method="simpleSearch" searchString="#Form.titleName#" returnvariable="simpleSearchResult"> <cfset variables.searchResponse = "simpleSearchResult"> </cfif> <!---CHECK IF ANY RECORDS WERE FOUND---> <cfif IsDefined("variables.simpleSearchResult") AND simpleSearchResult.RecordCount IS 0> <cfset variables.searchResponse = "noResult"> </cfif> <!---CHECK IF ADVANCED SEARCH FORM WAS SUBMITTED---> <cfif IsDefined("Form.AdvancedSearch") AND Len(Trim(Form.titleName)) LTE 2> <cfset variables.searchResponse = "invalidString"> <cfelseif IsDefined("Form.advancedSearch") AND Len(Trim(Form.titleName)) GTE 2> <!---EXECUTE METHOD AND GET DATA---> <cfinvoke component="myComponent" method="advancedSearch" returnvariable="advancedSearchResult" titleName="#Form.titleName#" genreID="#Form.genreID#" platformID="#Form.platformID#"> <cfset variables.searchResponse = "advancedSearchResult"> </cfif> <!---CHECK IF ANY RECORDS WERE FOUND---> <cfif IsDefined("variables.advancedSearchResult") AND advancedSearchResult.RecordCount IS 0> <cfset variables.searchResponse = "noResult"> </cfif> I'm using the searchResponse variable to decide what the the page displays, based on the following scenarios: <!---ALWAYS DISPLAY SIMPLE SEARCH BAR AS IT'S PART OF THE HEADER---> <form name="simpleSearch" action="search.cfm" method="post"> <input type="hidden" name="simpleSearch" /> <input type="text" name="titleName" /> <input type="button" value="Search" onclick="form.submit()" /> </form> <!---IF NO SEARCH WAS SUBMITTED DISPLAY DEFAULT FORM---> <cfif searchResponse IS ""> <h1>Advanced Search</h1> <!---DISPLAY FORM---> <form name="advancedSearch" action="search.cfm" method="post"> <input type="hidden" name="advancedSearch" /> <input type="text" name="titleName" /> <input type="text" name="genreID" /> <input type="text" name="platformID" /> <input type="button" value="Search" onclick="form.submit()" /> </form> </cfif> <!---IF SEARCH IS BLANK OR LESS THAN 3 CHARACTERS DISPLAY ERROR MESSAGE---> <cfif searchResponse IS "invalidString"> <cfoutput> <h1>INVALID SEARCH</h1> </cfoutput> </cfif> <!---IF SEARCH WAS MADE BUT NO RESULTS WERE FOUND---> <cfif searchResponse IS "noResult"> <cfoutput> <h1>NO RESULT FOUND</h1> </cfoutput> </cfif> <!---IF SIMPLE SEARCH WAS MADE A RESULT WAS FOUND---> <cfif searchResponse IS "simpleSearchResult"> <cfoutput> <h1>Search Results</h1> </cfoutput> <cfoutput query="simpleSearchResult"> <!---DISPLAY QUERY DATA---> </cfoutput> </cfif> <!---IF ADVANCED SEARCH WAS MADE A RESULT WAS FOUND---> <cfif searchResponse IS "advancedSearchResult"> <cfoutput> <h1>Search Results</h1> <p>Your search for "#Form.titleName#" returned #advancedSearchResult.RecordCount# result(s).</p> </cfoutput> <cfoutput query="advancedSearchResult"> <!---DISPLAY QUERY DATA---> </cfoutput> </cfif> Is my logic a) not efficient because my if statements/is there a better way to do this? And b) Can you see any scenarios where my code can break? I've tested it but I have not been able to find any issues with it. And I have no way of measuring performance. Any thoughts and ideas would be greatly appreciated. Many thanks

    Read the article

  • Elegant way to add functionallity to previously defined functions

    - by Bastiaan
    How to combine two functions together I have a class controlling some hardware: class Heater() def set_power(self,dutycycle, period) ... def turn_on(self) ... def turn_off(self) And a class that connects to a database and handles all data logging fuctionallity for an experiment: class DataLogger() def __init__(self) # Record measurements and controls in a database def start(self,t) # Starts a new thread to aqcuire and reccord measuements every t secconds Now, in my program recipe.py I want to do something like: log = DataLogger() @DataLogger_decorator H1 = Heater() log.start(60) H1.set_power(10,100) H1.turn_on() sleep(10) H1.turn_off() etc Where all actions on H1 are recorded by the datalogger. I can change any of the classes involved, just looking for an elegant way to do this. Ideally the hardware functions remain separated from the database and DataLogger functions. And ideally the DataLogger is reusable for other controls and measurements.

    Read the article

  • how to remove all text nodes and only preserve structure information of a html page with nokogiri

    - by user58948
    I want to remove all text from html page that I load with nokogiri. For example, if a page has the following: <body><script>var x = 10;</script><div>Hello</div><div><h1>Hi</h1></div></body> I want to process it with Nokogiri and return html like the following after stripping the text like so: <body><script>var x = 10;</script><div></div><div><h1></h1></div></body> (THat is, remove the actual h1 text, text between divs, text in p elements etc, but keep the tags. also, dont remove text in the script tags.) How can I do that?

    Read the article

  • Adding an encapsulated email (like a forwarded email) from Zend Mail.

    - by Kieran
    I'm trying to get Zend_Mail to send an encapsulated message - as though it's forwarding an email. $attachedContent = "<h1>H1 Email</h1>"; $emailContent = "<h1>Email Content>"; $mail = new Zend_Mail(); $mail->setBodyText('text content'); $mail->setBodyHtml($emailContent); $mail->setFrom('[email protected]', 'GAS'); $mail->addTo('[email protected]', 'GAS'); $at = $mail->createAttachment($attachedContent); $at->type = 'message/rfc822; name="forwarded message"'; $at->disposition = Zend_Mime::DISPOSITION_INLINE; $at->encoding = Zend_Mime::ENCODING_7BIT; $mail->setSubject('Test'); $mail->send(); Mail clients are getting the email, rendering the normal HTML content, and displaying the forwarded message and rendering its contents, however, it's formatting like: <h1>Email Content</h1> Can you see what I'm doing wrong? I've not found anything online, and have tried my best to copy the formatting from looking at email source. Cheers, Kieran

    Read the article

  • Loop with a while

    - by ookla
    Very basic question.. but I'm missing the point.. I have this data on my table: ID SITEID SECTION 1 1 posts 2 2 posts 3 1 aboutme 4 1 contact 5 2 questions The output is an array. I can't change it. I want to make this output on php with a single for loop with that array: <h1> sections for site 1 </h1> posts aboutme contact <h1>sections for site 2 </h1> posts questions I'm trying to do something like this, where $sectionsArray is my output. And I want to check if siteid is the same, then make a loop.. for ($j=0;$j<sizeof($sectionsArray);$j++) { while (siteid==1){ echo "<h1>'.$sectionsArray['siteid'].'</h1>'; } echo "<A href='section.php?id='.$sectionsArray['id'].' '">'.$sectionsArray['section'].'</a>; } But I don't get the logic of "grouping" the results with a while.. INSIDE a loop. Any light will be welcome. Thanks

    Read the article

  • How can I write an XSLT that will recursively include other files?

    - by Eric
    Let's say I have a series of xml files in this format: A.xml: <page> <header>Page A</header> <content>blAh blAh blAh</content> </page> B.xml: <page also-include="A.xml"> <header>Page B</header> <content>Blah Blah Blah</content> </page> Using this XSLT: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/page"> <h1> <xsl:value-of select="header" /> </h1> <p> <xsl:value-of select="content" /> </p> </xsl:template> </xsl:stylesheet> I can turn A.xml into this: <h1> Page A </h1> <p> blAh blAh blAh </p> But how would I make it also turn B.xml into this? <h1> Page B </h1> <p> Blah Blah Blah </p> <p> blAh blAh blAh </p> I know that I need to use document(concat(@also-include,'.xml')) somewhere, but I'm not sure where. Oh, and the catch is, I need this to still work if B were to be included in a third file, C.xml. Any idea as to how to do this?

    Read the article

  • Is there a selector or a work around to select any element with no children.

    - by rnaud
    Looking at the CSS3 specs, I can't find any way to select any element that has no children. Let me explain. <body> <h1>Main Page</h1> <div id="main"> <div class="post"> <h2>Article 1</h1> <p>some text</p> </div> <div class="post"> <h2>Article 2</h1> <p>some text</p> </div> </div> </body> I'm looking for a CSS syntax to select the h1, the two h2 and the two p. A way to select in any page, all elements with no children. Any suggestion ? Sorry, I forgot to add the "empty" part, I am actually already using the *:empty selector, but it's not working for any tag that has a nodeText as a child. So it's working for any input, image, object, but not for h2, h1, or any p.

    Read the article

  • Simple Jquery function won't work

    - by stijn26
    I have following jQuery code $(document).ready(function() { for(var i=1;i<4;i++) { var img= ".img"+i; var p= ".p"+i; $(img).on("click", function(){ $(p).hide(); }); } }); Applied on the following html: <div> <article> <h1>Over mezelf <img src='images/plus.png' class='img1'/></h1> <p class='p1'>Test</p> </article> <article> <h1>Contact <img src='images/plus.png' class='img2'/></h1> <p class='p2'>Test</p> </article> <article> <h1>Website <img src='images/plus.png' class='img3'/></h1> <p class='p3'>Test</p> </article> </div> When I click on the images, the last <p> disappears, it doesn't work on the other ones.

    Read the article

  • Metro: Using Templates

    - by Stephen.Walther
    The goal of this blog post is to describe how templates work in the WinJS library. In particular, you learn how to use a template to display both a single item and an array of items. You also learn how to load a template from an external file. Why use Templates? Imagine that you want to display a list of products in a page. The following code is bad: var products = [ { name: "Tesla", price: 80000 }, { name: "VW Rabbit", price: 200 }, { name: "BMW", price: 60000 } ]; var productsHTML = ""; for (var i = 0; i < products.length; i++) { productsHTML += "<h1>Product Details</h1>" + "<div>Product Name: " + products[i].name + "</div>" + "<div>Product Price: " + products[i].price + "</div>"; } document.getElementById("productContainer").innerHTML = productsHTML; In the code above, an array of products is displayed by creating a for..next loop which loops through each element in the array. A string which represents a list of products is built through concatenation. The code above is a designer’s nightmare. You cannot modify the appearance of the list of products without modifying the JavaScript code. A much better approach is to use a template like this: <div id="productTemplate"> <h1>Product Details</h1> <div> Product Name: <span data-win-bind="innerText:name"></span> </div> <div> Product Price: <span data-win-bind="innerText:price"></span> </div> </div> A template is simply a fragment of HTML that contains placeholders. Instead of displaying a list of products by concatenating together a string, you can render a template for each product. Creating a Simple Template Let’s start by using a template to render a single product. The following HTML page contains a template and a placeholder for rendering the template: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Application1</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.0.6/css/ui-dark.css" rel="stylesheet"> <script src="//Microsoft.WinJS.0.6/js/base.js"></script> <script src="//Microsoft.WinJS.0.6/js/ui.js"></script> <!-- Application1 references --> <link href="/css/default.css" rel="stylesheet"> <script src="/js/default.js"></script> </head> <body> <!-- Product Template --> <div id="productTemplate"> <h1>Product Details</h1> <div> Product Name: <span data-win-bind="innerText:name"></span> </div> <div> Product Price: <span data-win-bind="innerText:price"></span> </div> </div> <!-- Place where Product Template is Rendered --> <div id="productContainer"></div> </body> </html> In the page above, the template is defined in a DIV element with the id productTemplate. The contents of the productTemplate are not displayed when the page is opened in the browser. The contents of a template are automatically hidden when you convert the productTemplate into a template in your JavaScript code. Notice that the template uses data-win-bind attributes to display the product name and price properties. You can use both data-win-bind and data-win-bindsource attributes within a template. To learn more about these attributes, see my earlier blog post on WinJS data binding: http://stephenwalther.com/blog/archive/2012/02/26/windows-web-applications-declarative-data-binding.aspx The page above also includes a DIV element named productContainer. The rendered template is added to this element. Here’s the code for the default.js script which creates and renders the template: (function () { "use strict"; var app = WinJS.Application; app.onactivated = function (eventObject) { if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { var product = { name: "Tesla", price: 80000 }; var productTemplate = new WinJS.Binding.Template(document.getElementById("productTemplate")); productTemplate.render(product, document.getElementById("productContainer")); } }; app.start(); })(); In the code above, a single product object is created with the following line of code: var product = { name: "Tesla", price: 80000 }; Next, the productTemplate element from the page is converted into an actual WinJS template with the following line of code: var productTemplate = new WinJS.Binding.Template(document.getElementById("productTemplate")); The template is rendered to the templateContainer element with the following line of code: productTemplate.render(product, document.getElementById("productContainer")); The result of this work is that the product details are displayed: Notice that you do not need to call WinJS.Binding.processAll(). The Template render() method takes care of the binding for you. Displaying an Array in a Template If you want to display an array of products using a template then you simply need to create a for..next loop and iterate through the array calling the Template render() method for each element. (function () { "use strict"; var app = WinJS.Application; app.onactivated = function (eventObject) { if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { var products = [ { name: "Tesla", price: 80000 }, { name: "VW Rabbit", price: 200 }, { name: "BMW", price: 60000 } ]; var productTemplate = new WinJS.Binding.Template(document.getElementById("productTemplate")); var productContainer = document.getElementById("productContainer"); var i, product; for (i = 0; i < products.length; i++) { product = products[i]; productTemplate.render(product, productContainer); } } }; app.start(); })(); After each product in the array is rendered with the template, the result is appended to the productContainer element. No changes need to be made to the HTML page discussed in the previous section to display an array of products instead of a single product. The same product template can be used in both scenarios. Rendering an HTML TABLE with a Template When using the WinJS library, you create a template by creating an HTML element in your page. One drawback to this approach of creating templates is that your templates are part of your HTML page. In order for your HTML page to validate, the HTML within your templates must also validate. This means, for example, that you cannot enclose a single HTML table row within a template. The following HTML is invalid because you cannot place a TR element directly within the body of an HTML document:   <!-- Product Template --> <tr> <td data-win-bind="innerText:name"></td> <td data-win-bind="innerText:price"></td> </tr> This template won’t validate because, in a valid HTML5 document, a TR element must appear within a THEAD or TBODY element. Instead, you must create the entire TABLE element in the template. The following HTML page illustrates how you can create a template which contains a TR element: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Application1</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.0.6/css/ui-dark.css" rel="stylesheet"> <script src="//Microsoft.WinJS.0.6/js/base.js"></script> <script src="//Microsoft.WinJS.0.6/js/ui.js"></script> <!-- Application1 references --> <link href="/css/default.css" rel="stylesheet"> <script src="/js/default.js"></script> </head> <body> <!-- Product Template --> <div id="productTemplate"> <table> <tbody> <tr> <td data-win-bind="innerText:name"></td> <td data-win-bind="innerText:price"></td> </tr> </tbody> </table> </div> <!-- Place where Product Template is Rendered --> <table> <thead> <tr> <th>Name</th><th>Price</th> </tr> </thead> <tbody id="productContainer"> </tbody> </table> </body> </html>   In the HTML page above, the product template includes TABLE and TBODY elements: <!-- Product Template --> <div id="productTemplate"> <table> <tbody> <tr> <td data-win-bind="innerText:name"></td> <td data-win-bind="innerText:price"></td> </tr> </tbody> </table> </div> We discard these elements when we render the template. The only reason that we include the TABLE and THEAD elements in the template is to make the HTML page validate as valid HTML5 markup. Notice that the productContainer (the target of the template) in the page above is a TBODY element. We want to add the rows rendered by the template to the TBODY element in the page. The productTemplate is rendered in the default.js file: (function () { "use strict"; var app = WinJS.Application; app.onactivated = function (eventObject) { if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { var products = [ { name: "Tesla", price: 80000 }, { name: "VW Rabbit", price: 200 }, { name: "BMW", price: 60000 } ]; var productTemplate = new WinJS.Binding.Template(document.getElementById("productTemplate")); var productContainer = document.getElementById("productContainer"); var i, product, row; for (i = 0; i < products.length; i++) { product = products[i]; productTemplate.render(product).then(function (result) { row = WinJS.Utilities.query("tr", result).get(0); productContainer.appendChild(row); }); } } }; app.start(); })(); When the product template is rendered, the TR element is extracted from the rendered template by using the WinJS.Utilities.query() method. Next, only the TR element is added to the productContainer: productTemplate.render(product).then(function (result) { row = WinJS.Utilities.query("tr", result).get(0); productContainer.appendChild(row); }); I discuss the WinJS.Utilities.query() method in depth in a previous blog entry: http://stephenwalther.com/blog/archive/2012/02/23/windows-web-applications-query-selectors.aspx When everything gets rendered, the products are displayed in an HTML table: You can see the actual HTML rendered by looking at the Visual Studio DOM Explorer window:   Loading an External Template Instead of embedding a template in an HTML page, you can place your template in an external HTML file. It makes sense to create a template in an external file when you need to use the same template in multiple pages. For example, you might need to use the same product template in multiple pages in your application. The following HTML page does not contain a template. It only contains a container that will act as a target for the rendered template: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Application1</title> <!-- WinJS references --> <link href="//Microsoft.WinJS.0.6/css/ui-dark.css" rel="stylesheet"> <script src="//Microsoft.WinJS.0.6/js/base.js"></script> <script src="//Microsoft.WinJS.0.6/js/ui.js"></script> <!-- Application1 references --> <link href="/css/default.css" rel="stylesheet"> <script src="/js/default.js"></script> </head> <body> <!-- Place where Product Template is Rendered --> <div id="productContainer"></div> </body> </html> The template is contained in a separate file located at the path /templates/productTemplate.html:   Here’s the contents of the productTemplate.html file: <!-- Product Template --> <div id="productTemplate"> <h1>Product Details</h1> <div> Product Name: <span data-win-bind="innerText:name"></span> </div> <div> Product Price: <span data-win-bind="innerText:price"></span> </div> </div> Notice that the template file only contains the template and not the standard opening and closing HTML elements. It is an HTML fragment. If you prefer, you can include all of the standard opening and closing HTML elements in your external template – these elements get stripped away automatically: <html> <head><title>product template</title></head> <body> <!-- Product Template --> <div id="productTemplate"> <h1>Product Details</h1> <div> Product Name: <span data-win-bind="innerText:name"></span> </div> <div> Product Price: <span data-win-bind="innerText:price"></span> </div> </div> </body> </html> Either approach – using a fragment or using a full HTML document  — works fine. Finally, the following default.js file loads the external template, renders the template for each product, and appends the result to the product container: (function () { "use strict"; var app = WinJS.Application; app.onactivated = function (eventObject) { if (eventObject.detail.kind === Windows.ApplicationModel.Activation.ActivationKind.launch) { var products = [ { name: "Tesla", price: 80000 }, { name: "VW Rabbit", price: 200 }, { name: "BMW", price: 60000 } ]; var productTemplate = new WinJS.Binding.Template(null, { href: "/templates/productTemplate.html" }); var productContainer = document.getElementById("productContainer"); var i, product, row; for (i = 0; i < products.length; i++) { product = products[i]; productTemplate.render(product, productContainer); } } }; app.start(); })(); The path to the external template is passed to the constructor for the Template class as one of the options: var productTemplate = new WinJS.Binding.Template(null, {href:"/templates/productTemplate.html"}); When a template is contained in a page then you use the first parameter of the WinJS.Binding.Template constructor to represent the template – instead of null, you pass the element which contains the template. When a template is located in an external file, you pass the href for the file as part of the second parameter for the WinJS.Binding.Template constructor. Summary The goal of this blog entry was to describe how you can use WinJS templates to render either a single item or an array of items to a page. We also explored two advanced topics. You learned how to render an HTML table by extracting the TR element from a template. You also learned how to place a template in an external file.

    Read the article

  • Apache Server-Side Includes Refuse to Work (Tried everything in the docs but still no joy)

    - by raindog308
    Trying to get apache server-side includes to work. Really simple - just want to include a footer on each page. Apache 2.2: # ./httpd -v Server version: Apache/2.2.21 (Unix) Server built: Dec 4 2011 18:24:53 Cpanel::Easy::Apache v3.7.2 rev9999 mod_include is compiled in: # /usr/local/apache/bin/httpd -l | grep mod_include mod_include.c And it's in httpd.conf: # grep shtml httpd.conf AddType text/html .shtml DirectoryIndex index.html.var index.htm index.html index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml default.htm default.html home.htm index.php5 Default.html Default.htm home.html AddHandler server-parsed .shtml AddType text/html .shtml In the web directory I created a .htaccess with Options +Includes And then in the document, I have: <h1>next should be the include</h1> <!--#include virtual="/footer.html" --> <h1>include done</h1> And I see nothing in between those headers. Tried file=, also with/without absolute path. Is there something else I'm missing? I see the same thing on another unrelated server (more or less stock CentOS 6), so I suspect the problem is between keyboard and chair...

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >