code-cleanup

Remove unused source code files

你。 提交于 2019-12-18 05:18:13
问题 In Visual Studio 2010 I have a large solution that contains number of .cs files that are no longer used (not referenced in .csproj), but still present in code repository (ClearCase). Do you know of any tool / extension / script that would find all such files? One could write a script that goes through all projects' directories, takes all files that are checked in and than compares against content of a project file. In it is not there, than we have a candidate for deletion. It is not too

How to remove System.out.println's from codebase

北战南征 提交于 2019-12-18 02:48:14
问题 We have a huge (old legacy java) code-base, where many files (around 5k) have System.out.println's. We are planning to remove them for cleanup/performance reasons. How can we write a script that will replace them without introducing any issues in the code? The script cannot blindly delete them as following case can be an issue: if () some.code... else System.out.println(...); DB.close(); I'm thinking of replacing them with ';'. That will take care of above case. Do you see any other issues?

How to project clean in android studio?

好久不见. 提交于 2019-12-17 02:31:42
问题 I am new in Android studio so I face some problem with it. so please anyone can give me a way how to project clean in Android studio. In Eclipse Project -> clean -> OK but I don't know how it is done with Android Studio. 回答1: You can clean your project doing this Build > Clean Project or Build > Rebuild Project Also you can do the gradlew clean As @Kellogs commented : Manually delete the [project]/.gradle as hidden folder as that one is the main culprit for large cleaned projects sizes. 回答2:

It's necessary to remove views? In order to cleanup the Alloy controller (memory/performance)

这一生的挚爱 提交于 2019-12-14 02:55:39
问题 Lets say that I've a ScrollableView with 3 Views (forms), those form views have at least 10 fields, take a look at this exemple. index.js $.content.add(Alloy.createController('scrollable').getView()); scrollable.js $.scrollableView.addView(Alloy.createController('form',{ fields:[ {label:'field 1',type:'text'}, {label:'field 1',type:'date',value:'2016-06-08'}, ... ] }).getView()); $.scrollableView.cleanup = function() { $.destroy(); $.off(); for(var i = parseInt($.scrollableView.views.length);

Rubywarrior Level 4 (cleaning up my code help)

二次信任 提交于 2019-12-12 13:30:31
问题 I'm learning programming through Ruby and I found the awesome Rubywarrior by Ryan Bates from Railscasts. Unfortunately I'm stuck in that my code is throwing up syntax error messages (unexpected $end). I'm not asking for the answer, I would like to sort that out myself, but if someone could point out where my code is getting the error from that would be super. Thanks! class Player def initialize @maxhealth = 20 @dying = 7 @previoushealth = @maxhealth @health = warrior.health @warrior = warrior

Determining which PHP source files are not used

好久不见. 提交于 2019-12-12 11:00:43
问题 I have a large web app, and I think there are a bunch of old files that are no longer being used, is there an app which can tell me what these files are? 回答1: There is also the Dead Code Detector (DCD). It finds functions that are never called, which may help to clean up even the files you keep in production. 回答2: You should be able to start with your web server logs. These will show you which files ARE being used. From there you should be able to track down a good number of the files those

How to call a function by its name. An approach using STL::map and Class

﹥>﹥吖頭↗ 提交于 2019-12-12 02:13:17
问题 Based on post How to call a function by its name (std::string) in C++?, tried to make a version using CLASS, but my approach does not work. class A { public: int add(int i, int j) { return i+j; } int sub(int i, int j) { return i-j; } }; typedef int (*FnPtr)(int, int); int main(int argc, char* argv[]) { // initialization: std::map<std::string, FnPtr> myMap; A a; myMap["add"] = a.add; myMap["sub"] = a.sub; Returns this erro: main.cpp:31:22: error: cannot convert ‘A::add’ from type ‘int (A::)

Get operating system without using WMI

旧城冷巷雨未停 提交于 2019-12-11 09:31:33
问题 I have a Powershell script where I need to get the operating system for various servers. Up until now I've been using WMI in order to accomplish this task, however I've read about how WMI can get timeouts, so I was wondering is there another method of getting the operating system of a server? Here is the code that I use at the moment and want to change in order to avoid WMI: $serverVersion = Get-WMIObject -computer $server -class Win32_OperatingSystem 回答1: You will probably find what you are

How to stub out global logging function in rspec examples

主宰稳场 提交于 2019-12-11 09:01:25
问题 I am working with some code which logs to a global static logging class, e.g.: GlobalLog.debug("Some message") However in my tests, I don't want to include the real log, because it introduces a lot of unwanted dependencies. So I want to mock it out: describe "some function" do before(:all) do log = double('log') GlobalLog = log log.stub(:debug) end ... end Unfortunately, because doubles are cleared out after each example, this isn't allowed: https://www.relishapp.com/rspec/rspec-mocks/docs

Cleanup Perl code: my $export = $doc; $export =~ s:\.odt:\.pdf:;

跟風遠走 提交于 2019-12-11 06:24:06
问题 Perl code fragment: my $export = $doc; $export =~ s:\.odt:\.pdf:; How would this be written cleaner? Not simply what are 900 other ways to write it, TMTOWTDI. 回答1: my ($export = $doc) =~ s{\.odt}{\.pdf}; UPDATE: That solution doesn't compile (note to self: test before posting on SO). Instead you could say (my $export = $doc) =~ s{\.odt}{\.pdf}; 回答2: I go for [.] to match a literal period: $export ~= s{[.]odt$}{.pdf}; Note that only the first half of the s/// call is a regular expression. The