Posts

Showing posts with the label Directory

Change Directory In Node.js Command Prompt

Image
Answer : That isn't the Node.js command prompt window. That is a language shell to run JavaScript commands, also known as a REPL. In Windows, there should be a Node.js command prompt in your Start menu or start screen: Which will open a command prompt window that looks like this: From there you can switch directories using the cd command. To switch to the another directory process.chdir("../"); If you mean to change default directory for "Node.js command prompt", when you launch it, then (Windows case) go the directory where NodeJS was installed find file nodevars.bat open it with editor as administrator change the default path in the row which looks like if "%CD%\"=="%~dp0" cd /d "%HOMEDRIVE%%HOMEPATH%" with your path. It could be for example if "%CD%\"=="%~dp0" cd /d "c://MyDirectory/" if you mean to change directory once when you launched "Node.js command prom...

Can't Delete File From External Storage In Android Programmatically

Answer : Using ContentResolver to delete media files is wrong and provides many problems for the user. You can not delete a file on the sd-card simply by deleting its information from the ContentResolver on Android versions greater than Jelly Bean(4.3) . It works only on Android versions prior to KitKat(4.4) . That's why the Android team provided DocumentProvider. Why contentResolver.delete(...) is wrong? 1. Fills up the sd-card When you try to delete a media file on the sd-card by the ContentResolver on Android versions greater than 4.3, the actual media file will remain untouched because the contentResolver.delete(...) approach only removes the information (name, date, path ...) of the media and you will end up having unregistered media files on your sd-card which ContentResolver has no idea about their existence anymore and that's why you couldn't see them in your gallery and you think they've been deleted with this approach while they're stil...