Search Results

Search found 17958 results on 719 pages for 'local delivery'.

Page 56/719 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • TFS 2010 make change to local copy

    - by Prashant
    In TFS 2010 I have a project and I want to make only a local change to it and not check it in. I don't have edit privileges on the project. I tried removing the read only from the project but it will not work(will not allow me to edit). Is there an alternative ?

    Read the article

  • Android Convert Central Time to Local Time

    - by chedstone
    I have a MySql database that stores a timestamp for each record I insert. I pull that timestamp into my Android application as a string. My database is located on a server that has a TimeZone of CST. I want to convert that CST timestamp to the Android device's local time. Can someone help with this?

    Read the article

  • 'umfpack.h' not found, but it's in /opt/local/include/

    - by user2924321
    I'm trying to compile a program called hiQlab on OSX 10.8 g++ -g -O2 -I`echo /Users/.../Documents/hiQlab/hiqlab-2006-07-20/tools/`/lua/include -I`echo /Users/.../Documents/hiQlab/hiqlab-2006-07-20/tools/`/tolua++/include -c cscmatrix.cc cscmatrix.cc:13:12: fatal error: 'umfpack.h' file not found #include "umfpack.h" but I just installed SuiteSparse through macports which includes umfpack and umfpack.h is in fact present in default directory /opt/local/include/ do I need to add the path or something? Thanks!

    Read the article

  • How to make Web Storage persistent in Cordova using JS?

    - by ett
    I have a small quiz app, which is a cross-platform mobile app, that I plan for it to run on Android, iOS, and WP8. I want to store a local highscore, where it will keep track how many points the user had, and if he/she does better than the already stored highscore, update the current highscore. Though, I want the highscore to be persistent, what I mean is, every time the user opens the app I want the last highscore to be present and it to be compared with the new quiz score. Meaning, I don't want the highscore to be deleted after each time the app is closed. I also want for the first time when the app is ran, the highscore to be set to 0, so obviously the first time the user finishes the quiz gets a new highscore. I have those codes so far: scoredb.js // Wait for device API libraries to load document.addEventListener("deviceready", initScoreDB, false); // Device APIs are available function initScoreDB() { window.localStorage.setItem("score", 0); highscore = window.localStorage.getItem("score"); } main.js var correct = 0; var highscore; // In between I have some code that keeps incrementing // correct variable for each correct answer. if (correct > highscore) { window.localStorage.setItem("score", correct); highscore = correct; } It does seem to work okay once the app is started. I did the quiz three times, in the simulator, and it keeps the score as it should. Though, each time I open the app, highscore is reseted to 0. I guess it is due to the fact that I call initScoreDB when the device is ready, and I initialize the score to 0 there and give that value to highscore. Can someone help me to initialize the score to 0 only when the app is ran for the first time, and all the other times to keep the latest highscore as the current highscore and compare it each time with the score that is achieved when the quiz is finished. If someone can help me, I would be glad.

    Read the article

  • How do I use HTML5's localStorage in a Google Chrome extension?

    - by davidkennedy85
    I am trying to develop an extension that will work with Awesome New Tab Page. I've followed the author's advice to the letter, but it doesn't seem like any of the script I add to my background page is being executed at all. Here's my background page: <script> var info = { poke: 1, width: 1, height: 1, path: "widget.html" } chrome.extension.onRequestExternal.addListener(function(request, sender, sendResponse) { if (request === "mgmiemnjjchgkmgbeljfocdjjnpjnmcg-poke") { chrome.extension.sendRequest( sender.id, { head: "mgmiemnjjchgkmgbeljfocdjjnpjnmcg-pokeback", body: info, } ); } }); function initSelectedTab() { localStorage.setItem("selectedTab", "Something"); } initSelectedTab(); </script> Here is manifest.json: { "update_url": "http://clients2.google.com/service/update2/crx", "background_page": "background.html", "name": "Test Widget", "description": "Test widget for mgmiemnjjchgkmgbeljfocdjjnpjnmcg.", "icons": { "128": "icon.png" }, "version": "0.0.1" } Here is the relevant part of widget.html: <script> var selectedTab = localStorage.getItem("selectedTab"); document.write(selectedTab); </script> Every time, the browser just displays null. The local storage isn't being set at all, which makes me think the background page is completely disconnected. Do I have something wired up incorrectly?

    Read the article

  • I have a slight confusion with setting up Mercurial on my webserver...

    - by littlejim84
    I'm starting to use Mercurial on my web server (in this case MediaTemple's Grid). I've used SVN previously, though I'm not an expert of version control systems. I'm just needing a little help with clearing up some confusion with getting it set up optimally. I have a 'data' folder which is outside the web server root and that the browser cannot access. It was recommended to me before to have my Mercurial repositories setup here, then I would clone from here locally on my computer. I would also have a 'domains' folder that is basically the web server root and inside there is my actual domains where my websites are actually served to the browser - these would need to be updated from the 'data' repositories too. But with this in mind, after setting it up, it seems inefficient... I'm cloning to my local (that makes sense), adding, committing, pushing. That's fine... But then I'm then updating in my data repository folder and then updating in my domains folder to actually update my websites. Surely, I don't actually need this 'data' folder for repositories? Wouldn't my actual live 'domains' folders be the main repositories themselves? So I'm cloning locally and updating from these? Please help me clear some confusions with all this (if you can).

    Read the article

  • Why would autoconf/automake project link against installed library instead of local development libr

    - by Beau Simensen
    I'm creating a library libgdata that has some tests and non-installed programs. I am running into the problem that once I've installed the library once, the programs seem to be linking to the installed version and not the local version in ../src/libgdata.la any longer. What could cause this? Am I doing something horribly wrong? Here is what my test/Makefile.am looks like: INCLUDES = -I$(top_srcdir)/src/ -I$(top_srcdir)/test/ # libapiutil contains all of our dependencies! AM_CXXFLAGS = $(APIUTIL_CFLAGS) AM_LDFLAGS = $(APIUTIL_LIBS) LDADD = $(top_builddir)/src/libgdata.la noinst_PROGRAMS = gdatacalendar gdatayoutube gdatacalendar_SOURCES = gdatacalendar.cc gdatayoutube_SOURCES = gdatayoutube.cc TESTS = check_bare check_PROGRAMS = $(TESTS) check_bare_SOURCES = check_bare.cc (libapiutil is another library that has some helper stuff for dealing with libcurl and libxml++) So, for instance, if I run the tests without having installed anything, everything works fine. I can make changes locally and they are picked up by these programs right away. If I install the package, these programs will compile (it seems like it does actually look locally for the headers), but once I run the program it complains about missing symbols. As far as I can tell, it is linking against the newly built library (../src/libgdata.la) based on the make output, so I'm not sure why this would be happening. If i remove the installed files, the local changes to src/* are picked up just fine. I've included the make output for gdatacalendar below. g++ -DHAVE_CONFIG_H -I. -I.. -I../src/ -I../test/ -I/home/altern8/workspaces/4355/dev-install/include -I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include -I/usr/include/libxml2 -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -MT gdatacalendar.o -MD -MP -MF .deps/gdatacalendar.Tpo -c -o gdatacalendar.o gdatacalendar.cc mv -f .deps/gdatacalendar.Tpo .deps/gdatacalendar.Po /bin/bash ../libtool --tag=CXX --mode=link g++ -I/home/altern8/workspaces/4355/dev-install/include -I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include -I/usr/include/libxml2 -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -L/home/altern8/workspaces/4355/dev-install/lib -lapiutil -lcurl -lgssapi_krb5 -lxml++-2.6 -lxml2 -lglibmm-2.4 -lgobject-2.0 -lsigc-2.0 -lglib-2.0 -o gdatacalendar gdatacalendar.o ../src/libgdata.la mkdir .libs g++ -I/home/altern8/workspaces/4355/dev-install/include -I/usr/include/libxml++-2.6 -I/usr/lib/libxml++-2.6/include -I/usr/include/libxml2 -I/usr/include/glibmm-2.4 -I/usr/lib/glibmm-2.4/include -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -o .libs/gdatacalendar gdatacalendar.o -L/home/altern8/workspaces/4355/dev-install/lib /home/altern8/workspaces/4355/dev-install/lib/libapiutil.so /usr/lib/libcurl.so -lgssapi_krb5 /usr/lib/libxml++-2.6.so /usr/lib/libxml2.so /usr/lib/libglibmm-2.4.so /usr/lib/libgobject-2.0.so /usr/lib/libsigc-2.0.so /usr/lib/libglib-2.0.so ../src/.libs/libgdata.so -Wl,--rpath -Wl,/home/altern8/workspaces/4355/dev-install/lib creating gdatacalendar Help. :) UPDATE I get the following messages when I try to run the calendar program when I've added the addCommonRequestHeader() method to the Service class after I had installed the library without the addCommonRequestHeader() method. /home/altern8/workspaces/4355/libgdata/test/.libs/lt-gdatacalendar: symbol lookup error: /home/altern8/workspaces/4355/libgdata/test/.libs/lt-gdatacalendar: undefined symbol: _ZN55gdata7service7Service22addCommonRequestHeaderERKSsS4_ Eugene's suggestion to try setting the $LD_LIBRARY_PATH variable did not help. UPDATE 2 I did two tests. First, I did this after blowing away my dev-install directory (--prefix) and in that case, it creates test/.libs/lt-gdatacalendar. Once I have installed the library, though, it creates test/.libs/gdatacalendar instead. The output of ldd is the same for both with one exception: # before install # ldd test/.libs/lt-gdatacalendar libgdata.so.0 => /home/altern8/workspaces/4355/libgdata/src/.libs/libgdata.so.0 (0xb7c32000) # after install # ldd test/.libs/gdatacalendar libgdata.so.0 => /home/altern8/workspaces/4355/dev-install/lib/libgdata.so.0 (0xb7c87000) What would cause this to create lt-gdatacalendar in one case but gdatacalendar in another? The output of ldd on libgdata is: altern8@goldfrapp:~/workspaces/4355/libgdata$ ldd /home/altern8/workspaces/4355/libgdata/src/.libs/libgdata.so.0 linux-gate.so.1 => (0xb7f7c000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7f3b000) libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7dec000) /lib/ld-linux.so.2 (0xb7f7d000)

    Read the article

  • Error When Loading Images on Local Host Test Server

    - by ke4ktz
    I have a peculiar problem that I just can't seem to find an explanation. I'm working on an AngularJS site for our family and am integrating data from various web services. Currently I am working on the photos section which will integrate in photos from our Flickr account. I have a main page which lists the various photo sets and displays the set's primary photo along with the title. (Note: I'm using the Flickr 'extras' parameter to return the primary photo's URL in the API calls.) <div data-ng-repeat="p in vm.photoSets"> <a ng-href="#/photos/{{p.id}}"> <img ng-src="{{p.primary_photo_extras.url_s}}"></img> </a> <h4>{{p.title._content}}</h4> </div> When clicking on the photo, the routing will display a page with a list of all the photos from that set, showing the image and the title. <div data-ng-repeat="p in vm.photoSetData.photo"> <a ng-href="#/photos/{{vm.photoSetId}}/{{p.id}}" <img ng-src="{{p.url_s}}"></img> </a> <h4>{{p.title}}</h4> </div> Now, here's where the problem is occuring. When I upload the code to my public website on my hosting provider, everything works just fine. Both pages display their respective photos. However, when I attempt to run the site on my local system, either in MAMP or NodeJS (using http-server), the second page gives me an error for each image: Error: [$interpolate:interr] Can't interpolate: {{p.url_s}} Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy. URL: https://farm1.staticflickr.com/37/82749767_e82ff60ce3_m.jpg http://errors.angularjs.org/1.2.9/$sce/insecurl?p0=https%3A%2F%2Ffarm1.staticflickr.com%2F37%2F82749767_e82ff60ce3_m.jpg http://errors.angularjs.org/1.2.9/$interpolate/interr?p0=%7B%7Bp.url_s%7D%7D&p1=Error%3A%20%5B%24sce%3Ainsecurl%5D%20Blocked%20loading%20resource%20from%20url%20not%20allowed%20by%20%24sceDelegate%20policy.%20%20URL%3A%20https%3A%2F%2Ffarm1.staticflickr.com%2F37%2F82749767_e82ff60ce3_m.jpg%0Ahttp%3A%2F%2Ferrors.angularjs.org%2F1.2.9%2F%24sce%2Finsecurl%3Fp0%3Dhttps%253A%252F%252Ffarm1.staticflickr.com%252F37%252F82749767_e82ff60ce3_m.jpg minErr/<@http://localhost/scripts/angular.js:78 $interpolate/fn@http://localhost/scripts/angular.js:8254 $RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost/scripts/angular.js:11800 $RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost/scripts/angular.js:12061 done@http://localhost/scripts/angular.js:7843 completeRequest@http://localhost/scripts/angular.js:8026 createHttpBackend/</jsonpDone<@http://localhost/scripts/angular.js:7942 jsonpReq/doneWrapper@http://localhost/scripts/angular.js:8039 jsonpReq/script.onerror@http://localhost/scripts/angular.js:8053 The API call to Flickr is successful and returns the correct data. In fact, the image title does display! I've tested it with Firefox, Safari and Chrome...all three browsers fail. I cannot find any explanation as to why it would work remotely but fail locally. Also, the images show up on the first page, but not on the second, even though one of the images on the second page is the same image URL as on the first page. Even going directly to the second page, bypassing the first page, still fails. Any ideas on how to fix this? It would be nice to test locally without having to upload to the server each time I make a change. Update: I have shut off the $sce security to see if that was causing the issue. Although it resulted in turning the error off, the files still don't load on the local test server. I have used the developer tools' network monitor and it doesn't even show an attempt to retrieve the files. AngularJS appears to shut down the retrieval, although the correct path shows up in the DOM.

    Read the article

  • How to access Google Chrome browser history programmatically on local machine

    - by Tejas
    I want to write a simple program which shows my internet activity over a period of time (which site I visited, how many times and so on). I mostly use Google Chrome browser. I found out Chrome stores browser history at this location - C:\Documents and Settings\\Local Settings\Application Data\Google\Chrome\User Data\Default (please correct me if I'm wrong). How can I open the history files? They don't have any file extension. I could not open using notepad, SQLite browser. How do I access this data programmatically? I want to know which file format it is and how to read it using a programming language like C#.

    Read the article

  • Can a Silverlight application authenticate versus a local LDAP/ActiveDirectory Server

    - by caryden
    If I have an externally hosted application (www.outside.com) outside the firewall but users within a company wanted to be able to enable LDAP authentication against their local (behind the firewall) AD server (acting as LDAP) or other LDAP server (call it ldap.inside.com), how would this be done. It seems technically possible in that when a user tried to login to outside.com through a client-side silverlight interface, that the SL app could connect to the outside.com login service and be told to authenticate that user against ldap.inside.com. The SL app would make the calls to ldap.inside.com to authenticate the user. Of course, there is the issue of how the server is notified securely that the client authenticated itself...Has anyone done this?

    Read the article

  • Redmine error undefined local variable 'usage' when recieving email

    - by fred
    I posted this on the Redmine forum about 20 days ago but am having no luck finding an answer, so I thought I'd see if I can find some love here: Somewhere during an upgrade to RM I lost the ability to have RM receive email. It was running just beautifully on 8.5. Some while back I upgraded and was not using the receive email feature for some time. At 9.2 and, now, 0.9.3.stable.3625, I'm getting an error in the procmail.log file: undefined local variable or method `usage' for #<RedmineMailHandler:0x6c14d34bb0a0> (NameError) I have a SVN install and used it, just tonight, to update the the 9.3 stable version. I walked through all the upgrade steps and everything seems to work fine, except for this. In rdm-redminehandler.rb I commented out the offending 'usage' line and got another error: 422 Unprocessable Entity

    Read the article

  • Running msiexec from a service (Local System account)

    - by Jarrod
    We are working on an update system for our software. The updater should in the background as a service, and when an update is available, downloads and installs it. We need the service to install the update since the msi requires elevation to run, but some of our clients will be restricted users. The MSI is a WIX MSI and does a Major Upgrade when run. The problem is, the update does not seem to work when ran from our service. I can see msiexec run, and it returns successfully, but seems to make no changes to the system. The same command, when run from my user account works as expected. Is there some caveat to running msiexec from a Local System service? We are simply doing: System.Diagnostics.Process.Start("msiexec.exe", arguments);

    Read the article

  • Dojo reading a json file from a local filesystem using dojo.xhrGet

    - by pfdevil
    Hello, I'm trying to read a file from a local filesystem. I do not have a server at my disposal and thus i'm trying to do it this way. Here is what I got so far; function init(){ netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserWrite'); dojo.xhrGet( { url: "/json/coursedata.json", handleAs:"json", load: function (type, data, evt) {alert (data) }, //mimetype: "text/plain" }); } I'm getting this error from the firebug console; Access to restricted URI denied" code: "1012 http://ajax.googleapis.com/ajax/libs/dojo/1.4/dojo/dojo.xd.js Line 16

    Read the article

  • reporting services: use a custom assembly with a local (RDLC) report

    - by JMarsch
    Hello: I am designing a report that will be used in local mode (an RDLC file) in a Winform app. I have a custom assembly with a static class that has some functions that I want to use inside of the report (as expressions). I have found all sorts of help for doing this with RDL reports, but I'm running into a permissions problem with my RDLC report. I get the following error at runtime: "The report references the code module (my module), which is not a trusted assembly". I know that this is some kind of a code security issue, but I'm not sure what to do to fix it. The documentation that I have seen online is aimed at RDL reports, and it instructs me to edit a SQL Server-specific policy file. I'm using RDLC, so there is no sql server involved. What do I need to do to acquire the appropriate permissions?

    Read the article

  • Perforce command line only showing local users/changelists/workspaces, but P4V shows all

    - by M Katz
    We are using P4 for free with two users. In the P4V admin gui I can see both myself and my partner as users, and in the P4V gui I can see all workspaces (clients) and all changelists (both mine and my partner's). From the command line, 'p4 users' only shows me, 'p4 clients' only shows my local workspace, etc. Is there some mode, environment setting, or special directory from which I have to use the p4 command line to see those global objects? I believe I am a p4 superuser (since I read this is the default on installation and we didn't change anything). I'm obviously missing something very basic about the relationship between p4 command line and P4V. The reason I need to use the command line is to delete an old client workspace (used on a different machine) that has an empty changelist associated with it. I therefore need to use 'p4 client -d -f old-workspace-name' from the command line. But when I do it tells me client 'old-workspace-name' doesn't exist.

    Read the article

  • 503 (Server Unavailable) WebException when loading local XHTML file in Visual C# 2008

    - by kcoppock
    Hello! So I'm currently working on an ePub reader application, and I've been reading through a bunch of regular XML files just fine with System.Xml and XmlDocument: XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(Path.Combine(Directory.GetCurrentDirectory(), "META-INF/container.xml")); XmlNodeList xnl = xmldoc.GetElementsByTagName("rootfile"); However, now I'm trying to open the XHTML files that contain the actual book text, and they're XHTML files. Now I don't really know the difference between the two, but I'm getting the following error with this code (in the same document, using the same XmlDocument and XmlNodeList variable) xmldoc.Load(Path.Combine(Directory.GetCurrentDirectory(), "OEBPS/part1.xhtml")); "WebException was unhandled: The remote server returned an error: (503) Server Unavailable" It's a local document, so I'm not understanding why it's giving this error? Any help would be greatly appreciated. :) I've got the full source code here if it helps: http://drop.io/epubtest (I know the ePubConstructor.ParseDocument() method is horribly messy, I'm just trying to get it working at the moment before I split it into classes)

    Read the article

  • Can you define a ResourceDictionary.MergedDictionary together with other (local) resources in <Wind

    - by Jeremy Holt
    I would like to refer to a MergedDictionary together with locally declared resources in my Windows.Resources. However, I'm getting this error: "All objects added to an IDictionary must have a Key attribute or some other type of key associated with them." Is it possible to mix local resources together with imported resources in the same Window.Resources? The XAML is: <Window.Resources> <CollectionViewSource x:Key="cvsData" Source="{Binding Path=Data}"> <CollectionViewSource.GroupDescriptions> <PropertyGroupDescription PropertyName="Country"/> </CollectionViewSource.GroupDescriptions> </CollectionViewSource> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary x:Name="images" Source="pack://application:,,,/CoreWpfControls;component/Images.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> Thanks Jeremy

    Read the article

  • Sync Framework, Local Database Cache, and my DAL

    - by Refracted Paladin
    I am creating a WPF app that needs to allow users to work in a temporary disconnected state and I plan to use a Local Database Cache. My question's are about my data access layer. Do you typically create the whole DAL to point at the Cache or both and create a switching mechanism? Is Entity's a good way to go for my DAL against the Cache? I am used to L2S but my understanding is that I can't use that against SQLCE, correct? Thanks! PS: Any good resources out there for using Sync, Linq, and WPF? Tutorials, videos, etc?

    Read the article

  • Share application in local network

    - by hedgehogrider
    I would like to eventually create a managerial program that shares and updates information for multiple computers that are on the same network. I am fairly familiar with Python, C++ and a bit of Java, is there a library I could use with any of these languages to design such a program? I could probably create the local interface from where I am right now, but when it comes to packing and sharing data I could not be more clueless; any advice would be platinum. The program will need to differentiate between administrative and user access if that makes a difference.

    Read the article

  • Reading Local Group Policy / Active Directory Settings

    - by Shinobi
    I'm writing a C# program that will enforce password complexity in accordance with the Windows Group Policy setting "Password must meet complexity requirements". Specifically, if that policy is set to Enabled either on the local machine (if it's not part of a domain) or by the Domain Security Policy (for domain members), then my software needs to enforce a complex password for its own internal security. The issue is that I can't figure out how to read that GPO setting. Google searches have indicated that I can read GPO settings with one of these two APIs: the System.DirectoryServices library in .NET Framework, and Windows Management Instrumentation (WMI), but I haven't had any success so far. Any insights would be helpful.

    Read the article

  • assign logon scripts to local users

    - by user311130
    Hello, I wrote a c# code that creates new local user DirectoryEntry localMachine = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer"); DirectoryEntry group = localMachine.Children.Find("administrators", "group"); DirectoryEntry user = localMachine.Children.Find(accountName, "user"); Console.WriteLine(user.Properties.ToString()); I tried to set the logon script for that user by doing: localMachine.Properties["scriptPath"].Insert(0, "logonScript.vbs"); localMachine.CommitChanges(); same with group or user instances.but the property doesn't exist in any of theses instances (localMachine, group or user). I know that because I did: System.Collections.ICollection col = localMachine.Properties.PropertyNames; foreach (Object ob in col) { Console.WriteLine(ob.ToString()); } Any idea of how to do that in other way?Cheers,

    Read the article

  • wkhtmltopdf - cannot convert local file

    - by user522962
    I just downloaded version 10.0 for opensuse v. 11.3. I can convert a webpage (ie www.google.com) using it but cannot convert a local file. I grant all permissions on the file (& i've even tried running under sudo to no avail). This is the error: "Loading pages (1/6) Error: Failed loading page file:///file.html". The file exists but wkhtmltopdf refuses to load it. I even tried version 9.9 w/ the same result What am I missing?

    Read the article

  • Mapping Absolute / Relative (Local) Paths to Absolute URLs

    - by Alix Axel
    I need a fast and reliable way to map an absolute or relative local path (say ./images/Mafalda.jpg) to it's corresponding absolute URL, so far I've managed to come up with this: function Path($path) { if (file_exists($path) === true) { return rtrim(str_replace('\\', '/', realpath($path)), '/') . (is_dir($path) ? '/' : ''); } return false; } function URL($path) { $path = Path($path); if ($path !== false) { return str_replace($_SERVER['DOCUMENT_ROOT'], getservbyport($_SERVER['SERVER_PORT'], 'tcp') . '://' . $_SERVER['HTTP_HOST'], $path); } return false; } URL('./images/Mafalda.jpg'); // http://domain.com/images/Mafalda.jpg Seems to be working as expected, but since this is a critical feature to my app I want to ask if anyone can spot any problem that I might have missed and optimizations are also welcome since I'm going to use this function several times per each request.

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >