I Have several forms in my website and I have several pages with intense database activity. I want to set a cap on requests per user. For example, I don't want people to make over 10 requests in less than 10 seconds.
Is there way to do this in Django?
Hi
In my report there is a table and a line.
the table is showing rows of data from my DB.
I want to know how you could make the table size commensurate with the line (make the length of the line is equal to the length of the table)
I set the property "RepeatWith" in the line properties to the table in my report, but this isn't working because this will only work if the data region spans multiple pages.
How I can do that?
Thanks in Adv
I have a Windows Forms WebBrowser control embedded in my application. Is there any way to get a web pages favicon using either the WebBrowser or HtmlDocument API? Even obtaining it from the local file system would suffice. Downloading the icon as a separate operation would be a last resort...
Thanks.
Hi experts.
I have some filter and one grid.And grid have some buttons like modify/edit.I am selecting some value from filters and getting some result in grid.now i want to modify some record.when i come again on grid data in filter should be remain same.
There is two pages.
one contain filters and grid
second contain modify details.
Thanks
Pankaj Pareek.
Hey,
I'm using the WebBrowser control in an ASP.NET MVC 2 app (don't judge, I'm doing it in an admin section only to be used by me), here's the code:
public static class Screenshot
{
private static string _url;
private static int _width;
private static byte[] _bytes;
public static byte[] Get(string url)
{
// This method gets a screenshot of the webpage
// rendered at its full size (height and width)
return Get(url, 50);
}
public static byte[] Get(string url, int width)
{
//set properties.
_url = url;
_width = width;
//start screen scraper.
var webBrowseThread = new Thread(new ThreadStart(TakeScreenshot));
webBrowseThread.SetApartmentState(ApartmentState.STA);
webBrowseThread.Start();
//check every second if it got the screenshot yet.
//i know, the thread sleep is terrible, but it's the secure section, don't judge...
int numChecks = 20;
for (int k = 0; k < numChecks; k++)
{
Thread.Sleep(1000);
if (_bytes != null)
{
return _bytes;
}
}
return null;
}
private static void TakeScreenshot()
{
try
{
//load the webpage into a WebBrowser control.
using (WebBrowser wb = new WebBrowser())
{
wb.ScrollBarsEnabled = false;
wb.ScriptErrorsSuppressed = true;
wb.Navigate(_url);
while (wb.ReadyState != WebBrowserReadyState.Complete) { Application.DoEvents(); }
//set the size of the WebBrowser control.
//take Screenshot of the web pages full width.
wb.Width = wb.Document.Body.ScrollRectangle.Width;
//take Screenshot of the web pages full height.
wb.Height = wb.Document.Body.ScrollRectangle.Height;
//get a Bitmap representation of the webpage as it's rendered in the WebBrowser control.
var bitmap = new Bitmap(wb.Width, wb.Height);
wb.DrawToBitmap(bitmap, new Rectangle(0, 0, wb.Width, wb.Height));
//resize.
var height = _width * (bitmap.Height / bitmap.Width);
var thumbnail = bitmap.GetThumbnailImage(_width, height, null, IntPtr.Zero);
//convert to byte array.
var ms = new MemoryStream();
thumbnail.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
_bytes = ms.ToArray();
}
}
catch(Exception exc)
{//TODO: why did screenshot fail?
string message = exc.Message;
}
}
This works fine for the first screenshot that I take, however if I try to take subsequent screenshots of different URL's, it saves screenshots of the first url for the new url, or sometimes it'll save the screenshot from 3 or 4 url's ago. I'm creating a new instance of WebBrowser for each screenshot and am disposing of it properly with the "using" block, any idea why it's behaving this way?
Thanks,
Justin
I'm working on a personal project to build a small web app that is built using AJAX requests and talks to a RESTful API rather than traditional HTML pages and form submissions.
Are there any online articles or tutorials or any books that people could recommend that cover design patterns for this kind of thing?
Hi All,
I have a javascript class with methods and properties.
Is it possible to wire this class up to a pageunload event?
I am trying to call a method in my class when the user moves pages.
How can I do this.
Thanks
In one of my Selenium test cases, I try to ensure that certain pages can't be accessed. Instead, HTTP return code 403 should be given.
However, here Selenium terminates test execution with the following exception:
com.thoughtworks.selenium.SeleniumException: XHR ERROR: URL = http://user:[email protected]/admin Response_Code = 403 Error_Message = Forbidden
Any way to work around that?
Hello everyone,
I am using SharePoint Server 2007 with collaboration portal template on Windows Server 2008. The default search address for a site is pointed to /SearchCenter/Pages/Results.aspx. Any ideas how to change the address to some other address? Either programming solution or easy config solution is fine.
thanks in advance,
George
I have a master page which references a style in the following manner:
<link rel="stylesheet" type="text/css" href="../../Content/Style.css" />
All my pages inherit from this master page. And this works well when the URL is http://www.domain.com/home/details/5, however the URL is http://www.domain.com/home/create, then, of course, Style.css cannot be found because `../../Content/Style.css' resolves to a directory one higher where there is nothing there.
How is this typically handled?
I set up a few pages with OutputCache profiles and confirmed that they are being cached by using multiple browsers and requests to retrieve the page with a timestamp which matched across all requests. When I try to enumerate the HttpContect.Cache it is always empty.
Any ideas what is going on here or where I should be going for this information instead?
I've been looking around JQuery libraries for the URL hash, but found none that were good. There is the "history plugin", but we all know it's buggy and isn't flexible.
I am loading my pages inside a div. I'll need a way to do back/forward along with the url hashing.
mydomain.com/#home
mydomain.com/#aboutus
mydomain.com/#register
What's the best library that can handle all of this?
I'm using Visual Studios' built-in ASP.NET Development Server (VWD) to test my web site during development.
I would like this ASP.NET web site to use extensionless URLs (pages don't require the aspx extension). Ordinarily I would configure a custom 404 in IIS that directs to an ASPX page. How would I do this with VWD?
P.S. This is not an ASP.NET MVC web site.
For example, to access a page in my search folder, I have to write:
mywebsite.tld/search/searchJob.php
I don't want users to have to write down folder structure and whatnot. What can I do to change this?
OR, is there a better way to organize my files? Because I'm only two pages in and I decided to move some files and got lost in the heirarchy (that's why I moved them like in the picture).
Hi
Does someone know a good way to automate the gui testing based on an Asp.Net frontend? (instead of always run the pages and test the inputs and outputs of a control by hand)
Are there any references or framework to support these tests?
Thanks
I'm writing an extension for firefox. Using dom.location to keep track of visited search results pages, i'm getting this url http://www.google.com/search?hl=en&source=hp&q=hi&aq=f&aqi=&oq=&fp=642c18fb4411ca2e . If you click it, the google search results for "hi" should come up. You'll know that from the title bar - because the rest of the page won't load. This happens with any google search. Oddly enough, if you cut part of it off, so say, http://www.google.com/search?hl=en&source=hp&q=hi - it works! But Googling "hi" myself does give me a longish URL - http://www.google.com/#hl=en&source=hp&q=hi&aq=f&aqi=&oq=&fp=db658cc5049dc510 . I know for a fact that the first time that URL was visited, the page loaded, I did it myself.
Can anyone make reason out of this?
I just tried my experiment again, this time saving the original URL in the location bar. It turns out, dom.location.href is giving a different value. How is this happening?
Original:
http://www.google.com/#hl=en&source=hp&q=hi&aq=f&aqi=&oq=&fp=642c18fb4411ca2e
dom.location.href
http://www.google.com/search?hl=en&source=hp&q=hi&aq=f&aqi=&oq=&fp=642c18fb4411ca2e
window.addEventListener("load", function() { myExtension.init(); }, false);
var myExtension = {
init: function() {
var appcontent = document.getElementById("appcontent"); // browser
if(appcontent)
appcontent.addEventListener("DOMContentLoaded", myExtension.onPageLoad, true);
var messagepane = document.getElementById("messagepane"); // mail
if(messagepane)
messagepane.addEventListener("load", function () { myExtension.onPageLoad(); }, true);
},
onPageLoad: function(aEvent) {
var doc = aEvent.originalTarget; // doc is document that triggered "onload" event
// do something with the loaded page.
// doc.location is a Location object (see below for a link).
// You can use it to make your code executed on certain pages only.
var url = doc.location.href;
if (url.match(/(?:p|q)(?:=)([^%]*)/)) {alert("MATCH" + url);resultsPages.push(url);} else {alert(url);
}
}
This snippet comes directly from Mozilla with the matching and alerts my own. I apologize for not posting the code earlier.
I am trying to get the list of people from the http://en.wikipedia.org/wiki/Category:People_by_occupation . I have to go through all the sections and get people from each section.
How should i go about it ? Should i use a crawler and get the pages and search through those using BeautifulSoup ?
Or is there any other alternative to get the same from Wikipedia ?
I am using UIWebView in a regular Objective-C iPhone App. Web pages displayed in the UIWebView are writing to a HTML5 client-side SQL database via javascript. I would like to open this database for reading and writing from the iPhone App. Is this possible? and if so, how do I find the database and can I use the SQLite framework to open them?
I'm using Ion Auth and trying to implement the forgotten password feature which relies upon an email being sent from CI. My LAMP server is on a shared cPanel account and uses sendmail. However, I have the ability to over-ride any PHP settings with my own php.ini file in the public_html directory.
As per the CodeIgniter 2 documentation for configuring email sending, I have done the following...
1) created a file called located at application/config/email.php
2) email.php contains this code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| EMAIL SENDING SETTINGS
| -------------------------------------------------------------------
*/
$config['protocol'] = 'sendmail';
/* End of file email.php */
/* Location: ./application/config/email.php */
3) The in the application/config/ion_auth.php file, I set this value to TRUE
$config['use_ci_email'] = TRUE;
The email is successfully sent, but I get a variety of PHP Error Warnings on all pages.
These appear on all pages, sometimes two or three times in a row:
A PHP Error was encountered
Severity: Warning
Message: date() [function.date]: It is not safe to rely on the
system's timezone settings. You are required to use the
date.timezone setting or the date_default_timezone_set() function. In
case you used any of those methods and you are still getting this
warning, you most likely misspelled the timezone identifier. We
selected 'America/New_York' for 'EST/-5.0/no DST' instead
Filename: libraries/Email.php
Line Number: 704
A PHP Error was encountered
Severity: Warning
Message: date() [function.date]: It is not safe to rely on the
system's timezone settings. You are required to use the
date.timezone setting or the date_default_timezone_set() function. In
case you used any of those methods and you are still getting this
warning, you most likely misspelled the timezone identifier. We
selected 'America/New_York' for 'EST/-5.0/no DST' instead
Filename: libraries/Email.php
Line Number: 709
In addition to the above, these two also show up after the forgotten password form is submitted:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by
(output started at
/home/username/codeigniter/system/core/Exceptions.php:185)
Filename: libraries/Session.php
Line Number: 675
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by
(output started at
/home/username/codeigniter/system/core/Exceptions.php:185)
Filename: helpers/url_helper.php
Line Number: 540
I'm not sure why I would be getting these Error Warnings or how else I am supposed to configure my email sending options. I don't see any other email sending options in the documentation that is related to these particular Warning Messages. When I remove my config/email.php file AND set Ion Auth's use_ci_email to FALSE, the Error Warnings go away.
Where did I go wrong?
Just before I hit the submit button, I solved this problem. I'm still going to post this question as a learning experience for others. If nobody solves this after a reasonable amount of time, I'll post the solution.
I have added and removed fields in my models.py file and then run manage.py syncdb. Usually I have to quit out of the shell and restart it before syncdb does anything. And then even after that, I am getting errors when trying to access the admin pages, it seems that certain new fields that I've added still don't show up in the model:
Caught an exception while rendering: no such column: mySite_book.Title
I want to use WatiN with IE in a parallel setting, i.e. work with dozens/hundreds of pages at once. I've tried sticking it into a Parallel.For loop only to see the whole thing crash, so I'm thinking opening multiple tabs in the browser is the way to go. Can someone suggest how this can be done using WatiN (or just some IE-related API) or whether there's a better way? TIA!
Hello community,
i have the following problem sometimes my openURL-Dialog works perfectly, then i looked at the variable from the url and that is the variable:
www.brehm-gmbh.de
but some other times there are some crazy elements at the end of the variable like this:
www.adamczyk-fenster.de%E2%80%8E
i get this pages from an .asc file and both are in this file normal without this elements,
what can i do to solve this problem?
thank you all for helping beforehand
Any idea why the following virtual host causes xampp to give me a "403 forbidden error"?
<VirtualHost *:80>
ServerName rst
DocumentRoot "C:/xampp/htdocs/administrator/login.php"
</VirtualHost>
If I delete this code then xampp loads web pages just fine...but I don't want to have to type in the whole url...I want to just type in "rst" and go to my page.
This is on a windows vista machine.
Thanks for the help.
I have a CSS stylesheet defined in the Master Page of my project. On one of the pages/views that inherits from the Master Page, I need to add another CSS stylesheet (I could also add it inline, though I'd rather not).
However, how to do this escapes me. Is this even possible?