Search Results

Search found 1159 results on 47 pages for 'libs'.

Page 41/47 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47  | Next Page >

  • jquery - loading inline javascript via AJAX

    - by yaya3
    I have thrown together a quick prototype to try and establish a few very basic truths regarding what inline JavaScript can do when it is loaded with AJAX: index.html <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> </head> <body> <script type="text/javascript"> $('p').css('color','white'); alert($('p').css('color')); // DISPLAYS FIRST but is "undefined" $(document).ready(function(){ $('#ajax-loaded-content-wrapper').load('loaded-by-ajax.html', function(){ $('p').css('color','grey'); alert($('p').css('color')); // DISPLAYS LAST (as expected) }); $('p').css('color','purple'); alert($('p').css('color')); // DISPLAYS SECOND }); </script> <p>Content not loaded by ajax</p> <div id="ajax-loaded-content-wrapper"> </div> </body> </html> loaded-by-ajax.html <p>Some content loaded by ajax</p> <script type="text/javascript"> $('p').css('color','yellow'); alert($('p').css('color')); // DISPLAYS THIRD $(document).ready(function(){ $('p').css('color','pink'); alert($('p').css('color')); // DISPLAYS FOURTH }); </script> <p>Some content loaded by ajax</p> <script type="text/javascript"> $(document).ready(function(){ $('p').css('color','blue'); alert($('p').css('color')); // DISPLAYS FIFTH }); $('p').css('color','green'); alert($('p').css('color')); // DISPLAYS SIX </script> <p>Some content loaded by ajax</p> Notes: a) All of the above (except the first) successfully change the colour of all the paragraphs (in firefox 3.6.3). b) I've used alert instead of console.log as console is undefined when called in the 'loaded' HTML. Truths(?): $(document).ready() does not treat the 'loaded' HTML as a new document, or reread the entire DOM tree including the loaded HTML, it is pointless inside AJAX loaded content JavaScript that is contained inside 'loaded' HTML can effect the style of existing DOM nodes One can successfully use the jQuery library inside 'loaded' HTML to effect the style of existing DOM nodes One can not use the firebug inside 'loaded' HTML can effect the existing DOM (proven by Note a) Am I correct in deriving these 'truths' from my tests (test validity)? If not, how would you test for these?

    Read the article

  • Problem in running boost eample blocking_udp_echo_client on MacOSX

    - by n179911
    I am trying to run blocking_udp_echo_client on MacOS X http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/example/echo/blocking_udp_echo_client.cpp I run it with argument 'localhost 9000' But the program crashes and this is the line in the source which crashes: `udp::socket s(io_service, udp::endpoint(udp::v4(), 0));' this is the stack trace: #0 0x918c3e42 in __kill #1 0x918c3e34 in kill$UNIX2003 #2 0x9193623a in raise #3 0x91942679 in abort #4 0x940d96f9 in __gnu_debug::_Error_formatter::_M_error #5 0x0000e76e in __gnu_debug::_Safe_iterator::op_base* , __gnu_debug_def::list::op_base*, std::allocator::op_base* ::_Safe_iterator at safe_iterator.h:124 #6 0x00014729 in boost::asio::detail::hash_map::op_base*::bucket_type::bucket_type at hash_map.hpp:277 #7 0x00019e97 in std::_Construct::op_base*::bucket_type, boost::asio::detail::hash_map::op_base*::bucket_type at stl_construct.h:81 #8 0x0001a457 in std::__uninitialized_fill_n_aux::op_base*::bucket_type*, __gnu_norm::vector::op_base*::bucket_type, std::allocator::op_base*::bucket_type , unsigned long, boost::asio::detail::hash_map::op_base*::bucket_type at stl_uninitialized.h:194 #9 0x0001a4e1 in std::uninitialized_fill_n::op_base*::bucket_type*, __gnu_norm::vector::op_base*::bucket_type, std::allocator::op_base*::bucket_type , unsigned long, boost::asio::detail::hash_map::op_base*::bucket_type at stl_uninitialized.h:218 #10 0x0001a509 in std::__uninitialized_fill_n_a::op_base*::bucket_type*, __gnu_norm::vector::op_base*::bucket_type, std::allocator::op_base*::bucket_type , unsigned long, boost::asio::detail::hash_map::op_base*::bucket_type, boost::asio::detail::hash_map::op_base*::bucket_type at stl_uninitialized.h:310 #11 0x0001aa34 in __gnu_norm::vector::op_base*::bucket_type, std::allocator::op_base*::bucket_type ::_M_fill_insert at vector.tcc:365 #12 0x0001acda in __gnu_norm::vector::op_base*::bucket_type, std::allocator::op_base*::bucket_type ::insert at stl_vector.h:658 #13 0x0001ad81 in __gnu_norm::vector::op_base*::bucket_type, std::allocator::op_base*::bucket_type ::resize at stl_vector.h:427 #14 0x0001ae3a in __gnu_debug_def::vector::op_base*::bucket_type, std::allocator::op_base*::bucket_type ::resize at vector:169 #15 0x0001b7be in boost::asio::detail::hash_map::op_base*::rehash at hash_map.hpp:221 #16 0x0001bbeb in boost::asio::detail::hash_map::op_base*::hash_map at hash_map.hpp:67 #17 0x0001bc74 in boost::asio::detail::reactor_op_queue::reactor_op_queue at reactor_op_queue.hpp:42 #18 0x0001bd24 in boost::asio::detail::kqueue_reactor::kqueue_reactor at kqueue_reactor.hpp:86 #19 0x0001c000 in boost::asio::detail::service_registry::use_service at service_registry.hpp:109 #20 0x0001c14d in boost::asio::use_service at io_service.ipp:195 #21 0x0001c26d in boost::asio::detail::reactive_socket_service ::reactive_socket_service at reactive_socket_service.hpp:111 #22 0x0001c344 in boost::asio::detail::service_registry::use_service at service_registry.hpp:109 #23 0x0001c491 in boost::asio::use_service at io_service.ipp:195 #24 0x0001c4d5 in boost::asio::datagram_socket_service::datagram_socket_service at datagram_socket_service.hpp:95 #25 0x0001c59e in boost::asio::detail::service_registry::use_service at service_registry.hpp:109 #26 0x0001c6eb in boost::asio::use_service at io_service.ipp:195 #27 0x0001c711 in boost::asio::basic_io_object ::basic_io_object at basic_io_object.hpp:72 #28 0x0001c783 in boost::asio::basic_socket ::basic_socket at basic_socket.hpp:108 #29 0x0001c865 in boost::asio::basic_datagram_socket ::basic_datagram_socket at basic_datagram_socket.hpp:107 #30 0x000027bc in main at main.cpp:32 This is the gdb output: (gdb) continue /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127: error: attempt to copy-construct an iterator from a singular iterator. Objects involved in the operation: iterator "this" @ 0x0x100420 { type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE (mutable iterator); state = singular; } iterator "other" @ 0x0xbfffe8a4 { type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE (mutable iterator); state = singular; } Program received signal: “SIGABRT”. (gdb) continue Program received signal: “?”. Does someone has any idea why this example does not work on mac osx? Thank you.

    Read the article

  • How to detect page zoom level in all modern browsers?

    - by understack
    How can I detect page zoom level in all modern browsers? While this thread tells how to do it in IE7 and IE8, I can't find good solution for FF, Safari and Chrome. For FF one of the suggested solution FF stores page zoom level for future. So on first page load would I be able to get zoom level? Somewhere I read it works if you're changing zoom level on that page after its loaded. Is there a way to trap 'zoom' event? I need this because some of my calculations are based on no of pixels and they get changed on Zoom. Thanks. Modified sample given by tfl. This would alert different height based on zoom level. <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"/></script> <title></title> </head> <body> <div id="xy" style="border:1px solid #f00; width:100px;"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque sollicitudin tortor in lacus tincidunt volutpat. Integer dignissim imperdiet mollis. Suspendisse quis tortor velit, placerat tempor neque. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Praesent bibendum auctor lorem vitae tempor. Nullam condimentum aliquam elementum. Nullam egestas gravida elementum. Maecenas mattis molestie nisl sit amet vehicula. Donec semper tristique blandit. Vestibulum adipiscing placerat mollis. </div> <div> <button onclick="alert($('#xy').height());">Show</button> </div> </body> </html>

    Read the article

  • How to detect if Asp.Net form is valid

    - by Hasan Gürsoy
    Hi, I have a form which is in an updatePanel and I have a span with hidden loading image, which I want to show when user clicks to submit button but I first need to check if page is valid on client side. Also I'm making loading span visible with jQuery. Here is my code: <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function showLoading() { $('#loader').show(); } </script> </head> <body> <asp:ScriptManager ID="smMain" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="upForm" runat="server"> <ContentTemplate> <asp:MultiView ID="mvContact" runat="server" ActiveViewIndex="0"> <asp:View ID="vDefault" runat="server"> <asp:TextBox ID="tEMail" runat="server" CssClass="input" /> <asp:RequiredFieldValidator ID="rfvEMail" runat="server" ControlToValidate="tEMail" ErrorMessage="* required" Display="Dynamic" /> <asp:RegularExpressionValidator ID="revEMail" runat="server" ControlToValidate="tEMail" ErrorMessage="* invalid" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" /> <asp:ImageButton ID="btnSubmit" runat="server" ImageUrl="~/Assets/Images/btnSubmit.png" ToolTip="Submit Form" style="margin:5px 5px 0 -5px" onclick="btnSubmit_Click" OnClientClick="showLoading();" /> <span id="loader"><img src="Assets/Images/loader.gif" title="Sending..." /></span> </asp:View> <asp:View ID="vResult" runat="server"> <div class="result"> <span id="lResult" runat="server">Your message is sent</span> </div> </asp:View> </asp:MultiView> </ContentTemplate> </asp:UpdatePanel> </body></html>

    Read the article

  • Maven webapp with maven-eclipse-plugin doesn't generates <dependent-module>

    - by chrsk
    I use the eclipse:eclipse goal to generate an Eclipse Project environment. The deployment works fine. The goal creates the var classpath entries for all needed dependencies. With m2eclipse there was the Maven Container which defines an export folder which was WEB-INF/lib for me. But i don't want to rely on m2eclipse so i don't use it anymore. the class path entries which are generated by eclipse:eclipse goal don't have such a export folder. While booting the servlet container with WTP it publishes all resources and classes except the libraries to the context. Whats missing to publish the needed libs, or isn't that possible without m2eclipse integration? Enviroment Eclipse 3.5 JEE Galileo Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200) Java version: 1.6.0_14 m2eclipse The maven-eclipse-plugin configuration <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.8</version> <configuration> <projectNameTemplate>someproject-[artifactId]</projectNameTemplate> <useProjectReferences>false</useProjectReferences> <downloadSources>false</downloadSources> <downloadJavadocs>false</downloadJavadocs> <wtpmanifest>true</wtpmanifest> <wtpversion>2.0</wtpversion> <wtpapplicationxml>true</wtpapplicationxml> <wtpContextName>someproject-[artifactId]</wtpContextName> <additionalProjectFacets> <jst.web>2.3</jst.web> </additionalProjectFacets> </configuration> </plugin> The generated files After executing the eclipse:eclipse goal, the dependent-module is not listed in my generated .settings/org.eclipse.wst.common.component, so on server booting i miss the depdencies. This is what i get: <?xml version="1.0" encoding="UTF-8"?> <project-modules id="moduleCoreId" project-version="1.5.0"> <wb-module deploy-name="someproject-core"> <wb-resource deploy-path="/" source-path="src/main/java"/> <wb-resource deploy-path="/" source-path="src/main/webapp"/> <wb-resource deploy-path="/" source-path="src/main/resources"/> </wb-module> </project-modules>

    Read the article

  • Whats happening to my HTML?

    - by user156814
    I am making changes to my website, and I just noticed that things look different. In IE, the content doesnt center, theres a margin on my content, and the font looks bigger in chrome.. I ran it through Yahoo's HTML validator and the error I get is line 1 - Error: character "" not allowed in prolog. I believe that there may be some sort of whitespace being sent before the DOC TYPE, but I cant seem to fix it. The HTML looks fine in my text editor (Notepad++) so I dont know what the problem is. Im using a strict DOC Type. Everything was fine before I made any changes, but I cant pinpoint what caused the change. If it helps, I'm using a Framework (Kohana). My initial thought was that something was being sent to the browser by an echo or something, but I couldnt find any echo statements. I dont know what could be causing this... If you want to see any code or HTML just ask. Thanks. Heres the HTML (only head and doctype) via the page source in Google Chrome There seems to be some foreign characters in the source that I've never seen before, yet dont show up anywhere else (yahoo, or otherwise) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Recent Debates - Clashing Thoughts</title> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="en-us" /> <meta name="description" content="Clashing Thoughts is a great place to argue! Search topics you feel passionate about, pick where you stand on the issue and get your point across. The votes are tallied up for every debate so you can even see which side is most popular." /> <meta name="keywords" content="debates, arguments, topics, popular topics, popular debates, surveys, choices" /> <link rel="stylesheet" type="text/css" href="http://localhost/css/master.css" media="screen" /> <link rel="stylesheet" type="text/css" href="http://localhost/css/clashingthoughts.css" media="screen" /> <link rel="icon" type="image/x-icon" href="http://localhost/images/favicon.ico" /> <link rel="shortcut icon" type="image/x-icon" href="http://localhost/images/favicon.ico" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> </head>

    Read the article

  • Freetype2 failing under WoW64

    - by Necrolis
    I built a tff to D3D texture function using freetype2(2.3.9) to generate grayscale maps from the fonts. it works great under native win32, however, on WoW64 it just explodes (well, FT_Done and FT_Load_Glyph do). from some debugging, it seems to be a problem with HeapFree as called by free from FT_Free. I know it should work, as games like WCIII, which to the best of my knowledge use freetype2, run fine, this is my code, stripped of the D3D code(which causes no problems on its own): FT_Face pFace = NULL; FT_Error nError = 0; FT_Byte* pFont = static_cast<FT_Byte*>(ARCHIVE_LoadFile(pBuffer,&nSize)); if((nError = FT_New_Memory_Face(pLibrary,pFont,nSize,0,&pFace)) == 0) { FT_Set_Char_Size(pFace,nSize << 6,nSize << 6,96,96); for(unsigned char c = 0; c < 95; c++) { if(!FT_Load_Glyph(pFace,FT_Get_Char_Index(pFace,c + 32),FT_LOAD_RENDER)) { FT_Glyph pGlyph; if(!FT_Get_Glyph(pFace->glyph,&pGlyph)) { LOG("GET: %c",c + 32); FT_Glyph_To_Bitmap(&pGlyph,FT_RENDER_MODE_NORMAL,0,1); FT_BitmapGlyph pGlyphMap = reinterpret_cast<FT_BitmapGlyph>(pGlyph); FT_Bitmap* pBitmap = &pGlyphMap->bitmap; const size_t nWidth = pBitmap->width; const size_t nHeight = pBitmap->rows; //add to texture atlas } } } } else { FT_Done_Face(pFace); delete pFont; return FALSE; } FT_Done_Face(pFace); delete pFont; return TRUE; } ARCHIVE_LoadFile returns blocks allocated with new. As a secondary question, I would like to render a font using pixel sizes, I came across FT_Set_Pixel_Sizes, but I'm unsure as to whether this stretches the font to fit the size, or bounds it to a size. what I would like to do is render all the glyphs at say 24px (MS Word size here), then turn it into a signed distance field in a 32px area. Update After much fiddling, I got a test app to work, which leads me to think the problems are arising from threading, as my code is running in a secondary thread. I have compiled freetype into a static lib using the multithread DLL, my app uses the multithreaded libs. gonna see if i can set up a multithreaded test. Also updated to 2.4.4, to see if the problem was a known but fixed bug, didn't help however. Update 2 After some more fiddling, it turns out I wasn't using the correct lib for 2.4.4 -.- after fixing that, the test app works 100%, but the main app still crashes when FT_Done_Face is called, still seems to be a crash in the memory heap management of windows. is it possible that there is a bug in freetype2 that makes it blow up under user threads?

    Read the article

  • jQuery - draggable images on iPad / iPhone - how to integrate event.preventDefault();?

    - by Tim
    Hello! I use jQuery, jQuery UI and jQuery mobile to build a web application for iPhone / iPad. Now I create images and they should be draggable, so I did this: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>Drag - Test</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" /> <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script> <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script> </head> <body> <div> <div style="width:500px;height:500px;border:1px solid red;"> <img src="http://upload.wikimedia.org/wikipedia/en/thumb/9/9e/JQuery_logo.svg/200px-JQuery_logo.svg.png" class="draggable" alt="jQuery logo" /> <img src="http://upload.wikimedia.org/wikipedia/en/a/ab/Apple-logo.png" class="draggable" alt="Apple Inc. logo" /> </div> </div> </body> <script type="text/javascript"> $(document).ready(function() { $(".draggable").draggable(); }); </script> </html> Here you can see the live example: http://jsbin.com/igena4/ The problem is, that the whole page want to scroll. I searched in Apple's HTML5 examples and found this to prevent the scrolling of the page, so that the image is draggable: ... onDragStart: function(event) { // stop page from panning on iPhone/iPad - we're moving a note, not the page event.preventDefault(); ... } But the problem is for me, how can I include this into my jQuery? Where do I get event? Best Regards.

    Read the article

  • Help me please, javascript place problem or another thing??

    - by ilkdrl
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Urunler.aspx.cs" Inherits="Urunler" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-language" content="en" /> <link href="rss/example_ticker.css" rel="stylesheet" type="text/css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script src="rss/jquery.zrssfeed.min.js" type="text/javascript"></script> <script src="rss/jquery.vticker.js" type="text/javascript"></script> <title></title> <script type="text/javascript" src="lightbox/js/prototype.js"></script> <script type="text/javascript" src="lightbox/js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="lightbox/js/lightbox.js"></script> <link rel="stylesheet" href="lightbox/css/lightbox.css" type="text/css" media="screen" /> <style type="text/css"> ........... ........... ........... <td style="background-color: #808080"> <script type="text/javascript"> $(document).ready(function () { $('#ticker1').rssfeed('http://www.xxxxxxx.com/map.asp').ajaxStop(function () { $('#ticker1 div.rssBody').vTicker({ showItems: 3 }); }); }); </script> <div id="ticker1" > </div> Hi, i have two scripts.lightbox and rss. lightbox script works very well in mywebform1 but rss feed dont work.I didnot solve that?Help me please. PS: on the other hand, my another webpage(mywebform2) in same website has only rss feed and works very well.

    Read the article

  • Error in jquery attribute selector and IE6-7

    - by Guillermo Vasconcelos
    Hi, I'm trying to implement a JQuery script to process some areas inside an image map. I'm using $('area[shape="poly"]') as a selector to obtain the areas I'm interested in. It is working fine in IE8 and Firefox, but it is not selecting the elements in IE6 or IE7. This is a test page that shows this problem. I don't know if this is a JQuery bug or I am doing something wrong. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { var areas = $('area[shape="poly"]'); alert('areas: ' + areas.length); }); //]]> </script> <title>Test</title> </head> <body> <img id="img1" src="nothing.gif" style="width:300px; height:300px; border: 2px solid black" usemap="#map1"/> <map id="map1"> <area shape="rect" title="rectArea" coords="126,112,231,217" alt=""/> <area shape="poly" title="polyArea1" coords="274,72,262,70,251,68,240,67,228,66,217,67,206,68,194,70,183,72,181,63,192,60,204,58,216,57,228,56,240,57,252,58,264,60,276,63" alt=""/> <area shape="poly" title="polyArea2" coords="241,194,235,193,228,193,222,193,216,194,196,119,204,117,212,116,220,115,228,115,237,115,245,116,253,117,261,119" alt=""/> </map> </body> </html> This is showing 2 in IE8 and Firefox and 0 in IE6-7 Thanks, Guillermo

    Read the article

  • compiling a program to run in DOS mode

    - by dygi
    I write a simple program, to run in DOS mode. Everything works under emulated console in Win XP / Vista / Seven, but not in DOS. The error says: this program caonnot be run in DOS mode. I wonder is that a problem with compiler flags or something bigger. For programming i use Code::Blocks v 8.02 with such settings for compilation: -Wall -W -pedantic -pedantic-errors in Project \ Build options \ Compiler settings I've tried a clean DOS mode, booting from cd, and also setting up DOS in Virtual Machine. The same error appears. Should i turn on some more compiler flags ? Some specific 386 / 486 optimizations ? UPDATE Ok, i've downloaded, installed and configured DJGPP. Even resolved some problems with libs and includes. Still have two questions. 1) i can't compile a code, which calls _strdate and _strtime, i've double checked the includes, as MSDN says it needs time.h, but still error says: _strdate was not declared in this scope, i even tried to add std::_strdate, but then i have 4, not 2 errors sazing the same 2) the 2nd code is about gotoxy, it looks like that: #include <windows.h> void gotoxy(int x, int y) { COORD position; position.X = x; position.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), position); } error says there is no windows.h, so i've put it in place, but then there are many more errors saying some is missing from windows.h, I SUPPOSE it won't work because this functions is strictly for windows right ? is there any way to write similar gotoxy for DOS ? UPDATE2 1) solved using time(); instead of _strdate(); and _strtime(); here's the code time_t rawtime; struct tm * timeinfo; char buffer [20]; time ( &rawtime ); timeinfo = localtime ( &rawtime ); strftime (buffer,80,"%Y.%m.%d %H:%M:%S\0",timeinfo); string myTime(buffer); It now compiles under DJGPP. UPDATE3 Still need to solve a code using gotoxy - replaced it with some other code that compiles (under DJGPP). Thank You all for help. Just learnt some new things about compiling (flags, old IDE's like DJGPP, OpenWatcom) and refreshed memories setting DOS to work :--)

    Read the article

  • Drawing text to <canvas> with @font-face does not work at the first time

    - by lemonedo
    Hi all, First try the test case please: http://lemon-factory.net/test/font-face-and-canvas.html I'm not good at English, so I made the test case to be self-explanatory. On the first click to the DRAW button, it will not draw text, or will draw with an incorrect typeface instead of the specified "PressStart", according to your browser. After then it works as expected. At the first time the text does not appear correctly in all browsers I've tested (Firefox, Google Chrome, Safari, Opera). Is it the standard behavior or something? Thank you. PS: Following is the code of the test case <!DOCTYPE html> <html> <head> <meta http-equiv=Content-Type content="text/html;charset=utf-8"> <title>@font-face and canvas</title> <style> @font-face { font-family: 'PressStart'; src: url('http://lemon-factory.net/css/fonts/prstart.ttf'); } canvas, pre { border: 1px solid #666; } pre { float: left; margin: .5em; padding: .5em; } </style> </head> <body> <div> <canvas id=canvas width=250 height=250> Your browser does not support the CANVAS element. Try the latest Firefox, Google Chrome, Safari or Opera. </canvas> <button>DRAW</button> </div> <pre id=style></pre> <pre id=script></pre> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script> var canvas = document.getElementById('canvas') var ctx = canvas.getContext('2d') var x = 30 var y = 10 function draw() { ctx.font = '12px PressStart' ctx.fillStyle = '#000' ctx.fillText('Hello, world!', x, y += 20) ctx.fillRect(x - 20, y - 10, 10, 10) } $('button').click(draw) $('pre#style').text($('style').text()) $('pre#script').text($('script').text()) </script> </body> </html>

    Read the article

  • IE 8: Object Expected for Every Javascript Function

    - by Yetkin EREN
    Hi; Moz say's everything is ok! IE say's object expected everywhere.. for example this my make a box function (in all.js file); function kutuyap(Eid,iduzan,text,yer,ekle){ var div; if (document.createElement && (div = document.createElement('div'))) { div.name = div.id = Eid+iduzan; document.getElementById(yer).appendChild(div); } //$('#'+yer).append("<div id="+Eid+iduzan+"></div>") $('#'+Eid+iduzan).addClass("minikutu"); $('#'+Eid+iduzan).html("&nbsp;"+text+'<span id='+Eid+'y'+iduzan+' class="yokedici">X</span>'); $("#"+Eid+'y'+iduzan).attr("onclick","kutusil('"+Eid+"y"+iduzan+"','"+iduzan+"','"+ekle+"');"); $('#'+ekle).val($('#'+ekle).val()+Eid+'-'); } and after that i call function like this; HTML; <select name="Mturs" class="inputs" id="Mturs"> <option value="0" selected="selected">Choise One</option> <option value="4">Pop</option> <option value="3">Pop-Rock </option> <option value="5">Rock (Yabanci)</option> </select> <input name="secMtur" id="secMtur" value="" type="hidden"> <script> $('#Mturs').live('change', function() { $('#Mturs :selected').each(function (i) { if ( $('#Mturs :selected').val() != 0 ) { secMturde=$('#secMtur').val().indexOf($('#Mturs :selected').val()+'-'); splitter=$('#secMtur').val().split("-") if(splitter.length<=12){ if (secMturde<0) { kutuyap($('#Mturs :selected').val(),'mtur',$(this).html(),'divmtur','secMtur'); }else{ alert("Choisen before") } }else{ alert("Max limit is 12 !") } } }); }); </script> sory for my realy bad english.. edit: and i have this tags; <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"> </script> <script type="text/javascript" src="alljs.js"></script>

    Read the article

  • how to use jquery autocomplete?

    - by kyrogue
    hi, i am creating a web project using JSP, and is trying to implement a simple search for users from my database using jquery autocomplete, however i am having trouble understanding how it works. i have little to no knowledge on jquery and ajax just to let you know. i have done the following code and am stuck. <%@page contentType="text/html" pageEncoding="UTF-8" import="ewa.dbConnect,ewa.sendEmail,ewa.pwGen,ewa.hashPw,java.sql.*" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="css/jquery.autocomplete.css" /> <script src="js/jquery.autocomplete.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <input type="text" id="search" name="search"/> <script> $("#search").autocomplete("getdata.jsp"); </script> </body> </html> <%@page contentType="text/html" pageEncoding="UTF-8" import="ewa.dbConnect,java.sql.*" %> <%! dbConnect db = new dbConnect(); %> <% String query = request.getParameter("q"); db.connect(); Statement stmt = db.getConnection().createStatement(); ResultSet rs = stmt.executeQuery("SELECT username FROM created_accounts WHERE username LIKE "+query); while(rs.next()) { out.println(rs.getString("username")); } db.disconnect %> if i am not wrong i read from a website, the parameter q is default and is just there, however how do i display the data? how do i pass the values from getdata.jsp into the autocomplete?

    Read the article

  • generated service mock: everything but RhinoMocks fails?

    - by hko
    I have the "quest" to search for the next Mocking Framework for my company, and basically it's down to NSubstitute (simplest syntax, but no strict mocks), FakeItEasy(best reviews, Roy Osherove bonus, and slightly better lib support than NSubstitute), Moq (best "other libs support", biggest featureset, downside: mock.Object). We definitely want to move on from RhinoMocks, e.g. because of the unusefull interactiontest error messages (it should tell me what the parameter was instead, when a verification fails). So I was pretty surprised the other day (that was yesterday) when I found out RhinoMocks could do a thing where every other mock framework fails at: Mocking an autogenerated SomethingService (a typical VS autogenerated service with a default construtor in a partial class). Please don't argue about the design.. I intend to write lightweight integration tests (and some unit tests), and I can't mess around with the service, the product is installed on too many customers system. See this code: // here the NSubstitute and FakeItEasy equivalents throw an exception.. see below TicketStoreService fakeTicketStoreService = MockRepository.GenerateMock<TicketStoreService>(); fakeTicketStoreService.Expect(service => service.DoSomething(Arg.Is(new Guid())).Return(new Guid()); fakeTicketStoreService.DoSomething(Arg.Is(new Guid())); fakeTicketStoreService.VerifyAllExpectations(); Note that DoSomething is a non-virtual methodcall in an autogenerated class. So it shouldn't work, according to common knowledge. But it does. Problem is that it's the only (non commercial) framework that can do this: Rhino.Mocks works, and verification works too FakeItEasy says it doesn't find a default constructor (probably just wrong exception message): No default constructor was found on the type SomeNamespace.TicketStoreService Moq gives something sane and understandable: Invalid setup on a non-virtual (overridable in VB) member: service=> service.DoSomething Nsubstitute gives a message System.NotSupportedException: Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface. I'm really wondering what's going on here with the frameworks, except Moq. The "fancy new" frameworks seem to have an initial perf hit too, probably preparing some Type cache and serializing stuff, whilst RhinoMocks somehow manages to create a very "slim" mock without recursion. I have to admit I didn't like RhinoMocks very well, but here it shines.. unfortunately. So, is there a way to get that to work with newer (non-commercial!) mocking frameworks, or somehow get a sane error message out of Rhino.Mocks? And why can Rhino.Mocks achieve this, when clearly every Mocking framework states it can only work with virtual methods when given a concrete class? Let's not derail the discussion by talking about alternative approaches like Extract&Override or runtime-proxy Mocking frameworks like JustMock/TypeMock/Moles or the new Fakes framework, I know these, but that would be less ideal solutions, for reasons beyond this topic. Any help appreciated..

    Read the article

  • Javascript & Jquery why it doesnt work on IE?

    - by Yetkin EREN
    i cant run any function on ie this is a little part; my test page : http://www.yetkineren.com/testpage.html code: <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <title>test page</title> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"> </script> <script type="text/javascript" language="javascript"> function kutuyap(Eid,iduzan,yazi,yer,ekle){ var div; div = document.createElement('div') div.id = Eid+iduzan; document.getElementById(yer).appendChild(div); //$('#'+yer).append("<div id="+Eid+iduzan+"></div>") $('#'+Eid+iduzan).addClass("minikutu"); $('#'+Eid+iduzan).html(" "+yazi+'<span id='+Eid+'y'+iduzan+' class="yokedici">X</span>'); // $("#"+Eid+'y'+iduzan).attr("onclick","kutusil('"+Eid+"y"+iduzan+"','"+iduzan+"','"+ekle+"');"); $("#"+Eid+'y'+iduzan).click(function() { kutusil(Eid+'y'+iduzan, iduzan, ekle); }); $('#'+ekle).val($('#'+ekle).val()+Eid+'-'); } function kutusil(Eid,iduzan,ekle){ $('#'+Eid).live('click',function() { sil=$(this).parents("div:first").attr("id"); silinecek=sil.replace(iduzan,''); $('#'+ekle).val($('#'+ekle).val().replace(silinecek+'-','')); $(this).parents("div:first").remove(); }); } </script> <select name="Mturs" class="inputs" id="Mturs"> <option value="0" selected="selected">Choise One</option> <option value="4">Pop</option> <option value="3">Pop-Rock </option> <option value="5">Rock (Yabanci)</option> </select> <input name="secMtur" id="secMtur" value="" type="hidden"> <script> $('#Mturs').live('change', function() { $('#Mturs :selected').each(function (i) { if ( $('#Mturs :selected').val() != 0 ) { secMturde=$('#secMtur').val().indexOf($('#Mturs :selected').val()+'-'); splitter=$('#secMtur').val().split("-") if(splitter.length<=12){ if (secMturde<0) { kutuyap($('#Mturs :selected').val(),'mtur',$(this).html(),'divmtur','secMtur'); }else{ alert("Choisen before") } }else{ alert("Max limit is 12 !") } } }); }); </script>

    Read the article

  • Inserting newlines into a GtkTextView widget (GTK+ programming)

    - by Mark Roberts
    I've got a button which when clicked copies and appends the text from a GtkEntry widget into a GtkTextView widget. (This code is a modified version of an example found in the "The Text View Widget" chapter of Foundations of GTK+ Development.) I'm looking to insert a newline character before the text which gets copied and appended, such that each line of text will be on its own line in the GtkTextView widget. How would I do this? I'm brand new to GTK+. Here's the code sample: #include <gtk/gtk.h> typedef struct { GtkWidget *entry, *textview; } Widgets; static void insert_text (GtkButton*, Widgets*); int main (int argc, char *argv[]) { GtkWidget *window, *scrolled_win, *hbox, *vbox, *insert; Widgets *w = g_slice_new (Widgets); gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Text Iterators"); gtk_container_set_border_width (GTK_CONTAINER (window), 10); gtk_widget_set_size_request (window, -1, 200); w->textview = gtk_text_view_new (); w->entry = gtk_entry_new (); insert = gtk_button_new_with_label ("Insert Text"); g_signal_connect (G_OBJECT (insert), "clicked", G_CALLBACK (insert_text), (gpointer) w); scrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolled_win), w->textview); hbox = gtk_hbox_new (FALSE, 5); gtk_box_pack_start_defaults (GTK_BOX (hbox), w->entry); gtk_box_pack_start_defaults (GTK_BOX (hbox), insert); vbox = gtk_vbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); gtk_widget_show_all (window); gtk_main(); return 0; } /* Insert the text from the GtkEntry into the GtkTextView. */ static void insert_text (GtkButton *button, Widgets *w) { GtkTextBuffer *buffer; GtkTextMark *mark; GtkTextIter iter; const gchar *text; buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (w->textview)); text = gtk_entry_get_text (GTK_ENTRY (w->entry)); mark = gtk_text_buffer_get_insert (buffer); gtk_text_buffer_get_iter_at_mark (buffer, &iter, mark); gtk_text_buffer_insert (buffer, &iter, text, -1); } You can compile this command (assuming the file is named file.c): gcc file.c -o file `pkg-config --cflags --libs gtk+-2.0` Thanks everybody!

    Read the article

  • Popup browser incompability

    - by Cornelis
    I have a popup with drop down menus on it. I've scaled it down and simplified it for test purposes, but it still doesn't work the way I want/it should. <!DOCTYPE html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('.trigger').click(function(){ var picker = jQuery('.popup'); jQuery('<div></div>').css({ height: screen.height, width: screen.width, position: 'absolute', 'z-index': -1, top: picker.offset().top*-1, left: picker.offset().left*-1, border: '1px solid red' }).click(function(){ picker.trigger('focusout'); jQuery(this).hide(); }).prependTo(picker); picker.css('visibility', 'visible'); }); jQuery('.popup').live("focusout", function() { jQuery('.popup').fadeTo(500, 0.0, function() { jQuery('.popup').css('visibility', 'hidden'); jQuery('.popup').css('opacity', '1.0'); }); }); }); </script> </head> <body> <p> <input type=text class=trigger /> <div id=popup-div class=popup style="visibility: hidden; border: 1px solid red"> <select> <option>option1</option> </select> <p>Popup text</p> </div> </p> </body> When you click on the input field, a 'popup' appears, if you click outside the red border it fades away. If you click on the select option it shouldn't dissappear! However on this point, Chrome doesn't work the same as IE/FF/Opera/Safari, and makes the div dissappear. (Using Chrome 4.0.295.0) Does anybody knows a work-around for Chrome? Calling event.stopPropagation() on select elements did not work so far

    Read the article

  • JQuery Cycle, how can I change from image to div?

    - by vick
    <!doctype html> <html> <head> <title>JQuery Cycle Plugin - Example Slideshow</title> <style type="text/css"> .slideshow { height: 232px; width: 232px; margin: auto } .slideshow img { padding: 15px; border: 1px solid #ccc; background-color: #eee; } </style> <!-- include jQuery library --> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <!-- include Cycle plugin --> <script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.74.js"></script> <!-- initialize the slideshow when the DOM is ready --> <script type="text/javascript"> $(document).ready(function() { $('.slideshow').cycle({ fx: 'shuffle' // choose your transition type, ex: fade, scrollUp, shuffle, etc... }); }); </script> </head> <body> <div class="slideshow"> <img src="http://cloud.github.com/downloads/malsup/cycle/beach1.jpg" width="200" height="200" /> <img src="http://cloud.github.com/downloads/malsup/cycle/beach2.jpg" width="200" height="200" /> <img src="http://cloud.github.com/downloads/malsup/cycle/beach3.jpg" width="200" height="200" /> </div> </body> </html> How can I make this exact scroller work with divs instead of img?? basically, I want to use <div> etc etc etc </div> instead of: <img src="http://cloud.github.com/downloads/malsup/cycle/beach3.jpg" width="200" height="200" />

    Read the article

  • Dojo and Ajax - rendering widgets

    - by Michael Merchant
    I'm trying to load content into a Dojo content pane in a specific html tag and not replace the entire content pane. The html I'm loading includes a markup defined widget that I'd like to have rendered when the new row is loaded. So, I have a table that is being dynamically filled via ajax,ie: <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig="parseOnLoad: true, isDebug:true"></script> <div id="table-pane" dojoType="dijit.layout.ContentPane"> <table class="test"> <tbody> <tr><td>Name</td><td>Year</td><td>Age</td></tr> <tr> <td><span dojoType="dijit.InlineEditBox" editor="dijit.form.Textarea">Mike</span> </td> <td>2010</td> <td>12</td> </tr> </tbody> </table> </div> </body> <script> var html ='<tr><td><span dojoType="dijit.InlineEditBox" editor="dijit.form.Textarea">John</span></td><td>2011</td><td>22</td></tr>'; dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.InlineEditBox"); dojo.require("dijit.form.Textarea"); dojo.addOnLoad(function(){ pane = dijit.byId("table-pane"); add_elem(); }); function add_elem(){ var node = $(".test tr:last"); node.after(html); dojo.addOnLoad(function(){ //Here I want to initiate any widgets that haven't been initiated pane.buildRendering(); }); }</script> How do I render the Dojo widget in the new table row?

    Read the article

  • Parsing secure entries XML file with jquery

    - by user573131
    Apologies if this is elementary. I'm primarily a front end designer/dev. I have webform through a form service called wufoo. Wufoo generates a lovely XML (or json) file that can be grabed and parsed. I'm trying to grab the entries xml feed that is associated with the form and parse it via jquery to show who has entered. Im using the following code (which works with a local xml file). http://bostonwebsitemakeover.com/2/test <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"></script> <script> $(document).ready(function () { $.ajax({ type: "GET", url: "people.xml", dataType: "xml", success: xmlParser }); }); function xmlParser(xml) { $('#load').fadeOut(); $(xml).find("Entry").each(function () { $(".main").append('<div class="entry">' + $(this).find("Field1").text() + ' ' + $(this).find("Field2").text() + ' http://twitter.com/' + $(this).find("Field17").text() + '</div>'); $(".entry").fadeIn(1000); }); } </script> My XML file contains the following: <?xml version="1.0"?> <Entries> <Entry> <EntryId>1</EntryId> <Field1>Meaghan</Field1> <Field2>Severson</Field2> <Field17/> </Entry> <Entry> <EntryId>2</EntryId> <Field1>Michael</Field1> <Field2>Flint</Field2> <Field17>michaelflint</Field17> </Entry> <Entry> <EntryId>3</EntryId> <Field1>Niki</Field1> <Field2>Brown</Field2> <Field17>nikibrown</Field17> </Entry> <Entry> <EntryId>4</EntryId> <Field1>Niki</Field1> <Field2>Brown</Field2> <Field17>nikibrown</Field17> </Entry> </Entries> I'm wondering how I would do this with the xml file hosted on the wufoo (which is https) So I guess Im asking how do I authenticate the feed via jquery? Or do i need to do this via json? Could someone explain how?

    Read the article

  • Application error with MyFaces 1.2: java.lang.IllegalStateException: No Factories configured for this Application.

    - by IgorB
    For my app I'm using Tomcat 6.0.x and Mojarra 1.2_04 JSF implementation. It works fine, just I would like to switch now to MyFaces 1.2_10 impl of JSF. During the deployment of my app a get the following error: ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myApp]] StandardWrapper.Throwable java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions! If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml. A typical config looks like this; <listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener> at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:106) at javax.faces.webapp.FacesServlet.init(FacesServlet.java:137) at org.apache.myfaces.webapp.MyFacesServlet.init(MyFacesServlet.java:113) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1172) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:992) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4058) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4371) ... Here is part of my web.xml configuration: <servlet> <servlet-name>Faces Servlet</servlet-name> <!-- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> --> <servlet-class>org.apache.myfaces.webapp.MyFacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> ... <listener> <listener- class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener> Has anyone experienced similar error, and what should I do i order to fix it? Thanx!

    Read the article

  • JQuery selfbuild plugin question - default value is overwritten.

    - by Bruno
    Hi jQuery ninjas. I need your help. I have made a really clean and simple example to illustrate my problem. I have build my own jquery plugin: (function($) { $.fn.setColorTest = function(options) { options = $.extend($.fn.setColorTest.defaults,options); return this.each(function() { $(this).css({ 'color': options.color}); }); } $.fn.setColorTest.defaults = { color: '#000' }; })(jQuery); As you can see I'm setting a default color and making it possible for the user to change it. My problem/question is: I have two paragraphs on the same page where I want to use the default color for the first and a different color for the second paragraph: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Color Test</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('a#click').click(function() { $('#test1').setColorTest(); }); $('a#click2').click(function() { $('#test2').setColorTest({color: '#fff666'}); }); }); </script> </head> <body> <a id="click">click here</a> <a id="click2">click here2</a> <p id="test1">Test 1</p> <p id="test2">Test 2</p> </body> </html> My problem is that if I click on the second paragraph (p) that overrides the default color and afterwards clicks on the first p it will use the overwritten color and not the default color for the first p. How can I ensure that the first p always will use the default color? I know I can just define the color for the first p as well but that is not an option here $('#test1').setColorTest('color': '#000'); So what to do?

    Read the article

  • How to "enable" HTML5 elements in IE that were inserted by AJAX call?

    - by Gidon
    IE does not work good with unknown elements (ie. HTML5 elements), one cannot style them , or access most of their props. Their are numerous work arounds for this for example: http://remysharp.com/2009/01/07/html5-enabling-script/ The problem is that this works great for static HTML that was available on page load, but when one creates HTML5 elements afterward (for example AJAX call containing them, or simply creating with JS), it will mark these newly added elements them as HTMLUnknownElement as supposed to HTMLGenericElement (in IE debugger). Does anybody know a work around for that, so that newly added elements will be recognized/enabled by IE? Here is a test page: <html><head><title>TIME TEST</title> <!--[if IE]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script> </head> <body> <time>some time</time> <hr> <script type="text/javascript"> $("time").text("WORKS GREAT"); $("body").append("<time>NEW ELEMENT</time>"); //simulates AJAX callback insertion $("time").text("UPDATE"); </script> </body> </html> In IE you will see the: UPDATE , and NEW ELEMENT. In any other modern browser you will see UPDATE, and UPDATE Solution Using the answer provided I came up with the following piece of javascript to HTML5 enable a whole bunch of elements returned by my ajax call: (function ($) { jQuery.fn.html5Enable = function () { if ($.browser.msie) { $("abbr, article, aside, audio, canvas, details, figcaption, figure, footer, header, hgroup, mark, menu, meter, nav, output, progress, section, summary, time, video", this).replaceWith(function () { if (this.tagName == undefined) return ""; var el = $(document.createElement(this.tagName)); for (var i = 0; i < this.attributes.length; i++) el.attr(this.attributes[i].nodeName, this.attributes[i].nodeValue); el.html(this.innerHtml); return el; }); } return this; }; })(jQuery); Now this can be called whenever you want to append something: var el = $(AJAX_RESULT_OR_HTML_STRING); el.html5Enable(); $("SOMECONTAINER").append(el); See http://code.google.com/p/html5shiv/issues/detail?id=4 for an explanation about what this plugin doesn't do.

    Read the article

  • Error using paho-mqtt in App Engine Python App

    - by calumb
    I am trying to right a Google Cloud Platform app in python with Flask that makes an MQTT connection. I have included the paho python library by doing pip install paho-mqtt -t libs/. However, when I try to run the app, even if I don't try to connect to MQTT. I get a weird error about IP address checking: RuntimeError: error('illegal IP address string passed to inet_pton',) It seems something in the remote_socket lib is causing a problem. Is this a security issue? Is there someway to disable it? Relevant code: from flask import Flask import paho.mqtt.client as mqtt import logging as logger app = Flask(__name__) # Note: We don't need to call run() since our application is embedded within # the App Engine WSGI application server. #callback to print out connection status def on_connect(mosq, obj, rc): logger.info('on_connect') if rc == 0: logger.info("Connected") mqttc.subscribe('test', 0) else: logger.info(rc) def on_message(mqttc, obj, msg): logger.info(msg.topic+" "+str(msg.qos)+" "+str(msg.payload)) mqttc = mqtt.Client("mqttpy") mqttc.on_message = on_message mqttc.on_connect = on_connect As well as full stack trace: ERROR 2014-06-03 15:14:57,285 wsgi.py:262] Traceback (most recent call last): File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 239, in Handle handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 298, in _LoadHandler handler, path, err = LoadObject(self._handler) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 84, in LoadObject obj = __import__(path[0]) File "/Users/cbarnes/code/ignite/tank-demo/appengine-flask-demo/main.py", line 24, in <module> mqttc = mqtt.Client("mqtthtpp") File "/Users/cbarnes/code/ignite/tank-demo/appengine-flask-demo/lib/paho/mqtt/client.py", line 403, in __init__ self._sockpairR, self._sockpairW = _socketpair_compat() File "/Users/cbarnes/code/ignite/tank-demo/appengine-flask-demo/lib/paho/mqtt/client.py", line 255, in _socketpair_compat listensock.bind(("localhost", 0)) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/socket.py", line 222, in meth return getattr(self._sock,name)(*args) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/api/remote_socket/_remote_socket.py", line 668, in bind self._SetProtoFromAddr(request.mutable_proxy_external_ip(), address) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/api/remote_socket/_remote_socket.py", line 632, in _SetProtoFromAddr proto.set_packed_address(self._GetPackedAddr(address)) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/api/remote_socket/_remote_socket.py", line 627, in _GetPackedAddr AI_NUMERICSERV|AI_PASSIVE): File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/api/remote_socket/_remote_socket.py", line 338, in getaddrinfo canonical=(flags & AI_CANONNAME)) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/api/remote_socket/_remote_socket.py", line 211, in _Resolve canon, aliases, addresses = _ResolveName(name, families) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/api/remote_socket/_remote_socket.py", line 229, in _ResolveName apiproxy_stub_map.MakeSyncCall('remote_socket', 'Resolve', request, reply) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 94, in MakeSyncCall return stubmap.MakeSyncCall(service, call, request, response) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_stub_map.py", line 328, in MakeSyncCall rpc.CheckSuccess() File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/api/apiproxy_rpc.py", line 156, in _WaitImpl self.request, self.response) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 200, in MakeSyncCall self._MakeRealSyncCall(service, call, request, response) File "/Users/cbarnes/google-cloud-sdk/platform/google_appengine/google/appengine/ext/remote_api/remote_api_stub.py", line 234, in _MakeRealSyncCall raise pickle.loads(response_pb.exception()) RuntimeError: error('illegal IP address string passed to inet_pton',) INFO 2014-06-03 15:14:57,291 module.py:639] default: "GET / HTTP/1.1" 500 - Thanks!

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47  | Next Page >