Search Results

Search found 2126 results on 86 pages for 'wrapper'.

Page 66/86 | < Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >

  • "Outward" border-radius in css?

    - by MaxMackie
    Currently, the links at the top of my website look like this: However, I am trying to "round" the bottom edges of the buttons to make it look like they are coming out of the page and into the ribbon at the top. I am aware that you can hack it and add a "separator" div with rounded corners between each entry, but this would be difficult to do seeing at the borders used are not all from the same div. Also, it wouldn't be easy seeing as my buttons are very close to each other. The css for the "button": .button { border-top: 3px solid #A1C1BE; border-left: 3px solid #A1C1BE; border-right: 3px solid #A1C1BE; border-bottom: 0px; padding: 5px 8px 5px 8px; margin: 0 0 -9px 0; border-radius: 5px 5px 0 0; font-size: 12px; font-family: 'PT Sans', sans-serif; background-color: #f8f8ff; color: #484848; } css for the "ribbon": #top-wrapper { border-bottom: 5px solid #A1C1BE; width: 100%; background-color: #59554E; padding: 10px 0 0 0; color: #C0C0A8; } As you can see, the thicker border belongs to the ribbon which stretches the length of the webpage, whereas the thinner blue border is part of the button.

    Read the article

  • JQuery Dragging Outside Parent

    - by Andy
    I'm using JQuery's draggable(); to make li elements draggable. The only problem is when the element is dragged outside its parent, it doesn't show up. That is, it doesn't leave the confines of its parent div. An example is here: http://imgur.com/N2N1L.png - it's as if the z-index for everything else has greater priority (and the element slides under everything). Here's the code: $('.photoList li').draggable({ distance: 20, snap: theVoteBar, revert: true, containment: 'document' }); And the li elements are placed in DIVs like this: <div class="coda-slider preload" id="coda-slider-1"> <div class="panel"> <div class="panel-wrapper"> <h2 class="title" style="display:none;">Page 1</h2> <ul class="photoList"> <li> <img class="ui-widget-content" src="photos/1.jpg" style="width:100px;height:100px;" /> </li> </ul> </div> </div> I'm positive the problem is it won't leave its parent container, but I'm not sure what to do to get it out. Any direction or help would be appreciated GREATLY!

    Read the article

  • Adding a button or link to an inline in Django admin

    - by Lexo
    Hello, I have created the following django models: class Entry(SiteObject): parent = models.ForeignKey(Blog, related_name="entries") content = models.TextField(help_text = "The Content of the blog post") class EntryImage(models.Model): entry = models.ForeignKey(Entry, related_name="entryimages") imagewidth = models.PositiveIntegerField(editable=False,) imageheight = models.PositiveIntegerField(editable=False,) image_file = ImageWithThumbnailsField( #from sorl-thumbnail. Basically a wrapper for an ImageField that generates a thumbnail. upload_to="images/blogs", height_field="imageheight", width_field="imagewidth", help_text = "Select an image to upload.", thumbnail={'size': (360,720)}, generate_on_save=True, ) The EntryImage class shows up as an inline in the admin page for Entry. What I'd like to do is place a link or a button beside each of these inlines that does the following: Save the EntryImage Append <Image x> to the content of the Entry, where x is the number of the EntryImage. This will be replaced by the image's thumbnail using a template filter. Save the Entry Return to editing the Entry I have looked into this, but I just can't wrap my head around where I'm supposed to add this button or link. Has anyone else tried something similar? I've got JQuery available, since I'm using WYMEditor for the content field of the Entry class. Would this help? Thanks in advance, Lexo

    Read the article

  • Attaching event on the fly with prototype

    - by andreas
    Hi, I've been scratching my head over this for an hour... I have a list of todo which has done button on each item. Every time a user clicks on that, it's supposed to do an Ajax call to the server, calling the marking function then updates the whole list. The problem I'm facing is that the new list has done buttons as well on each item. And it doesn't attach the click event anymore after first update. How do you attach an event handler on newly updated element with prototype? Note: I've passed evalScripts: true to the updater wrapper initial event handler attach <script type="text/javascript"> document.observe('dom:loaded', function() { $$('.todo-done a').each(function(a) { $(a).observe('click', function(e) { var todoId = $(this).readAttribute('href').substr(1); new Ajax.Updater('todo-list', $.utils.getPath('/todos/ajax_mark/done'), { onComplete: function() { $.utils.updateList({evalScripts: true}); } }); }); }) }); </script> updateList: <script type="text/javascript"> var Utils = Class.create({ updateList: function(options) { if(typeof options == 'undefined') { options = {}; } new Ajax.Updater('todo-list', $.utils.getPath('/todos/ajax_get'), $H(options).merge({ onComplete: function() { $first = $('todo-list').down(); $first.hide(); Effect.Appear($first, {duration: 0.7}); new Effect.Pulsate($('todo-list').down(), {pulses: 1, duration: 0.4, queue: 'end'}); } }) ); } }) $.utils = new Utils('globals'); </script> any help is very much appreciated, thank you :)

    Read the article

  • Encapsulate update method inside of object or have method which accepts an object to update

    - by Tom
    Hi, I actually have 2 questions related to each other: I have an object (class) called, say MyClass which holds data from my database. Currently I have a list of these objects ( List < MyClass ) that resides in a singleton in a "communal area". I feel it's easier to manage the data this way and I fail to see how passing a class around from object to object is beneficial over a singleton (I would be happy if someone can tell me why). Anyway, the data may change in the database from outside my program and so I have to update the data every so often. To update the list of the MyClass I have a method called say, Update, written in another class which accepts a list of MyClass. This updates all the instances of MyClass in the list. However would it be better instead to encapulate the Update() method inside the MyClass object, so instead I would say foreach(MyClass obj in MyClassList) { obj.update(); } What is a better implementation and why? The update method requires a XML reader. I have written an XML reader class which is basically a wrapper over the standard XML reader the language natively provides which provides application specific data collection. Should the XML reader class be in anyway in the "inheritance path" of the MyClass object - the MyClass objects inherits from the XML reader because it uses a few methods. I can't see why it should. I don't like the idea of declaring an instance of the XML Reader class inside of MyClass and an MyClass object is meant to be a simple "record" from the database and I feel giving it loads of methods, other object instances is a bit messy. Perhaps my XML reader class should be static but C#'s native XMLReader isn't static.? Any comments would be greatly appreciated Thanks Thomas

    Read the article

  • JQuery methods and DOM properties

    - by Bob Smith
    I am confused as to when I can use the DOM properties and when I could use the Jquery methods on a Jquery object. Say, I use a selector var $elemSel = $('#myDiv').find('[id *= \'select\']') At this point, $elemSel is a jquery object which I understand to be a wrapper around the array of DOM elements. I could get a reference to the DOM elements by iterating through the $elemSel object/array (Correct?) My questions: 1. Is there a way to convert this $elemSel into a non JQuery regular array of DOM elements? 2. Can I combine DOM properties and JQuery methods at the same time (something like this) $elemSel.children('td').nodeName (nodeName is DOM related, children is JQuery related) EDIT: What's wrong with this? $elemSel.get(0).is(':checked') EDIT 2: Thanks for the responses. I understand now that I can use the get(0) to get a DOM element. Additional questions: How would I convert a DOM element to a JQuery object? If I assign "this" to a variable, is that new var DOM or JQuery? If it's JQuery, how can I convert this to a DOM element? (Since I can't use get(0)) var $elemTd = $(this); When I do a assignment like the one above, I have seen some code samples not include the $ sign for the variable name. Why? And as for my original question, can I combine the DOM properties and JQuery functions at the same time on a JQuery object? $elemSel.children('td').nodeName

    Read the article

  • Why doesn't this code work correctly?

    - by MisterSir
    I'm working on a website that displays galleries, using jCarousel. But no matter what I try, I can't get it to work, and I need to finish this by today. I have a very urgent schedule. My code basically takes image URLs from a database and sends them to AJAX, which passes it to jCarousel which makes the gallery. But there are a few problems: It doesn't display correctly! I can only get the last item pulled from the database, and it displays on the bottom-most row. After the item pulled from the database is displayed, the first time I click on "prev" there's no scroll effect, and the item just disappears! Only if I click on "next" 2-3 times there's a scroll effect and the item remains visible. My items are always displayed at the end of the carousel! This is urgent.. Please help me fix this. about.html: <!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" xml:lang="en-us"> <head> <script type="text/javascript" src="jquery-1.4.4.min.js"></script> <script type="text/javascript" src="/lib/jquery.jcarousel.min.js"></script> <link rel="stylesheet" type="text/css" href="/skins/tango/skin.css" /> <!--<style type="text/css"> #wrapper { width: 700px; margin-left: auto; margin-right: auto; } #carousel { margin-top: 120px; padding-left: 120px; } #side { padding-left: 550px; position: absolute; padding-top: 120px; } #hidden { color: #FFFFFF; } </style>--> <script type="text/javascript"> jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; } else if (t < (2.5/2.75)) { return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; } else { return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }; function mycarousel_initCallback(carousel) { jQuery('#mycarousel-next').bind('click', function() { carousel.next(); return false; }); jQuery('#mycarousel-prev').bind('click', function() { carousel.prev(); return false; }); }; jQuery(document).ready(function() { jQuery('#mycarousel').jcarousel({ easing: 'BounceEaseOut', wrap: "first", initCallback: mycarousel_initCallback, animation: 1000, scroll: 3, visible: 3, buttonNextHTML: null, buttonPrevHTML: null }); jQuery('#mycarousel2').jcarousel({ easing: 'BounceEaseOut', animation: 1000, wrap: "first", initCallback: mycarousel_initCallback, scroll: 3, visible: 3, buttonNextHTML: null, buttonPrevHTML: null }); jQuery('#mycarousel3').jcarousel({ easing: 'BounceEaseOut', animation: 1000, scroll: 3, wrap: "first", initCallback: mycarousel_initCallback, visible: 3, buttonNextHTML: null, buttonPrevHTML: null }); }); var prevButton = null; function getObject(b, el) { var currbutton = b; var http; var url = "about.php"; var parameters = "d=carousel&cat=" + currbutton; try { http = new XMLHttpRequest(); } catch(e) { try { http = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { http = new ActiveXObject("Microsoft.XMLHTTP"); } } function getServer() { if (http.readyState == 4) { var i = 0; var liArr = http.responseText; var built = liArr.split(", "); var li = document.createElement("li"); var ul1 = document.getElementById("mycarousel"); var ul2 = document.getElementById("mycarousel2"); var ul3 = document.getElementById("mycarousel3"); if (el != prevButton) { prevButton = el; while (ul1.hasChildNodes() ) {ul1.removeChild(ul1.lastChild);} while (ul2.hasChildNodes() ) {ul2.removeChild(ul2.lastChild);} while (ul3.hasChildNodes() ) {ul3.removeChild(ul3.lastChild);} } else return 0; while (i < (built.length) / 3) { li.innerHTML = built[i]; ul1.appendChild(li); i++; } while (i < ((built.length) / 3)*2) { li.innerHTML = built[i]; ul2.appendChild(li); i++; } while (i < (built.length)) { li.innerHTML = built[i]; ul3.appendChild(li); i++; } } } http.open("POST", url, true); http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http.setRequestHeader("Content-length", parameters.length); http.setRequestHeader("Connection", "close"); http.onreadystatechange = getServer; http.send(parameters); } </script> </head> <body> <span id="hidden"> </span> <div id="wrapper"> <div id="side"> <form name="cats"> <input type="button" value="Hats" onclick="getObject('hats', this);"/><br /> <input type="button" value="Pants" onclick="getObject('pants', this);"/><br /> <input type="button" value="Shirts" onclick="getObject('shirts', this);"/><br /> </form> </div> <div id="carousel"> <ul id="mycarousel" class="jcarousel-skin-tango"> </ul> <ul id="mycarousel2" class="jcarousel-skin-tango"> </ul> <ul id="mycarousel3" class="jcarousel-skin-tango"> </ul> <input type="button" id="mycarousel-prev" value="prev" /> <input type="button" id="mycarousel-next" value="next" /> </div> </div> </body> </html> I commented the CSS because I thought it was giving me trouble, but honestly I have no idea what the hell's going on with jCarousel. about.php: <?php echo "<img width='75' height='75' src='http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg' />, hi, hi, hi, hi, hi, hi, hi, hi"; ?> Also, even if there are no other items than what is displayed, I'm still able to scroll back, but not forward, assumingly because my item is always placed at the end of the carousel. I know it looks like a lot of code but it's really not! My formatting takes a lot of lines, the commented CSS takes a lot, and a lot of the code is HTML and jCarousel configuration, and there's also the BounceEasing effect which takes a few lines. There's not much actual code! So as I said, this is urgent and I need this fixed. But I can't get it to work. Please help me! Thanks for your time! EDIT: I changed the code a bit, but it still does not work. I really need help on this one!! EDIT: I added document.createElement("li"); to each while loop. Now all my items are displayed, but they are displayed vertically and not horizontally on each row. Other than that all other problems are the same. EDIT: Oh and also, in the row my image displays, only the image is there. Maybe jCarousel doesn't accept img and text, I don't know.

    Read the article

  • Routing in Php and decorator pattern

    - by Joey Salac Hipolito
    I do not know if I am using the term 'routing' correctly, but here is the situation: I created an .htaccess file to 'process' (dunno if my term is right) the url of my application, like this : RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] Now I have this : http://appname/controller/method/parameter http://appname/$url[0]/$url[1]/$url[2] What I did is: setup a default controller, in case it is not specified in the url setup a Controller wrapper I did it like this $target = new $url[0]() $controller = new Controller($target) The problem with that one is that I can't use the methods in the object I passed in the constructor of the Controller: I resolved it like this : class Controller { protected $target; protected $view; public function __construct($target, $view) { $this->target = $target; $this->view = $view; } public function __call($method, $arguments) { if (method_exists($this->target, $method)) { return call_user_func_array(array($this->target, $method), $arguments); } } } This is working fine, the problem occurs in the index where I did the routing, here it is if(isset($url[2])){ if(method_exists($controller, $url[1])){ $controller->$url[1]($url[2]) } } else { if(method_exists($controller, $url[1])){ $controller->$url[1]() } } where $controller = new Controller($target) The problem is that the method doesn't exist, although I can use it directly without checking if method exist, how can I resolve this?

    Read the article

  • PHP's openssl_sign generates different signature than SSCrypto's sign

    - by pascalj
    I'm writing an OS X client for a software that is written in PHP. This software uses a simple RPC interface to receive and execute commands. The RPC client has to sign the commands he sends to ensure that no MITM can modify any of them. However, as the server was not accepting the signatures I sent from my OS X client, I started investigating and found out that PHP's openssl_sign function generates a different signature for a given private key/data combination than the Objective-C SSCrypto framework (which is only a wrapper for the openssl lib): SSCrypto *crypto = [[SSCrypto alloc] initWithPrivateKey:self.localPrivKey]; NSData *shaed = [self sha1:@"hello"]; [crypto setClearTextWithData:shaed]; NSData *data = [crypto sign]; generates a signature like CtbkSxvqNZ+mAN... The PHP code openssl_sign("hello", $signature, $privateKey); generates a signature like 6u0d2qjFiMbZ+... (For my certain key, of course. base64 encoded) I'm not quite shure why this is happening and I unsuccessfully experimented with different hash-algorithms. As the PHP documentation states SHA1 is used by default. So why do these two functions generate different signatures and how can I get my Objective-C part to generate a signature that PHPs openssl_verify will accept? Note: I double checked that the keys and the data is correct!

    Read the article

  • Execute function without sending 'self' to it

    - by Sergey
    Is that possible to define a function without referencing to self this way? def myfunc(var_a,var_b) But so that it could also get sender data, like if I defined it like this: def myfunc(self, var_a,var_b) That self is always the same so it looks a little redundant here always to run a function this way: myfunc(self,'data_a','data_b'). Then I would like to get its data in the function like this sender.fields. UPDATE: Here is some code to understand better what I mean. The class below is used to show a page based on Jinja2 templates engine for users to sign up. class SignupHandler(webapp.RequestHandler): def get(self, *args, **kwargs): utils.render_template(self, 'signup.html') And this code below is a render_template that I created as wrapper to Jinja2 functions to use it more conveniently in my project: def render_template(response, template_name, vars=dict(), is_string=False): template_dirs = [os.path.join(root(), 'templates')] logging.info(template_dirs[0]) env = Environment(loader=FileSystemLoader(template_dirs)) try: template = env.get_template(template_name) except TemplateNotFound: raise TemplateNotFound(template_name) content = template.render(vars) if is_string: return content else: response.response.out.write(content) As I use this function render_template very often in my project and usually the same way, just with different template files, I wondered if there was a way to get rid of having to call it like I do it now, with self as the first argument but still having access to that object.

    Read the article

  • Java UnknownHostException When and Why?

    - by interstar
    I'm trying to post to a website from a Processing Sketch. (Processing is basically Java running in a fancy environment). I'm using this library : http://libraries.seltar.org/postToWeb/ but I don't know if that makes a difference. You can see from the stack trace below that this is just a wrapper for the Java standard library. Anyway, the important point is that the host "mysite.com" is up and running. I am seeing it from the browser. But when I try to post to it from Java I just get the UnknownHostException appearing. Given that the site is up. What else might this mean? The program is currently running inside the Processing environment. Presumably as an Applet. java.net.UnknownHostException: mysite.com at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:195) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at sun.net.NetworkClient.doConnect(NetworkClient.java:163) at sun.net.www.http.HttpClient.openServer(HttpClient.java:394) at sun.net.www.http.HttpClient.openServer(HttpClient.java:529) at sun.net.www.http.HttpClient.<init>(HttpClient.java:233) at sun.net.www.http.HttpClient.New(HttpClient.java:306) at sun.net.www.http.HttpClient.New(HttpClient.java:323) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014) at org.seltar.Bytes2Web.PostToWeb._post(PostToWeb.java:90) at org.seltar.Bytes2Web.ByteToWeb.post(ByteToWeb.java:66) at experimentPostToWeb.keyPressed(experimentPostToWeb.java:35) at processing.core.PApplet.handleKeyEvent(Unknown Source) at processing.core.PApplet.dequeueKeyEvents(Unknown Source) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:662)

    Read the article

  • SQL Server getdate() to a string like "2009-12-20"

    - by Adam Kane
    In Microsoft SQL Server 2005 and .NET 2.0, I want to convert the current date to a string of this format: "YYYY-MM-DD". For example, December 12th 2009 would become "2009-12-20". How do I do this in SQL. The context of this SQL statement in the table definiton. In other words, this is the default value. So when a new record is created the default value of the current date is stored as a string in the above format. I'm trying: SELECT CONVERT(VARCHAR(10), GETDATE(), 102) AS [YYYY.MM.DD] But SQL server keeps converting that to: ('SELECT CONVERT(VARCHAR(10), GETDATE(), 102) AS [YYYY.MM.DD]') so the result is just: 'SELECT CONVERT(VARCHAR(10), GETDATE(), 102) AS [YYYY.MM.DD]' Here's a screen shot of what the Visual Studio server explorer, table, table definition, properties shows: These wrapper bits are being adding automatically and converting it all to literal string: (N' ') Here's the reason I'm trying to use something other than the basic DATETIME I was using previously: This is the error I get when hooking everything to an ASP.NET GridView and try to do an update via the grid view: Server Error in '/' Application. The version of SQL Server in use does not support datatype 'date'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: The version of SQL Server in use does not support datatype 'date'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [ArgumentException: The version of SQL Server in use does not support datatype 'date'.] Note: I've added a related question to try to get around the SQL Server in use does not support datatype 'date' error so that I can use a DATETIME as recommended.

    Read the article

  • Java: extending Object class

    - by Fabio F.
    Hello, I'm writing (well, completing) an "extension" of Java which will help role programming. I translate my code to Java code with javacc. My compilers add to every declared class some code. Here's an example to be clearer: MyClass extends String implements ObjectWithRoles { //implements... is added /*Added by me */ public setRole(...){...} public ... /*Ends of stuff added*/ ...//myClass stuff } It adds Implements.. and the necessary methods to EVERY SINGLE CLASS you declare. Quite rough, isnt'it? It will be better if I write my methods in one class and all class extends that.. but.. if class already extends another class (just like the example)? I don't want to create a sort of wrapper that manage roles because i don't want that the programmer has to know much more than Java, few new reserved words and their use. My idea was to extends java.lang.Object.. but you can't. (right?) Other ideas? I'm new here, but I follow this site so thank you for reading and all the answers you give! (I apologize for english, I'm italian)

    Read the article

  • PHP/MySQL - Working with two databases, one shared and one local to an instance of application

    - by Extrakun
    The situation: Using a off-the-shelf PHP application, I have to add in a new module for extra functionality. Today, it is made known that eventually four different instances of the application are to be deployed, but the data from the new functionality is to be shared among those 4 instances. Each instance should still have their own database for users, content and etc. So the data for the new functionality goes into a 'shared' database. The data for the application (user login, content, uploads) go into a 'local' database To make things more complex, the new module I am writing will fetch data from the local DB and the shared DB at the same time. A re-write of the base application will take too long. I only have control over the new module which I am writing. The ideal solution: Is there a way to encapsulate 2 databases into one name using MySQL? I do not wish to switch DB connections or specifically name the DB to query from inside my SQL statements. The application uses a DB wrapper, so I am able to change it somehow so I can invisibly attempt to read/write to two different DB. What is the best way to handle this problem?

    Read the article

  • Adding select menu default value via JS?

    - by purpler
    Hi, i'm developing a meta search engine website, Soogle and i've used JS to populate select menu.. Now, after the page is loaded none of engines is loaded by default, user needs to select it on his own or [TAB] to it.. Is there a possibility to preselect one value from the menu via JS after the page loads? This is the code: Javascript: // SEARCH FORM INIT function addOptions(){ var sel=document.searchForm.whichEngine;for(var i=0;i<arr.length;i++){ sel.options[i]=new Option(arr[i][0],i)}} function startSearch(){ searchString=document.searchForm.searchText.value;if(searchString!=""){ var searchEngine=document.searchForm.whichEngine.selectedIndex; var finalSearchString=arr[searchEngine][1]+searchString;location.href=finalSearchString}return false} function checkKey(e){ var character=(e.which)?e.which:event.keyCode;if(character=='13'){ return startSearch()}} // SEARCH ENGINES INIT var arr = new Array(); arr[arr.length] = new Array("Web", "http://www.google.com/search?q="); arr[arr.length] = new Array("Images", "http://images.google.com/images?q="); arr[arr.length] = new Array("Knoweledge","http://en.wikipedia.org/wiki/Special:Search?search="); arr[arr.length] = new Array("Videos","http://www.youtube.com/results?search_query="); arr[arr.length] = new Array("Movies", "http://www.imdb.com/find?q="); arr[arr.length] = new Array("Torrents", "http://thepiratebay.org/search/"); HTML: <body onload="addOptions();document.forms.searchForm.searchText.focus()"> <div id="wrapper"> <div id="logo"></div> <form name="searchForm" method="POST" action="javascript:void(0)"> <input name="searchText" type="text" onkeypress="checkKey(event);"/> <span id="color"></span> <select tabindex="1" name="whichEngine" selected="Web"></select> <br /> <input tabindex="2" type="button" onClick="return startSearch()" value="Search"/> </form> </div> </body>

    Read the article

  • How can I receive mouse events when a wrapped control has set capture?

    - by Greg
    My WndProc isn't seeing mouse-up notifications when I click with a modifier key (shift or control) pressed. I see them without the modifier key, and I see mouse-down notifications with the modifier keys. I'm trying to track user actions in a component I didn't write, so I'm using the Windows Forms NativeWindow wrapper (wrapping the component) to get Windows messages from the WndProc() method. I've tried tracking the notifications I do get, and I the only clue I see is WM_CAPTURECHANGED. I've tried calling SetCapture when I receive the WM_LBUTTONDOWN message, but it doesn't help. Without modifier (skipping paint, timer and NCHITTEST messages): WM_PARENTNOTIFY WM_MOUSEACTIVATE WM_MOUSEACTIVATE WM_SETCURSOR WM_LBUTTONDOWN WM_SETCURSOR WM_MOUSEMOVE WM_SETCURSOR WM_LBUTTONUP With modifier (skipping paint, timer and NCHITTEST messages): WM_KEYDOWN WM_PARENTNOTIFY WM_MOUSEACTIVATE WM_MOUSEACTIVATE WM_SETCURSOR WM_LBUTTONDOWN WM_SETCURSOR (repeats) WM_KEYDOWN (repeats) WM_KEYUP If I hold the mouse button down for a long time, I can usually get a WM_LBUTTONUP notification, but it should be possible to make it more responsive.. Edit: I've tried control-clicking outside of the component of interest and moving the cursor into it before releasing the mouse button, and then I do get a WM_LBUTTONUP notification, so it looks like the component is capturing the mouse on mouse-down. Is there any way to receive that notification when another window has captured the mouse? Thanks.

    Read the article

  • Enum "copy" problem

    - by f0b0s
    Hi all! I have a class, let's call it A. It has a enum (E) and a method Foo(E e), with gets E in the arguments. I want to write a wrapper (decorator) W for A. So it'll have its own method Foo(A::E). But I want to have some kind of encapsulation, so this method should defined as Foo(F f), where F is another enum defined in W, that can be converted to A::E. For example: class A { public: enum E { ONE, TWO, THREE }; void Foo(E e); }; class B { //enum F; // ??? void Foo(F f) { a_.Foo(f); } private: A a_; }; How F should be defined? I don't want to copy value like this: enum F { ONE = A::ONE, TWO = A::TWO, THREE = A::THREE }; because its a potential error in the near feature. Is the typedef definition: typedef A::E F; is the best decision? Is it legal?

    Read the article

  • Is there a safe / standard way to manage unstructured memory in C++?

    - by andand
    I'm building a toy VM that requires a block of memory for storing and accessing data elements of different types and of different sizes. I've done this by writing a wrapper class around a uint8_t[] data block of the needed size. That class has some template methods to write / read typed data elements to / from arbitrary locations in the memory block, both of which check to make certain the bounds aren't violated. These methods use memmove in what I hope is a more or less safe manner. That said, while I am willing to press on in this direction, I've got to believe that other with more expertise have been here before and might be willing to share their wisdom. In particular: 1) Is there a class in one of the C++ standards (past, present, future) that has been defined to perform a function similar to what I have outlined above? 2) If not, is there a (preferably free as in beer) library out there that does? 3) Short of that, besides bounds checking and the inevitable issue of writing one type to a memory location and reading a different from that location, are there other issues I should be aware of? Thanks.-&&

    Read the article

  • __toString magic and type coercion

    - by TomcatExodus
    I've created a Template class for managing views and their associated data. It implements Iterator and ArrayAccess, and permits "sub-templates" for easy usage like so: <p><?php echo $template['foo']; ?></p> <?php foreach($template->post as $post): ?> <p><?php echo $post['bar']; ?></p> <?php endforeach; ?> Anyways, rather than using inline core functions, such as hash() or date(), I figured it would be useful to create a class called TemplateData, which would act as a wrapper for any data stored in the templates. This way, I can add a list of common methods for formatting, for example: echo $template['foo']->asCase('upper'); echo $template['bar']->asDate('H:i:s'); //etc.. When a value is set via $template['foo'] = 'bar'; in the controllers, the value of 'bar' is stored in it's own TemplateData object. I've used the magic __toString() so when you echo a TemplateData object, it casts to (string) and dumps it's value. However, despite the mantra controllers and views should not modify data, whenever I do something like this: $template['foo'] = 1; echo $template['foo'] + 1; //exception It dies on a Object of class TemplateData could not be converted to int; Unless I recast $template['foo'] to a string: echo ((string) $template['foo']) + 1; //outputs 2 Sort of defeats the purpose having to jump through that hoop. Are there any workarounds for this sort of behavior that exist, or should I just take this as it is, an incidental prevention of data modification in views?

    Read the article

  • maven assemblies. Putting each dependency with transitive dependencies in own directory?

    - by jr
    I have a maven project which consists of a few modules. This is to be deployed on a client machine and will involve installing Tomcat and will make use of NSIS for installer. There is a separate application which monitors tomcat and can restart it, perform updates, etc. So, I have the modules setup as follows: project +-- client (all code, handlers, for the war) +-- client-common - (shared code, shared between monitor and client) +-- client-web - (the war, basically just uses war has applicationcontext, web.xml,etc) +-- monitor - (the monitor application jar. Uses wrapper to run) So, I need to create an installer. I was planning on creating another module which would be the installer. This is where I would have tomcat directory and I'd like maven to "assemble" everything and then run NSIS so I can create the final installer. However, I need to have the monitor jar file in a directory and then have all monitors dependencies in a lib/ directory. The final directory structure should be: project-installer-directory/monitor/monitor-version.jar project-installer-directory/monitor/lib/monitor-dep-1.jar project-installer-directory/monitor/lib/monitor-dep-2.jar project-installer-directory/monitor/lib/monitor-dep-3.jar project-installer-directory/webapps/client-web.war Where in the client-web\WEB-INF\lib directory we will have all client-web's dependencies after it is exploded. That works, I have the .war file. What I am having problems with is getting the monitor module dependencies independent of the dependencies of the client-web module. I tried to just create the installer module and make the monitor and client-web dependencies, but when I use dependencies-copy it gives me everything. Not what I want. I'm leaning towards creating a new module called monitor-assembly or something to give me a zip file which contains the directory format I need, but that is yet another module. Can someone please help me with the correct way to accomplish this? thanks!

    Read the article

  • PHP: SimpleXML and Arrays

    - by acemasta
    When I run this code: foreach($xml->movie as $movie) { if(isset($movie->photos)) { foreach ($movie->photos as $photo) { echo $photo."&nbsp;"; } echo "<hr/>"; } } I get nice output of the actual data, e.g. a row looks like 06397001.jpg 06397002.jpg 06397003.jpg 06397004.jpg 06397005.jpg But when I throw it in an array, it includes all the SimpleXML wrapper tags and the jpgs are not at the root of the array. code: foreach($xml->movie as $movie) { if(isset($movie->photos)) { $photos = array(); foreach ($movie->photos as $photo) { $photos[] = $photo; } } else $photos = ""; var_dump($photos); echo "<hr />"; } e.g. same row looks like array(5) { [0]= object(SimpleXMLElement)#11 (1) { [0]= string(12) "06397001.jpg" } [1]= object(SimpleXMLElement)#12 (1) { [0]= string(12) "06397002.jpg" } [2]= object(SimpleXMLElement)#13 (1) { [0]= string(12) "06397003.jpg" } [3]= object(SimpleXMLElement)#14 (1) { [0]= string(12) "06397004.jpg" } [4]= object(SimpleXMLElement)#15 (1) { [0]= string(12) "06397005.jpg" } } Why is this happening/how can I remove this so I just get an array of the photos at root level like when I echo it? Thanks, sorry for the single line code formatting; was messing up when I tried to paste directly with line breaks.

    Read the article

  • Accessing global variable in multithreaded Tomcat server

    - by jwegan
    I have a singleton object that I construct like thus: private static volatile KeyMapper mapper = null; public static KeyMapper getMapper() { if(mapper == null) { synchronized(Utils.class) { if(mapper == null) { mapper = new LocalMemoryMapper(); } } } return mapper; } The class KeyMapper is basically a synchronized wrapper to HashMap with only two functions, one to add a mapping and one to remove a mapping. When running in Tomcat 6.24 on my 32bit Windows machine everything works fine. However when running on a 64 bit Linux machine (CentOS 5.4 with OpenJDK 1.6.0-b09) I add one mapping and print out the size of the HashMap used by KeyMapper to verify the mapping got added (i.e. verify size = 1). Then I try to retrieve the mapping with another request and I keep getting null and when I checked the size of the HashMap it was 0. I'm confident the mapping isn't accidentally being removed since I've commented out all calls to remove (and I don't use clear or any other mutators, just get and put). The requests are going through Tomcat 6.24 (configured to use 200 threads with a minimum of 4 threads) and I passed -Xnoclassgc to the jvm to ensure the class isn't inadvertently getting garbage collected (jvm is also running in -server mode). I also added a finalize method to KeyMapper to print to stderr if it ever gets garbage collected to verify that it wasn't being garbage collected. I'm at my wits end and I can't figure out why one minute the entry in HashMap is there and the next it isn't :(

    Read the article

  • How do I do MongoDB console-style queries in PHP?

    - by Zoe Boles
    I'm trying to get a MongoDB query from the javascript console into my PHP app. What I'm trying to avoid is having to translate the query into the PHP "native driver"'s format... I don't want to hand build arrays and hand-chain functions any more than I want to manually build an array of MySQL's internal query structure just to get data. I already have a string producing the exact content I want in the Mongo console: db.intake.find({"processed": {"$exists": "false"}}).sort({"insert_date": "1"}).limit(10); The question is, is there a way for me to hand this string, as is, to MongoDB and have it return a cursor with the dataset I request? Right now I'm at the "write your own parser because it's not valid json to kinda turn a subset of valid Mongo queries into the format the PHP native driver wants" state, which isn't very fun. I don't want an ORM or a massive wrapper library; I just want to give a function my query string as it exists in the console and get an Iterator back that I can work with. I know there are a couple of PHP-based Mongo manager applications that apparently take console-style queries and handle them, but initial browsing through their code, I'm not sure how they handle the translation. I absolutely love working with mongo in the console, but I'm rapidly starting to loathe the thought of converting every query into the format the native writer wants...

    Read the article

  • fastest way to crawl recursive ntfs directories in C++

    - by Peter Parker
    I have written a small crawler to scan and resort directory structures. It based on dirent(which is a small wrapper around FindNextFileA) In my first benchmarks it is surprisingy slow: around 123473ms for 4500 files(thinkpad t60p local samsung 320 GB 2.5" HD). 121481 files found in 123473 milliseconds Is this speed normal? This is my code: int testPrintDir(std::string strDir, std::string strPattern="*", bool recurse=true){ struct dirent *ent; DIR *dir; dir = opendir (strDir.c_str()); int retVal = 0; if (dir != NULL) { while ((ent = readdir (dir)) != NULL) { if (strcmp(ent->d_name, ".") !=0 && strcmp(ent->d_name, "..") !=0){ std::string strFullName = strDir +"\\"+std::string(ent->d_name); std::string strType = "N/A"; bool isDir = (ent->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=0; strType = (isDir)?"DIR":"FILE"; if ((!isDir)){ //printf ("%s <%s>\n", strFullName.c_str(),strType.c_str());//ent->d_name); retVal++; } if (isDir && recurse){ retVal += testPrintDir(strFullName, strPattern, recurse); } } } closedir (dir); return retVal; } else { /* could not open directory */ perror ("DIR NOT FOUND!"); return -1; } }

    Read the article

  • Need help make these classes use Visitor Pattern and generics

    - by Shervin
    Hi. I need help to generify and implement the visitor pattern. We are using tons of instanceof and it is a pain. I am sure it can be modified, but I am not sure how to do it. Basically we have an interface ProcessData public interface ProcessData { public setDelegate(Object delegate); public Object getDelegate(); //I am sure these delegate methods can use generics somehow } Now we have a class ProcessDataGeneric that implements ProcessData public class ProcessDataGeneric implements ProcessData { private Object delegate; public ProcessDataGeneric(Object delegate) { this.delegate = delegate; } } Now a new interface that retrieves the ProcessData interface ProcessDataWrapper { public ProcessData unwrap(); } Now a common abstract class that implements the wrapper so ProcessData can be retrieved @XmlSeeAlso( { ProcessDataMotorferdsel.class,ProcessDataTilskudd.class }) public abstract class ProcessDataCommon implements ProcessDataWrapper { protected ProcessData unwrapped; public ProcessData unwrap() { return unwrapped; } } Now the implementation public class ProcessDataMotorferdsel extends ProcessDataCommon { public ProcessDataMotorferdsel() { unwrapped = new ProcessDataGeneric(this); } } similarly public class ProcessDataTilskudd extends ProcessDataCommon { public ProcessDataTilskudd() { unwrapped = new ProcessDataGeneric(this); } } Now when I use these classes, I always need to do instanceof ProcessDataCommon pdc = null; if(processData.getDelegate() instanceof ProcessDataMotorferdsel) { pdc = (ProcessDataMotorferdsel) processData.getDelegate(); } else if(processData.getDelegate() instanceof ProcessDataTilskudd) { pdc = (ProcessDataTilskudd) processData.getDelegate(); } I know there is a better way to do this, but I have no idea how I can utilize Generics and the Visitor Pattern. Any help is GREATLY appreciated.

    Read the article

< Previous Page | 62 63 64 65 66 67 68 69 70 71 72 73  | Next Page >