w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Caching dynamic pages / excluding parts from caching
Ok, the solution was fragment caching. First you have to set your secret phrase by setting define('W3TC_DYNAMIC_SECURITY', 'my_string'); in wp-config.php and then you can use PHP code like this <!-- mfunc echo "Hello World<br/>"; --><!-- /mfunc --> which outputs this dynamic code <?php echo "Hello World<br/>"; ?>

Categories : PHP

Caching mostly static pages
You should take a look at the new html 5 caching stuff, it is pretty cool, and sounds like it would be just what you are looking for. http://www.html5rocks.com/en/tutorials/appcache/beginner/

Categories : Http

Prevent caching on magento cms pages
In EE there are 3 types of pages that are cached. CMS pages, categories and products. Each entity is defined in app/code/Core/Enterprise/PageCache/etc.xml inside the tag <cache><requests> under the <frontend> tag. For cms pages there is this line <cms>enterprise_pagecache/processor_default</cms> This sets the processor for the cms pages. You need to disable this cache by adding in one of your custom modules, in the config.xml this: <frontend> ...<!-- other config settings here --> <cache> <requests> <cms></cms><!-- this should override the cms page cache processor to null --> </requests> </cache> </fronend> Make your module depend on Enterprise_PageCache

Categories : Magento

Prevent jQuery Mobile from caching pages
I just had to add this to page2.php to get it to work: <script type="text/javascript"> $(document).on('pagehide', 'div', function (event, ui) { var page = jQuery(event.target); if (page.attr('data-cache') == 'never') { page.remove(); }; }); </script> And also change <div data-role="page"> to <div data-role="page" data-cache="never">

Categories : Jquery

external caching of pages with rails, multiple perspectives on the same page
So right off the bat the easiest way to solve this is to have a separate page for admin roles vs a common user. So they have to go through a different manner to edit the page. If it has to be on the same page their are one of two things you can do. a) fragment cache the page and exclude parts that are user specific b) use ajax to hit an end point that clarifies the roles. So basically by default you will hide the buttons and make an ajax request to /api/owners/roles that will determine for the current logged in user what their roles are. If they have greater then x role $(".edit-button").show()

Categories : Ruby On Rails

Is querying a MySQL database dozens of times in order to allow effective caching better than a few large queries with less caching?
The correct answer is: It depends. Caching is a way of optimizing a recognized use pattern by shortcutting producing repeatedly expensive data with re-using the data from a previous run. So the first question you should answer is: It there an observed repeated use pattern that has a noticable "expensive" step of producing data? If not: Don't use caching that you still do not need, wait until you can observe something. The second question you should be able to answer is: Can you measure how long it takes with and without cache, and is the difference noticable? And the third important question to answer is: How can you clean the cache from outdated information if the original data gets changed, and you want that new data to be displayed instantly? So in your case you are asking if using

Categories : PHP

Multiple instances use a co-located caching but fail to access, good named caching implementation required
First I'd move your cache and cacheFactory instantiation out of your getPrices method. Also, evaluate your need for the lock - this may be causing timeouts. Another VERY important observation - you are using a constant cache key and saving/retrieving data for every productId with the same cache key. You should be using a cache key like: var cacheKey = string.format("priceDatabyProductId-{0}", productId);. You need to set some breakpoints and examine exactly what you are caching and retrieving from the cache. The code as written will save the first productId to the cache and then keep returning that data regardless of the productId. Here is a full working example we use in production using the "default" named cache in dedicated cache roles: public static class MyCache { private

Categories : Asp Net

Azure Caching - Failure after upgrading to SDK 2.1 and caching 2.1
Not really an answer but some comments which might help you diagnose the problem: Visual Studio 2012/Update 3 - Please ensure that you have latest updates applied to VS. We had gone through similar problems and this was one of the things that helped us. Collect lots of cache diagnostics data - In your cache configuration section, change the Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel value to 4 in your cache worker role's configuration section. After you do that, add the following lines of code in your cache worker role's OnStart() method: DiagnosticMonitorConfiguration dmConfig = DiagnosticMonitor.GetDefaultInitialConfiguration(); // Configure the collection of cache diagnostic data. CacheDiagnostics.ConfigureDiagnostics(dmConfig); DiagnosticMonitor.Start("Microsoft.Window

Categories : Caching

What is distributed caching in terms of caching persistent data for multiple applications/ multiple instances of an application
My best attempt for answers: I would say both. A distributed cache means that the logical idea of a cache is spread across multiple distinct machines. For example, you might have 5 nodes in your cache, and each node is on it's on machine/VM. Usually once you need a distributed cache, your application is also distributed. Small website = one server, maybe one cache node. Big website = many web servers, distributed cache. Most distributed caches distribute the cache entries evenly amongst nodes. If you write an entry to one node, it will get replicated to all other nodes. The idea is that each cache node can be taken out of the "cluster" and you don't lose any data. The idea of having one cache entry on one machine is called sharding. It means you look at the cache key and then decide w

Categories : Caching

Django per-view caching not caching
I think there are some mistakes in your code :) UpdateCacheMiddleware must be the first middleware and FetchFromCacheMiddleware must be the last (https://docs.djangoproject.com/en/dev/topics/cache/#the-per-site-cache) Dont know if 'django_pylibmc' is a shortcut in your cachebackend but in my settings it is "django.core.cache.backends.memcached.PyLibMCCache" Maybe that helps.

Categories : Django

Always Display Child Pages on Parent Pages and Child Pages PHP MySQL
perhaps I can try to understand your question using an example. Consider, your table has the following records: id title parent 1 a 0 2 b 0 3 c 0 4 a1 1 5 a2 1 6 b1 2 7 c1 3 8 c2 3 9 c3 3 Your above code will generate an output like this in the first run, i.e. a list of all parent categories and their child categories: a a1 a2 b b1 c c1 c2 c3 Your requirement is that if someone clicks on a parent category, say "a", it should show only a's child categories and hide all child categories of "b" and "c". Right? Additionally, if someone clicks on the child category, it should still show the same result as if someone clicked on the parent page. If my understanding on your requirement is correct, you can fix your code by passing the paren

Categories : PHP

AngularJS application hosted on Github pages (gh-pages) ajax crawling
BromBone (http://www.brombone.com/) claims to offer that _escaped_fragment_ handling as a service for you. However, it's a commercial service. I guess it would matter how important it was to you for those pages to work with Google.

Categories : Ajax

Apache redirect all sub pages to home page except specific pages
In the VirtualHost section of www.domain.co.uk insert this code just below RewriteEngine On line: RewriteCond %{REQUEST_URI} !^/(terms|request-information)(/.*|)$ [NC] RewriteRule ^ / [L,R=301] EDIT: Multiple rewrite rules seem to cause a redirection error, only use one.

Categories : Apache

Wordpress: Query child pages content while on parent pages
I figured it out. Hopefully anyone else having this question will find this! I found the wordpress codex for get_pages: http://codex.wordpress.org/Function_Reference/get_pages <?php $children = get_pages( array( 'sort_column' => 'menu_order', 'sort_order' => 'ASC', 'hierarchical' => 0, 'parent' => $post->ID, 'post_type' => 'projects', )); foreach( $children as $post ) { setup_postdata( $post ); ?> <div class="section-container"> <?php the_content(); ?> </div> <?php } ?>

Categories : Wordpress

Is it possible to create wordpress category pages like home pages? (designed)
Firstly your question is not clear and you just asked a general question for that answer is Yes absolutely Possible. Without any specific information of theme or error, we cant help you. Here is some thought: You can easily customize wordpress theme category page category.php or even if you want a different category template for only one category, you can do that. To do that, create category-[slug].php or category-[id].php file in your theme files - replace slug or id whatever you use with that of category you want a different tempelate. Once you edit template for category page, you can add all options yourself - Good option is to display a Slider of category page and query posts for that category only to show on that slider or show promotional stuff on top from that category in slide

Categories : Wordpress

VisualForce Pages automatically including "loose.dtd" in all pages
This is documented in salesforces documentation. The default doctype is loose, if you want a stricter or different doctype you need to specify it using the docType attribute. Eg <apex:page controller="Pagecontroller" docType="html-5.0"> More info here: http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_page.htm

Categories : HTML

How do I create redirects in Umbraco when old pages have same directory as new pages?
this will tell you how MVC is interpreting the route http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

Categories : Asp Net Mvc

How to Create ASPX web pages dynamic when the site is run(Like Tag Pages)?
Suppose: Table - Article : I am considering only few columns with their datatypes that relates to an article. Id (PK, Autogenerated), Title(varchar(1000)), Description(ntext), ArticleDate(datetime2), Tags(varchar(1000)) Allow user to select multiple tags as SO does or a text box where tags will be entered as comma separated value. Suppose after entering a record we have Id | Title | Description | ArticleDate | Tags --------------------------------------------------------------------------------- 1 | How to use tags in article? | blah!blah!blah! | 09/07/2013 | c#,asp.net, English,.net, sql say front end has link having tag SQL.

Categories : C#

define Java class in jsp pages and reuse them across different jsp pages
Using a filter would promote re-use. If you wanted to include test1.jsp within test2.jsp you can use scriplets to include (or forward request) to test2.jsp. But underneath jsp will be compile to a servlet (class).

Categories : Jsp

Iterate through pages in Word and find pages contains image
A Document has a Shapes Collection representing all the Shapes. Each Shape has an Anchor, using which we can get to the TopMargin, and other properties, of the shape's page: Sub JiggleAllShapes() Dim shp As Shape For Each shp In ActiveDocument.Shapes shp.Anchor.Paragraphs(1).Range.PageSetup.TopMargin = 0 Next shp End Sub We can get the page number from the Anchor: shp.Anchor.Information(wdActiveEndPageNumber) There is a Pages Collection but it is not as useful IMO: Sub WhatAboutPages() Dim pge As Page For Each pge In ActiveDocument.ActiveWindow.Panes(1).Pages 'Debug.Print pge.NothingUsefulHere Next pge End Sub With this approach you would have to delve into the Rectangles collection and use RectangleType to try to determine if the current

Categories : Vba

Master Pages and Child Pages Setup
Dim ContentPlaceHolder As ContentPlaceHolder Dim gv As GridView ContentPlaceHolder = CType(Master.FindControl("GridViewPlaceHolder"), ContentPlaceHolder) If Not ContentPlaceHolder Is Nothing Then gv = CType(ContentPlaceHolder.FindControl("GridView1"), GridView) If Not gv Is Nothing Then Dim es As EntityDataSource = EntityDataSource1 gv.DataSource = es gv.DataBind() End If End If

Categories : C#

Show Children Pages when on other Parent pages
If you know the page id then you can use wp_list_pages( $args ); $args = array( 'depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'), 'child_of' => 'parent page id goes here', 'exclude' => '', 'include' => '', 'title_li' => __('Pages'), 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title', 'link_before' => '', 'link_after' => '', 'walker' => '', 'post_type' => 'page', 'post_status' => 'publish' ); $child_pages=wp_list_pages( $args ); Note : child_of (integer) Displays the sub-pages of a single Page only; uses the ID for a Page as the value. Note that the child_of parameter w

Categories : PHP

How to Add Footers to Documents in Odd Pages and Even Pages
Three steps to solve your problem 1> 0 implies false and -1 true so use .PageSetup.OddAndEvenPagesHeaderFooter = -1 2> use WdHeaderFooterIndex.wdHeaderFooterEvenPages to access footer on even page 3> use WdHeaderFooterIndex.wdHeaderFooterFirstPage to access footer on odd page

Categories : C#

List children pages, unless none exist, in which case, list sibling pages, in WordPress
this should either do it outright or at least show you how: when viewing a Page that has children (or is a child) it displays only children of that parent. When visiting main page, all top level pages are listed in the sidebar. When visiting a top level page with no children, all top level pages are listed. When visiting a top level page with children, just the children pages, and descendant pages, are listed. When visiting a child page, just the children, and descendant pages, of that parent, are listed. <?php $output = wp_list_pages('echo=0&depth=1&title_li=<h2>Top Level Pages </h2>' ); if (is_page( )) { $page = $post->ID; if ($post->post_parent) { $page = $post->post_parent; } $children=wp_list_pages( 'echo=0&chi

Categories : PHP

Redirect Desktop Internal Pages to Correct Mobile Internal Pages with Htaccess
At the end, you have two RewriteRule lines which I believe should be changed to: RewriteRule ^/?$ http://m.domain.com [R=302] RewriteRule ^/?(.*)/?$ http://m.domain.com/$1.html [R=302,L] The ^/?(.*)/?$ means give me a string that starts at the beginning (^) and gives me all characters ((.*)) until the end ($) without the trailing/beginning (/) if there is one (?). The http://m.domain.com/$1.html means that if the address is http://www.domain.com/internal-page/ then it becomes http://m.domain.com/internal-page.html. The [R=302,L] should mean a 302 redirect (R=302) and the last rewrite (L), so no other rewrites can occur on our URL. EDIT: I believe that in the case of your RewriteRules the first one was redirecting to http://m.domain.com in the event that the URL was just the domain,

Categories : Htaccess

Highcharts showing in some pages, not showing in root pages
You can try to change permission of that file. Right Click that file and Change Permission as Read/view/Write. I had same problem in CPanel. I done this one. Then it's working fine. Just Try it.

Categories : PHP

Using an appropriate key for caching
No harm in using employeeId as the key but its better to prefix this with something like Employee so that another Object in the cache with same id doesn't overwrite your employee cache entry. So something like this: // employee is an instance of Employee cache.put("Employee::" + employee.getId(), employee); EDIT: If you dedicated buckets for each object type // employee is an instance of Employee cache.put(employee.getId(), employee);

Categories : Caching

PHP caching - out of the box
As far a I know, there is no default caching mechanism in PHP similar to .NET's application object. The only thing that comes close is storing things in the $_SESSION object, but that would mean caching per user and not global caching.

Categories : PHP

JVM and OS DNS Caching
I think I've run into this problem, or a very similar one. What I did then was to implement my own DNS provider for the JVM, see how to change the java dns service provider for details. You can use the dnsjava mentioned there or roll your own.

Categories : Java

No caching in HTML5
I think if you leave out the manifest attribute, it defaults to no cache. I know that on firefox, you can use add-on tools like Firebug or HttpFox to check if the page is cached. Not sure about other browsers, but most likely it's under "Network" tab of developer tools.

Categories : HTML

Caching in Codeigniter
please put htaccess file in the folder and write : Header set Cache-Control "max-age=29030400, public" now please put this htaccess file in folder which file you want to make cache.

Categories : Codeigniter

Codeigniter caching?
The point of CI caching is to reduce the number of database queries, any time-consuming PHP calculations, etc... Basically, it will render a plain HTML page from your controller (and all the views it calls, of course). So, it won't really speed up your header and footer, unless you pull the data for them from the database or anythings that dynamic and heavy... but any modern browser will cache that for you unless you specifically disallow caching. So, the bottom line, CI caching allows caching of the full pages only, no separate parts. Of course, there are alternative ways to achieve what you wanted, for example you can make the header and the footer separate controllers, put caching in them, and call them by AJAX... but I'm not sure it's worth it.

Categories : PHP

Caching redirects in asp.net
Programatically you can try something like this: Response.Cache.SetExpires(DateTime.Now.AddDays(1)); Response.Cache.SetCacheability(HttpCacheability.Private); Response.Cache.SetValidUntilExpires(true); Response.AddHeader("Vary", "User-Agent, Accept-Encoding"); Response.Redirect("http://www.avnetwork.com/index");

Categories : Asp Net

The best way to caching json
Based on your requirement I would recommend SQLite data base. Since shared preference is suitable for configuration storage - often small data/strings. File cache is hard to manage, so I recommend SQLite - easy to manage and ability to store mass data. Considering the performance, if the number of index is not that huge, SQLite database should have the acceptable performance. E.g. only several ms slower than a file cache. You might be able to combine these two approaches together. Use random access file with index-offset stored in SQLite.

Categories : Android

Dictionary and Caching
In this case I don't think you are going to get a unique key But you can do better This suffers from if you switch left and right you get the same key. Int32 key = left.GetHashCode() ^ right.GetHashCode() ^ weight.GetHashCode(); 15 ^ 17 ^ 20 == 17 ^ 15 ^ 20 This will decrease key collisions Int32 key = 17*left.GetHashCode() ^ 23*right.GetHashCode() ^ weight.GetHashCode(); Better yet can use an UInt64 key UInt64 key = (((UInt64)left.GetHashCode() << 32) | (UInt64)right.GetHashCode()) ^ ((UInt64)weight.GetHashCode() << 30); And look at how you average. All of those colors are being cast to Double in the calculation and that has overhead. How exact to that have to be? If weight and complement were Int32 there would be some rounding error but it would be faster. Int3

Categories : C#

Haskell Caching
This concept is called partial application . It works because in Haskell, all functions actually only have one parameter. A function a -> b -> c might look like a function that takes two parameters (one of typa a, and one of type b), but it's really a function a -> ( b -> c), i.e. a function with one paramater (of type a) that returns a function that takes a parameter (of type b). See http://www.haskell.org/haskellwiki/Partial_application (or just generally, give http://learnyouahaskell.com/ a go)

Categories : Haskell

How does caching work in JAX-RS?
Yes. When using a browser like firefox or chrome, you don't need to worry about HTTP cache because modern browsers will handle it. For example, it uses in-memory cache when using Firefox. When using Android, it depends on how you interact with the origin server. According to WebView, it's actually a browser object, but you need to handle HTTP cache on your own if using HTTPClient. It's not about HTTP caching but your server-side logic. the common answer is using database cache so that you don't need to hit database in every HTTP request. Actually JAX-RS just provides you ways to work with HTTP cache headers. you need to use CacheControl and/or EntityTag to do time based cache and conditional requests. for example, when using EntityTag, the builder will handle response status code 304 whic

Categories : Java

C# File Caching
Odds are, you're catching an exception in the else block and it's only returning the fileContents. Try putting a breakpoint in the exception block to see what is going on. You'll need to change it to: catch( Exception e ) in order to get this information. Also, you don't need this: File.Delete(filePath); The WriteAllText method will overwrite the file that is already there. Try removing that line and check your directory permissions. You may also want to change (File.GetLastWriteTime(filePath) > DateTime.Now.AddMinutes(-30))) to (DateTime.Now - File.GetLastWriteTime(filePath)).TotalMinutes > 30

Categories : C#

Caching big data
I would consider a NoSQL storage engine. I am thinking at Redis in particular. Redis is a in-memory, fast, key-value store with persistence, which should be a good fit for this kind of scenario. You can then defer most of the lock/consistency hassle to it. A problem with Redis is if you are really bound to a Windows env. There is an "unofficial" port of redis; the port is done by Microsoft itself.. but I admit that I would not be extremely confident in using it in production. As for a C# client/library, there is Booksleeve. This site (SO) uses it :) so I bet it is pretty stable! Of course you will need to tailor Redis to your needs. Redis does offer persistence, and the persistence is configurable (see http://redis.io/topics/persistence). Also, it offers expiration of objects (http://re

Categories : C#

Caching framework for .NET
Memorycache simply suits your case by just adding into your repositories But remember: The MemoryCache class is similar to the ASP.NET Cache class. The MemoryCache class has many properties and methods for accessing the cache that will be familiar to you if you have used the ASP.NET Cache class. The main differences between the Cache and MemoryCache classes are that the MemoryCache class has been changed to make it usable by .NET Framework applications that are not ASP.NET applications. For example, the MemoryCache class has no dependencies on the System.Web assembly. Another difference is that you can create multiple instances of the MemoryCache class for use in the same application and in the same AppDomain instance.

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.