I'm looking for a way to dynamically generate javascript. I didn't find any information on this by browsing through Script#'s documentation, so here are my questions:
1) Is it possible to generate javascript code during runtime?
2) Is it possible to dynamically set a file name to which generated code would be saved to? Or can I get the generated code as a string?
A scenario would be: A user goes to a web site, enters a name in a text box, hits a button and a javascript is generated that would say alert("Hello name"). (which can be offered as a download)
I'm using the version I got through NuGet (0.7.5).
If it is possible, I would appreciate any hints or examples.
Thank you!
1) Yes, its possible. The script# compiler is packaged in ScriptSharp.dll and you can use the API it exposes. For an example of doing so, check out the sources of the script# msbuild tasks in the script# repository.
2) When you use the API, you effectively pass in a Stream - so you get the generated content, which you can use as you wish.
I'll recommend cloning the repository and using the "cc" branch to pick up the latest changes. The wiki on github has steps to build. 0.7.5 is a bit old now.
Hope that helps.
Related
I am writing a small Visual Studio addin to let the user use more features of the comment tokens (TODO, HACK, etc.). For this I want to extend Visual Studio with new commands (such as TODISCUSS, TODELETE, FIXME, TESTME, etc.). I'd like to do this programmatically when my addin starts.
I already found out how to do this manually: http://msdn.microsoft.com/en-us/library/ekwz6akh%28v=vs.80%29.aspx
Does anyone have an idea how this could be done via the API?
Any ideas or suggestions would be appreciated!
Edit :
See this MSDN Link perhaps digging around in TaskList will get you somewhere.
Original Post :
It's not very clear (to me :) what exactly you want to do. Is it: find, edit, or refactor the tokens and then do something else with the sources? I can suggest this article on Code Project (NRefactory).
Using NRefactory you can do anything and everything with the source files including locating the tokens you want and doing stuff with them. You will also know the files you found them in, line numbers etc.
Perhaps you will be able to use Nrefactory to do all the heavy lifting as far as sources are concerned.
I am writing an application in c# that presents a form for developers to fill out. The application takes in information about the repositories (repos) and then puts it into a wiki template. Once I format and save to an .md file, I would like to push it to the repository. I just got done converting a few hundred repositories from SVN to an enterprise version GitHub and none of them have wikis. I want to give the developers an easy way to outline what the code is and where it came from without them having to format etc. I already know about 'gitaccess' and the Ruby api. These, however, require a full clone of the repo before a wiki can be pushed to it. I do not want this. Any help is very appreciated. Thank you.
This isn't exactly an answer, but it's still relevant. You can use a batch file to script the push commands, and then use gitcredentials, which is built into git, to handle the username and password prompts, which should allow you to script the entire process of pushing the wiki pages. See https://www.kernel.org/pub/software/scm/git/docs/gitcredentials.html for more details.
You can use the Wiki link from the top action bar from within the repo. Within the Wiki area, you can create pages desired right from the web by clicking the New Page button. There are also Edit and Preview buttons on the web page for viewing before you save the Wiki document.
To add to this, I did not realize you were trying to script your changes. The wiki exists in a separate, but parallel repo to the code repo and you do not have to clone the code repo to get the wiki repo (although you do need to clone the wiki repo). You can access the xyz.git repo's wiki using xyz.wiki.git. On the Wiki page (which you already know about), and of course, you can get the URL by clicking on the Git Access button at the top.
If you really can't clone the wiki repos, Git offers only a total of 4 protocols as specified in the Git Documentation. Here is a blog post that talks about 8 ways to share your git repository, which may give you some clues to other ways to do what you want to do.
Does anyone know of a batch processor or a VS 2010 plugin/script that would let me translate comments and region names from Chinese into English?
The only ones I've found either process all strings or only one string at a time.
I have two large C# projects that I am trying to read through.
Thanks.
Use PrepTags to prepare your file for translation. It will allow you to select the text to be translated based on regex.
www.preptags.com
You can work file by file for free, or process the files as batch using the pro version (€39)
In your case, it's pretty simple to prepare. You just mark everything as protected, then unprotect the content of the comments & region names.
Disclosure: I develop PrepTags.
As was noted, you can use Google Translate API or alternatively Bing Translator API. You can detect comments and regions in your files using System.CodeDom.
I'm not too sure if this is possible. What you can do to help would be the following:
1) Make sure that both C# projects have the Properties > Build > Xml document file check box checked.
2.1) Write an application that reads in the generated xml file.
2.2) Parse the file, and for each value make a call to Google Translate to get the translated value.
2.3) Place the translated value within another xml file that has the same structure as the one created from building the project.
This wouldn't solve the your desire to translate the region names, but its a start. At least you would have intelligence when using the two projects.
This is actually a good idea for a small open source project. I may decide to pick it up. If I do, I'll let you know.
I was building something using jQuery's AutoComplete plugin last week, but today I found that it's not working.
After some debugging, it seems that the external scripts I've been loading no longer exist:
http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js
http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js
http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js
Even the demo on the plugin page no longer works:
http://docs.jquery.com/Plugins/autocomplete
Was the plugin deprecated over the weekend and I didn't know it? Or is there some way to let them know that the files aren't showing up?
Here's a link to the static delivery on the google CDN:
http://code.google.com/apis/libraries/
I'm not sure they do the plugins, but you can get the main library this way.
Here are some quick links to get your missing scripts:
http://docs.jquery.com/Plugins/bgiframe
http://plugins.jquery.com/project/dimensions
http://docs.jquery.com/Plugins/autocomplete
Like #Paddy said in the comments above, I would HIGHLY recommend pulling these down into your project and creating local references to each instead of relying on the FQDN of the scripts on another host to remain unchanged forever.
UPDATE:
Note that I myself have noticed some downloads going missing recently on jquery.com, so you may have trouble finding the downloads. If so, I would recommend checking if google's cache has a hard link to them - I've been able to find a couple this way.
I am using a software named Daisy 2.02 Validator and it is with GUI but i want to access it programatically so that i can control all the validation process through my C# project. I am unable to find any help about it's libraries, any .net Api or any DOS command for controlling it. Please provide me help.
Thanks,
Regard,
Muhammad Waqas
If it's a .NET executable, try and use ILDASM.exe or better still - use Reflector to find out whether it has a public API. You may then be able to add it as a reference (all you need to do is simply rename the .exe to .dll) to your project or alternatively load it as an assembly and use reflection to use its API.
Obviously the first option is much preferred.
If it isn't a .NET executable, you could use scraping, but you would have to profile your app for that first and work out what low level windows messages and controls it responds to. Bit of a nightmare.
from what I see Daisy 2.02 Validator is an open source project.
if the API is not implemented you can just add it yourself
Worst case maybe send keystrokes to it.