I have SEF urls like /sitename/section/12-news-title and number 12 is id of the news. I need to get that number 12 in my php code, is there any out of the box method in PHP for this?
I have 2 asp.net web applications running in IIS7:
http://app1.local/
and
http://app2.local/
My host.ini file just maps the above urls to localhost:
::1 app1.local
::1 app2.local
I added the same machine key to both their web.config's.
When I sign into app2, and then go to app1, the call to Request.IsAuthenticated is false?
Should this work?
Hi all
I have a URL such as http://www.domain.com/index.php?p=register. I want to redirect that to use HTTPS (SSL) with .htaccess, but only on this, and a couple of other pages (the login page, etc), but not the entire site. The URLs don't point to directories, but are used to dynamically include different files.
Can someone give me a pointer or an example of how to get a single page redirect to HTTPS please?
Thanks,
James
I have a Service which receives URLs to download.
The Service than downloads these URLs and save them to a file on the SD Card.
When I put more than 2 items in the download queue my device is unusable. It nearly freezes. Huge lags and so on.
Any idea?
Sourcecode:
private static boolean downloading = false;
private static ArrayList<DownloadItem> downloads = new ArrayList<DownloadItem>();
/**
* called once when the service started
*/
public static void start() {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
if (downloads.size() > 0 && !downloading) {
downloading = true;
DownloadItem item = downloads.get(0);
downloadSingleFile(item.getUrl(), item.getFile());
}
}
}
});
thread.start();
}
public static void addDownload(DownloadItem item) {
downloads.add(item);
}
private static void downloadSuccessfullFinished() {
if (downloads.size() > 0)
downloads.get(0).setDownloaded(true);
downloadFinished();
}
private static void downloadFinished() {
// remove the first entry; it has been downloaded
if (downloads.size() > 0)
downloads.remove(0);
downloading = false;
}
private static void downloadSingleFile(String url, File output) {
final int maxBufferSize = 4096;
HttpResponse response = null;
try {
response = new DefaultHttpClient().execute(new HttpGet(url));
if (response != null
&& response.getStatusLine().getStatusCode() == 200) {
// request is ok
InputStream is = response.getEntity().getContent();
BufferedInputStream bis = new BufferedInputStream(is);
RandomAccessFile raf = new RandomAccessFile(output, "rw");
ByteArrayBuffer baf = new ByteArrayBuffer(maxBufferSize);
long current = 0;
long i = 0;
// read and write 4096 bytes each time
while ((current = bis.read()) != -1) {
baf.append((byte) current);
if (++i == maxBufferSize) {
raf.write(baf.toByteArray());
baf = new ByteArrayBuffer(maxBufferSize);
i = 0;
}
}
if (i > 0) // write the last bytes to the file
raf.write(baf.toByteArray());
baf.clear();
raf.close();
bis.close();
is.close();
// download finished get start next download
downloadSuccessfullFinished();
return;
}
} catch (Exception e) {
// not successfully downloaded
downloadFinished();
return;
}
// not successfully downloaded
downloadFinished();
return;
}
Hello,
I have a list of urls for which I want to display first 200 or 250 characters. Can I do it using jquery or should I download them on the server side [using PHP] and store them in database?
I guess I will have to use fopen with limit of characters. **
How can I create the mod_rewrite rule so I can convert the following URLs:
From:
domain/something/param/action
ex:domain/cities/Chicago/view
to:
domain/something/action.php?param1=param
ex: domain/cities/view.php?city=Chicago
Changing to cities/view/Chicago cannot be an alternative.
Thanks in advance.
My friend said, "Pylons is so much better for web services."
My other friend said, "You can modify Django in a way to do exactly whatever you like."
In Django, what is necessary to be modified (urls.py? models classes? settings?) in order to do "web services" with APIs and REST and versioning, etc etc.?
I've made no changes to the django project after running django-admin.py startproject Twingle
When I run the local web server using python manage.py runserver, I can view the splash page telling me everything is working fine. But when I try to visit that project through apache, it fails. You can see the error at
http://djaffry.selfip.com:8080/
The exception:
Exception Value: No module named Twingle.urls
(the project is Twingle)
I seem to be having an issue with my Apache Rewrites
RewriteEngine on
RewriteBase /
RewriteRule ^wordpress/?$ / [NC,L,R=301]
RewriteRule ^/$ wordpress/ [NC,L]
I simply need to remove /wordpress from the URL as I have pages within Wordpress I want to be seen as the main directory
At the moment the urls are
domain.com/wordpress/blog
I'd rather not have /wordpress, rather domain.com/blog
Any help?
I've got the following regex that was working perfectly until a new situation arose
^.*[?&]U(?:RL)?=(?<URL>.*)$
Basically, it's used against URLs, to grab EVERYTHING after the U=, or URL= and return it in the URL match
So, for the following
http://localhost?a=b&u=http://otherhost?foo=bar
URL = http://otherhost?foo=bar
Unfortunately an odd case came up
http://localhost?a=b&u=http://otherhost?foo=bar&url=http://someotherhost
Ideally, I want URL to be "http://otherhost?foo=bar&url=http://someotherhost", instead, it is just "http://someotherhost"
Does anyone have any ideas how to design a website with an iframe inside , like a gallery , to browse inside urls , but still remain on the basic site ?
Something like this : http://ru.trovit.com/nedvizhimost/index.php/cod.frame/url.http%253A%252F%252Fwww.mesto.ru%252Fhouse-sale%252F1165477/id_ad.123131lZaNE/type.1/what.%D0%B4%D0%BE%D0%BC%20%D0%BB%D0%B5%D0%BD%D0%B8%D0%BD%D0%B3%D1%80%D0%B0%D0%B4%D1%81%D0%BA%D0%B0%D1%8F%20%D0%BE%D0%B1%D0%BB%D0%B0%D1%81%D1%82%D1%8C/pos.2/org.1/frame_pos.2/publisher_id./referer_id.51/t.1
I have WAMP installed on my local machine and am looking to serve up charts using jFree's Eastwood charting, which requires me to use servlets. So basically I will insert images with src tags that have URLs pointing to my servlet on the same machine.
What's the easiest way to enable servlets on the same machine? Do I need to install a servlet server on a different port? Or is there a way to integrate it into WAMP?
I have a very long a unfriendly URL an I'm looking to make SEO better for the site:
http://www.site.com/sub-site/index.php?page=nameofpage&locale=en_EN
I would like to have this instead:
http://
www.site.com/sub-site/en/nameofpage
all the URLS are hard coded in the links in the form of:
<a href="index.php?page=nameofpage&locale=en_EN">link</a>
What is the best way to achieve this?
First, I can assume that all urls that end with jpeg, jpg, bmp, png or gif are images, and others aren't.
I thought of, and tried two solutions:
Matching the regular expression .(jpe?g|bmp|png|gif)$
Using ends-with to check each separately
But, it appears that neither of these exist in XPath 1.0, or at least, they don't exist in Firefox (I am writing a greasemonkey script, so it is only important for the path to work in Firefox).
I want to be able to download a page and all of its associated resources (images, style sheets, script files, etc) using Python. I am (somewhat) familiar with urllib2 and know how to download individual urls, but before I go and start hacking at BeautifulSoup + urllib2 I wanted to be sure that there wasn't already a Python equivalent to "wget --page-requisites http://www.google.com".
Specifically I am interested in gathering statistical information about how long it takes to download an entire web page, including all resources.
Thanks
Mark
I need a list of urls to apply filters to and ATM i write $('.classname a') but now i need only the first link of each list. How do i get this using jquery?
is there a way to make mod_rewrite redirect all urls contain the following request:
?do=page&f=*
to a specific page? for example:
http://example.com/index.php?do=page&f=2
http://example.com/index2.php?do=page&f=4
http://example.com/page.php?do=page&f=22
to:
http://example.com/custom.php
hi,
what's the easiest way to cut string in Flex ?
I mean, I have a sequence of urls, I want them at most 60 characters length. If they are longer they should be cut and "..." should be added at the end.
<mx:LinkButton label="{bookmarksRepeater.currentItem.name}" click="navigateToURL(new URLRequest(event.currentTarget.label.toString()))" />
thanks
HI,
I used to have PHP websites and using url rewriting on picture to have SEO friendly urls,
On php I had links like
/image/blablablabla-1234-blablabla
rewriting to:
/image/1234.jpg
by using a url rewrite rule on apache .htaccess file.
Now I totally switched to ruby on rails and I would like to know what is the best way to do that on RoR? I am hosting websites on apache with passenger.
Thanks in advance
I've got a regex for detecting links that works pretty well for urls of the form http://example.com, http://www.example.com etc but not for www.example.com
I am trying to extend what i have so that www.foo.com also gets matched without breaking previous functionality.
I tried this:
/\(?\b((http|https|ftp):\/\/|)(www\.)[-A-Za-z0-9+&@#\/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#\/%=~_()|]/
but this only works when www is present and doesn't work e.g. for http://example.com ...
I have a simple page structure like below
/directory/subdir_1/index.php
/directory/subdir_2/index.php
....
(there are no other files in these directories)
is it possible to have 'fake/pretty' urls for the above files as below?
/directory/subdir_1
/directory/subdir_2
...
so this path would show whether the visitor typed that,/directory/subdir_2/ or /directory/subdir_2/index.php.
Many thanks
Is there a difference between these URLs in regards to having slashes at the end of the URL?
https://drchrono.com/about_us
https://drchrono.com/about_us/
Do web frameworks and web servers (e.g. Apache, Nginx, Django) handle these requests differently?
I want to implement some attractive /path/to/my/app URLs for a java application. There is already an apache instance in front of the app server, with mod_rewrite installed. Do I win anything by using a java-based rewriter like UrlRewriteFilter instead?
I wrote a code:
use LWP::UserAgent;
use HTTP::Cookies;
use threads;
use threads::shared;
$| = 1;
$threads = 50;
my @urls : shared = loadf('url.txt');
my @thread_list = ();
$thread_list[$_] = threads->create(\&thread) for 0 .. $threads - 1;
$_->join for @thread_list;
thread();
sub thread
{
my ($web, $ck) = browser();
while(1)
{
my $url = shift @urls;
if(!$url)
{
last;
}
$code = $web->get($url)->code;
print "[+] $url - code: $code\n";
if($code == 200)
{
open F, ">>200.txt";
print F $url."\n";
close F;
}
elsif($code == 301)
{
open F, ">>301.txt";
print F $url."\n";
close F;
}
else
{
open F, ">>else.txt";
print F "$url code - $code\n";
close F;
}
}
}
sub loadf {
open (F, "<".$_[0]) or erroropen($_[0]);
chomp(my @data = <F>);
close F;
return @data;
}
sub browser
{
my $web = new LWP::UserAgent;
my $ck = new HTTP::Cookies;
$web->cookie_jar($ck);
$web->agent('Opera/9.80 (Windows 7; U; en) Presto/2.9.168 Version/11.50');
$web->timeout(5);
return $web, $ck;
}
After its working for some time physical storage is full.
Can u help me to re-write it with AnyEvent. I tried but my code didn't work. I read that it will help me to safe some memory.
Thanks a lot to any helpers.