Search Results

Search found 21331 results on 854 pages for 'require once'.

Page 31/854 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • How to add a weather info to be evalueated only once???

    - by Savvas Sopiadis
    Hi everybody! In a ASP.MVC (1.0) project i managed to get weather info from a RSS feed and to show it up. The problem i have is performance: i have put a RenderAction() Method in the Site.Master file (which works perfectly) but i 'm worried about how it will behave if a user clicks on menu point 1, after some seconds on menu point 2, after some seconds on menu point 3, .... thus making the RSS feed requesting new info again and again and again! Can this somehow be avoided? (to somehow load this info only once?) Thanks in advance!

    Read the article

  • Drawbacks with reading and writing a big file to or from disk at once instead of small chunks?

    - by Johann Gerell
    I work mainly on Windows and Windows CE based systems, where CreateFile, ReadFile and WriteFile are the work horses, no matter if I'm in native Win32 land or in managed .Net land. I have so far never had any obvious problem writing or reading big files in one chunk, as opposed to looping until several smaller chunks are processed. I usually delegate the IO work to a background thread that notifies me when it's done. But looking at file IO tutorials or "textbook examples", I often find the "loop with small chunks" used without any explanation of why it's used instead of the more obvious (I dare to say!) "do it all at once". Are there any drawbacks to the way I do that I haven't understood?

    Read the article

  • Html5 Audio plays only once in my Javascript code.

    - by Poul
    I have a dashboard web-app that I want to play an alert sound if its having problems connecting. The site's ajax code will poll for data and throttle down its refresh rate if it can't connect. Once the server comes back up, the site will continue working. In the mean time I would like a sound to play each time it can't connect (so I know to check the server). Here is that code. This code works. var error_audio = new Audio("audio/"+settings.refresh.error_audio); error_audio.load(); //this gets called when there is a connection error. function onConnectionError() { error_audio.play(); } However the 2nd time through the function the audio doesn't play. Digging around in Chrome's debugger the 'played' attribute in the audio element gets set to true. Setting it to false has no results. Any ideas?

    Read the article

  • Delay function from running for n seconds then run it once. (2minute question)

    - by Ozaki
    TLDR I have a function that runs on the end of a pan in an openlayers map. Don't want it to fire continously. I have a function that runs on the end of panning a map. I want it so that it will not fire the function until say 3 secconds after the pan has finished. Although I don't want to queue up the function to fire 10 or so times like setTimeout is currently doing. How can I delay a function from running for n seconds then run it only once no matter how many times it has been called?

    Read the article

  • how to fix Facebook JSDK that sometimes loads twice, once, or doesnt load at all?

    - by user1108310
    Im using facebook javaSDK for my website and I have a weird problem. When I load the website with "internet explorer" it always runs fine. When I load the website with firefox it always loads TWICE, and when I use chrome the JSDK sometimes loads once and sometimes not loads at all , giving me the error "Uncaught ReferenceError: FB is not defined ". I tried using asynchronous loading for the SDK but still the same problem. btw I have firebug on firefox, could that be the reason the JSDK loads twice? Thanks

    Read the article

  • fade in all divs of a page. once the content of the divs is loaded

    - by daniel
    I want all the divs on my page to fade in after the content is loaded. The code below loads in all imgs in the #div container. Which is great. but it does not load in images that are used as div background images loaded through the css file. So i think the most effective way is to create a piece of code that fades in all the divs on the page after the content ie: images and text has loaded. Is there A way to do this. Cheers. $(document).ready(function() { $('#container img').fadeIn(4000); // and tell pending images to do the same, once they've finished loading: $('#container img').load(function () { $(this).fadeIn(4000); }); });

    Read the article

  • Any way to have delayed_job execute some run-once code at startup and use across all jobs?

    - by Rob Cameron
    So I've got a delayed_job task that pushes some info to an XMPP server. Ideally you create a connection to XMPP once and then constantly push data to it, rather than creating a new connection every time you have some data to send. Is there any kind of facility in delayed_job for running a sort of 'setup' method when a worker starts, have it set some instance variables (like the XMPP connection object) that can then be used by all the jobs that come up? It's okay if each worker runs its own setup method. I just don't want every job (thousands per day) connecting to the XMPP server from scratch every time. Thanks for any help!

    Read the article

  • AsyncTask Threading Rule - Can it really only be used once?

    - by stormin986
    In the documentation on AsyncTask it gives the following as a rule related to threading: The task can be executed only once (an exception will be thrown if a second execution is attempted.) All this means is that you have to create a new instance of the class every time you want to use it, right? In other words, it must be done like this: new DownloadFilesTask().execute(url1, url2, url3); new DownloadFilesTask().execute(url4, url5, url6); Or conversely, you can NOT do the following: DownloadFilesTask dfTask = new DownloadFilesTask(); dfTask().execute(url1, url2, url3); dfTask().execute(url4, url5, url6); Can someone verify this is an accurate interpretation? I realize I pretty much just answered this for myself as I was typing this out... But it wasn't immediately obvious to me so I think this would be useful to have posted nonetheless.

    Read the article

  • How do I add netsh advfirewall context command in Visual Studio 2010 Click Once publishing?

    - by Rivers Edge
    I have a .Net 4.0 Windows application which requires access thru the firewall. I know about the netsh advfirewall firewall command, but I would like very much to have this program allowed at install time (the Click Once deployment). How can I add this command to execute as a post install command, exectuing as Administrator - i.e. The person doing the install does not have to execute the netsh advfirewall command separately or does not have to go to the Firewall and manually add the program in the Allowed list. I cannot find an area in Publish in Visual Studio 2010 to insert a post install command line execution.

    Read the article

  • Fade in list of images, once all are loaded.

    - by Nathan Barry
    I have a group of images in this format: <ul id="photo-list"> <li><img src="" /></li> <li><img src="" /></li> <li><img src="" /></li> </ul> My goal is that once all the images have finished loading, then #photo-list will fade in. Also I would like to display a loading animation before the images are loaded. Any help is appreciated!

    Read the article

  • How to execute a function called many times, only once !

    - by Roesone
    Hello, is there a way to execute a function that is called thousand of times only once ? I have a function that adds items in a container of sort, and there is code in there, that updates lists and other windows (GUI staff). So, if i have to add a million items (the number of which is impossible to tell, anyone could call the function from anywhere), the GUI update mechanism will be called as many as times... Is there a way to tell appart continuous function execution (and ignore it) from discontinuous ? Is there a safe way to execute the update mechanism only the last time the add-item function is called, within a time interval ? Thank you.

    Read the article

  • How to put log in box in a website to ensure one user can vote once only?

    - by shah
    I have a school project to do which requires us to develop an online voting website. how do i ensure one user has voted once only? the website is supposed to be in booths in public places which means i cannot use ip addresses or cookies. i was planning to use fb login id or maybe some other email id but i cannot find relevant codes/links. i just want people to go through the procedure of entering the log in id but not go to fb directly. my website cannot be published online. could you please suggest how i can achieve this? it is a bit urgent, thank you!

    Read the article

  • Is there a way to echo this only once and not have it repeat?

    - by Fernando
    I have the following query: $select = mysql_query("SELECT * FROM posts WHERE id = $postIds"); while ($return = mysql_fetch_assoc($select)) { $postUrl = $return['url']; $postTitle = $return['title']; echo "<h1><a href='$postUrl'>".$postTitle."</a></h1>"; } Now the problem is, the variable $postIds often times contain the same id multiple times. So the title of the post echos itself multiple times. Is there a way to have it echo only once?

    Read the article

  • How to Break out of multiple loops at once in C#?

    - by Rosarch
    What if I have nested loops, and I want to break out of all of them at once? while (true) { // ... while (shouldCont) { // ... while (shouldGo) { // ... if (timeToStop) { break; // break out of everything? } } } } In PHP, break takes an argument for the number of loops to break out of. Can something like this be done in C#? What about something hideous, like goto? // in the innermost loop goto BREAK // ... BREAK: break; break; break;

    Read the article

  • Is there a way to inspect all controller variables at once in Rails?

    - by m.u.sheikh
    I am exploring an big controller method, with about 10 or so instance variables. Some of them are set in before_filter methods, and some others inside the method itself. I want to inspect them with puts, but dont want to write all of them out example: puts "var1: #{@var1.inspect}....var15: #{@var15.inspect}" Is there a generic method that will display all the instance variables with an @ sign set so far in the current method? If not, what is the next best way to inspect all of them at once without having to write all of them in a puts statement?

    Read the article

  • How do I deal with connection strings in a Click-Once application?

    - by Pwninstein
    I'm thinking of building a Click-Once application, and am trying to wrap my head around how to handle the whole connection string issue. The problem is the following: I want to use EF to get data directly from each client, thus requiring each client to have a connection string configured (this is not the issue). How do I deal with clients that are not on the same domain as the SQL Server being queried? In other words, if I tried to run my app from home as opposed to from work, what should my connection string look like? Would I need to configure my SQL Server differently to allow this scenario? Thanks in advance!

    Read the article

  • symlink files newer than X age, then later remove symlink once file ages?

    - by bleomycin
    Hello everyone, i have a large number of files/folders coming in each day that are being sorted automatically to a wide variety of folders. I'm looking for a way to automatically find these files/folders and create symlinks to them all within an "incoming" folder. Searching for file age should be sufficient for finding the files, however searching for age and owner would be ideal. Then once the files/folders being linked to reach a certain age, say 5 days, remove the symlinks to them automatically from the "incoming" folder. Is this possible to do with a simple shell or python script that can be run with cron? Thanks!

    Read the article

  • how to get stl map to construct/destruct inserted object only once.

    - by Alberto Toglia
    I have found a very prejudicial fact about stl maps. For some reason I cant get objects being inserted in the map to get constructed/destructed only once. Example: struct MyObject{ MyObject(){ cout << "constructor" << endl; } ~MyObject(){ cout << "destructor" << endl; } }; int main() { std::map<int, MyObject> myObjectsMap; myObjectsMap[0] = MyObject(); return 0; } returns: constructor destructor destructor constructor destructor If I do: typedef std::pair<int, MyObject> MyObjectPair; myObjectsMap.insert( MyObjectPair(0,MyObject())); returns: constructor destructor destructor destructor I'm inserting Objects responsible for their own memory allocation, so when destructed they'll clean themselves up, being destructed several times is causing me some trouble.

    Read the article

  • Click once Deployment suddenly does not work. Displays windows login?

    - by Raja
    Hello All, I am facing a peculiar issue. We use click once deployment for our windows application. It was working fine till last week. I made some changes to the application (just code nothing changed in properties) and suddenly I cannot publish anymore. When we give publish now it displays windows authentication dialog and when we provide the credentials nothing happens. It tries to connect to remote server (local LAN) and shows the dialog again. Any idea why this happens? Thanks for your help.

    Read the article

  • Web server which supports removing a file immediately after it has been downloaded once?

    - by Shabbyrobe
    I need a web server that allows me to remove a file after it has been successfully downloaded once. Is there any way to do this with apache? Is there another web server I can use for this task? I had already looked into Tornado for this purpose, but couldn't find a way to get an event to fire as soon as the download finished. the on_connection_close would only fire when I shut down the server. I'd prefer something PHP or Python-based if I have to code it myself.

    Read the article

  • How can I execute a block of code exactly once in PHP?

    - by Jack
    I have one main.php file with a class definition. Other php files use this main.php file //main.php <?php class A{ } //I want to execute the following statements exactly once $a = new A(); /* Some code */ ?> I use main.php in other php files like //php1.php <?php require_once("main.php"); $b = new A(); /* Some code */ ?> Is there any statement in PHP like execute_once()? How do I solve this?

    Read the article

  • Is it possible to evaluate a JSP only once per session, and cache it after that?

    - by Bears will eat you
    My site has a nav menu that is dynamically built as a separate JSP, and included in most pages via <jsp:include />. The contents and styling of the menu are determined by which pages the user does and doesn't have access to. The set of accessible pages is retrieved from the database when a user logs in, and not during the course of a session. So, there's really no need to re-evaluate the nav menu code every time the user requests a page. Is there an easy way to generate the markup from the JSP only once per session, and cache/reuse it during the session?

    Read the article

  • Facebook access_token: how do I get it once the user accepted my app?

    - by hoktar
    When a user visits my site which contains a facebook app the first time, it requires him to allow it and he gets promted to do that, then I get the code which I can convert to an access_token. So far so good. But how do I get the token once the user has already visited the site? As long as this token form the first time is active everything is fine. But how do I get another token when the user had already allowed the app a week ago and is only visiting my page again?

    Read the article

  • How to connect to Oracle using JRuby & JDBC

    - by Rob
    First approach: bare metal require 'java' require 'rubygems' require "c:/ruby/jruby-1.2.0/lib/ojdbc14.jar" # should be redundant, but tried it anyway odriver = Java::JavaClass.for_name("oracle.jdbc.driver.OracleDriver") puts odriver.java_class url = "jdbc:oracle:thin:@myhost:1521:mydb" puts "About to connect..." con = java.sql.DriverManager.getConnection(url, "myuser", "mypassword"); if con puts " connection good" else puts " connection failed" end The result of the above is: sqltest.rb:4: cannot load Java class oracle.jdbc.driver.OracleDriver (NameError) Second approach: Active Record require 'rubygems' gem 'ActiveRecord-JDBC' require 'jdbc_adapter' require 'active_record' require 'active_record/version' require "c:/ruby/jruby-1.2.0/lib/ojdbc14.jar" # should be redundant... ActiveRecord::Base.establish_connection( :adapter => 'jdbc', :driver => 'oracle.jdbc.driver.OracleDriver', :url => 'jdbc:oracle:thin:@myhost:1521:mydb', :username=>'myuser', :password=>'mypassword' ) ActiveRecord::Base.connection.execute("SELECT * FROM mytable") The result of this is: C:/ruby/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.1/lib/active_recordconnection_adapters/jdbc_adapter.rb:330:in `initialize': The driver encountered an error: cannot load Java class oracle.jdbc.driver.OracleDriver (RuntimeError) Essentially the same error no matter how I go about it. I'm using JRuby 1.2.0 and I have ojdbc14.jar in my JRuby lib directory Gems: ActiveRecord-JDBC (0.5) activerecord-jdbc-adapter (0.9.1) activerecord (2.2.2) What am I missing? Thanks,

    Read the article

  • The model item passed into the dictionary is of type ‘mvc.Models.ModelA’ but this dictionary require

    - by Malcolm Frexner
    I have this annoying mistake in some of my builds. There is no error in the project, because if I build again, then the problem disappears. The message only appears, when the site is deployed to a Windows 2008 Server. I first thought that it might be an issue with temporary files, but thats not the case. I deployed the build to a different web and the error still appears. The error appears on random actions of the site. Most of the time builds are ok, but each 3rd or 4th build produces runtime errors. I build using a WebdeploymentProject in release mode. Views are precompiled. It's not http://stackoverflow.com/questions/178194/in-asp-net-mvc-i-encounter-an-incorrect-type-error-when-rendering-a-page-with-the, because views have totally different names. How I can debug this problem or how I can get help for this? Here is my WebDeploymentProject <!-- Microsoft Visual Studio 2008 Web Deployment Project http://go.microsoft.com/fwlink/?LinkID=104956 --> <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProductVersion>9.0.21022</ProductVersion> <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{E5E14CEB-0BCD-4203-9A5A-34ABA9C717EA}</ProjectGuid> <SourceWebPhysicalPath>..\B2CWeb</SourceWebPhysicalPath> <SourceWebProject>{3E632DB6-6DB3-4BD0-8CCA-12DE67165B48}|B2CWeb\B2CWeb.csproj</SourceWebProject> <SourceWebVirtualPath>/B2CWeb.csproj</SourceWebVirtualPath> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <OutputPath>.\Debug</OutputPath> <EnableUpdateable>false</EnableUpdateable> <UseMerge>true</UseMerge> <SingleAssemblyName>B2CWeb_Build</SingleAssemblyName> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugSymbols>false</DebugSymbols> <OutputPath>..\B2CWeb_Deploy\</OutputPath> <EnableUpdateable>false</EnableUpdateable> <UseMerge>true</UseMerge> <SingleAssemblyName>B2C_Web</SingleAssemblyName> <ContentAssemblyName> </ContentAssemblyName> <DeleteAppCodeCompiledFiles>false</DeleteAppCodeCompiledFiles> </PropertyGroup> <ItemGroup> </ItemGroup> <Import Project="$(MSBuildExtensionsPath)\Microsoft\WebDeployment\v9.0\Microsoft.WebDeployment.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.WebDeployment.targets. <Target Name="BeforeBuild"> </Target> <Target Name="BeforeMerge"> </Target> <Target Name="AfterMerge"> </Target> <Target Name="AfterBuild"> </Target> --> </Project>

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >