Jump to content

smiles

Members
  • Content Count

    774
  • Joined

  • Last visited

Everything posted by smiles

  1. smiles

    video live streaming

    http://www.adobe.com/devnet/adobe-media-server/articles/beginner_live_fms3.html
  2. smiles

    Google map "Search box" for address

    Sorry, I forgot '.value' -> document.getElementById('search_address').value <!DOCTYPE html><html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map_canvas { height: 100% } </style> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map; var geocoder = new google.maps.Geocoder(); function initialize() { var latlng = new google.maps.LatLng(37.77, -122.4); // set up the default options var myOptions = { zoom: 8, center: latlng, navigationControl: true, navigationControlOptions: {style: google.maps.NavigationControlStyle.DEFAULT, position: google.maps.ControlPosition.TOP_LEFT }, mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT, position: google.maps.ControlPosition.TOP_RIGHT }, scaleControl: true, scaleControlOptions: { position: google.maps.ControlPosition.BOTTOM_LEFT }, mapTypeId: google.maps.MapTypeId.ROADMAP, draggable: true, disableDoubleClickZoom: false, keyboardShortcuts: true }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); if (true) { var trafficLayer = new google.maps.TrafficLayer(); trafficLayer.setMap(map); } if (true) { var bikeLayer = new google.maps.BicyclingLayer(); bikeLayer.setMap(map); } if (true) { addMarker(map,37.7715,-122.4,"We are here"); } } function search() { var searchText = document.getElementById('search_address').value; if (searchText != '') { geocoder.geocode({ address: searchText }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { var viewport = results[0].geometry.viewport; var location = results[0].geometry.location; if (viewport) { map.fitBounds(viewport); } else { map.setCenter(location); } } }); }} function addMarker(map,lat,long,titleText) { var markerLatlng = new google.maps.LatLng(lat,long); var marker = new google.maps.Marker({ position: markerLatlng, map: map, title:"We are here", icon: "" });} </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width:100%; height:100%"></div><input type="text" id="search_address" value="" size="98"/><button onclick="search();">Search</button> </body></html>
  3. smiles

    Google map "Search box" for address

    lets map be a public variableyour search function maybe like this function search() {var searchText = document.getElementById('search_address');if (searchText != '') { geocoder.geocode({ address: searchText }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { var viewport = results[0].geometry.viewport; var location = results[0].geometry.location; if (viewport) { map.fitBounds(viewport); } else { map.setCenter(location); } } });}}
  4. smiles

    Adding a Timepicker to jQuery UI Datepicker

    For simple, the files and folders hierarchy will be like below - test.html- jquery-ui-1.8.20.custom.css- jquery-ui-1.8.20.custom.min.js- jquery-1.7.2.min.js- images- - - - ui-icons_cd0a0a_256x240.png- - - - ...- - - - ... and in your test.html <link type="text/css" rel="stylesheet" href="jquery-ui-1.8.20.custom.css" /><script src="jquery-1.7.2.min.js"></script><script type="text/javascript" src="jquery-ui-1.8.20.custom.min.js"></script> That's all! You dont have to worried about which jQuery ui should be imported.
  5. smiles

    Passing parameters into function.

    Try this timeout = setTimeout(function(){ sayGreet("Hello", "There!");}, 5000);
  6. smiles

    JS Dropdown Link

    Here has a lot of choices http://www.htmldrive.net/categorys/show/1/Menu-Navigation
  7. smiles

    AJAX Database Example - double select

    Put id for two selects<select id="users" name="users" ..><select id="age" name="age" ...> Just onchange=showUser()function showUser(){ var age = document.getElementById("age").value; var user = document.getElementById("users").value; ...}
  8. smiles

    weird animations

    Follow Quicksand's homepage http://razorjack.net/quicksand/, I see one difference - Your div that contains <ul id='content' ...> also contains filterOptions, while in Quicksand's homepage, filterOptions place outside that div - That div also has its width nearly two times larger than <ul id='content' ...> (I think object will based on width of object's container to calculate the offset for animation)
  9. smiles

    HTML5 requestFileSystemSync

    http://www.html5rock...ile/filesystem/ Chrome File API stores files as blob, for e.g you create abc.txt then the link to access maybe like this C:\Users\{your account}\AppData\Local\Google\Chrome\User Data\Default\File System\001\t\00\00000002 Here is the code I tested before <script>var fs = null;// Check for the various File API support.if (window.File && window.FileReader && window.FileList && window.Blob) { // Initiate filesystem on page load. initFS();} else { alert('The File APIs are not fully supported in this browser.');}function errorHandler(e) { var msg = ''; switch (e.code) { case FileError.QUOTA_EXCEEDED_ERR: msg = 'QUOTA_EXCEEDED_ERR'; break; case FileError.NOT_FOUND_ERR: msg = 'NOT_FOUND_ERR'; break; case FileError.SECURITY_ERR: msg = 'SECURITY_ERR'; break; case FileError.INVALID_MODIFICATION_ERR: msg = 'INVALID_MODIFICATION_ERR'; break; case FileError.INVALID_STATE_ERR: msg = 'INVALID_STATE_ERR'; break; default: msg = 'Unknown Error'; break; }; console.log('Error: ' + msg);} function initFS() { window.webkitRequestFileSystem(window.TEMPORARY, 1024*1024, function(filesystem) { fs = filesystem; }, errorHandler);} function writeFile(path, content){ fs.root.getFile('log1.txt', {create: true}, function(fileEntry) { fileEntry.createWriter(function(fileWriter) { fileWriter.onwriteend = function(e) { console.log('Write completed.'); }; fileWriter.onerror = function(e) { console.log('Write failed: ' + e.toString()); }; var bb = new window.WebKitBlobBuilder(); bb.append(content); fileWriter.write(bb.getBlob('text/plain')); }, errorHandler); fs.root.getDirectory(path, {create: true}, function(dirEntry) { fileEntry.moveTo(dirEntry); console.log('in'); }, errorHandler); }, errorHandler);} </script><button onclick="writeFile('file-api/', 'blah blah blah')">Test FileAPI</button>
  10. smiles

    call a hidden jsp file from a html page

    Hi! You should get familiar with AJAX, it is so popular http://w3schools.com...ax_examples.aspAfter understand somehow about it, I recommend jQuery.ajax http://www.w3schools...jquery_ajax.asp
  11. smiles

    Help to edit following code

    just surround element.fireEvent(event.eventType, event); by try catch try { element.fireEvent(event.eventType, event);} catch (error) { // error here maybe fireEvent not allow the second argument. element.fireEvent(event.eventType);}
  12. smiles

    Help to edit following code

    Well!!! SCRIPT438: Object doesn't support property or method 'fireEvent' prototype.js, line 5736 character 7 You may check this link http://prasadblog.blogspot.com/2009/11/prototype-eventfire-exception-to-be.html
  13. smiles

    Help to edit following code

    Because the #slider's width always be set with the same size as original width of the big images, so I think u have to design your images with the fix width (see below, 390px) temporarily, in .css div.mc-caption-bg, div.mc-caption-bg2 -> add width: 390px; #slider -> add width: 390px; (also, overflow: hidden)
  14. smiles

    Full height of a page

    Something like this ? <html><head><style type='text/css'> html, body {height: 100%; margin: 0} #content {width: 100%; height: 100%;} #top {position: absolute; top: 0px; bottom: 115px; width: 100%; background-color: pink;} #bottom {position: absolute; bottom: 15px; height: 100px; width: 100%; background-color: green;}</style></head><body><div id='content'> <div id='top'>blah</div> <div id='bottom'>blah</div></div></body></html>
  15. smiles

    Help to edit following code

    Nope!!! I see it again, smooth now, .js in minimized version so can't be edited, your config code for slider is the same as example, your css just to put the elements in the right place, no effect on smoothness. I see no problem now, sorry to confused you
  16. smiles

    Problem with appendChild

    I try your code, see the same thing, I think there is no problem with removeChild or appendChild, please notice 'viewers' variable in viewer.js, after each 500ms, it will contain one more Viewer object, I see Chrome process in Task Manager raise its using memory -> hanging. Try to put viewers = [] in front of viewers.push(this) at line 38, everything will be fine!
  17. smiles

    Help to edit following code

    The only difference between yours and example that affect smoothness is the Description part, it changes while gallery's images slidingTry to find out the animation function and put in another function that run when animation ends $('...').animate({[some css attributes]}, [duration], function(){ //animate stop here, then changes Description here})
  18. smiles

    How to create fullpage & fixed sidebar

    Try this <html><head><style type='text/css'> html, body {height: 100%; margin: 0} #content {width: 100%; height: 100%} #left {width: 100px; height: 100%; float: left; background-color: red} #right {margin-left: 100px; height: 100%; background-color: green}</style></head><body><div id='content'> <div id='left'>Testing</div> <div id='right'>Testing</div></div></body></html>
  19. smiles

    Twitter.

    $(function(){...}) will run after all DOMs loaded, while window.onload does the same but include images, objects ... loaded.So why put window.onload inside $(function(){...}), just comment it out. Try declare barLocations outside $(function(){...}), use var barLocations = []; then in success function: barLocations = []; (reset it)barLocations.push($.parseJSON(output)); I think your alert will be OK!
  20. smiles

    Can someone please check this code?

    Wow, huge code, why don't use array, for loop ... to shorten it Anyway, I had some looks if(c1r1.fill == Color.WHITE){c1r1.fill = Color.MAGENTA}else if(c2r1.fill == Color.WHITE and c1r1wit == false ){c2r1.fill = Color.MAGENTA/* Why not c2r1wit = false here */} if(c1r1.fill == Color.WHITE){c1r1wit = true} /* why not else{c1r1wit = false} here */ if(k1r1.fill == Color.WHITE){k1r1wit = true} /* why not else{k1r1wit = false} here */
  21. smiles

    Wages not calculating correctly

    your program is innocent Is the calculating formula correct ?
  22. smiles

    Navigation problem

    Hi! Nesting selectors may help u, like this example <html><head><style type="text/css">p a {color:red;}span a {color:green;}</style></head><body><p>This is a <a href="....">link</a> within a paragraph element.</p><span>This is a <a href="....">link</a> within a span element.</span></body></html>
  23. Hi, maybe u fixed it already I try code above, following http://www.ryan-h.com/uncategorized/java-speech-jsapi-freetts/ and stops at this error (with the GUI built successfully) "System property "mbrola.base" is undefined. Will not use MBROLA voices." Just one notice, saw deep inside this line: javax.speech.EngineList elist = Central.availableSynthesizers(null); (with Java Decompiler tool for the Central.class), it call loadProps() function with the content below: private static final synchronized void loadProps() { if(loadedProperties) return; loadedProperties = true; String s = File.separator; String as[] = new String[2]; as[0] = System.getProperty("user.home") + s + "speech.properties"; as[1] = System.getProperty("java.home") + s + "lib" + s + "speech.properties"; for(int i = 0; i < as.length; i++) { String s1 = as; Properties properties = new Properties(); File file = new File(s1); try { FileInputStream fileinputstream = new FileInputStream(file); properties.load(new BufferedInputStream(fileinputstream)); fileinputstream.close(); } catch(FileNotFoundException _ex) { } catch(IOException _ex) { } for(Enumeration enumeration = properties.propertyNames(); enumeration.hasMoreElements() { String s2 = (String)enumeration.nextElement(); if(s2.endsWith("EngineCentral")) { String s3 = properties.getProperty(s2); try { registerEngineCentral(s3); } catch(EngineException _ex) { } } } } } So be sure to put the speech.properties in the right directory (try to print out System.getProperty("user.home") to get the location)
  24. smiles

    How do I add buttons inside a background

    Maybe u fixed it already import javax.swing.JFrame;import javax.swing.ImageIcon;import javax.swing.JLabel;import java.awt.Container;import javax.swing.JTextField;import javax.swing.JButton;import java.awt.FlowLayout; class ShowPicture{public static void main(String args[]) {JFrame frame;Container contentPane;JTextField textfield;JButton button;FlowLayout layout;String sorry; frame = new JFrame();frame.setTitle("Coffee Table"); ImageIcon icon = new ImageIcon("background.png");JLabel label = new JLabel(icon); /****************************/frame.setContentPane(label);contentPane = frame.getContentPane();/****************************/ textfield = new JTextField("Type your text here.");sorry = "This button is temporarily out of order.";button = new JButton(sorry); contentPane.add(textfield);contentPane.add(button);layout = new FlowLayout();contentPane.setLayout(layout); /****************************///contentPane.add(label);/****************************/ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setVisible(true);}}
×