Search Results

Search found 7 results on 1 pages for 'hp1'.

Page 1/1 | 1 

  • How can I further optimize this color difference function?

    - by aLfa
    I have made this function to calculate color differences in the CIE Lab colorspace, but it lacks speed. Since I'm not a Java expert, I wonder if any Java guru around has some tips that can improve the speed here. The code is based on the matlab function mentioned in the comment block. /** * Compute the CIEDE2000 color-difference between the sample color with * CIELab coordinates 'sample' and a standard color with CIELab coordinates * 'std' * * Based on the article: * "The CIEDE2000 Color-Difference Formula: Implementation Notes, * Supplementary Test Data, and Mathematical Observations,", G. Sharma, * W. Wu, E. N. Dalal, submitted to Color Research and Application, * January 2004. * available at http://www.ece.rochester.edu/~gsharma/ciede2000/ */ public static double deltaE2000(double[] lab1, double[] lab2) { double L1 = lab1[0]; double a1 = lab1[1]; double b1 = lab1[2]; double L2 = lab2[0]; double a2 = lab2[1]; double b2 = lab2[2]; // Cab = sqrt(a^2 + b^2) double Cab1 = Math.sqrt(a1 * a1 + b1 * b1); double Cab2 = Math.sqrt(a2 * a2 + b2 * b2); // CabAvg = (Cab1 + Cab2) / 2 double CabAvg = (Cab1 + Cab2) / 2; // G = 1 + (1 - sqrt((CabAvg^7) / (CabAvg^7 + 25^7))) / 2 double CabAvg7 = Math.pow(CabAvg, 7); double G = 1 + (1 - Math.sqrt(CabAvg7 / (CabAvg7 + 6103515625.0))) / 2; // ap = G * a double ap1 = G * a1; double ap2 = G * a2; // Cp = sqrt(ap^2 + b^2) double Cp1 = Math.sqrt(ap1 * ap1 + b1 * b1); double Cp2 = Math.sqrt(ap2 * ap2 + b2 * b2); // CpProd = (Cp1 * Cp2) double CpProd = Cp1 * Cp2; // hp1 = atan2(b1, ap1) double hp1 = Math.atan2(b1, ap1); // ensure hue is between 0 and 2pi if (hp1 < 0) { // hp1 = hp1 + 2pi hp1 += 6.283185307179586476925286766559; } // hp2 = atan2(b2, ap2) double hp2 = Math.atan2(b2, ap2); // ensure hue is between 0 and 2pi if (hp2 < 0) { // hp2 = hp2 + 2pi hp2 += 6.283185307179586476925286766559; } // dL = L2 - L1 double dL = L2 - L1; // dC = Cp2 - Cp1 double dC = Cp2 - Cp1; // computation of hue difference double dhp = 0.0; // set hue difference to zero if the product of chromas is zero if (CpProd != 0) { // dhp = hp2 - hp1 dhp = hp2 - hp1; if (dhp > Math.PI) { // dhp = dhp - 2pi dhp -= 6.283185307179586476925286766559; } else if (dhp < -Math.PI) { // dhp = dhp + 2pi dhp += 6.283185307179586476925286766559; } } // dH = 2 * sqrt(CpProd) * sin(dhp / 2) double dH = 2 * Math.sqrt(CpProd) * Math.sin(dhp / 2); // weighting functions // Lp = (L1 + L2) / 2 - 50 double Lp = (L1 + L2) / 2 - 50; // Cp = (Cp1 + Cp2) / 2 double Cp = (Cp1 + Cp2) / 2; // average hue computation // hp = (hp1 + hp2) / 2 double hp = (hp1 + hp2) / 2; // identify positions for which abs hue diff exceeds 180 degrees if (Math.abs(hp1 - hp2) > Math.PI) { // hp = hp - pi hp -= Math.PI; } // ensure hue is between 0 and 2pi if (hp < 0) { // hp = hp + 2pi hp += 6.283185307179586476925286766559; } // LpSqr = Lp^2 double LpSqr = Lp * Lp; // Sl = 1 + 0.015 * LpSqr / sqrt(20 + LpSqr) double Sl = 1 + 0.015 * LpSqr / Math.sqrt(20 + LpSqr); // Sc = 1 + 0.045 * Cp double Sc = 1 + 0.045 * Cp; // T = 1 - 0.17 * cos(hp - pi / 6) + // + 0.24 * cos(2 * hp) + // + 0.32 * cos(3 * hp + pi / 30) - // - 0.20 * cos(4 * hp - 63 * pi / 180) double hphp = hp + hp; double T = 1 - 0.17 * Math.cos(hp - 0.52359877559829887307710723054658) + 0.24 * Math.cos(hphp) + 0.32 * Math.cos(hphp + hp + 0.10471975511965977461542144610932) - 0.20 * Math.cos(hphp + hphp - 1.0995574287564276334619251841478); // Sh = 1 + 0.015 * Cp * T double Sh = 1 + 0.015 * Cp * T; // deltaThetaRad = (pi / 3) * e^-(36 / (5 * pi) * hp - 11)^2 double powerBase = hp - 4.799655442984406; double deltaThetaRad = 1.0471975511965977461542144610932 * Math.exp(-5.25249016001879 * powerBase * powerBase); // Rc = 2 * sqrt((Cp^7) / (Cp^7 + 25^7)) double Cp7 = Math.pow(Cp, 7); double Rc = 2 * Math.sqrt(Cp7 / (Cp7 + 6103515625.0)); // RT = -sin(delthetarad) * Rc double RT = -Math.sin(deltaThetaRad) * Rc; // de00 = sqrt((dL / Sl)^2 + (dC / Sc)^2 + (dH / Sh)^2 + RT * (dC / Sc) * (dH / Sh)) double dLSl = dL / Sl; double dCSc = dC / Sc; double dHSh = dH / Sh; return Math.sqrt(dLSl * dLSl + dCSc * dCSc + dHSh * dHSh + RT * dCSc * dHSh); }

    Read the article

  • GlassFish build failed

    - by hp1
    Hello, Each time I try to deploy my server side code, the build fails. If I try to restart my machine, the build is successful but fails later when I try to build the subsequent times. I get the following Severe messages when I attempt to build: SEVERE: "IOP00410216: (COMM_FAILURE) Unable to create IIOP listener on the specified host/port: localhost/3820" org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216 completed: No WARNING: Can not find resource bundle for this logger. class name that failed: org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory WARNING: Exception getting SocketInfo java.lang.RuntimeException: Orb initialization eror WARNING: "IOP02310202: (OBJ_ADAPTER) Error in connecting servant to ORB" org.omg.CORBA.OBJ_ADAPTER: vmcid: SUN minor code: 202 completed: No Following are the details for the severe method: SEVERE: "IOP00410216: (COMM_FAILURE) Unable to create IIOP listener on the specified host/port: localhost/3820" org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 216 completed: No at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:3835) at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFailed(ORBUtilSystemException.java:3855) at com.sun.corba.ee.impl.transport.SocketOrChannelAcceptorImpl.initialize(SocketOrChannelAcceptorImpl.java:98) at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.getAcceptors(CorbaTransportManagerImpl.java:247) at com.sun.corba.ee.impl.transport.CorbaTransportManagerImpl.addToIORTemplate(CorbaTransportManagerImpl.java:264) at com.sun.corba.ee.spi.oa.ObjectAdapterBase.initializeTemplate(ObjectAdapterBase.java:131) at com.sun.corba.ee.impl.oa.toa.TOAImpl.<init>(TOAImpl.java:130) at com.sun.corba.ee.impl.oa.toa.TOAFactory.getTOA(TOAFactory.java:114) at com.sun.corba.ee.impl.orb.ORBImpl.connect(ORBImpl.java:1740) at com.sun.corba.ee.spi.presentation.rmi.StubAdapter.connect(StubAdapter.java:212) at com.sun.corba.ee.impl.orb.ORBImpl.getIOR(ORBImpl.java:2194) at com.sun.corba.ee.impl.orb.ORBImpl.getFVDCodeBaseIOR(ORBImpl.java:966) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.glassfish.gmbal.generic.FacetAccessorImpl.invoke(FacetAccessorImpl.java:126) at org.glassfish.gmbal.impl.MBeanImpl.invoke(MBeanImpl.java:440) at org.glassfish.gmbal.impl.AttributeDescriptor.get(AttributeDescriptor.java:144) at org.glassfish.gmbal.impl.MBeanSkeleton.getAttribute(MBeanSkeleton.java:569) at org.glassfish.gmbal.impl.MBeanSkeleton.getAttributes(MBeanSkeleton.java:625) at org.glassfish.gmbal.impl.MBeanImpl.getAttributes(MBeanImpl.java:389) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttributes(DefaultMBeanServerInterceptor.java:726) at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttributes(JmxMBeanServer.java:665) at org.glassfish.admin.amx.util.jmx.MBeanProxyHandler.getAttributes(MBeanProxyHandler.java:273) at org.glassfish.admin.amx.core.proxy.AMXProxyHandler.attributesMap(AMXProxyHandler.java:1193) at org.glassfish.admin.amx.core.proxy.AMXProxyHandler.attributesMap(AMXProxyHandler.java:1203) at org.glassfish.admin.amx.core.proxy.AMXProxyHandler.handleSpecialMethod(AMXProxyHandler.java:414) at org.glassfish.admin.amx.core.proxy.AMXProxyHandler._invoke(AMXProxyHandler.java:792) at org.glassfish.admin.amx.core.proxy.AMXProxyHandler.invoke(AMXProxyHandler.java:526) at $Proxy107.attributesMap(Unknown Source) at org.glassfish.admin.amx.core.AMXValidator._validate(AMXValidator.java:642) at org.glassfish.admin.amx.core.AMXValidator.validate(AMXValidator.java:1298) at org.glassfish.admin.amx.impl.mbean.ComplianceMonitor$ValidatorThread.doRun(ComplianceMonitor.java:256) at org.glassfish.admin.amx.impl.mbean.ComplianceMonitor$ValidatorThread.run(ComplianceMonitor.java:227) Caused by: java.net.BindException: Address already in use at sun.nio.ch.Net.bind(Native Method) at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:119) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59) at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:52) at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createServerSocket(IIOPSSLSocketFactory.java:293) at com.sun.corba.ee.impl.transport.SocketOrChannelAcceptorImpl.initialize(SocketOrChannelAcceptorImpl.java:91) ... 32 more

    Read the article

  • WebService: Firefox can't establish a connection to the server at 192.168.10.203:8080

    - by hp1
    Hi, I am trying to create a WebService. I am not able to access the URL. If I try to connect to http://192.168.10.203:8080/EchoBeanService/EchoBean?wsdl I get an error: Firefox can't establish a connection to the server at 192.168.10.203:8080 However, if I am able to connect to the using localhost in the URL: http://localhost:8080/EchoBeanService/EchoBean?wsdl Echo.java package services; public interface Echo { public String printEcho(); public String printEchoParam(String str); } EchoBean.java package model; import javax.jws.WebService; import javax.ejb.Stateless; import javax.jws.WebMethod; import services.Echo; @Stateless @WebService public class EchoBean implements Echo { public EchoBean(){} @WebMethod public String printEcho(){ return "WebServices Echo "; } @WebMethod public String printEchoParam(String str){ return ("In PrintEcho( String " + str +" )" ); } } -H

    Read the article

  • Array not returned correct

    - by hp1
    Hello, I am trying to return a simple array, but I am not getting the correct result. I am getting the following arr1[0] = 1 arr1[1] = 32767 result while the result should have been arr1[0] = 1 arr1[1] = 15 Please suggest. int *sum(int a, int b){ int arr[2]; int *a1; int result = a+b; arr[0]= 1; arr[1]= result; a1 = arr; return a1; } int main(){ int *arr1 = sum(5,10); cout<<"arr1[0] = "<<arr1[0]<<endl; cout<<"arr1[1] = "<<arr1[1]<<endl; return 0; }

    Read the article

  • Array not returned correctly

    - by hp1
    I am trying to return a simple array, but I am not getting the correct result. I am getting the following arr1[0] = 1 arr1[1] = 32767 result while the result should have been arr1[0] = 1 arr1[1] = 15 Please suggest. int *sum(int a, int b){ int arr[2]; int *a1; int result = a+b; arr[0]= 1; arr[1]= result; a1 = arr; return a1; } int main(){ int *arr1 = sum(5,10); cout<<"arr1[0] = "<<arr1[0]<<endl; cout<<"arr1[1] = "<<arr1[1]<<endl; return 0; }

    Read the article

  • How to get my list of rows from database to show while using Zend-Paginator

    - by Matto
    I'm fairly new to the world of Zend-Framework, and have taken over a site that is in zend-framework. There is a bug on one of the pages right now and I can not figure it out. I think it has something to do with Zend Paginator, but not sure. This is the code in the controller for the section I am having a problem with: $currentPage = $this->_getParam('page'); $numWebsitesFullOnline = $websites->getWebsitesFullOnline(); $select = $websites->select(); $select->setIntegrityCheck(false); $select->from(array('w' => 'websites'), array('id', 'online', 'kw_adjective', 'kw_name', 'kw_location', 'url', 'email', 'address', 'ftp_server', 'ftp_username', 'ftp_password', 'ftp_folder', 'phone_number', 'indexed', 'youtube_position', 'twitter_user', 'facebook_id', 'video_made', 'image1_id', 'image2_id', 'image3_id', 'bg_color', 'dark_color', 'light_color', 'links_color', 'text_color', 'google_account', 'ganalytics', 'gmaps_status', 'google_position', 'gmap_position', 'hp1', 'hp2', 'hp3', 'hp4', 'hp5', 'hp6', 'hp7', 'hp8', 'hp9', 'hp10', 'about1_id', 'about2_id', 'about3_id', 'tip1_id', 'tip2_id', 'tip3_id', 'contact_texts_id', 'quote_texts_id', 'demographics_id')) ->join(array('d' => 'demographics'), 'w.demographics_id = d.id', array('total_population')) ->order(array('total_population DESC', 'kw_location')); $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($select)); $paginator->setItemCountPerPage(50); $paginator->setCurrentPageNumber($currentPage); $paginator->setPageRange(($paginator->getTotalItemCount() / 50) + 1); $this->view->paginator = $paginator; $numWebsitesOnline = $websites->getWebsitesOnline(); On the php page I have this code to call the websites that are in the database to a list: <p class="red"> Websites online: <?php echo $this->numOnline; ?> </p> <?php print_r(count($this->paginator)); ?> <?php if(count($this->paginator)): ?> <table class="table-list"> <?php foreach($this->paginator as $item): ?> <tr> <?php if($this->userIsAllowedAction('websites', 'reload')): ?> <td class="center noborder w30"> <img class="hidden" src="<?php echo $this->baseUrl() . '/images/loader.gif' ?>" alt="Loading..."/><a class="reload" title="refresh" href="<?php echo $this->baseUrl(); ?>/utils/ui/refresh-website.php" rel="<?php echo urlencode('http://' . $item['url'] . '/install.php'); ?>,<?php echo urlencode($item['ftp_server']); ?>,<?php echo $item['ftp_username']; ?>,<?php echo $item['ftp_password']; ?>,<?php echo $item['ftp_folder']; ?>,<?php echo $this->baseUrl(); ?>,<?php echo $item['id']; ?>"><img src="<?php echo $this->baseUrl(); ?>/images/icon-refresh.png" alt="Refresh"/></a> </td> <?php endif; ?> <td class="center noborder w30"> <?php if($this->userIsAllowedAction('websites', 'edit')): ?><a title="Edit" href="<?php echo $this->url(array('controller' => 'websites', 'action' => 'edit', 'id' => $item['id'])); ?>"><img src="<?php echo $this->baseUrl(); ?>/images/icon-edit.png" alt="Edit"/></a><?php endif; ?> </td> <td class="center noborder w30"> <?php if($this->userIsAllowedAction('websites', 'remove')): ?><a title="Remove" href="<?php echo $this->url(array('controller' => 'websites', 'action' => 'remove', 'id' => $item['id'])); ?>"><img src="<?php echo $this->baseUrl(); ?>/images/icon-delete.png" alt="Remove"/></a><?php endif; ?> </td> <td> <?php if($item['online']): ?> <span class="hidden"><?php echo trim($this->escape($item['kw_adjective'] . $item['kw_name'])); ?></span><a class="goto-website" href="http://<?php echo $item['url']; ?>" target="_blank"><?php echo $this->escape($item['kw_location']); ?></a> <?php else: ?> <?php echo $this->escape($item['kw_location']); ?> <?php endif; ?> </td> <td class="center population"> <?php if($item['total_population'] >= 0) echo $item['total_population']; ?> </td> <td class="center"> <?php if(!empty($item['url'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if(!empty($item['email'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if($item['demographics_id']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if($item['hp1'] && $item['hp2'] && $item['hp3'] && $item['hp4'] && $item['hp5'] && $item['hp6'] && $item['hp7'] && $item['hp8'] && $item['hp9'] && $item['hp10'] && $item['about1_id'] && $item['about2_id'] && $item['about3_id'] && $item['tip1_id'] && $item['tip2_id'] && $item['tip3_id'] && $item['contact_texts_id'] && $item['quote_texts_id']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if(file_exists($_SERVER['DOCUMENT_ROOT'] . $this->baseUrl() . Zend_Registry::get('assets_base_path') . '/' . $item['id'] . '/header.jpg')): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if(($item['bg_color'] != '' && $item['bg_color'] != 'e6e6e6') || ($item['dark_color'] != '' && $item['dark_color'] != '003e75') || ($item['light_color'] != '' && $item['light_color'] != '3073ad') || ($item['links_color'] != '' && $item['links_color'] != '255593') || ($item['text_color'] != '' && $item['text_color'] != '4f4f4f')): ?> <img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/> <?php endif; ?> </td> <td class="center"> <?php if($item['image1_id'] && $item['image2_id'] && $item['image3_id']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if(!empty($item['twitter_user'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if(!empty($item['facebook_id'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if(!empty($item['phone_number'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if($item['google_account']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if($item['video_made']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if($item['youtube_position']) { echo $item['youtube_position']; }; ?> </td> <td class="center"> <?php if(!empty($item['address'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if($item['gmaps_status'] == 1): ?><img src="<?php echo $this->baseUrl(); ?>/images/icon-gmapspending.png" alt="Pending"/><?php elseif($item['gmaps_status'] == 2): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if(!empty($item['ganalytics'])): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark.png" alt="DONE"/><?php endif; ?> </td> <td class="center"> <?php if($item['online']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark_red.png" alt="Online!"/><?php endif; ?> </td> <td class="center"> <?php if($item['indexed']): ?><img src="<?php echo $this->baseUrl(); ?>/images/check_mark_red.png" alt="Online!"/><?php endif; ?> </td> <td class="center"> <?php if($item['gmap_position']) { echo $item['gmap_position']; }; ?> </td> <td class="center"> <?php if($item['google_position']) { echo $item['google_position']; }; ?> </td> </tr> <?php endforeach; ?> </table> <?php endif; ?> The print_r(count($this-paginator)); line is returning "0", and the $this-numOnline; line is returning 1. So it sees that there is one row in the websites table of the database, but it is not returning anything to page and listing out the rows in the websites table. Not sure if this is the paginator that is causing this cause it is returning 0 or something else I don't know about.

    Read the article

  • HTML5 Form: Page Is Reloading Instantly After Restyling (And It Shouldn't Be)

    - by user3689753
    I have a form. I have made it so that if your name is not put in, a red border is put on the name field. That works, BUT...it's for a split second, and then the page reloads. I want the red border to appear, and then stay there. For some reason it's for a split second. Can someone help me make it so the page doesn't reload after displaying the red border? Here's the script. window.onload = function() { document.getElementById("Hogwarts").onsubmit = function () { window.alert("Form submitted. Owl being sent..."); var fname = document.getElementById("fName"); if(!fName.value.match("^[A-Z][A-Za-z]+( [A-Z][A-Za-z]*)*$")) { window.alert("You must enter your name."); addClass(fName, "errorDisp"); document.getElementById("fName").focus(); } else return true; } } function addClass(element, classToAdd) { var currentClassValue = element.className; if (currentClassValue.indexOf(classToAdd) == -1) { if ((currentClassValue == null) || (currentClassValue === "")) { element.className = classToAdd; } else { element.className += " " + classToAdd; } } } function removeClass(element, classToRemove) { var currentClassValue = element.className; if (currentClassValue == classToRemove) { element.className = ""; return; } var classValues = currentClassValue.split(" "); var filteredList = []; for (var i = 0 ; i < classValues.length; i++) { if (classToRemove != classValues[i]) { filteredList.push(classValues[i]); } } element.className = filteredList.join(" "); } Here's the HTML. <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <title>Hogwarts School of Witchcraft And Wizardry Application Form</title> <link rel="stylesheet" type="text/css" href="main.css" media="screen"/> <script src="script.js" type="text/javascript"></script> </head> <body> <section> <header> <h1>Hogwarts School of Witchcraft And Wizardry</h1> <nav></nav> </header> <main> <form method="post" id="Hogwarts"> <!--<form action="showform.php" method="post" id="Hogwarts">--!> <fieldset id="aboutMe"> <legend id="aboutMeLeg">About Me</legend> <div class="fieldleading"> <label for="fName" class="labelstyle">First name:</label> <input type="text" id="fName" name="fName" autofocus maxlength="50" value="" placeholder="First Name" size="30"> <label for="lName" class="labelstyle">Last name:</label> <input type="text" id="lName" name="lName" required maxlength="50" value="" placeholder="Last Name" pattern="^[A-Za-z ]{3,}$" size="30"> <label for="age" class="labelstyle">Age:</label> <input type="number" id="age" name="age" required min="17" step="1" max="59" value="" placeholder="Age"> </div> <div class="fieldleading"> <label for="date" class="labelstyle">Date Of Birth:</label> <input type="date" name="date1" id="date" required autofocus value=""> </div> <div id="whitegender"> <div class="fieldleading"> <label class="labelstyle">Gender:</label> </div> <input type="radio" name="sex" value="male" class="gender" required="required">Male<br/> <input type="radio" name="sex" value="female" class="gender" required="required">Female<br/> <input type="radio" name="sex" value="other" class="gender" required="required">Other </div> </fieldset> <fieldset id="contactInfo"> <legend id="contactInfoLeg">Contact Information</legend> <div class="fieldleading"> <label for="street" class="labelstyle">Street Address:</label> <input type="text" id="street" name="street" required autofocus maxlength="50" value="" placeholder="Street Address" pattern="^[0-9A-Za-z\. ]+{5,}$" size="35"> <label for="city" class="labelstyle">City:</label> <input type="text" id="city" name="city" required autofocus maxlength="30" value="" placeholder="City" pattern="^[A-Za-z ]{3,}$" size="35"> <label for="State" class="labelstyle">State:</label> <select required id="State" name="State" > <option value="Select Your State">Select Your State</option> <option value="Delaware">Delaware</option> <option value="Pennsylvania">Pennsylvania</option> <option value="New Jersey">New Jersey</option> <option value="Georgia">Georgia</option> <option value="Connecticut">Connecticut</option> <option value="Massachusetts">Massachusetts</option> <option value="Maryland">Maryland</option> <option value="New Hampshire">New Hampshire</option> <option value="New York">New York</option> <option value="Virginia">Virginia</option> </select> </div> <div class="fieldleading"> <label for="zip" class="labelstyle">5-Digit Zip Code:</label> <input id="zip" name="zip" required autofocus maxlength="5" value="" placeholder="Your Zip Code" pattern="^\d{5}$"> <label for="usrtel" class="labelstyle">10-Digit Telephone Number:</label> <input type="tel" name="usrtel" id="usrtel" required autofocus value="" placeholder="123-456-7890" pattern="^\d{3}[\-]\d{3}[\-]\d{4}$"> </div> <div class="fieldleading"> <label for="email1" class="labelstyle">Email:</label> <input type="email" name="email1" id="email1" required autofocus value="" placeholder="[email protected]" pattern="^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" size="35"> <label for="homepage1" class="labelstyle">Home Page:</label> <input type="url" name="homepage1" id="homepage1" required autofocus value="" placeholder="http://www.hp.com" pattern="https?://.+" size="35"> </div> </fieldset> <fieldset id="yourInterests"> <legend id="yourInterestsLeg">Your Interests</legend> <label for="Major" class="labelstyle">Major/Program Choice:</label> <select required id="Major" name="Major" > <option value="">Select Your Major</option> <option value="Magic1">Magic Horticulture</option> <option value="Magic2">Black Magic</option> <option value="White">White Magic</option> <option value="Blue">Blue Magic</option> <option value="Non">Non-Wizardry Studies</option> </select> </fieldset> <button type="submit" value="Submit" class="submitreset">Submit</button> <button type="reset" value="Reset" class="submitreset">Reset</button> </form> </main> <footer> &copy; 2014 Bennett Nestok </footer> </section> </body> </html> Here's the CSS. a:link { text-decoration: none !important; color:black !important; } a:visited { text-decoration: none !important; color:red !important; } a:active { text-decoration: none !important; color:green !important; } a:hover { text-decoration: none !important; color:blue !important; background-color:white !important; } ::-webkit-input-placeholder { color: #ffffff; } /* gray80 */ :-moz-placeholder { color: #ffffff; } /* Firefox 18- (one color)*/ ::-moz-placeholder { color: #ffffff; } /* Firefox 19+ (double colons) */ :-ms-input-placeholder { color: #ffffff; } body { margin: 0px auto; text-align:center; background-color:grey; font-weight:normal; font-size:12px; font-family: verdana; color:black; background-image:url('bgtexture.jpg'); background-repeat:repeat; } footer { text-align:center; margin: 0px auto; bottom:0px; position:absolute; width:100%; color:white; background-color:black; height:20px; padding-top:4px; } h1 { color:white; text-align:center; margin: 0px auto; margin-bottom:50px; width:100%; background-color:black; padding-top: 13px; padding-bottom: 14px; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5); text-shadow: 0 -1px 1px rgba(0,0,0,0.25); } button.submitreset { -moz-border-radius: 400px; -webkit-border-radius: 400px; border-radius: 400px; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5); text-shadow: 0 -1px 1px rgba(0,0,0,0.25); } .labelstyle { background-color:#a7a7a7; color:black; -moz-border-radius: 400px; -webkit-border-radius: 400px; border-radius: 400px; padding:3px 3px 3px 3px; } #aboutMe, #contactInfo, #yourInterests { margin-bottom:30px; text-align:left !important; padding: 10px 10px 10px 10px; } #Hogwarts { text-align:center; margin:0px auto; width:780px; padding-top: 20px !important; padding-bottom: 20px !important; background: -webkit-linear-gradient(#474747, grey); /* For Safari 5.1 to 6.0 */ background: -o-linear-gradient(#474747, grey); /* For Opera 11.1 to 12.0 */ background: -moz-linear-gradient(#474747, grey); /* For Firefox 3.6 to 15 */ background: linear-gradient(#474747, grey); /* Standard syntax */ border-color:black; border-style: solid; border-width: 2px; -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5); -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5); text-shadow: 0 -1px 1px rgba(0,0,0,0.25); } @media (max-width: 800px){ .labelstyle { display: none; } #Hogwarts { width:300px; } h1 { width:304px; margin-bottom:0px; } .fieldleading { margin-bottom:0px !important; } ::-webkit-input-label { /* WebKit browsers */ color: transparent; } :-moz-label { /* Mozilla Firefox 4 to 18 */ color: transparent; } ::-moz-label { /* Mozilla Firefox 19+ */ color: transparent; } :-ms-input-label { /* Internet Explorer 10+ */ color: transparent; } ::-webkit-input-placeholder { /* WebKit browsers */ color: grey !important; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: grey !important; } ::-moz-placeholder { /* Mozilla Firefox 19+ */ color: grey !important; } :-ms-input-placeholder { /* Internet Explorer 10+ */ color: grey !important; } #aboutMe, #contactInfo, #yourInterests { margin-bottom:10px; text-align:left !important; padding: 5px 5px 5px 5px; } } br { display: block; line-height: 10px; } .fieldleading { margin-bottom:10px; } legend { color:white; } #whitegender { color:white; } #moreleading { margin-bottom:10px; } /*opera only hack attempt*/ @media not all and (-webkit-min-device-pixel-ratio:0) { .fieldleading { margin-bottom:30px !important; } } .errorDisp { border-color: red; border-style: solid; border-width: 2px; }

    Read the article

1