w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Accessing HostingEnvironment.MapPath() within class called by webservice / website
In the end I've found the following solution: Set the properties on the dependent files: Copy to Output Directory = Copy if newer This copies the files into the bin folder of the Hosting Environment (so it will copy it into either the WCF Service or the WebApplication from the Class Library) HostingEnvironment.ApplicationPhysicalPath then returns this location The difference is the files are being copied cross project when building (I didn't know copy if newer did this). I can therefore access the files from the applications' bin (and not from the Class Library as I was attempting before).

Categories : C#

Server.MapPath returning a path with a folder that doesn’t exists
I don't believe MapPath guarantees that a path exists, it just tacks your virtual path to the context path. I think your problem is that you're using HttpContext.Current.Server.MapPath try using HttpContext.Current.Request.MapPath

Categories : Dotnet

StreamReader Server.MapPath - Physical path given, virtual path expected
MapPath translates paths starting from ~ to full local path. Does not look like you need it in your code. If the file is supposed to be at fixed place all the time, open in directly by full path. If it is relative to site root, then use something like Server.MapPath("~/status.txt")

Categories : C#

In ASP.NET, what determines the value of HostingEnvironment.IsDevelopmentEnvironment?
The decompiled code of this property is as follows: public static bool IsDevelopmentEnvironment { get { return ((AppDomain.CurrentDomain.GetData(".devEnvironment") as bool?) == true); } } But I couldn't fin where this value is set.. :-(

Categories : Asp Net

Wordpress uploads files in a wrong path (wrong date)
Are you uploading to a post from 2009? If so, this may explain (it's a feature not a bug): "Using WP 2.8.4, when uploading new media files to a page or post that has already been published, the new file is added in the /UPLOAD_DIR/year/month/ directory that corresponds to the original page/post publication date, rather than the file upload date." From: http://core.trac.wordpress.org/ticket/10752

Categories : Wordpress

vim autocompletes wrong path when executing external script in a different path
Try executing: export PATH="~/Dropbox/Work/Scripts:$PATH" which will add it as the first place to look for the script. Then you'll see if the "k/Scripts/PythonTidy.py" is in the PATH prior, and thus found first by vim.

Categories : Vim

os.path.join in python returns 'wrong' path?
From the os.path.join() documentation: Join one or more path components intelligently. If any component is an absolute path, all previous components (on Windows, including the previous drive letter, if there was one) are thrown away, and joining continues. A / at the start makes /tmp an absolute path. If you wanted to join multiple path elements that perhaps contain a leading path separator, then strip those first: os.path.join(*(elem.lstrip(os.sep) for elem in elements)) Special-casing absolute paths makes it possible for you to specify either a relative path (from a default parent directory) or an absolute path and not have to detect if you have an absolute or relative path when constructing your final value.

Categories : Python

strtotime returning wrong day
This is because The Date represents the time is in time zone specified in date.timezone settings. So the timezone -07:00 is parsed and converted back to date.timezone timezone. To understand the idea just add e in the date string echo date('D e',strtotime("2013-06-16T06:00:00-07:00")); echo date('D e',strtotime("2013-06-16T18:00:00-07:00")); See example. Its better you use DateTime(). It does not have such limitation.

Categories : PHP

ReadAllText returning wrong value
You must iterate over your query result, executing command for each item in result, like this: foreach(var item in File.ReadAllLines(ofd.FileName).Select(x => x.Split(',')[4])); { objSqlCommands.sqlCommandInsertorUpdate2("INSERT", item); } BTW, for some reason you're using File.ReadAllText(), which returns string for all file content. Most likely, you will need to use File.ReadAllLines(), which will return string for each line in your file.

Categories : C#

@ModelAttribute is returning something wrong
When the first method is execute and the form is rendered the first time, the autor should be in the model. So using ${verbeteform.autor} should print the autor field. But when you submit the form, the model is fullfilled with the data in the form. So if the form doesnt have a autor field like: <form:form modelAttribute="verbeteform" method="POST"> <form:input path="autor"/> </form:form> the value is not added to the model, so in the second controller you have a null value in the autor field because the model is regenerated.

Categories : Java

Using Server.MapPath() to generate img src, not working
APP_Data is a restricted folder intended for Datasources such as Database only. ASP.Net will not deliver a file in here - try it by going to the URL for that image directly (I.E www.mysite/App_Data/5/62.jpg ) and you will see the error message HTTP Error 403 - Forbidden. Put your images in a folder outside of this and you will be fine, such as a folder in the root Called Images

Categories : Asp Net

Server.MapPath() with IIS URL Rewrite Module 2.0
I was looking for the same thing so I gave it a try in a test app. It appears that Server.MapPath() does not acknowledge URL Rewrite Module rules. Here is how I tested using an empty web project (Razor syntax): Rewrite rule: <system.webServer> <rewrite> <rules> <rule name="Rewrite rule1 for test1"> <match url="^test1(.*)" /> <action type="Rewrite" url="{R:1}" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> cshtml: <p> The URL for this page is @Request.Url.AbsoluteUri . <br /> MapPath of /test1 is @Server.MapPath("~/test1") <br /> MapPath of / is @Server.MapPath("~/") </p> I

Categories : Iis

Using Server.MapPath to save a file
You can access it through the current context HttpContext.Current.Server.MapPath("~/App_Data/stored"); to get the full file path : var filePath = Path.Combine(HttpContext.Current.Server.MapPath("~/App_Data/stored"), package.Id + ".zip");

Categories : Asp Net

Wrong path with PHP in WordPress
The problem is with your SRC code. when you are in a page like: http://domain.com/page and you call a link from the path wp-content/themes/twentyeleven/images/loader.gif you get the url you are in now + the link path. which means you get: http://domain.com/page/wp-content/themes/twentyeleven/images/loader.gif while the real link is supposed to be: http://domain.com/wp-content/themes/twentyeleven/images/loader.gif if this is a function in a php file i recommend you to change it to this: $(document).ready(function() { //click of form bottom $("#contact-button").click(function(){ $(this).hide(); $("<img src='<?php bloginfo('template_url'); ?>/images/loader.gif' class='loader' />").appendTo("#contact"); } } you can find this function at: Function

Categories : PHP

CAS redirection with wrong path
I finaly found the solution. I replaced this lines : <init-param> <param-name>serverName</param-name> <param-value>http://localhost:8080/firstCasClient</param-value> </init-param> by : <init-param> <param-name>service</param-name> <param-value>http://localhost:8080/firstCasClient</param-value> </init-param> in CAS Authentication Filter and CAS Validation Filter Then it works fine :)

Categories : Java

Why is date() returning the wrong month?
date works on a timestamp not a textual representation of a date If you change the 0 to a 1 for day of month (thus getting a valid date to start from) and use strtotime date('F Y', strtotime('2013-05-01T00:00:00')); Then it will work

Categories : PHP

sexpr returning wrong value of r object
I decided to clear the cache and remove all objects (including hidden objects) from the workspace once again. But this time I also deleted several hidden files that R creates (history and data). When I ran the code chunks again and compiled the document, everything worked. I believe the only new step was deleting the hidden documents.

Categories : R

PHP preg_match returning the wrong indexes
preg_match matches the first match and then stops. The result array always contains the entire matched expression in its 0 index and all capture groups in the following indices starting at 1. E.g.: preg_match('/foo (w+)/', 'foo bar', $r) $r here contains 0 => 'foo bar', 1 => 'bar'. So in your case you're just seeing the very first hello twice due to this. If you want to match all occurrences of the expression, use preg_match_all.

Categories : PHP

SQL AVG() Returning the wrong result for 3 columns
The OUTER JOIN you have in the query may be affecting the number of rows that the AVG function is operating over. If you don't need it (and I can't see anywhere where that table is referenced elsewhere in your query) try removing it.

Categories : SQL

CTE returning wrong value in CASE EXIST
Why not run an actual test WITH cte AS ( SELECT City.* FROM City WHERE (City.CityName COLLATE SQL_Latin1_General_CP1_CI_AI) LIKE 'são paulo' ) SELECT Neighbor.City_Id FROM Neighbor INNER JOIN cte ON Neighbor.City_Id = cte.city_id WHERE (Neighbor.NeighborName COLLATE SQL_Latin1_General_CP1_CI_AI) LIKE 'ademar'

Categories : SQL

SQLite returning wrong data
Try this one select AUTHORS_ABSTRACT.ABSTRACTSITEM_ID, ABSTRACT_AFFILIATION.AFFILIATION_NUMBER, AUTHORS_AFFILIATE.ABSTRACTAUTHOR_ID from AUTHORS_ABSTRACT left join ABSTRACT_AFFILIATION on AUTHORS_ABSTRACT.ABSTRACTAUTHOR_ID = ABSTRACT_AFFILIATION._id left join AUTHORS_AFFILIATE on ABSTRACT_AFFILIATION._id=AUTHORS_AFFILIATE.ABSTRACTAFFILIATION_ID ORDER BY AUTHORS_ABSTRACT.ABSTRACTSITEM_ID ASC

Categories : Database

Javascript if statement returning wrong value
It looks like your checkHour variable is loaded with the date. You never set it's value to the hours. Perhaps you meant the second line to read: checkHour = checkHour.getHours();, so your corrected code would be: var checkHour = new Date(); checkHour = checkHour.getHours(); function time(){ if((checkHour >= 0) && (checkHour <= 12)){ alert(" Good Morning"); }else if((checkHour >= 12) && (checkHour <= 18)){ alert("Afternoon"); }else{ alert("Good Evening") } }

Categories : Javascript

function returning wrong value while executing
You are returning select @car = t1.TBarcode from Transaction_tbl t1 this from your function. Since it does not have proper where clause @car is assigned by the first value of TBarcode . Hence the function returns the first value of TBarcode from Transaction_tbl as output Try this ALTER function [dbo].[keyloc](@status numeric(18,2),@cardID VARCHAR(50)/*Newly added*/) RETURNS varchar(50) ASbegin declare @car nvarchar(100), @keylocation Varchar(50) if @status=0 begin select @car = t1.TBarcode from Transaction_tbl t1 WHERE t1.TBarcode =@cardID select @keylocation='With Employee'+'('+@car+')' return @keylocation end Procedure ALTER procedure [dbo].[fetchkey] @carid nvarchar(50) =null as begin select t.TBarcode, t.Status, [dbo].[keyloc](t.Status,@car

Categories : Sql Server

Why won't File.copy work with Server.MapPath
Server.MapPath is a secure method, and requires that you have AspEnableParentPaths set to true for your application. http://msdn.microsoft.com/en-us/library/ms524632(v=vs.90).aspx

Categories : Asp Net

How we Redirect one Page to AnotherPage with Server.MapPath
you don't need MapPath here, since you have relative path you can directly call Response.Redirect Response.Redirect("~/ReportPage.aspx"); Server.MapPath will return physical path of given file. For example when we need to read TEXT file inside root folder var lines = File.ReadAllLines(Server.MapPath("~/temp.txt")); But in your case no need of a Server.MapPath

Categories : C#

Cannot use Server.MapPath to access a external file
Server.MapPath works only with files that are inside the website and is used by specifying a relative location: string configFile = Server.MapPath("~/App_Data/config.xml.config"); If you want to access a file from some other location you will have to manually provide the absolute path to it: string configFile = @"c:worksome_folderconfig.xml.config";

Categories : C#

Returning view via a path name
I can convert the paths to Virtual Web Paths if needed like "~UIClientPartnerControllerView.cshtml". Yes, that's precisely what you should do because that's what the View method expects - a relative path to the root of the website: return View("~/UI/Client/Partner/Controller/View.cshtml", someViewModel);

Categories : C#

Wrong path to a Pomm map file
The problem is in namespacing. Symfony trying to call class MyDatabasePublicSchemaProductMap that should be located in MyDatabase/PublicSchema/ProductMap.php file whereas your file located in Database/PublicSchema/ProductMap.php So you should rename the Database folder to MyDatabase ot Database name to Database.

Categories : Postgresql

getting wrong path after sign in rails_admin
Why your routes have /s after admin/, I think it must look like this: http://localhost:3000/admin/sign_in To make sure run rake routes

Categories : Ruby On Rails

Wrong boundingbox with path in fabric.js
It has something to do with the coordinates of the path. Let's do a simple example. The blue triangle is defined with absolute coordinates and the selection if fine It has been produced with canvas = new fabric.Canvas('myCanvas', { selection: false }); var path = new fabric.Path('M 0 0 L 0 100 L 100 100 Z'); path.set({ left: 20, top: 0, fill: 'blue', }); canvas.add(path); canvas.renderAll(); If we take relative coordinates as with the green triangle then the selection does not surround the object properly anymore. canvas = new fabric.Canvas('myCanvas', { selection: false }); var path = new fabric.Path('M 20 20 l 0 100 l 100 0 Z'); path.set({ left: 20, top: 0, fill: 'green', }); canvas.add(path); canvas.renderAll(); So if we take another path for the heart (copied out from

Categories : Javascript

CoreData (MagicalRecord) returning the wrong values
Did you update self.currentZooId to reflect your changes? Update: So, you're asking for the first record in your data set here. The thing is,you're not specifying an order. That is, findFirst just asks the data store for all, and then just returns the first in the list (have a look at the code for more specifics). Since that list can be in any order, you're going to get whatever the data store gives you in at particular instance. What you want to do is add a sort parameter to findFirst to make sure you always get the item you expect. Look at the headers to find the correct firstFirst method with a sort parameter.

Categories : IOS

SQL Data reader returning wrong date
This could be an issue regarding the localization. You can both set a localization to the SQL connection and the system you are working on, even the column-specification in excel. My best guess would be to check wether the settings are fine.

Categories : C#

to_char returning wrong date postgresql
Change MM to MI in the minutes place select to_char(now(),'YYYY/MM/DD HH24:MM:SS'), to_char(now(),'YYYY/MM/DD HH24:MI:SS'); to_char | to_char ---------------------+--------------------- 2013/08/21 15:08:00 | 2013/08/21 15:51:00

Categories : Postgresql

PHP HTML Form Returning to wrong jQuery tab?
Try This: <script type="text/javascript"> $(".registerBtn").click( function() { $('.navigation > li').removeClass('current'); $('a[href="#tab2"]').addClass('current'); $.post( $(".registerForm").attr("action"), $(".registerForm :input").serializeArray(), function(info){ $(".registerResult").html(info); }); }); $(".registerForm").submit( function() { return false; }); </script>

Categories : PHP

Date is returning the wrong year in US server
The difference is just one day.. or to be precise few hours from 31st Dec 2010 to 1st Jan 2011. Since UK's time is ahead of US A time in milliseconds like 1293840000000L represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT. So, the same value for UK and US differs.

Categories : Java

Dropdown Returning Wrong value asp.net server control
It's very common issue related to binding of dropdown list. Here your list is binding every time your page loads which makes selected value as first item of the dropdown, So you just need to bind it when it is not postback from server like this. if(!IsPostBack) { joblist = util.getJobList(orgid); this.joblistdropdown.DataSource = joblist; joblistdropdown.DataTextField = "Jobtitle"; joblistdropdown.DataValueField = "Id"; this.joblistdropdown.DataBind(); }

Categories : C#

GraphicsConfiguration.getDevice() returning the wrong Monitor ID
For your first question, you could use JFrame(GraphicsConfiguration). If the problem isn't repeatable, there might be something else going on that is messing things up

Categories : Java

String to Date conversion returning wrong value
One issue I see is: DateFormat formatter = new SimpleDateFormat("yyyy-MM-DD"); should be: DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); DD represents Day in YEAR. Read this for more information on SimpleDateFormat.

Categories : Java

Localization is returning null. What is wrong with the code?
There nothing wrong with your code, You are using GPS_PROVIDER which requires open sky field to fetch GPS Information. I suggest you to use NETWORK_PROVIDER if you want to fetch GPS details in side the room as well. try { LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); longitude = location.getLongitude(); latitude = location.getLatitude(); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); }

Categories : Android

Average returning wrong value from SQLite database
I don't think you're getting 166.67, I think you're actually getting 142.85 (142.86, I'm not sure how Java's DecimalFormat handles rounding and truncation). Why would I think that? Well, your SQL says this: SELECT ROUND(AVG(_mileage)) ... So the average is 7.166 and that becomes 7.0 when you round it. Then 1000/7.0 gives you 142.8571.... In any case, I think you just want to remove that ROUND() call from your SQL. And if you really are getting 166.67 then you'll want to check that your data really is what you think it is after the ORDER and LIMIT or look for a bug elsewhere in your computations.

Categories : Android



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