w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Playing media across multiple webpages
The best solution remains AJAX exactly as you planned. And also, as you planned, the browser history (and bookmarking) won't work correctly unless you use history.js. I'll let you read more from another post: How to "bookmark" page or content fetched using AJAX? content-fetched-using-ajax Edit to help AJAX implementation: Without seeing your code, it is hard to say if it is gonna work, but something similar to this very generic script could turn any website from "regular" to ajax driven, with jQuery: $('body').on('click','a',ajaxContentReplace); $('body').on('submit','form',ajaxContentReplace); function ajaxContentReplace(){ if($(this).is('form'){ // Will send form data in POST and retrieve the html in #container to put it in #container. $('#container').load

Categories : PHP

php script to search multiple webpages from file for specific word
To search the particular webpage for a given string, I'd use stripos() (case-insensitive) or strpos() (case-sensitive) instead of regular expressions: if( stripos(haystack, needle) !== FALSE ) { //the webpage contains the word } An example: $str = 'sky is blue'; $wordToSearchFor = 'sky'; if (strpos($str, $wordToSearchFor) !== false) { echo 'true'; } else { echo 'Uh oh.'; } Demo! Although, programmitcally skimming through webpages isn't considered a good practice and shouldn't be done unless it's absolutely necessary. UPDATE: In your file_get_contents call you're doing: $data = file_get_contents('$allads[$index]'); You're using single quotes, and the variable values do not get replaced. You'll have to use double quotes to have file_get_contents fetch the actual URL

Categories : PHP

Screenshoting many webpages
Try calling page.close() after each render. The docs mention reusing the same object without closing can prevent garbage collection.

Categories : Javascript

Insert Webpages into Div instead of iframe?
You cannot load content from another website just with pure JavaScript. Period. http://en.wikipedia.org/wiki/Same_origin_policy So what you can do? You can make a web request from your server and get Http response from remote server and put them into div element. <div><%=(new WebClient()).DownloadString("http://www.stackoverflow.com")%></div> But one of biggest problem is that, since you will download all styles and scripts from remote website then your page probably will not look good. Not even human readable. And if you will keep hitting from same IP to those servers you will may blocked by them. Good luck.

Categories : Javascript

PHP Mail Sending on some webpages
After the colons (":") ion From, X-Mailer etc, there should be a space. $headers = 'From: ' . $_POST["email"] . " " . 'Reply-To: ' . $_POST["email"] . " " . 'X-Mailer: PHP/' . phpversion(); Additionally, make sure that the "To" is formatted correctly. What is the value of $email on the second page? Has it been correctly set? Finally, what server is this running on? Could it be that the default From: email address is not valid (and that is why the code on the first page is working as expected, because it is setting a correct From email address?).

Categories : PHP

Why do some webpages have jerky rendering
This almost aways happens when you have a css rule for blocking that is overwriting the previous. The best thing to do is to have the first thing in the css file to be blocking and normalizing. Every time you need something to be in a place or have a specific size, you should go to the blocking section of your code. But the most preocupying part of the site you shown is the time it takes to load a fancybox css file.

Categories : HTML

Bandwidth control for Webpages using php
I found the coding for this question $speed = 10; ob_start(); include(filename.php); $now = time(); foreach(str_split(ob_get_clean(), $speed*1024) as $chunk) { echo $chunk; flush(); $now++; while($now > time()) { usleep(1000000); } }

Categories : PHP

update System.Web.WebPages dll
If you use MVC3 the better solution for you will be to download more earliest version of PagedList, because "System.Web.WebPages, Version=2.0.0.0" is used by MVC4. MVC3 will generate an error if you change Version=1.0.0.0 to Version=2.0.0.0. The other solution is update your MVC3 project to MVC4. You may use autoupdate tool from Nuget or there are a big nomber of articles in web, how to do it by hand.

Categories : C#

Declare functions in ASP.NET WebPages
You can create your own functions within .cshtml files. This article explains the functions keyword and how to use it: http://www.mikesdotnetting.com/Article/173/The-Difference-Between-@Helpers-and-@Functions-In-WebMatrix. If you include it in the .cshtml file that also makes use of the function, you cannot call it from other pages. If you wanted to do that, you can add a function to a .cshtml file and then put that in App_Code. There are no events as such in ASP.NET Web Pages. You can check to see if a page has been posted back using the IsPost property. If you want to make use of reusable utility methods in MVC, you are better off taking the more traditional approach of creating static classes and adding your methods there. App_Code is really for Web Site projects (ASP.NET Web Pages) a

Categories : Misc

Url Routing ASP.NET WebPages (.cshtml) without MVC
Simple routes like the one where you just want to reach an existing file name without the extension work by default in a Web Pages site. The 2 is accessible in the UrlData collection. Here's an article that explains how the rudimentary routing system works in Web Pages: http://www.mikesdotnetting.com/Article/165/WebMatrix-URLs-UrlData-and-Routing-for-SEO If you want to map a url that doesn't match a file on disk, you can use a Nuget package (http://www.nuget.org/packages/WebPageRouteHandler/). It's a bit more complicated, but I have written an article about how to use that too: http://www.mikesdotnetting.com/Article/187/More-Flexible-Routing-For-ASP.NET-Web-Pages

Categories : Misc

How to have navigation bar changes sync across webpages
There a few methods to achieve this. An easy one is to use a CMS to create your site. Something like WordPress, Joomla, Drupal, Plone, etc... The other approach could be to use AJAX as mentioned in the comments. jQuery provides a simple method for this. All you would do is create a div at the head of each page and use the .load() method to load your header page in. It would probably be a better design to use ajax to load your pages into a framework. This is where you layout the main page, and set a content container, each of your subsequent pages are loaded into that container... The other approach would be to use php files and the include command to include the header page. More info found here. If you're keen to get into AJAX, then this book is great - http://www.apress.com/9781590596

Categories : HTML

ASP.NET WebPages use html extension
You want to use routing. Are you using webforms or MVC? Global.asax is a good start. Add the complete code here: namespace Name { public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { RegisterRoutes(RouteTable.Routes); } protected void Session_Start(object sender, EventArgs e) { } protected void Application_BeginRequest(object sender, EventArgs e) { } protected void Application_AuthenticateRequest(object sender, EventArgs e) { } protected void Application_Error(object sender, EventArgs e) { } protected void Session_End(object sender, EventArgs e) { }

Categories : Asp Net

AppStart vs static constructor in ASP.NET WebPages
From what I can tell AppStart.cshtml seems much more integrated with the rest of the webapp. http://www.asp.net/web-pages/tutorials/working-with-pages/18-customizing-site-wide-behavior A plain static constructor will have a lot less knowledge of the web environment

Categories : Asp Net

How to achieve smooth transition between webpages?
First of all, you definitely should use jQuery, since it makes the animation creation much easier. Here's how you should go about it: Put the entire page contents( all of them, as you stated all the pages are just one page ) in a wrapper div. This wrapper div should have max width of 100% and overflow: hidden Create a second wrapper div inside the main wrapper, but this one's width is equal to the gross widths of all pages(or better say pseudo-page or something) Now each page is a div inside the second wrapper and there positions must be absolute( then you should set the appropriate left and top positions for them). the second wrapper's position must be absolute too and the first wrapper's position must be relative, or none of the absolute positions would work the way you wanted it to.

Categories : HTML

How do I block an ip address from seeing a group of webpages?
You only want to block the directory /foo/, so create an .htaccess file in /foo/ (which, intuitively, will only apply to /foo/). Then, use the same syntax to block IP addresses as usual: order allow, deny deny from 127.0.0.1 allow from all I believe this returns a 403 - Forbidden. Not sure how you'd go about returning a 404. (You could just use the same page for 403 errors as you do for 404 errors, and it's unlikely the user will check the response status code) Edit: does user4035's answer work if you begin with RewriteEngine On?

Categories : Htaccess

Drupal site webpages getting 500 in google
PHP Parse error: syntax error, unexpected $end.... if it's the case means that PHP has finished analyzing your code, but you forgot to close a symbol somewhere in your page or in those that are included. Check: you may forgot to close a quote, so PHP continues to analyze your code until it finds the closing quotation-mark. You may forgot to close a bracket, so from the last opening, PHP thinks all the code that follows as part of a block that never ends. You may forgot to close a parenthesis, so from the last open parenthesis, it thinks all the code that follows as part of it and that is not ending. You may forgot a comma

Categories : Drupal

webpages in subfolder not recognising styles
Since you dodn't post any code, we'll have to guess. <link rel="stylesheet" href="style.css" /> <link rel="stylesheet" href="/style.css" /> Compare the two lines and check your own code. Maybe you need this slash.

Categories : CSS

Are S3 metadata necessary for webpages with meta tags?
A as a general rule, it's better to specify your Cache-Control rules in the headers and not in the HTML meta tags as some proxy servers might ignore the latter. If you add the Cache-Control rules in the header, it's redundant to also specify them as meta tags in HTML.

Categories : HTML

JavaScript different webpages loading in same container
You can do something like this Javascript Code $(document).ready(function() { $(".target").click(function(e) { var url = $(this).attr("link"); $('#result').load(url, function(response, status, xhr) { if (status == "error") { var msg = "Sorry but there was an error: "; $("#result").html(msg + xhr.status + " " + xhr.statusText); } }); }); }); HTML Code, but please be aware the pages need to be on same domain, you can not load cross domain using this approach, for opening cross domain pages you can use iframe instead. <ul id="menu"> <li class="target" style="cursor:pointer" link="page1.html"> Grade 1 </

Categories : Jquery

Extracting Disqus comments from webpages using c#
Since the Disqus embed is a javascript embed, the comments won't be available in the page source unless the site renders them there. If you're scraping the page and letting the javascript render, then the first page (up to 50 comments) are available within the Disqus iFrame within the "postCompatContainer" DIV. However, I'd instead suggest using the Disqus API to accomplish this. There's two main parts to this: Get the thread information from the article Specifically in the page source you have to find the variables 'disqus_shortname' and 'disqus_identifier' or 'disqus_url'. If 'disqus_identifier' or 'disqus_url' aren't available, then you can try using the window location address, but this is less reliable. Make the API call with that data. Specifically you'll want to use our thr

Categories : C#

javascript at top of my pages not coded in Webpages
This may be injection code from something like HughesNet or other provider. http://www.webproworld.com/webmaster-forum/threads/127543-Mystery-Javascript http://community.norton.com/t5/Norto...-a/td-p/751780

Categories : Misc

iPad Retina display only using 1024 for webpages
That's an intended behaviour. Since most web sites still specify their text size in pixels (12px), a retina screen would results in text that is much too small. To avoid this, Safari on the iPad 3rd gen and iPhone 4/4s tell web servers that they have 1/4 the resolution they really have. The text is then rendered in finer details by Safari but it also retains its intended size. As a workaround, try setting the meta tag "viewport" in your site to allow for a greater resolution. <meta name="viewport" content="width=device-width" />

Categories : Asp Net

Simultaneously downloading of webpages/files in EJB(java)
Here are two really good SO answers that can help. This one gives you your options, and this one explains why you shouldn't spawn threads in an ejb. The problem with the first answer is it doesn't contain a lot of knowledge about EJB 3.0 options. So, here's a tutorial on using @Asynchronous. No offense, but I don't see any evidence in your code that you've read this tutorial yet. Your asynchronous method should return a Future. As the tutorial says: The client may retrieve the result using one of the Future.get methods. If processing hasn’t been completed by the session bean handling the invocation, calling one of the get methods will result in the client halting execution until the invocation completes. Use the Future.isDone method to determine whether processing has complet

Categories : Java

How to show a specific div from an external site on one of my webpages
I'm the developer of Outfitpoints, so I thought I'd answer with a few options. Firstly, the data I use comes straight out of the Planetside2 API (census.soe.com), so you could write something that pulls some data yourself straight from the source. However, yours is not the first request to provide this sort of data in a way people can imbed on their own site, so I will be looking into providing the data in that format in the very near future. What sort of site are you looking to embed it in (enjin, guildlaunch, vbulletin etc.)? Just so I can test and make sure it works with it. Also, feel free to give me a shout using the contact method on the site if you want to discuss it more.

Categories : Wordpress

How to deal with unknown encoding when scraping webpages?
It is better to simply read Content-Type in meta tags or headers. Please note, that Chrome (opposite to Opera) does not guess encoding. If it is not said that it is UTF8 or anything else in either of places, it threads site as windows default encoded. So only really bad sites do not define it.

Categories : Python

can't find DisplayModeProvider Class in System.Web.WebPages
Try this DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("iPhone") { ContextCondition = (context => context.Request.UserAgent.IndexOf ("iPhone", StringComparison.OrdinalIgnoreCase) >= 0) });

Categories : Asp Net Mvc

Adding a searchable database of webpages from my website. What to use?
use mysql's select and a form html <form method="post"> Username: <input type="text" name="name"><br> <input type="submit" name="submit"> </form> mysql query after submit <?php if($_POST['submit']){ $con=mysqli_connect("example.com","peter","abc123","my_db"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM users WHERE name = '".$_POST['name']."'"); while($row = mysqli_fetch_array($result)) { echo '<a href="website.com/players/'.$_POST['name'].'"></a>'; echo "<br>"; } mysqli_close($con); } ?>

Categories : PHP

Using a Razor @functions in several webpages (.cshtml files)
You can define "global" helper functions in a Razor file in the AppCode directory as described here: http://weblogs.asp.net/scottgu/archive/2011/05/12/asp-net-mvc-3-and-the-helper-syntax-within-razor.aspx. However, helpers only render page elements; they cannot return a value (or more correctly, the returned value is the HTML markup to be rendered). If you need to return a value, your best bet is an extension method.

Categories : Asp Net

Two webpages displaying differently special spanish characters
Change iso-8859-1 to utf-8, should fix it. The menu.php page is rendering with windows-1252 encoding, even tho it has iso-8859-1 set. Are the menu.php contents coming from a database? If yes, which encoding is the database using?

Categories : PHP

Detecting duplicate webpages among large number of URLs
possible solutions exact methods 1) brute force: compare every new page to all visited pages (very slow and inefficient) 2) calculate hash of every visited page (md5,sha1) and store the hashes in a database and look up every new page's hash in the database 3)standard Boolean model of information retrieval (BIR) ........many other possible methods near exact methods 1)fuzzy hash 2)latent semantic indexing ....

Categories : Algorithm

How to show Hindi(non-english) webpages using web view in android application
try the below link :Click here private boolean copyFile(Context context,String fileName) { boolean status = false; try { FileOutputStream out = context.openFileOutput(fileName, Context.MODE_PRIVATE); InputStream in = context.getAssets().open(fileName); // Transfer bytes from the input file to the output file byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { out.write(buf, 0, len); } // Close the streams out.close(); in.close(); status = true; } catch (Exception e) { System.out.println("Exception in copyFile:: "+e.getMessage()); status = false; } System.o

Categories : Android

Using Python's Requests library to navigate webpages / Click buttons
The only solution to this I have found is Selenium. If it werent a javascript heavy website you could try mechanize but for this you need to render the javascript and then inject javascript...like Selenium does. Upside: You can record actions in Firefox (using selenium) then export those actions to python. The downside is that this code has to open a browser window to run.

Categories : Python

Drawing canvas for mobile webpages with sketch.js resets ontouch
See the workaround posted by leonth here: https://github.com/intridea/sketch.js/issues/1 I made a jsFiddle with the workaround and it now works for me on mobile devices:http://jsfiddle.net/ezanker/4hfkb/5/ switch (e.type) { case 'mousedown': case 'touchstart': if (this.painting) { //add this.stopPainting(); //add } //add this.startPainting(); break; ...

Categories : Javascript

Visual Studio 2012 view webpages in mobile devices
If you want to create a responsive page/layout, I would choose a responsive framework like twitter bootstrap. There's a nuget package, even if I would download the css and javascript and implement it myself. It's quite easy to grasp and you can find lot of tutorials. If what you're asking is a tool which can allow you to test and render your asp.net MVC app in a mobile device you can try opera mobile emulator.

Categories : Visual Studio

Good way to store data about u customers who visited w webpages on d days
Assumptions: We have queries which give some web page j and ask for a list of users that have visited the web pages on exactly k days and have visited at least m distinct pages in total. For the below, assume "map" = "hashmap", which would, ideally, give constant time queries. One can also use "treemap" at a logarithmic cost i.t.o the number of elements. Similarly for "set", "hashset", "treeset". I'm assuming the input isn't static, but I won't really change my approach if it is. Basic idea: For each user, have a map of web pages to counts and last visited day. We can have a map of user identifiers to the map of web pages. Whenever a user visits a page: If it's a new page, just create a map entry with the page to a count of 1 and the last visited day otherwise, if the day is the sa

Categories : Algorithm

How webpages like Statigram doesn't exceed Instagram API rate limits
Most likely they're using one of the following methods: An arrangement with Instagram Credential rotation IP rotation Heavy caching (especially across credentials or IPs) Screenscraping In cases like this, if you don't have a special arrangement, you're almost certainly violating the terms of service. If you think your service is useful enough that Instagram would be willing to whitelist you to make more requests, get in touch with them.

Categories : Api

System.web.webpages run error after install Visual Studio 2012
You are getting this error because of assembly reference or configuration issues. You can easily fix it by executing the following command in nuget console (Tools -> Library Package Manager -> Package Manager Console). Install-Package AspNetMvc -Version 3.0.20105.0 It will automatically add all the required references and configures it. Once the installation completes, rebuild and publish the application. If you're using Visual Studio 2010 SP1, you can right click on the project and select "Add Deployable Assemblies". Select the ASP.NET MVC 3 option. That'll add the MVC assemblies to a special directory which will ensure they are in the bin directory when building/publishing your web application. Source

Categories : C#

JSP <%@include file = "/webpages/includeFiles/header.jsp" %> works but not when used with request.getContextPath()
You cannot include dynamic valuse in <%@include file = "">. Use the standard action which accepts dynamic values <jsp:include page="<%=request.getContextPath()%>/firstPage.jsp"></jsp:include>

Categories : Jsp

Why can't I get my site to recognize a default error page for status code 404 in a WebMatrix WebPages environment?
The customErrors entry in your web.config under system.web works for urls with file extensions as we have established. but to work for extension-less urls, you need to override IIS by adding an entry to the system.webServer node in your web.config: <system.webServer> <httpErrors existingResponse="Replace" errorMode="Custom"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="/Error404.cshtml" responseMode="ExecuteURL" /> </httpErrors> </system.webServer> Having done this, you also need to move any other custom error handling to the system.webServer section and remove the customErrors entry under system.web.

Categories : Asp Net

For AngularJS web app: webpages don't remember their last scroll positions when navigating back to them with the back button. Why? How to fix?
If you want to fix it, I can think of an idea of keeping the track of every route scroll position in a map (in service or on a rootScope) - when you are leaving the page ($routeChangeStart listener) just save the scroll position together with route path. And when coming to any page, you can check if a record in a map exists for the route path and scroll window to desired position on $routeChangeSuccess event

Categories : Angularjs



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