relative-path

Changing relative URLs of Javascript files

爱⌒轻易说出口 提交于 2019-12-25 02:58:01
问题 I'm screen scraping using Curl like this: <?php $url = "http://www.bbc.com/news/"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $curl_scraped_page = curl_exec($ch); curl_close($ch); echo $curl_scraped_page; ?> And then I echo the content on an HTML page. The problem is that when I look in my console I see 404 errors because of relative URLs assigned to javascript files. For instance if the URL is: somejavascriptfile.js on loading the page my domain name is added like

Curl and relative path in <head>

你。 提交于 2019-12-24 19:04:08
问题 Im ising this script to scrape a website: <?php $url = "http://www.nu.nl"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $curl_scraped_page = curl_exec($ch); curl_close($ch); echo $curl_scraped_page; ?> The output ads the wrong domain in javascript,css files in the head section. So I tried to fix it with: $url = preg_replace("/<head>/i", "<head><base href='$url' />", $url, 1); Doesn't work, any ideas why? I can't spot anything. Example 回答1: What about using the right

Changing base URL on part of a page only

帅比萌擦擦* 提交于 2019-12-24 16:14:32
问题 I have a page on my site that fetches and displays news items from the database of another (legacy) site on the same server. Some of the items contain relative links that should be fixed so that they direct to the external site instead of causing 404 errors on the main site. I first considered using the <base> tag on the fetched news items, but this changes the base URL of the whole page, breaking the relative links in the main navigation - and it feels pretty hackish too. I'm currently

Using OpenFileDialog w/ a relative path as initialDirectory

折月煮酒 提交于 2019-12-24 04:34:06
问题 I'd like to give the appropriate value to Initial directory, so it would open the folder (called "Images") which I created in my project. I must use a relative path, so my program works not depending on the computer I work . But the problem is I don't know how to access this folder... Does anyone know how to solve this problem? 回答1: use: openFileDialog.InitialDirectory = Path.Combine(Application.StartupPath, @"YourSubDirectoryName"); Edit: or try this if you prefer... are you in windows forms

Setting a relative path to sqlite database with Delphi and Firedac

六眼飞鱼酱① 提交于 2019-12-24 01:17:57
问题 In replacement of my previous question which was confusing and poorly formulated, here is the "real" question. I would like to known how to set, with Firedac, at runtime, a relative path to a sqlite database located in a subfolder of my application folder. As Jerry Dodge stated : Any application should never rely on writable data in the same directory anyway. Also, even if you did, you should make sure all your paths are relative to the application at least. At the moment, the application I

MSBuild clean directory string

守給你的承諾、 提交于 2019-12-24 00:53:45
问题 I have a property in MSBuild to represent the directory above the MSBuildProjectDirectory: <PropertyGroup> <BuildDir>$(MSBuildProjectDirectory)\..</PRSBuildDir> </PropertyGroup> I need to then use this property, but I need the directory string cleaned so that it doesn't include the .. . In other words I need the .. evaluated, so that if the current project file is in C:\Test\Tom\MyDir , then I need a property containing the string C:\Test\Tom . The reason I'm asking is because I'm trying to

How can I specify a RELATIVE JDBC SQLite url (path?)

只谈情不闲聊 提交于 2019-12-24 00:44:53
问题 I've been trying to get this work for two days and tried all suggestions that I could find. Alas, without success, so far. This is what I'm trying to do: I am building a small (java swing) desktop database application. I'm using Netbeans 7.0 and SQLite, and found the JDBC driver from http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC to work fine as long as I specify an absolute path in the JDBC URL: jdbc:sqlite://Users.../lib/db/ithildin.db Here's how it looks in Netbeans' Services ->

Getting relative path from absolute path in PowerShell

梦想与她 提交于 2019-12-24 00:19:51
问题 The problem You have an absolute path, but you want it to be relative to another path. Example: P:/SO/data/database.txt --> Now we want the filename to be relative to: P:/SO/team/lists/ ../../data/database.txt I have already found the Stack Overflow question How to convert absolute path to relative path in PowerShell? . One answer links to an already developed Cmdlet, but this one didn't work for me. And the trick using Set/Get-Location requires the paths to exist. 回答1: The solution I found

ASP.NET WebForms: Why do relative paths within user controls work locally, but not when deployed?

安稳与你 提交于 2019-12-23 22:22:42
问题 Rewriting Question I cannot, for the life of me, get relative image paths work consistently inside usercontrols between using VS's dev server and publishing to a remote IIS server. I do not want to make my image a server tag by adding runat="server" . I want it to be strictly client and I do not want to use any hocus pocus code hacks. I want to resolve the disconnect, so here is my problem: My images are stored in ~/images . My usercontrols are stored in ~/usercontrols/anothersubfolder . When

Is there an easy method to combine two relative paths in C#?

眉间皱痕 提交于 2019-12-23 21:28:02
问题 I want to combine two relative paths in C#. For example: string path1 = "/System/Configuration/Panels/Alpha"; string path2 = "Panels/Alpha/Data"; I want to return string result = "/System/Configuration/Panels/Alpha/Data"; I can implement this by splitting the second array and compare it in a for loop but I was wondering if there is something similar to Path.Combine available or if this can be accomplished with regular expressions or Linq? Thanks 回答1: Provided that the two strings are always