A Visual Studio Code extension that will send the current file's text to a local HTTP server? - http

I'm using a live coding environment called Improviz. Essentially it has an output window and a separate editor window. When you type code in the editor and press CTRL+Enter, it evaluates code and updates the output window. The way it does this is by sending the code you've types to an HTTP server running on localhost:3000.
I'd like to use VS Code instead of the bare editor. I don't necessarily care about intellisense, etc. I just want to be able to type code, press CTRL+Enter and have the current file's text be sent to the HTTP server. The server accepts a /read POST request with the code as the content of the request.
I would love to make a proper extension from scratch, but at the moment I'm hoping that there's an extension that I can fork and modify - one that sends the text from the editor to an HTTP server. Does anyone know of such a thing? I suspect there's some other live coding environment that uses this same setup and that maybe there's an extension for it - but I've been digging and can't find this simple extension that I'm imagining already exists.
Thanks for any help.

Related

Programmaticaly spoofing an http script request in an iframe

I'm building a backend admin system which edits json files that control the look and feel of the main site. I want to add a 'preview' button before the user hits save. To do that, I want to use the main site, but instead of calling the actual json file in production, save a temp version of it and redirect this user's traffic for that file to the temp file - from the original site code.
i've considered both chrome pluggins, configuring iframe somehow or, in worst case scenario, grabbing the production front-end, parsing out the call to the prod json file and replacing with new temp json file. That is obviously not ideal as it would entail a lot of work and if anything changes on the prod site, this will have to be updated.
I would love your ideas!
Do you have access to the main site's source code? You could implement a preview option from the main site which accepts a GET parameter and uses a temporary JSON setting based on this GET parameter.
From the backend admin system's point of view, it's just a matter of adding the JSON as part of the ajax GET request.
Unfortunately though, there is no easy way of doing this if you don't have access to the main site's source code or if you can't reach out to whoever maintains that main site.
Your cleanest option might be to recreate the main site's look and feel instead and pass it off as a "preview".

Post Verb not allowed iis7

I'm trying to implement an upload with progress bar code i found here. But when i run my example code i get the following error in IIS7 Windows7:
Click here for larger image
I tried messing with my handlers but only messed it up more as i don't know what i'm doing. Can someone help me get this working?
It appears that your are trying to upload the file to (or trying to get process update from) a html file (fileupload.html) - now html files are considered as static files by IIS. So you can only issue GET request (there is no point in submitting POST to a static file because the content is not going to change based on POST data) and hence the error.
Perhaps, you have done integration incorrectly or may be using wrong plugin (the author is talking about using it in conjunction with apache module). You may want to look at alternatives from below links:
http://mattberseth.com/blog/2008/07/aspnet_file_upload_with_realti.html
File Upload with progress bar in Asp.Net Mvc/ jQuery?

Can I make the download dialog box appear without "save" option?

I have a hyperlink to an executable like so: Run Now
I'm trying to make the download dialog box appear without the save function as it is to only run only on the user's computer.
Is there any way to manipulate the file download dialog box?
FYI: Running on Windows Server '03' - IIS.
Please no suggestions for a WCF program.
Okay I found it for anyone stumbling upon this conundrum in the future.
Add the following tag to your head section: <meta name="DownloadOptions" content="nosave" /> and the file download dialog box will not display the "save" option.
For the user to not open/run but save replace "nosave" with "noopen"
Not unless you have some control over a user's machine. If your application can run on limited resources, you might want to consider doing it in Silverlight.
IMO, having a website launching an executable is a pretty bad idea.... even worst if that website is open to the general public (not on intranet). I don't know what that app is doing but it sure is NOT, 1) cross browser, 2) cross platform, and 3) safe for your users.
If you are on intranet, you might get away with giving the full server path (on a shared drive) to the executable and change security settings on your in-house machines.
Other than that, you won't succeed in a open environment such as the Internet.
From your comments, if the user downloading the file is the issue, then there's no way to get around it, as they have to download the file in order to be able to run it.
There's any number of ways to get around whatever you could manage in browser, from proxies like Fiddler intercepting the data, or lower level things like packet sniffing. Or even simply going into the browser's temp/cache folder and copying the file out once it's running.
You could probably get around most laymen by having a program that they can download that registers a file extension with Windows. Then the file downloaded from this site would have the URL of the actual data obfuscated somehow (crypto/encoding/ROT-13/etc). The app would then go and grab the file. The initial program could even have whatever functionality provided by what you want to download, but it needs the downloaded key.
But this is moving into the area of DRM and security by obscurity. If an attacker wants your file, and it's on the Internet, they will get the file.

Getting data into flex charts from csv

I am developing a flex charting web application which gets data from csv files. This application is supposed to be installed on the website of a client. The client uses a web server management system where the URLs generated are pretty long and contain non-alphanumeric characters. An example is given below:
http://www.example.com/EXTERNAL/ORGANIZATION/0,,contentMDK:20135608~pagePK:64060242~piPK:64060289~theSitePK:299948,00.html
The problem is that on my test server, the application is running just fine. But when deployed on the client's site, the application and the charts load, but the CSV data fails to load. The error given is:
Input output error: IO_ERROR
I have tried both relative referencing (relative with respect to the swf file) and absolute reference to the URL of the csv file. But both approaches have failed.
Any ideas?
I would ideally like to stay away from absolute URLs since that would break down if the charts need to move to another location.
Thanks
Vinayak
Umm, I don't know what to say really. Not knowing much about the server I'll have to resort to a list of things I can think of. Some of these are admittedly just a stab in the dark. In general it appears that this is a server side issue and as a front end developer you can't be expected to solve this. I know that getting the application to work is the priority here, but if you don't have access to the server there not much you can do to this issue.
First let's eliminate the completely obvious. Is the file ending definitely supposed to be .html and not .csv?
My original thought was that the CMS is somehow blocking Flash from loading the content, but would allow a browser to access it. Since it won't allow that either there are three options that come to mind:
1) The server or the browser does something to the URL when you make the request. Try installing the LiveHTTPHeaders (link) add on for Firefox, that'll allow you to look at the raw HTTP requests and responses. There might be some server side redirects that affect the request. The HTTP Headers should help you with that too.
2) The .csv files are kept in a folder that the web server doesn't have read access to.
3) maybe you need to use HTTPS instead of HTTP. This would be a bit strange since you are getting the URL from the server in the first place. The clients server admin should be able to sort this out for you.
4) I'm not sure what would happen if the script that handles your request is Python. In Python the colons are directory separators, so that might throw the whole thing off.
5) The clients management system does something strange to the URL before it's handed to you. Although I'm not sure how you would test this.
That's it I think. I'm out of ideas for now. For the testing I would forget the flex application and just try the requests from the browser address bar first. Since the application is working on your test server the issue shouldn't be your code. When you get the requests to work on the browser, if they still don't work from Flex then it's your code.
I don't know how much it helps, but there is an as3 CSVLib available.
About the IOError, can you please paste the text ?
If you listen for the IOErrorEvent and trace event.text in the handler,
you should something similar to this:
Error #2035: URL Not Found. URL: yourFile.csv
HTH,
George

The server didn't send back a proper XML response

I'm using FCKEditor in that when "Browse Server" button is clicked the following error is thrown.
The server didn't send back a proper
XML response. Please contact your
system administrator.
XML Request error: Not Found(404)
Requested URL:
/fckeditor/editor/filemanager/connectors/asp/connector.asp?Command=....
I'm developing and testing my website on IIS7 with .NET.
I would imagine that you need to ensure that you've configured FCK to use ASPX for the FileBrowserLanguage and QuickUploadLanguage rather than asp.
I've got this set in the CustomFckConfig.js file, rather than modifying the core FckConfig.js file:
// The following value defines which File Browser connector and Quick Upload
// "uploader" to use. It is valid for the default implementaion and it is here
// just to make this configuration file cleaner.
// It is not possible to change this value using an external file or even
// inline when creating the editor instance. In that cases you must set the
// values of LinkBrowserURL, ImageBrowserURL and so on.
// Custom implementations should just ignore it.
var _FileBrowserLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage = 'aspx' ; // asp | aspx | cfm | lasso | perl | php | py
I can't imagine that IIS7 is configured to serve .asp pages these days - isn't it geared up for .aspx? Seeing as you've tagged this question asp.net, I assume that the rest of your site is running in .Net.
We had same problem with our web site build in .net 3.5 and hosted on IIS7.
I found solution that helped us. We changed source code of fckeditor (small fix) and set response filter property to null. Bug was related to compression of server response in asp.net.
Article that helped us we found HERE.
I hope it will help you too.
Best regards,
Been walking through --a very long walk I might add-- a lot of suggested solutions but never found one that would address my problem.
I kept on getting the same response:
The server didn't send back a proper
XML response. Please contact your
system administrator.
XML request error: OK (200)
Requested URL:
https:.../fckeditor/editor/filemanager/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2F&uuid=1260177467559
Response text:
window.location.replace("http:.../fckeditor/editor/filemanager/connectors/aspx/connector.aspx?Command=GetFoldersAndFiles&Type=Image&CurrentFolder=%2F&uuid=1260177467559
Until finally, I stepped closer, re-read the response again and noticed that the request and response are using different protocols.
FYI, the editor is implemented in a secure part of the site accessible by site admins only. We're using the Ventaur component that does the automatic switching of HTTP/HTTPS requests.
The images --we only need to upload/browser image types-- reside in a subdirectory that is also configured to use HTTPS.
This gave me an indication as to where the problem is coming from, so I proceeded to set the fckeditor directory to use HTTPS as well.
This finally worked and iI was able to upload/browse images.
Using FireBug, check what the response the server is sending back to you.
You can do this by checking the Console Tab, after clicking your 'Browse Server' button.
That way, you can see what exactly is being received from the server, so you'll be able to debug it.
That means that either a URI mapping is not made, or a file is missing. It's trying to access a certain URI, but it cannot find it (404 status code).
Are you sure your installation/configuration is complete and correct?
In addition to Zhaph's comment, check the server encoding and make sure that jives with your FCKEditor configuration.
make sure your fckeditor.dll is on the path of Bin folder
and make sure you have a right version of it

Resources