Search Results

Search found 5586 results on 224 pages for 'global illumination'.

Page 82/224 | < Previous Page | 78 79 80 81 82 83 84 85 86 87 88 89  | Next Page >

  • ffmpeg works on terminal not with PHP exec

    - by goliatone
    If I execute a ffmpeg command from terminal, I get the desired result: ffmpeg -i src.mp4 -ar 22050 -ab 32 -f flv -s 320x240 video.flv Terminal's output ... video:3404kB audio:1038kB global headers:0kB muxing overhead 2.966904% Then, if called via PHP exec: exec("ffmpeg -i src.mp4 -ar 22050 -ab 32 -f flv -s 320x240 video.flv", $o, $v); var_dump($o); var_dump($v); the output is: array(0) { } int(1) Any thoughts on how to approach this?

    Read the article

  • ASA5505 Novice. Setting up Outside/Inside/and DMZ as Guest Network

    - by GriffJ
    I need a little help in developing a config for our ASA5505. I'm an MCSA/MCITPAS but I don't have a lot of practical cisco experience. Here is what I need help with, we currently have a PIX as our boarder gateway and well it's antiquated and it only has a 50 user license which means I'm constantly clearing local-host throughout the day as people complain. I discovered that the last IT person bought at couple ASA5505s and they've been sitting in the back of a cupboard. So far I've duplicated the configuration from the pix to the asa but as I was going to be going this far I thought I'd go further and remove another old cisco router that was used only for the guest network, I know the asa can do both jobs. So I'm going to paste a scenario I wrote up with the actual IPs changed to protect the innocent. ... Outside Network: 1.2.3.10 255.255.255.248 (we have a /29) Inside Network: 10.10.36.0 255.255.252.0 DMZ Network: 192.168.15.0 255.255.255.0 Outside Network on e0/0 DMZ Network on e0/1 Inside Network on e0/2-7 DMZ Network has DHCPD Enabled. DMZ DHCPD Pool is 192.168.15.50-192.168.15.250 DMZ Network needs to be able to see DNS on Inside Network at 10.10.37.11 and 10.10.37.12 DMZ Network needs to be able to access webmail on inside network at 10.10.37.15 DMZ Network needs to be able to access business website on inside network at 10.10.37.17 DMZ Network needs to be able to access the outside network (access to the internet). Inside Network has NO DHCPD. (dhcp is handled by domain controller) Inside Network needs to be able to see anything on the DMZ network. Inside Network needs to be able to access the outside network (access to the internet). There is some access-list stuff already, some static mapping already. Maps external IPs from our ISP to our inside server IPs static (inside,outside) 1.2.3.11 10.10.37.15 netmask 255.255.255.255 static (inside,outside) 1.2.3.12 10.10.37.17 netmask 255.255.255.255 static (inside,outside) 1.2.3.13 10.10.37.20 netmask 255.255.255.255 Allows access to our Webserver/Mailserver/VPN from the Outside. access-list 108 permit tcp any host 1.2.3.11 eq https access-list 108 permit tcp any host 1.2.3.11 eq smtp access-list 108 permit tcp any host 1.2.3.11 eq 993 access-list 108 permit tcp any host 1.2.3.11 eq 465 access-list 108 permit tcp any host 1.2.3.12 eq www access-list 108 permit tcp any host 1.2.3.12 eq https access-list 108 permit tcp any host 1.2.3.13 eq pptp Here is all the NAT and route stuff I have so far. global (outside) 1 interface global (outside) 2 1.2.3.11-1.2.3.14 netmask 255.255.255.248 nat (inside) 1 0.0.0.0 0.0.0.0 nat (dmz) 1 0.0.0.0 0.0.0.0 route outside 0.0.0.0 0.0.0.0 1.2.3.9 1

    Read the article

  • SQL Server Full Text Search resource consumption

    - by Sam Saffron
    When SQL Server builds a fulltext index computer resources are consumed (IO/Memory/CPU) Similarly when you perform full text searches, resources are consumed. How can I get a gauge over a 24 hour period of the exact amount of CPU and IO(reads/writes) that fulltext is responsible for, in relation to global SQL Server resource usage. Are there any perfmon counters, DMVs or profiler traces I can use to help answer this question?

    Read the article

  • Google DNS Same Entry Different Results

    - by Henrik P. Hessel
    Why is this happening? The Rootserver returns a wrong entry I fixed containing 5269.XXX.com. instead of 5269 XXX.com. Macbook @ Home ; <<>> DiG 9.6.0-APPLE-P2 <<>> @8.8.8.8 srv _xmpp-server._tcp.XXX.com. ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18412 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;_xmpp-server._tcp.XXX.com. IN SRV ;; ANSWER SECTION: _xmpp-server._tcp.XXX.com. 64328 IN SRV 10 0 5269 XXX.com. ;; Query time: 21 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Tue Dec 28 03:16:45 2010 ;; MSG SIZE rcvd: 86 Rootserver ; <<>> DiG 9.6-ESV-R1 <<>> @8.8.8.8 srv _xmpp-server._tcp.XXX.com. ; (1 server found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 27240 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;_xmpp-server._tcp.XXX.com. IN SRV ;; ANSWER SECTION: _xmpp-server._tcp.XXX.com. 52139 IN SRV 0 10 0 5269.XXX.com. ;; Query time: 7 msec ;; SERVER: 8.8.8.8#53(8.8.8.8) ;; WHEN: Tue Dec 28 03:23:23 2010 ;; MSG SIZE rcvd: 91

    Read the article

  • Can the OS X unlock panel trigger a login hook similar to loginwindow?

    - by Allen
    I'd like to automatically run a shell script every time I authenticate onto my computer. However, all the info I can find about loginhook and Global LoginItems applies only when authenticating to "loginwindow," and not to the "unlock panel." The unlock panel prompts for a password when waking up from sleep or from a locked screen. Is there any way to trigger script execution after successfully unlocking the screen?

    Read the article

  • Run AIR Debug Launcher (ADL) without a GUI for continuous build on Hudson CI and xvnc plugin

    - by jensendarren
    I cannot seem to get a headless FlexUnit build to run in Hudson CI + xvnc plugin on Ubuntu 9.04. Here is what I have tried: compiled using -use-network=false switch added Global Flash Player Trust file /var/lib/hudson/.macromedia/Flash_Player/#Security/FlashPlayerTrust/security.cfg (with the content /) commented out the last line "twm &" from /var/lib/hudson/.vnc/xstartup

    Read the article

  • Exchange 2003 mailbox migrated to 2010 not showing up in Address book

    - by TJ
    I have migrated about 45 mailboxes at this point from our single instance of Exchange 2003 to a High Availability Exchange 2010 environment successfully. However one mailbox moved successfully and the user is able to send and receive e-mail internally and externally with no problems but they do not show up in the Global Address List. The OAB is owned by an Exchange 2010 mailbox server. What am I missing?

    Read the article

  • Laptop Backup Synch to the Data Center Without VPN

    - by Sameer
    We would like to synchronize our users or backup their laptops to the data center – looking for suggestions/alternatives to synch them to the data center where they don’t have to know about it. Blue sky like to haves: • Don’t want VPN but needs to secure • Admin can access all files • Global dedup • Select file types only – MS Office, PSTs, PDFs • Incremental change only • Right now 60 users but needs to scale (all Windows7 64 bit) • Can allocate budget if have to Don’t mean to be vague but hoping to get some proven places to start.

    Read the article

  • linux multipath routing load balance

    - by user52883
    I would like to know how to load balance two Business DLS links which have fixed IPs. I believe it would look something like this: ip route add default scope global \ nexthop via gatewayDLS1 dev interface1 weight 1 \ nexthop via gatewayDLS2 dev interface2 weight 1 Is this be all I need in order to get multipath routing? Please, give me a more detailed answer if possible, thanks you.

    Read the article

  • Load balancers, multiple data centers and url based routing

    - by kunkunur
    There is one data center - dc1. There is a business need to setup another data center - dc2 in another geography and there might be more in the future say dc3. Within the data center dc1: There are two web servers say WS1 and WS2. These two webservers do not share anything currently. There isnt any necessity foreseen to have more webservers within each dc. dc1 also has a local load balancer which has been setup with session stickiness. So if a user say u1 lands on dc1 and if the load balancer decides to route his first request to WS1 then from there on all u1's requests will get routed to WS1. Local load balancer and webservers are invisible to the user. Local load balancer listens to the traffic on a virtual ip which is assigned to the virtual cluster of webservers ws1 and ws2. Virtual ip is the ip to which the host name is resolved to in the DNS. There are no client specific subdomains as of now instead there is a client specific url(context). ex: www.example.com/client1 and www.example.com/client2. Given above when dc2 is onboarded I want to route the traffic between dc1 and dc2 based on the client. The options that I have found so far are. Have client specific subdomains e.g. client1.example.com and client2.example.com and assign each of them with the virtual ip of the data center to which I want to route them. or Assign www.example.com and www1.example.com to first dc i.e. dc1 and assign www2.example.com to dc2. All requests will first get routed to dc1 where WS1 and WS2 will redirect the user to www1.example.com or www2.example.com based on whether the url ends with /client1 or /client2. I need help in the following If I setup a global load balancer between dc1 and dc2 do I have any alternative solutions. That is, can a global load balancer route the traffic based on the url ? Are there drawbacks to subdomain based solutions compared to www1 solution? With www1 solution I am worried that it creates a dependency on dc1 atleast for the first request and the user will see that he is getting redirected to a different url.

    Read the article

  • OS X: How to force traffic through a specific SOCKS proxy on a per-app basis?

    - by GJ.
    I'm running a certain desktop app (actually via AIR if it makes any difference) which doesn't have any built-in proxy configuration settings. I need to get all traffic just from this app directed through a secure SOCKS proxy. This implies I can't use the global network preferences, as these would affect many other apps. Is there any way to force all network communication through a given SOCKS proxy on a per-app basis?

    Read the article

  • Addig a second samba server to windows domain

    - by Eric
    Hi, I'm trying to add a second samba server (stand alone) to our windows domain, managed by a Samba server, but we've had some problems, we see the server and the shares, but cannot access the shares. We decided to start with minimal configuration. [global] netbios name = GINGER wins server = 192.168.0.2 workgroup = DOMAIN1 os level = 20 security = share passdb backend = tdbsam preferred master = no domain master = no [data] comment = Data path = /home/data guest only = Yes Again trying to access the share gives permissions error. Thanks,

    Read the article

  • Restarting or stopping apache results in waiting forever

    - by steko
    I have two simple WSGI apps running on top of mod_wsgi and apache2 on a test development server. There is no mod_python on this machine. The WSGI configuration is as follows WSGIDaemonProcess tops stack-size=524288 maximum-requests=5 WSGIScriptAlias /tops /home/ubuntu/tops-cloud/tops.wsgi <Directory /home/ubuntu/tops-cloud> WSGIProcessGroup tops WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all </Directory> WSGIDaemonProcess flaskal maximum-requests=5 WSGIScriptAlias /c14 /home/ubuntu/c14/flaskal/flaskal.wsgi <Directory /home/ubuntu/c14/flaskal> WSGIProcessGroup flaskal WSGIApplicationGroup %{GLOBAL} Order deny,allow Allow from all </Directory> If I make changes to the app, I need to restart the web server, so I would expect that a simple sudo service apache2 restart does what I need. Same goes for any changes to the config (e.g. number of maximum requests, etc). Instead, it never ends "waiting", like this: $ sudo service apache2 restart * Restarting web server apache2 ... waiting .................................................. until I just do CTRL-C. At that point, the only way to resume a working server is to kill the process and restart it, not very convenient. The same happens with the stop command. The error logs at the "debug" level show the following lines after a failed restart [Wed Nov 14 21:55:19 2012] [notice] caught SIGTERM, shutting down [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=9047): Shutdown requested 'tops'. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=9047): Stopping process 'tops'. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=9047): Destroying interpreters. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=9047): Cleanup interpreter ''. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=9047): Terminating Python. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=8920): Shutdown requested 'flaskal'. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=8920): Stopping process 'flaskal'. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=8920): Destroying interpreters. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=8920): Cleanup interpreter ''. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=8920): Terminating Python. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=8920): Python has shutdown. [Wed Nov 14 21:55:19 2012] [info] mod_wsgi (pid=9047): Python has shutdown. If I then try to restart again (with the process still running), I get the following error: * Restarting web server apache2 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Action 'start' failed. The Apache error log may have more information. Unfortunately the Apache error log doesn't have anything. When apache2 is running properly, both apps work without any problem.

    Read the article

  • URL Based Internal Redirecting

    - by bculverscate
    Basically, we have one external IP address, several servers internally and want to redirect to each internal server based on request URL. We do not want to install another piece of hardware to do this for us but we have a firewall running Linux that currently forwards to only one of the internal servers. Example of our setup can be seen here: http://img23.imageshack.us/img23/5469/drawing1br.jpg NOTE: domain.com does not point to this box nor would we like it to. Subdomains are pointed manually to our global IP address.

    Read the article

  • emacs for sys admins

    - by mbac32768
    Are you a sys admin that uses emacs? What tools/plugins do you find essential? In my organization the programmers tend to use emacs whereas the sys admins gravitate towards vim. Since we have 4:1 programmers:sys admins, the global emacs config has a lot more goodness but it doesn't fit nicely into my workflow since I'm used to starting/stopping vim on remote hosts 1000 times a day Does emacs have a place in your sys admin workflow?

    Read the article

  • When and how often to start connection to database in php?

    - by AndHeiberg
    When and how often is it good practice to start the connection to your database in php? I'm new to databases, and I'm wondering when I should start by database connection. I'm creating a api with an index, controllers and model. Should I start the connection in the index and then pass it to all the other files, start the connection at the top of all files and call it as a global in functions as needed or start and end the connection in every function?

    Read the article

  • Apache: scope for environmental variables

    - by Anonymous
    While there's documentation available on Apache environmental variables, I can not find answer to one important question. Imagine I use rewrite rules to set environmental variable RewriteRule ... ... [E=something:1] What is the scope of "something" - global Apache server (this means "something" will be available for other request transactions), this request (means that "something" is only valid for THIS http request (and its related processing - but what's about internal redirects and other internal stuff - are they considered as THIS request, or another one?), and may be set differently within another (concurrent) request?

    Read the article

  • Windows TCP timeout

    - by hs2d
    Is there on windows any default timeout for tcp connection? So when no answere is received the connection would be closed. Why im asking is that on one machine the connection is closed afther 5 minutes.(Windows XP) Running the same client - server connection on other machine the connection is kept open forever like it should be. Or maybe there is some global java virtual machine setting somewhere i should know about? The server and client run on the same local machine

    Read the article

  • Git: can I store known repository in the repository?

    - by 0x6adb015
    I am setting up a Git repository. I know you can add repositories using git config --global, but is there a way that those known repositories gets cloned by users? For example, I add git://X/mobility.git as X to the repo (somehow), a user clone it from git://Y, but then can do git push X without previously doing the git config ?

    Read the article

  • ASP.NET MVC - Views location Problem : The view 'Index' or its master was not found

    - by user326873
    Hi all, I've create an asp.net MVC 2 project, it works fine!! I've been asked to integrate the project in an existing web project in classic asp.net (I've add the folder containing the source, and not make a new project, because they have to bee in same project) I've configured my web.config file <pages pageBaseType="System.Web.UI.Page" > <controls> <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </controls> <namespaces> <add namespace="System.Web.Mvc" /> <add namespace="System.Web.Mvc.Ajax" /> <add namespace="System.Web.Mvc.Html" /> <add namespace="System.Web.Routing" /> <add namespace="System.Linq" /> <add namespace="System.Collections.Generic" /> <add namespace="SearchApp.Helpers.CheckBoxList"/> <add namespace="SearchApp.Helpers.Pager"/> </namespaces> </pages> <httpModules> <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </httpModules> <!--- END MVC config section--> and my global.asax file (I'm working under IIS 5.1) : public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "SearchApp", // Route name "SearchApp/{controller}.aspx/{action}/{id}", // URL with parameters new { controller = "Search", action = "Index", id = "" } // Parameter defaults ); } protected void Application_Start(Object sender, EventArgs e) { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } The hierarchy of the project is (I can’t find how to insert Image in the post): +Project ++MVC2AppFolder +++Controller ++++SearchController.cs +++Views ++++Search +++++Index.aspx ++global.asax ++web.config as you can see the global.asax is not in the MVC App folder when I try to access the page Search/index.aspx using this url http://localhost/cstfwsrv/SearchApp/Search.aspx/Index[^] have the following error : I The view 'Index' or its master was not found. The following locations were searched: ~/Views/Search/Index.aspx ~/Views/Search/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx 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.InvalidOperationException: The view 'Index' or its master was not found. The following locations were searched: ~/Views/Search/Index.aspx ~/Views/Search/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx 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: [InvalidOperationException: The view 'Index' or its master was not found. The following locations were searched: ~/Views/Search/Index.aspx ~/Views/Search/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx] System.Web.Mvc.ViewResult.FindView(ControllerContext context) +253553 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +139 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +10 System.Web.Mvc.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +251 System.Web.Mvc.<>c__DisplayClass16.<InvokeActionResultWithFilters>b__13() +19 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +178 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +314 System.Web.Mvc.Controller.ExecuteCore() +105 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +39 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +34 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +59 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +44 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +7 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8677678 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 As you can see he search for the Index.aspx page under ~/Views/Search/Index.aspx , wich is under ~/MVC2AppFolder/Views/Search/Index.aspx Is there a way to set in the Route Method, or any where else, the View Path? Thanks’ in advance

    Read the article

  • Nested While Loop for mysql_fetch_array not working as I expected

    - by Ayush Saraf
    I m trying to make feed system for my website, in which i have got i data from the database using mysql_fetch_array system and created a while loop for mysql_fetch_array and inside tht loop i have repeated the same thing again another while loop, but the problem is that the nested while loop only execute once and dont repeat the rows.... here is the code i have used some function and OOP but u will get wht is the point! i thought of an alternative but not yet tried vaz i wanna the way out this way only i.e. using a for loopo insted of while loop that mite wrk... public function get_feeds_from_my_friends(){ global $Friends; global $User; $friend_list = $Friends->create_friend_list_ids(); $sql = "SELECT feeds.id, feeds.user_id, feeds.post, feeds.date FROM feeds WHERE feeds.user_id IN (". $friend_list. ") ORDER BY feeds.id DESC"; $result = mysql_query($sql); while ($rows = mysql_fetch_array($result)) { $id = $rows['user_id']; $dp = $User->user_detail_by_id($id, "dp"); $user_name = $User->full_name_by_id($id); $post_id = $rows['id']; $final_result = "<div class=\"sharedItem\">"; $final_result .= "<div class=\"item\">"; $final_result .= "<div class=\"imageHolder\"><img src=\"". $dp ."\" class=\"profilePicture\" /></div>"; $final_result .= "<div class=\"txtHolder\">"; $final_result .= "<div class=\"username\"> " . $user_name . "</div>"; $final_result .= "<div class=\"userfeed\"> " . $rows['post'] . "</div>"; $final_result .= "<div class=\"details\">" . $rows['date'] . "</div>"; $final_result .= "</div></div>"; $final_result .= $this->get_comments_for_feed($post_id); $final_result .= "</div>"; echo $final_result; } } public function get_comments_for_feed($feed_id){ global $User; $sql = "SELECT feeds.comments FROM feeds WHERE feeds.id = " . $feed_id . " LIMIT 1"; $result = mysql_query($sql); $result = mysql_fetch_array($result); $result = $result['comments']; $comment_list = get_array_string_from_feild($result); $sql = "SELECT comment_feed.user_id, comment_feed.comment, comment_feed.date FROM comment_feed "; $sql .= "WHERE comment_feed.id IN(" . $comment_list . ") ORDER BY comment_feed.date DESC"; $result = mysql_query($sql); if(empty($result)){ return "";} else { while ($rows = mysql_fetch_array($result)) { $id = $rows['user_id']; $dp = $User->user_detail_by_id($id, "dp"); $user_name = $User->full_name_by_id($id); return "<div class=\"comments\"><div class=\"imageHolder\"><img src=\"". $dp ."\" class=\"profilePicture\" /></div> <div class=\"txtHolder\"> <div class=\"username\"> " . $user_name . "</div> <div class=\"userfeed\"> " . $rows['comment'] . "</div> <div class=\"details\">" . $rows['date'] . "</div> </div></div>"; } } }

    Read the article

  • Watching setTimeout loops so that only one is running at a time.

    - by DA
    I'm creating a content rotator in jQuery. 5 items total. Item 1 fades in, pauses 10 seconds, fades out, then item 2 fades in. Repeat. Simple enough. Using setTimeout I can call a set of functions that create a loop and will repeat the process indefinitely. I now want to add the ability to interrupt this rotator at any time by clicking on a navigation element to jump directly to one of the content items. I originally started going down the path of pinging a variable constantly (say every half second) that would check to see if a navigation element was clicked and, if so, abandon the loop, then restart the loop based on the item that was clicked. The challenge I ran into was how to actually ping a variable via a timer. The solution is to dive into JavaScript closures...which are a little over my head but definitely something I need to delve into more. However, in the process of that, I came up with an alternative option that actually seems to be better performance-wise (theoretically, at least). I have a sample running here: http://jsbin.com/uxupi/14 (It's using console.log so have fireBug running) Sample script: $(document).ready(function(){ var loopCount = 0; $('p#hello').click(function(){ loopCount++; doThatThing(loopCount); }) function doThatOtherThing(currentLoopCount) { console.log('doThatOtherThing-'+currentLoopCount); if(currentLoopCount==loopCount){ setTimeout(function(){doThatThing(currentLoopCount)},5000) } } function doThatThing(currentLoopCount) { console.log('doThatThing-'+currentLoopCount); if(currentLoopCount==loopCount){ setTimeout(function(){doThatOtherThing(currentLoopCount)},5000); } } }) The logic being that every click of the trigger element will kick off the loop passing into itself a variable equal to the current value of the global variable. That variable gets passed back and forth between the functions in the loop. Each click of the trigger also increments the global variable so that subsequent calls of the loop have a unique local variable. Then, within the loop, before the next step of each loop is called, it checks to see if the variable it has still matches the global variable. If not, it knows that a new loop has already been activated so it just ends the existing loop. Thoughts on this? Valid solution? Better options? Caveats? Dangers? UPDATE: I'm using John's suggestion below via the clearTimeout option. However, I can't quite get it to work. The logic is as such: var slideNumber = 0; var timeout = null; function startLoop(slideNumber) { ...do stuff here to set up the slide based on slideNumber... slideFadeIn() } function continueCheck(){ if (timeout != null) { // cancel the scheduled task. clearTimeout(timeout); timeout = null; return false; }else{ return true; } }; function slideFadeIn() { if (continueCheck){ // a new loop hasn't been called yet so proceed... // fade in the LI $currentListItem.fadeIn(fade, function() { if(multipleFeatures){ timeout = setTimeout(slideFadeOut,display); } }); }; function slideFadeOut() { if (continueLoop){ // a new loop hasn't been called yet so proceed... slideNumber=slideNumber+1; if(slideNumber==features.length) { slideNumber = 0; }; timeout = setTimeout(function(){startLoop(slideNumber)},100); }; startLoop(slideNumber); The above kicks of the looping. I then have navigation items that, when clicked, I want the above loop to stop, then restart with a new beginning slide: $(myNav).click(function(){ clearTimeout(timeout); timeout = null; startLoop(thisItem); }) If I comment out 'startLoop...' from the click event, it, indeed, stops the initial loop. However, if I leave that last line in, it doesn't actually stop the initial loop. Why? What happens is that both loops seem to run in parallel for a period. So, when I click my navigation, clearTimeout is called, which clears it.

    Read the article

< Previous Page | 78 79 80 81 82 83 84 85 86 87 88 89  | Next Page >