w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Batch file to identify 0 from a txt file which contain file name(e.g.ABCDE01)and trigger message display that 0 found together with the file name/path
Assuming format is always 0.0000, this should do it: @echo off find "0.0000" <"C:UsersUserDesktopoutcome.txt" >nul && echo ERROR:FOUND ZERO SIZE IN THE FILE!!! & pause

Categories : Batch File

Batch file to read txt file with file names then search for that file and copy to folder
you can try this: FOR /D /R "%~dp0" %%I IN (*) DO for /f "usebackq delims=" %%a in ("%~dp0list.txt") do xcopy "%%~I\%%~a" "C:your_files" /e /i For more help show list.txt.

Categories : Windows

How to determine that file recived is image file / Video File / Audio File
Just check the MIME type of the file. Have a look at this http://stackoverflow.com/a/13889946/1570662 This might help private static String getMimeType(String fileUrl) { String extension = MimeTypeMap.getFileExtensionFromUrl(fileUrl); return MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); }

Categories : Java

Generate the .bat file that will copy the selected lines from the .bat file (within .bat file) to another text file
Use the lines as below Echo The land is beautiful >> %_file% echo I wanna stay here >> %_file% echo etc........ >> %_file% echo etc........ >> %_file%

Categories : Batch File

How to extract two folder path C: (same Type File: e.g Text Document) and name of the file into text file with the file size in kb
The error you observe is caused by the signature of your procedure ListFiles. In VBScript all variables/parameters are of type Variant, so you must not explicitly specify a type. Change this: Sub ListFiles(f, folderPath As String, fileType As String) into this: Sub ListFiles(f, folderPath, fileType)

Categories : Vbscript

Java File.exists and other File operations returning wrong results for an existing File (network, macosx)
I think you might be looking for the WatchService. Oracle was also kind enough to provide a tutorial. Because the longevity of these links aren't guaranteed, I'll edit in an example code in a couple of minutes. I just wanted to let you know I think I found something in case you want to start looking at it for yourself. UPDATE Following the linked tutorial, I came up with code like this. I'm not sure it'll work (don't have time to test it), but it might be enough to get you started. The WatchService also has a take() method that will wait for events, which means you could potentially assume the file's existence (or lack thereof) based on the last output you gave. That will really depend on what this program will be interacting with. If this works, good. If not, maybe we can figure out

Categories : Java

code that doesn't work...Kill-process , search-for-file , streamwrite on file searched file
If you have only one file called "server.properties" then you could remove all the code that search for this file and write it directly. Dim z As String z = System.IO.Path.Combine(x, "server.properties") Using t = New StreamWriter(z) t.WriteLine(TextBox1.Text.ToString) t.Flush() End Using Regarding the error, encapsulating the writing code with a proper using statement ensures a complete clean-up. Also adding a call to Flush() is probably not necessary, but doesn't hurt.

Categories : Vb.Net

Check file type (FLV) before PHP upload file in temporary folder by reading only starting 3 bytes of file
@burhan-khalid provided a more up to date and correct answer above. Short Answer is no with your constraints. You can not access that file with PHP until it has been uploaded to the server. After it is uploaded you can read it but not before, at least not without some type of client side software that would allow you to stream it to PHP instead of the normal form submission.

Categories : PHP

Rename file in c#.net when its is uploaded through file upload control and save chang name of file in database
You can check out the following link http://asp-net-example.blogspot.in/2009/01/aspnet-fileupload-example-how-to-rename.html <%@ Page Language="C#" %> <%@ Import Namespace="System.IO" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Button1_Click(object sender, System.EventArgs e) { string uploadFolder = Request.PhysicalApplicationPath + "UploadFile\"; if (FileUpload1.HasFile) { string extension = Path.GetExtension(FileUpload1.PostedFile.FileName); FileUpload1.SaveAs(uploadFolder + "Test"+ extension); Label1.Text = "File uploaded successfully as: " + "Test"+ extensio

Categories : Asp Net

I want Java code to convert word file (doc file having text, images, tables etc. ) into pdf file.
You need to add the latest jar in the java build path. Check your projects build path and make sure the jar is present there. Do a clean build and clean publish and it should work. If not then you can even try to directly paste the jar in your projects deployment location (LIB folder).

Categories : Java

Android: File not showing up on file system while trying to copy SQL file from assets to app data directory
I had to override the getReadableDatabase function for the helper class because it has no idea to return myDatabase. The helper loads it up properly and everything, but it never actually returns it. @Override public SQLiteDatabase getReadableDatabase(){ return myDataBase; }

Categories : Android

I want to use a literal "FILE" in Java as a storage point for the data contained in a file system file
As of Java 7 you can have artificial file systems, like the ZipFileSystem, which is very near to what you want. In fact adding a file, removing a file, renaming a file, maintaining relative paths between two file systems. All such examples would be usable for your file system too. Also the new nio API can provide file attributes by free key. The advantage is using one generic API for all file systems. The class Path also holds its file system for instance.

Categories : Java

Python - exec(open('file.py').read()) reports error - No such file or directory. 'file.py'
open('xyz') does not search the various python import paths. If you give a relative path name, it starts with the current working directory, appends your path and looks there. If you give an absolute path, it ignores the current directory.

Categories : Python

Export to Excel button from web page gives an error after the file is downloaded to the users machine: "File format or file extension is not valid"
The method I've used in the past utilizes the EPPlus library: http://epplus.codeplex.com/ So include that in your project, then you can call this method, just pass in your DataTable: public static void DumpExcel(DataTable dataTable) { using (ExcelPackage package = new ExcelPackage()) { ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("DataTable"); worksheet.Cells["A1"].LoadFromDataTable(dataTable, true); for (int i = 1; i <= dataTable.Columns.Count; i++) { worksheet.Column(i).AutoFit(); if (dataTable.Columns[i - 1].DataType == System.Type.GetType("System.DateTime")) { worksheet.Column(i).Style.Numberformat.Format = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;

Categories : C#

How to specify log file location in log4j.properties file While running jar file from command prompt
log4j properties/xml file can be configured in multiple ways. You can check this How to initialize log4j properly?

Categories : Java

Validate file extensions and file size on Drupal 7 file field using the form API
It should work actually. We just need to mention file_validate_extensions & file_validate_size under upload_validators. Example: '#upload_validators' => array( 'file_validate_extensions' => array('gif png jpg jpeg'), 'file_validate_size' => array(MAX_FILE_SIZE*1024*1024), ),

Categories : Forms

Ruby: correctly load a file in parent directory, which file depends on another file
In file b.rb: require_relative "./a.rb" def f2(v2)...... See http://extensions.rubyforge.org/rdoc/classes/Kernel.html

Categories : Ruby

How to get the file name of input type="file" inside the servlet for File Upload
For Servlet 3.0 API Add @MultipartConfig() to the servlet and use this to print the names. public void printNames(HttpServletRequest request){ for(Part part : request.getParts()){ System.out.println("PN: "+ part.getName()); Collection<String> headers = part.getHeaders("content-disposition") if (headers == null) continue; for(String header : headers){ System.out.println("CDH: " + header); } } } For older Servlet APIs I would recommend to use Apache Commons FileUpload

Categories : Java

Display file link after selecting the file from file upload in jQuery
This cannot be done due to privacy issues with JS. You may want to look at using some type of content viewer on your page to generate a preview of the uploaded content, although it greatly depends on the content type (I have only ever had to do this with images, which are pretty easy to preview in this way).

Categories : Jquery

Batch file to read lines from text file which may contain reference of other file
You must quote strings and escape special characters, as > which is a special character to redirectt standard output. @echo off cd C:UsersuserDesktop C: call :readline text1.txt goto :eof :readLine for /f "tokens=1,2 delims=^>" %%a in (%1) do call :processline %%a %%b pause goto :eof :processline if %2.==. ( echo %line% >> output.txt ) else ( if %1=="#file#" call :readLine %2 ) goto :eof

Categories : Windows

After indexing file how to extract properties of file such as:-file type,name etc. by elasticsearch
Use elastic search head to take a look at the index tika generated in ElasticSearch for you http://mobz.github.io/elasticsearch-head/ Then you can search on those fields by using queries like author:Lav (assuming you found a field named author in your index)

Categories : Elasticsearch

JQuery File Upload preview File Type to allow all file types
The preview is for showing images. The PDF and document file types are not images, and cannot be shown. From the documentation: Preview images, audio and video: A preview of image, audio and video files can be displayed before uploading with browsers supporting the required APIs.

Categories : Jquery

Batch file to find a replace a file path in a file
The replacement f, a la FOR ... %v IN (...) DO ... %~fv will resolve the path and make it a fully-qualified path. So, the requirement to get this to work is to get the path to the file(s) in a FOR loop variable. FOR /F "delims=*" %%f IN (list_of_files.txt) DO @ECHO %%~ff As for getting paths from a .CSPROJ file, I don't know the format. Can you say how the paths will be expressed? Are they XML element attributes or content? If they're not easy to find, this will be exceedingly unreliable depending on how the data is expressed.

Categories : Batch File

c# starting a .exe file from current file path + folder + exe file
you can use this code smple static void Main(string[] args) { Process.Start(<"your file path"); } for example if you wish to run notepath++ then you path will be=@"C:Program Files (x86)Notepad++Notepad++.exe

Categories : C#

Open txt file, create new txt file, save old text to new file
The line outfilename$.SaveAs =:"FileName"infilename.txt",False" looks quite wrong indeed. You coud try this instead to pop-up a dialog for saving file outfilename$ = Application.GetSaveAsFilename(infilename$, "Neutral Files (*.txt),*.txt", , "Save file", "SAVE") Update : The full code is Sub test() Dim outfilename as Variant Dim infilename as Variant Dim msg As Variant infilename = Application.GetOpenFilename("Neutral Files (*.txt),*.txt", , "Open Neutral File", "OPEN", False) If infilename = "False" Then msg = MsgBox("No input file selected. Press OK to retry or cancel to quit", vbOKCancel) If msg = vbOK Then Do While msg <> vbCancel 'loop until user presses cancel infilename = Application.GetOpenFilename("Neutral Files (*.r01),*.r01", , "Open

Categories : Vba

check file size while writing file and create new file
I suggest you create a separate class whose only job it is to create files (in sequence), write data to the file, keep an eye on the size, and close / open files as needed. This will make your code more organized - you will be able to see your mistakes more clearly. The class would have the following methods: setMax(maxVal) - set the maximum file size (default 400k) setRoot(rootPath) - folder where files will be created setName(rootName) - "format string" used to generate file names (e.g. "myFile%03d.dat") writeData(dataSize, dataBlock) - write data. If no file open, open it. If file too big, split it. closeFile() - flush buffers, close the last file.

Categories : Java

FileInfo finds file, but File.Copy cannot find the file
What does latestFile.ToString() evaluate to? That is a strange way to obtain the path. Use FileInfo.FullName like the docs indicate. You can use the debugger to find such bugs yourself.

Categories : C#

convert h5 file to csv file or text file for data processing
Have you tried OPeNDAP Hyrax server with hdf5_handler module? For example, from the sample HDF5 file [1], you can get the following ASCII data [2]: Dataset: grid_1_2d.h5 temperature[0], 10, 10, 10, 10, 10, 10, 10, 10 temperature[1], 11, 11, 11, 11, 11, 11, 11, 11 temperature[2], 12, 12, 12, 12, 12, 12, 12, 12 temperature[3], 13, 13, 13, 13, 13, 13, 13, 13 ... OPeNDAP Hyrax server with hdf5_handler is a great tool/service because you can select (and subset) a dataset from an HDF5 file easily using HTML form as well [3]. You can find the detailed information about OPeNDAP hdf5_handler from [4]. [1] http://eosdap.hdfgroup.uiuc.edu:8080/opendap/data/hdf5/grid_1_2d.h5 [2] http://eosdap.hdfgroup.uiuc.edu:8080/opendap/data/hdf5/grid_1_2d.h5.ascii [3] http://eosdap.hdfgroup.uiuc.edu:8080/o

Categories : Csv

batch file which opens file which has spaces in file path
If double-clicking the file in Windows Explorer will start it properly, you don't need START or the name of the executable. You can simply use the filename itself, and Windows will check the file association and launch it properly. You can test this by just typing this at a command prompt (replace the path with a path to an existing text file on your machine) and hitting Enter: "C:Usersuser216485DocumentsReadme.txt" Just use this in your batch file: "C:my stuff more stuffmorefile.bhf"

Categories : Batch File

How can I fetch POST Variable value into another php file by include that file in another php file?
The obvious solution is to ditch the include and action directly to another.php Assuming there is a good reason for the include, then I can only think you should use a session variable to store the $_POST. Remember to put session_start() at the VERY top of both php files

Categories : PHP

How to rename file with first 32 characters of text file with batch file
Try this: @echo off setlocal enabledelayedexpansion cd /d c: est2 est for /f "delims=" %%i in ('dir /a-d /b *.txt') do ( set nname= for /f "usebackq delims=" %%f in ("%%i") do if not defined nname set "nname=%%f" set "nname=!nname:~0,32!" rename "%%i" "!nname!%%~xi" )

Categories : Batch File

jquery set value from input type file multifile to input type file single file for multiple file upload
It is not possible to programatically select files into a an <input type="file" />. The reason for this is security. Consider if it was possible - it would mean that unscrupulous developers could essentially steal files from visitors computers by using Javascript to select a file and submit the form without the user knowing.

Categories : Jquery

ignoring file Accounts.framework/Accounts, file was built for unsupported file format which is not the architecture being linked (i386):
Please correct me if I am wrong . By looking towards your log I think you are developing application for OSx and you are adding the iOS frameworks . http://developer.apple.com/library/ios/#documentation/Social/Reference/Social_Framework/_index.html#//apple_ref/doc/uid/TP40012233 and http://developer.apple.com/library/ios/#documentation/Accounts/Reference/AccountsFrameworkRef/_index.html#//apple_ref/doc/uid/TP40011024

Categories : Objective C

C# File.Exist(File_Path) Returns false even if File_Path is true, file exists and i have rights to access that file
When I exucute File.Exists in x86 configuration I have the same result, but when I am in 64 the two files returns true, and I found on the net that File.Exists in your case search in SysWOW64, check this question for more: check if file exist on 64 bits system using File.Exists

Categories : C#

shifting chars in C with modulus, outputting to file produces unsupported file format on one input, txt file on other input
Nominally, a text file must end with a newline. Your program does not ensure that there is a newline at the end of the file, so it does not always generate a text file. Indeed, it probably does so one time in 256 (or maybe 255; what do you do about null bytes?). Most Unix programs aren't that fussy about the last line, but some are. So, if that's the definition of a text file, it isn't very surprising that you don't produce one. In any case, the intermediate file is likely to contain a whole bunch of characters that make it look unlike a text file — depending on the password, of course. You use the password to generate a value for a Caesar shift. This means that most of your alphabetic characters are going to be shifted to a non-alphabetic position. This is fairly normal for an e

Categories : C

File operation to copy one .mp3 file to create another same file
getc() returns either an int, not a char. It needs to return int because it returns either the next byte read from the stream as a value between 0 and 255, or the value EOF, which is typically -1. Since there are 257 possible outputs, you need to be able to distinguish between the byte 255 and the sentinel EOF, but your code is conflating the two. Hence, once you hit the first byte with value 255, it erroneously cuts the file off short. If you change c to be int instead of char, it should work correctly.

Categories : C

file not found for a jar file -- even when I get the file name via Directory.getFiles()
The problem maybe the fact that your shell command does not match the run command. Shell(PathToFile) Is not the same as: Shell(String.Format("{0} {1} {2}", "C:PATHTOJAVA",PathToFile,Argument)

Categories : Dotnet

my .js file doesn't work in a .php file different from my plugin file
jQuery does not care if you have one file or a thousand. It simply searches through the DOM (which may be created by one .php file or by a thousand included) for a matched element. My advice for debugging this issue will be: firstly, to check that my_js.js is present on the page generated by other.php - if it's not - then you use wp_enqueue_script incorrectly

Categories : PHP

.txt file data into 2 column csv file batch file
@ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION @ECHO FileName,Contents SET FILE=FileSample.txt SET FIRST=^"%FILE%^",^" FOR /F "tokens=*" %%l IN (%FILE%) DO @((SET LINE=%%l) & (@ECHO !FIRST!!LINE:^"=^"^"!) & (SET FIRST=)) @ECHO ^" This echoes the filename, a comma, a double quote, then every line of the file (with double quotes "escaped" by replacing them with a double-double quote—which is necessary if the data in the file may have double quotes in it), followed by a (closing) double quote. The one limitation I see is that if the file doesn't end with a newline, the closing double quote will effectively add one. If the file does end with a newline, the FOR loop won't process that empty line, and the output will be correct. Overcoming that limitation would probably mean manually

Categories : Csv

finding most recent file version from list of file path names with jumbled file names
you can try: find $WORK.../.history -type f -printf '%T@ %p ' | sort -nr | cut -f2- | xargs grep 'your_pattern' Decomposed: the find finds all plain files and prints their modification time and path the sort sort sort them numerically - and reverse, so highest number comes first (the latest modified) the cut removes the time from each line the xargs run its argument for each file what get to it input, in this case will run the grep command, so the 1st file what the grep find - was the lastest modified The above not works when the filenames containing spaces, but hopefully this is not your case... The -printf works only with GNU find. For the repetative work, you can split the command to two parts: find $WORK.../.history -type f -printf '%T@ %p ' | sort -nr | cut -f2- > /somewhe

Categories : Eclipse



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