这个实用程序是否足够有用,值得放入 CodePlex 中?
这是我的第二个 C# 项目,多年前开始,它一直存在,因为(恕我直言)它是真正有用的软件。它的设计也很糟糕,代码也很尴尬。
它运行 C# 代码。您编写一个方法,方法名称出现在列表框中,您双击方法名称即可执行它。就是这样。
示例:
当我在工作中打开 C# Web 项目时,一种方法会运行我的项目所需的几个命令窗口应用程序,并检查以确认必需的服务是否已启动。我永远不必记住那些东西。
我讨厌大写,所以我有一个方法可以将 SQL 小写,但保留带引号的字符串的大小写。另一种方法是调用Web服务来美化SQL。它们都在剪贴板上运行。
一种方法修复 MP3 文件的名称:标题大小写、替换下划线和连字符、选择性地删除/插入文本或前置数字。创建播放列表!
我双击获取所有 Twitter 链接,将它们转换为带有超链接和 jQuery 支持的搜索的 HTML 页面。
方法在指定的 log4net.log 中搜索花费时间超过指定毫秒数的每个操作。
我可以通过双击一个方法来创建一个还原点(并使用另一个方法打开相应的对话框)。
当我的妻子必须为学校编写一些排序算法时,该实用程序是一个理想的测试平台。我一直用它来测试代码。
这些方法都没有任何令人印象深刻的。没有大大脑的东西。其中大部分只是字符串操作、文件系统操作——平凡的东西。不过很方便!
今天早上,我想将一些 SQL 输出格式化为 Excel 表中的行。我编写了一个方法来读取输出并将其格式化为制表符分隔的列,以便导入到 Excel 中。我不知道我还能怎么做。写了大约8分钟。
我有 300 种方法,也许其中 50 种经常有用,其余的则在需要时使用。有时我会把真正的残渣移到 Zaps 组中,这样就不会碍事了。
该实用程序具有许多易于使用的功能。与鼠标相比,我更喜欢键盘,因此方法被标记为可从下拉列表访问的组:control-T 选择不同的组。不记得组了?输入 control-F 可查找与字符串匹配的所有方法。向下箭头并按下可运行该方法。参数窗口始终记住它的状态:如果您上次输入 Hoytster,那么这次它就在那里。您可以右键单击某个方法来查看其工具提示;双击右键查看其来源。
我试图让快速创建新方法变得容易。
方法生成新函数的原型:您输入方法的名称、组标签、工具提示等,然后使用必要的属性修饰创建新方法。原型放置在剪贴板中,以便您可以将其粘贴到实用程序的源文件之一中。
提示参数很容易:
...GetParameters("*目标文件", "@Report File", "Open Report [No, Yes]");
打开一个窗口,其中包含标记为“目标文件”和“报告文件”的文本框,以及一个“打开报告”复选框,其中包含可切换“是”和“否”的文本。花括号中的字符串将变为单选按钮。由于开头的星号,目标文件必须存在;如果输入无效的目标文件,参数窗口将不会关闭。由于@符号,报告文件必须有效(可以创建)。
当你运行该方法并出现参数窗口时,它有一个[Capture]按钮,你可以点击生成捕获返回参数所需的代码,并将其再次放入剪贴板:
string targetFile =parameters["Target File"]; ... boolean openReport = 参数["打开报告"] == "是";
啊,我说得太长了。
那么,我应该有多大的野心呢?代码丛?也许是一个专门的网站,人们可以在其中上传他们的方法?
准备好发布该实用程序需要大量工作。我必须清理代码;删除真正愚蠢的方法和永远完成不了的方法;创建“创建新方法”过程的屏幕截图,记录驱动参数窗口的微小“元语言”(开玩笑)。
我喜欢大家使用我的实用程序来提高工作效率的想法。我喜欢看看你发明和分享了哪些方法。毫无疑问,它就在那里,但我不知道网络上有什么地方人们可以共享代码,就像“修复我的 MP3 的名称”这样简单的方法。
您想拥有这个实用程序吗?
除了工作过度和懒惰之外,我从来没有建立过网站(!)——你们可能会嘲笑我,因为我的 GetParameters() 方法有大约 200 行(我可怜的借口:我开始使用 FORTRAN)。这个实用程序从未被设计出来;它增加了。 :)
那么请告诉我:您认为这个实用程序足够有用,可以放在 CodePlex(或 somplace)上吗?
提前致谢! - 霍伊斯特
It was my second C# project, undertaken years ago, and it has lived on, because (imho) it is Genuinely Useful Software. It's also badly designed and the code is embarrassing.
It runs C# code. You write a method, the method name appears in a listbox, you double-click the method name to execute it. That's it.
Examples:
When I open up my C# web project at work, a method runs a couple command-window apps my project needs, and checks to confirm that the requisite service is up. I never have to remember that stuff.
I hate UPPERCASE, so I have a method that lower-cases SQL, but preserves the case of quoted strings. Another method calls a web service to beautify SQL. Those both operate on the clipboard.
One method fixes the names of MP3 files: title casing, replacing underscores and hyphens, optionally removing/inserting text or prepending numbers. Creates a playlist!
I double-click to harvest all of my Twitter links, turning them into an HTML page with hyperlinks and a jQuery-powered search.
A method searches the specified log4net.log for every operation that took longer than the specified number of milliseconds.
I can create a restore point by double-clicking a method (and open up the corresponding dialog with another method).
When my wife had to write some sorting algorithms for school, the utility was an ideal testbed. I use it to test bits of code all the time.
None of these methods is in any way impressive. No large brain stuff. Most of it is just string manipulation, file system operations -- mundane stuff. Handy though!
This morning, I wanted to format some SQL output as rows in an Excel table. I wrote a method to read the output and format it as tab-delimited columns, for import into Excel. I have no idea how else I could have done that. It took about 8 minutes to write.
I have 300 methods, perhaps 50 of which are often useful, the rest there if the occasion arises. Occasionally I move the real cruft into the Zaps group, so it's out of the way.
The utility has lots of ease-of-use features. I prefer the keyboard to the mouse, so methods are tagged into groups that are accessible from a dropdown: control-T selects a different group. Don't remember the group? You enter control-F to find all the methods matching a string. Arrow down and press to run the method. The parameters window always remembers its state: if you entered Hoytster last time, it's there this time. You can right-click a method to see its tooltip; double-right-click to see its source.
I tried to make it easy to create new methods quickly.
A method generates your new function's prototype: you enter the method's name, group tag, tooltip, etc, and the new method is created with the requisite attribute decorations. The prototype is placed in the clipboard so you can paste it into one of the utility's source files.
It's easy to prompt for parameters:
...GetParameters("*Target File", "@Report File", "Open Report [No, Yes]");
opens a window with textboxes labeled Target File and Report File, and an Open Report checkbox with text that toggles Yes and No. Strings in curly-braces become radiobuttons. The Target File must exist, because of the initial asterisk; the parameters window will not close if an invalid target file is entered. The Report File must be valid (it CAN be created) because of the @-sign.
When you run the method and the parameters window appears, it has a [Capture] button you click to generate the code needed to capture the returned parameters, putting it into the clipboard again:
string targetFile = parameters["Target File"];
...
boolean openReport = parameters["Open Report"] == "Yes";
Ach, I go on too long.
So, how ambitious should I be? CodePlex? Maybe a dedicated web site, where people can upload their methods?
Getting the utility publish-ready would be a lot of work. I have to clean up the code; remove the really dumb methods and the never-finished methods; create a screen cast of the "make a new method" process, document the teeny "meta-language" (tongue-in-cheek) that drives the parameters window.
I like the idea of y'all using my utility to be a bit more productive. I love the idea of seeing what methods you invent and share. No doubt it's out there, but I'm not aware of places on the net where people share code as simple as a method "Fix the names of my MP3s".
Would you like to have this utility?
Besides being overworked and lazy, I have never put up a web site (!) -- and y'all might mock me because my GetParameters() method has about 200 lines (my poor excuse: I started out with FORTRAN). This utility was never designed; it accreted. :)
So let me know: Do you think this utility is useful enough to put up on CodePlex (or somplace)?
Thanks in advance! - Hoytster
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将其发布到 CodePlex 上并评估其实用性。如果它对很多人来说非常有用,那么就开始围绕它创建一个社区(就像您提到的网站一样)来继续前进。如果这需要大量工作,并且您不知道它是否对人们有用,请从小事做起,然后不断提高。
我用我为 .NET 框架开发的基于 Apache mod_rewrite 的 URL 重写器做了同样的事情。
http://urlrewriter.codeplex.com
我从小规模开始,随着人们要求新功能并开始更多地使用它,而且,这种努力变得很容易证明是合理的。
Put it out on CodePlex and gage the usefulness of it. If it is very useful to many people start moving forward by creating a community around it like the website you talked about. If it is going to be a lot of work and you don't know if it will be useful to people, start small with your effort level and keep moving it up.
I did this exact same thing with my URL Rewriter that I developed, that was based off of Apache mod_rewrite, for the .NET framework.
http://urlrewriter.codeplex.com
I started small and as people requested new feature and started using it more and more, the effort became easy to justify.