w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Overwriting data using files
Instead of using OutputStreamWriter use Filewriter FileWriter fileWritter = new FileWriter(file,true); when u pass true it appends the contents.try this FileWriter myOutWriter = new FileWriter(file.getName(),true); eol = System.getProperty("line.separator"); writer = new BufferedWriter(myOutWriter); writer.write(txtData.getText() + eol);// write this text. writer.close(); fos.close();

Categories : Android

Git revert is overwriting my files
You're looking for git reset --soft <last commit you want to keep>. Note however that unlike revert, this will undo all of the commits after the one you specify (e.g. if you have A-B-C-D (HEAD) and you git reset --soft B, both C and D will be undone, with both of their changes left in the index). Of course, another option is to not undo your last commit, but instead just modify it to get rid of the mistakes. You can do this via git commit --amend, which acts just like git commit except that instead of creating a new commit, it modifies (amends) the latest existing commit. git commit -m "this commit has mistake(s)" ...edit the file(s) with mistake(s)... git add <file> git commit --amend -m "same commit, no mistake(s)"

Categories : GIT

Azure: How to synchronize log files without overwriting old ones?
You can change the fileName before going to use it. By overriding the File property you can add any unique prefix (DeploymentID,TimeTicks,GUID...) to the file name. public class AzureLocalStorageAppender:RollingFileAppender { public override string File { get { //Trace.WriteLine("get_"+base.File); return base.File; } set { base.File = RoleEnvironment.GetLocalResource("LocalResourceNameHere").RootPath + @"" + "_" + Guid.NewGuid().ToString() + new FileInfo(value).Name; //Trace.WriteLine(base.File); } } }

Categories : Asp Net Mvc

Overwriting vs. adding to the end of read csv files in c++
I can think of these two handy functions. You may wish to typedef some types. /*Read CSV using a vector of vector of string */ std::vector<std::vector<std::string> > loadCSV(std::istream &input){ std::string csvLine; std::vector<std::vector<std::string> > data; while( std::getline(input, csvLine) ){ std::istringstream csvStream(csvLine); std::vector<std::string> csvRow; std::string csvCol; while( std::getline(csvStream, csvCol, ',') ) csvRow.push_back(csvCol); data.push_back(csvRow); } return data; } /*Modify Data by accessing elements of data[row][col]*/ /*Add new data using push_back ref. loadCsv function */ /* Finally update */ void saveCSV(std::ostream &output,const std::vector<std::vector<std::str

Categories : C++

Application not updating after overwriting existing files
In the main page e.g. index.aspx you can put a fake query string in the value of the following line: <param name="source" value="ClientBin/MyApplication.xap?version=1.0.0.0" /> When you update your application, change the version number to e.g. 1.0.0.1 This is how we force the client to download the newest .xap file. There is no issue with bookmarking since this url will never appear in the address bar. The client would instead be bookmarking something like http://myurl/index.aspx.

Categories : C#

git does not display warning overwriting files when doing checkout
You should only get that error if the state of the file in HEAD (your current commit) is different from its state in the branch you're trying to check out, since then git can't easily be sure that it can carry your local changes over to the new branch. Your first example is slightly confusing, though: I created a new branch and checked it out (git checkout -b ). - On the new branch I changed a file - If I want to switch back to master, git throws the following warning: "error: Your local changes to the following files would be overwritten by checkout..." I assume that since you got that warning, you were either creating the new branch based on a something other than master, or you'd created a commit that introduced changes to that file before making further local modifications and

Categories : GIT

Batch file to run xcopy without overwriting existing files
Try using /y: xcopy s:* z: /E /y See MS documentation for details. EDIT: Arun R is right, this answer overwrites existing files instead of skipping them. The link he provides gives some solutions.

Categories : Windows

BASH: How to copy a file without overwriting older files
You can use the "--interactive" option (present in my cp from GNU coreutils 6.12) to prompt you before overwriting and fill it with a default: echo 'n' | cp --interactive ~/somefile.txt ~/somefile_already_exists.txt

Categories : Bash

Multi Project / Users / System Global Git Ignore Solution
I don't think there is a standard way to achieve that for a central repo. You might want to write a script that would fetch from a central location and commit any changes to all the repos that you have on the central server.

Categories : GIT

Visual Studio 2012 overwriting non compiled files (.js and .cshtml)
The only conceivable way this could happen is a pre or post build event exists that's copying those files from somewhere else and it's happenstance that the version you're working with matches where they are being copied from.

Categories : C#

Need solution for redirecting the users to the site after credit card payment through Paypal
I think the standard PayPal plugin only uses the basic PayPal service which doesn't "automatically" return the user to the merchant, it just presents them with the link to click. I believe you would have to use PayPal Pro (which keeps the user on your site) — looking at the Virtuemart Extensions directory there is a PayPal Pro plugin. By the way you really should update your Virtuemart installation as there have been dozens of bug fixes since 2.0.8.

Categories : Joomla

Referencing a Visual Studio solution in a different source control repository whose folder is different for different users
I have used each of the following as solutions to this problem (you could use either, but not both). Use a standard directory structure for your developers. For example: {basePath}/{user}/{repositoryName} This allows you to use relative paths to reference other repositories, as long as you know the {repositoryName} for the repository the project is contained in. Relative paths also allow you to use any {basePath}, so this quite a flexible system. However, there is always a concern that the version of your dependent projects may not be the expected version, potentially leading to strange outputs. For your issue reports, your developers will have to explicitly give the commit hash for both the main repository and the dependencies they are currently working with. Use subrepositories. Thi

Categories : C#

Do files get closed during an exception exit?
No, they don't. Use with statement if you want your files to be closed even if an exception occurs. From the docs: The with statement is used to wrap the execution of a block with methods defined by a context manager. This allows common try...except...finally usage patterns to be encapsulated for convenient reuse. From docs:  The with statement allows objects like files to be used in a way that ensures they are always cleaned up promptly and correctly. with open("myfile.txt") as f:     for line in f:         print line, After the statement is executed, the file f is always closed, even if a problem was encountered while processing the lines. Other objects which provide predefined clean-up actions will indicate this in their documentation.

Categories : Python

Is it ok to have different solution files in TFS for projects?
It depends on the source control: with Git support for Visual Studio, and the Visual Studio Tools for Git, you can use git submodule. That is define a parent git repo which will encapsulate ProjA, ProjB and ProjC. However, submodules aren't fully integrated in the Visual Studio Git integration yet: see "issue 790028". So git command-line remains handy.

Categories : Visual Studio

How to share css and js files across projects in the same solution?
Have one common project, call it something like Shared or Utilities (make sure it's a web project). Put your files in that project, then use the URL of that project + the path to the file to reference them in your other projects, something like: http://mysharedproject.co.uk/content/site.css

Categories : Jquery

Get Visual Studio Solution Files and Folders
This is gonna be very simple. Yes you can get the path of the project's solution file and can process the file inside it. string solutionPath = Directory.GetParent(Environment.CurrentDirectory).Parent.FullName;

Categories : C#

Local paths of files contained in a solution
Use a T4 Template to generate the absolute path to the solution folder and then use Path.Combine to combine it with the relative path to the file you need (something like "AoWUtilityNames amePrefix.txt"). See T4 Get Current Working Directory of Solution Here is a better code sample: Accessing Projects via DTE in C# T4 Template

Categories : C#

Possible issues with multiple solution files for the same set of projects
I've seen this done all the time, for the most part it is perfectly fine other than what you mentioned, any files added would have to be added to all of the projects. However, I would recommend you go with a make file of sorts, CMake is a very robust version but there are plenty of others. The way they work is basically, you write one script that defines how the project is to be made, then the end-user runs CMake.exe on it. It will take that script and generate the proper solution and project files for your entire project in the version of VS you want, it also supports generation of types like XCode and Eclipse solutions etc so it is very multi-platform.

Categories : Visual Studio 2010

How to add files in solution explorer of visual studio?
This should do public String SolutionPath() { return Path.GetDirectoryName(_applicationObject.Solution.FullName); } Gotten from: Visual studio addin - finding current solution folder path

Categories : C#

Filter source files in solution in visual studio
U can take help of this: This tool is good. http://slntools.codeplex.com/ or follow these links: http://www.wholetomato.com/products/features/fis.asp http://www.schwammysays.net/visual-studio-2012-tip-solution-explorer-filters/

Categories : Visual Studio

Detach CMake references from the generated solution/project files?
No, that can't be done. Moreover, those rules are not only for re-generating project files if they're not up-to-date anymore. For instance, there's also the CMake command mode that provides portability for copying files, directories, md5 sums and many other nice things. The bakefile project tried to do that (generating independent project files), but it seems it's pretty much dead now.

Categories : Visual Studio 2010

Is Visual Studio 10 expected to compile C# files that are not part of the solution?
Short answer: No. It only compiles whatever is is included in the .csproj marked as 'compile' (in the file properties window). Try to refresh the project, open the .csproj as a file text and check if those files are referenced there. Lastly, it might be a dependent project that references those files. If you can't find the solution, paste the exact error given by VS For clarification, solutions files (.sln) contains project files (.csproj); .csproj files are the ones that contain references to the files to build.

Categories : C#

Upgrade Visual Studio solution and project files programmatically
Let me present you a different view than the 2 you presented. The fact that an upgrade is slow is that all kinds of checks are performed on the projects/solutions that you attempt to upgrade. An 'Upgrade Report' is generated to provide feedback on those checks. This is information that should not be ignored since it provides remedies on the mentioned issues. You state that you deploy the projects/solutions via an installer. Presuming that you have a development team/tools that are up-to-date you could perform the upgrades as part of your installer design/development. Why would you not perform the upgrades yourself and include project files in your installer. During installation you would install the version of the project/solutions files that matches the target platform.

Categories : C#

Finalizing a Cursor that has not been deactivated or closed or database not closed error
When you are done with the cursor, you need to call Cursor.close(). Leaving it not closed leads to memory leaks. E.g.: Cursor cursor = null; try { cursor = getContentResolver().query(myUri, MY_PROJECTION, null, null, null); if (cursor != null && cursor.moveToFirst()) { // moar code } } finally { if (cursor != null) { cursor.close(); } }

Categories : Android

UNIX: find the files used by other users
Assuming all the users' home directories are under /home and your're trying to find all users that have a file foo.txt, you can use this find command: find /home -name "foo.txt" -exec bash -c "IFS=/ && read -a arr <<< {} && echo ${arr[2]}" ;

Categories : Unix

Not showing pdf files for non-users of my site
You can try this Enable mod_rewrite module in Apache HTTP Server. In the .htaccess file, rewrite the URL which requests for any PDF file to your PHP file. Create a PHP file which will authenticate the user. In the PHP file, if user is authenticated, serve the required PHP file as a download. The PDF file name can be found in $_GET['file']. PHP Code to serve a file as download header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="download.pdf"'); readfile("{$_GET['file']}.pdf"); Rewrite Rule in .htaccess file RewriteRule ^(.+).pdf$ /user_pdf_download.php?file=$1.pdf [L,NC,QSA] Here I took some assumptions. You can modify as required.

Categories : PHP

How to let users reference their uploaded files in a CharField?
Sounds like you're off to a good start. A few things it sounds like you might not be aware of: FileField, and thus its subclass ImageField, has a .url property. If you want to keep your MarkupField vanilla, you can override the model's save() method to add the extra syntax. My solution would be to have your template return a list of images with javascript set up so that the user is presented with a list of his images, and can click on one to add it to what she is writing. I like to use jquery for this sort of thing, but you could also do it in pure javascript. Your list could appear when they click an "add image" button, appear automatically when they start to type image-adding syntax, or both. I would also have thumbnails automatically generated and add a .thumbUrl to the model so th

Categories : Python

Good method to authenticate files to users
I would go with this: user initiates action, javascript asks Server 1 (ajax) for request for file on Server 2 Server 1 creates URL using hash_hmac with data: file, user ID, user secret when clicking that URL (server2.com/?file=FILE&user_id=ID&hash=SHA_1_HASH) server 2 asks server 1 for validation (sends file, user_id and hash) server 1 does the validation, sends response to server 2 server 2 pushes file or sends 403 HTTP response This way, server 2 only needs to consume API of server 1, server 1 has all the logic. Pseudocode for hash and url creation: // getHash($userId, $file) method $user = getUser($userId); $hash = hash_hmac('sha1', $userId . $file, $user->getSecret()); // getUrl($userId, $file) method return sprintf('http://server2.com/get-file?file=%1&user_id=%2

Categories : PHP

Allow users of an opensourced project to add their own files to their copy
What most application frameworks/CMSs are doing these days is to split this process in two packages: one library package (e.g. symfony/symfony, laravel/framework) that contains the bulk of the code, and that will be installed in vendor/ one "bootstrap" package (e.g. symfony/framework-standard-edition, laravel/laravel) that contains an application shell that your users can start from. That would contain default config and a composer.json that includes the library package + whatever else is needed in the "require" section. This bootstrap package is typically not updated via composer since it becomes the application/site of your users. Therefore it should contain as little code as possible, and be essentially only configuration.

Categories : PHP

Allowing users to upload files through website | PHP
it might be a folder permittion restriction, try making the target folder 777 (read - write - execute via your ftp program) and see if it works. I strongly recommend you to use php's ftp functions to upload files rather than the move_uploaded_file method. UPDATE try changing target path from $target_path = "/studentAccess/uploads/"; to $target_path = "../uploads/";

Categories : PHP

Batch to Remove files in a Folders of Different Users
cd "C:Documents and Settings" for /f %%a in ('dir /b') do del %%aFolder1file.abc This will look for Folder1file.abc in every folder under Documents and Settings. If you want to do this outside a batch file, change %%a to just %a.

Categories : Batch File

Allow users to upload files from server directory
I am answering this myself, but I won't mark it correct, because I don't like my answer. I hope someone else finds this, and offers a better solution. I am now using two file inputs with the user being able to choose either:   a. To upload from their desktop (as normally is the case) with the first input   or:   b. Select from a pseudo list of files from a directory on the server that has been populated with PHP scandir(), and then responding to their select with javascript. It works, but I don't like it, because generating a view for a directory full of images is resource intensive, and because it requires extra coding even after that as they are not selecting a file through native browser file dialogues. Feel free to offer a better solution.

Categories : PHP

Heroku - letting users download files from tmp
As far as I know, you have absolutely no guarantee that a request goes to the same dyno as the previous request. The best way to do this would probably be to either host the file somewhere else, like S3, or to send it immediately in the same request. If you're generating the file in a background worker, then it most definitely won't work. Every process runs on a separate dyno. See How Heroku Works for more information on their backend.

Categories : Ruby

Application gets closed when terminal is closed, how to stop this?
Use nohup to prevent child processes from being killed when the terminal closes. spawn nohup /usr/bin/firefox https://www.google.com/ I assume there's more to the script, since there's no need to use Expect just to start firefox.

Categories : Python

I want to make a folder where users can drop files but not delete them
Yes, you can do this. Right-click the folder, click properties, then Security tab. Click Advanced, Change Permissions, select the user/group you want to change, then Edit. Be careful of setting deny permissions - you're better off just not allowing Delete. You can Google that for more information.

Categories : Windows

Handling project files when multiple users are commiting
You have to fetch changes from the remote repository so that your local repository can know them. You can do either git fetch origin to fetch the changes, look around and then merge/rebase. Or: git pull with optional --rebase. This way you will merge or rebase your local changes on top of the incomming changes from the upstream.

Categories : GIT

Monitor and navigate S3 bucket for new files added by users
Though Amazon S3 does not formally have the concept of folders, you can actually simulate folders through the GET Bucket API, using the delimiter and prefix parameters. You'd get a result similar to what you see in the AWS Management Console interface. Using this, you could list the top-level directories, and scan through them. After finding the names of the top-level directories, you could change the parameters and issue a new GET Bucket request, to list the "files" inside the "directory", and check for the existence of the .complete file as well as your .xml and other relevant files. However, there might be a different approach to your problem: did you consider using SQS? You could make the process that receives the uploads post a message to a queue in SQS, say, completed-uploads, with

Categories : Ruby On Rails

laravel prevent unauthenticated users from viewing the files
Try this: Route::get('/directory/{file}', array('before' => 'auth', function($file) { return public_path() . "/directory/$file"; })); Change directory to whatever the directory is you are trying to protect. Also, I assumed the files you want to deal out are in your public directory. That may need to be changed too, depending on your usage. Auth is a filter that is already created in a default install of Laravel. It just makes sure they aren't a "guest." It will only let people access the directory if they are "logged in." I believe it looks for a cookie that Laravel sets when you log someone in.

Categories : PHP

turn a solution that reveals password to a secure solution
You cannot have an if statement of that style and be secure. Security requires that you don't store the password. To be secure you must: Only store the password in hashed form with a salt Send the submitted password to your server over SSL (On the server) hash the submitted password with the same salt and compare it to the stored hashed password Even if that wasn't the case, asking the browser (which is under the control of the user) to check if the password is right would be insecure because the user could look at the JavaScript and make the HTTP request in the else statement directly. You would need to do something like: $.ajax({ type: "POST", url: "modify_profile.php", data: {"firstname":firstname,"lastname":lastname, password: password}, success: function( data){ } })

Categories : PHP

How to reference .dll that in different solution from the main solution visual c++ 2008?
Hope this is somewhat helpful. Good Luck!! http://social.msdn.microsoft.com/Forums/en-US/84deabaa-ae82-47cc-aac0-592f5a8dfa22/linking-an-external-dll

Categories : Visual C++



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