filepath

Visual studio image loading in for cycle from resources

Deadly 提交于 2019-12-11 06:40:56
问题 In my image resources I have pictures with following names: c1.png, c2.png, c3.png, ... Whereas referring to the first image works with My.Resources.c1 I would like to display them in the cycle like this For i = 1 To numberOfPictures Dim tmpPicture As New PictureBox tmpPicture.Image = cstr(My.Resources.c) & cstr(i) & ".png" next Now this of course doesn't work, because string cannot be converted to System.Drawing.Image. Any ideas how to solve this? I know it's really easy in VB where I did it

Where to put a file to read from a class under a package in java?

只谈情不闲聊 提交于 2019-12-11 05:50:13
问题 I have a properties file contains the file name only say file=fileName.dat . I've put the properties file under the class path and could read the file name(file.dat) properly from it in the mainClass . After reading the file name I passed the file name(just name not the path) to another class under a package say pack.myClass to read that file. But the problem is pack.myClass could not get the file path properly. I've put the file fileName.dat both inside and outside the package pack but

How to separate filename from path? basename() versus preg_split() with array_pop()

℡╲_俬逩灬. 提交于 2019-12-11 03:45:36
问题 Why use basename() in PHP scripts if what this function is actually doing may be written in 2 lines: $subFolders = preg_split("!\\\|\\/!ui", $path); // explode on `\` or `/` $name = array_pop($subFolder); // extract last element's value (filename) Am I missing something? However I guess this code above may not work correctly if file name has some \ or / in it. But that's not possible, right? 回答1: PHP may run on many different systems with many different filesystems and naming conventions.

Extend RegExp to get the file extension

折月煮酒 提交于 2019-12-11 03:32:41
问题 I know, there're already a lot of RegExp based solutions, however I couldn't find one that fits to my needs. I've the following function to get the parts of an URL, but I also need the file extension. var getPathParts = function(url) { var m = url.match(/(.*)[\/\\]([^\/\\]+)\.\w+$/); return { path: m[1], file: m[2] }; }; var url = 'path/to/myfile.ext'; getPathParts(url); // Object {path: "path/to", file: "myfile"} I'm not very familiar with regex, maybe you can extend this given regexp, to

How to get path of file selected using MPMediaPickerController?

狂风中的少年 提交于 2019-12-11 02:48:57
问题 This is how I've code to open media picker list - (void)viewDidLoad { [super viewDidLoad]; player=[MPMusicPlayerController iPodMusicPlayer]; picker=[[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeAnyAudio]; [picker setDelegate:self]; picker.prompt=@"Add an audio to application"; } I've also implemented its delegate method - (void)mediaPicker:(MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection { /*I know only here I can get path

While searching for .pst files FOR keeps looping when it reaches a hidden shortcut folder

≡放荡痞女 提交于 2019-12-11 02:12:24
问题 The following command creates an infinite loop which is not what I want since I am iterating through files and it needs to end sometime... Here is what I have: cd C:\ FOR /R %i IN (*.pst) do @echo %i See what happens is that when it reaches AppData and finds a .pst (in AppData\Local\Microsoft\Outlook) there is a shortcut folder inside AppData\Local called "Application Data" which loops back to AppData\Local but keeps adding it's name to the address like so: %AppData%\Local\Application Data

Access to a specific file location (c:/folder/file) in an Azure website

こ雲淡風輕ζ 提交于 2019-12-11 01:28:14
问题 A company provides me a .dll with many files. The dll access to files using this kind of path " C:/folder/file.config ". I'm working on IIS 8 over a dedicated server BUT I would like to migrate the project on Windows Azure. I know that Windows Azure provides Virtual Machines, But I wouldn't use it just for this need. In my dream, I would like to use a web site linked to an Azure Storage and the dll which is located on the web site could access to its " C:/folder/file.config ". Could Windows

how to check a file path is an image or not in php?

此生再无相见时 提交于 2019-12-10 22:19:56
问题 I have a table that stores file paths of images.documents,pdf etc... My query is Select File_Paths from Uploads Now how do I check whether the file path is image or not using PHP... If it is an image i have to view it or else download it....... 回答1: Use the file info functions. 回答2: Good old getimagesize() is a reasonable way to find out whether a file contains a valid image. You just need to test its return value against FALSE : <?php $is_picture = getimagesize($filename)!==FALSE; ?> Of

get current jre's file path

坚强是说给别人听的谎言 提交于 2019-12-10 19:26:52
问题 Suppose we have two java applications A and B. Application A will call application B. Application A has started, however when A calls B, I don't know the java_home or any other jre path, I want to get which jre application A is run on, return the jre's execution file's path, is this possible? 回答1: You can get the installation directory for the JRE by requesting the system propertie java.home : String jrePath = System.getProperty("java.home"); More on System Properties here. 来源: https:/

Displaying an image using a php variable

梦想的初衷 提交于 2019-12-10 15:15:48
问题 I'm trying to display images by taking their file path from an sql table, but i'm having a lot of troubles. Here is whats going on: $image is a variable containing the text "itemimg/hyuna.png" which is path to an image. $image = 'itemimg/hyuna.png'; I assumed I would be able to display the image outside of the php block like so: <img src= "<? $image ?>" alt="test"/> This doesn't work though for some reason. So I thought maybe it's not able to read the variable outside the php block(i'm a