I'm messing around with Tamir.SharpSsh and wanted to see if it was possible to use it to implement a console SSH client fully in C#. I do not mean something like putty where it's actually running in it's own GUI, but something you could run directly from the windows cmd console.
The library is pretty great, except that it doesn't handle terminal emulation in any way. So when using SshShell, you can do some basic interaction, but the output is often very ugly and full of random characters and you cannot actually interact with things like shell scripts, etc.
As far as I can tell SharpSSH simply redirects the IO to the console IO.
How hard would it be to redirect this elsewhere and handle the terminal emulation? Also, is there an emulation library (C# and open source, preferably) already that I could use?
Edit: Gave up on SharpSSH, see answer below for the final solution I came up with.
I have actually since abandoned trying to use SharpSSH. It is a good library, but was just too lacking in overall functionality. I am now using a library called Granados which is a much more fleshed out SSH implementation. It has a built in event model (unlike SharpSSH which mostly involves wrangling with Streams) that makes usage very easy.
As for the terminal emulation part... Granados is actually the core of another open source project called Poderosa.
Poderosa is a complete terminal emulator application that can connect to ssh, telnet and even your local cygwin install.
I haven't really dove into it's terminal emulation code at all, but it definitely does it quite well, so I'm sure you could easily pull out whatever code you need.
I'm looking for the same thing. There is a library here that costs $700. Found another one on codeproject that looks shoddy but might be a good start. And there is an incomplete implementation right here on stackoverflow. Still searching..
Related
My question today is how to develop stun and turn servers for webrtc peer-to-peer application in c# is there any library supports this, I can't find any example or resource to obtain this.
Please help me with this because it took me too much time searching with no luck.
I tried OfficeSip and didn't work also I tried coturn over cygwin but didn't work.
I'm not sure if there's any STUN/TURN server or library implemented in C#.
The ones that I know of are
coturn
PJNATH
STUNTMAN
go-stun
ReTurn
turnover
On the coturn page you can see a list of all the RFC that has to be implemented.
Frankly, I would not commit to such a huge task of implementing a TURN/STUN server. If you need one that works in Windows, and none of these work, you can try to run it in a VM or something like Docker.
Maybe I did not fully understand how complex hadoop really is, if there is something incorrect please help me out. So what I got is this:
Hadoop is a great thing to handle a big amount of data. Mostly for data analysis and mining. I can write my own mapreduce functions or using pig or hive. I can even use existing functions, wordcount and stuff like that - I dont even have to write code.
Ok, but what if I would like to use the great power of hadoop for non-analysis/mining things? As example I have a .NET application written in C# that is able to read files and generating pdfs with some barcodes. This application is running on one server, but because the one server cannot handle the big amount of files I need more power. Why not adding some hadoop nodes/clusters to handle this job?
Question: can I take my .NET application and tell hadoop "do this, on every on your nodes/cluster"? -> Running these jobs without coding, is it possible?
If not, do I have to throw away the .NET application and rewrite everything in pig/hive/java-mapreduce? Or how do people solve these issues in my situation?
PS: The important thing here is not the pdf generator and maybe also not .NET/C# - the question is: there is an application in language whatever - can I give it to hadoop just like that? Or do we have to rewrite everything in mapreduce functions?
#Mongo : I'm not sure if I understood correct but I'd try sharing what I know. First of all hadoop is a framework - not an extension or a plugin.
If you want to process the files or perform a task in hadoop, you need to make sure that your requirements are properly put forward so that hadoop understand what to do with your data. To put it simple, let us consider the same word count example. If you want to perform the word count on a file, you can do it using any language. Lets say we have done it in Java, and we want to scale it to larger files- dumping the same code in to a hadoop cluster would not be helpful. Though the java logic remains the same, you will have to write a Map reduce code in java which would be understood by the hadoop framework.
Here's an example of a C# map reduce program for Hadoop processing
Here's another example of MapReduce Without Hadoop Using the ASP.NET Pipeline
Hope this is helpful. I'm assuming that my post adds some value to your question. I'm sure you would be getting better thoughts/suggestions/answers from the wonderful people here...
P.S: You could mostly do anything and everything thats related to file processing/ data analysis in Hadoop. It all depends up on how you do it :)
Cheers !
Any application that can run in Linux can be done in Hadoop, using Hadoop-streaming. And a C# application can run in Linux using Mono.
So you can run your C# application using both Hadoop-streaming and Mono. But still, you need to adapt your logic to the map-reduce paradigm.
However, it should not be a big deal in your case. For instance, you could:
create a Hadoop-streaming job with mappers only (no reducers)
process exactly 1 file per mapper
each mapper would run "mono yourApp.exe", reading the input file in stdin, and writing the output in stdout
Also, Mono must be available on the Hadoop cluster. If not, some admin privileges will be required to install and deploy Mono yourself.
I am interested in making an application that can automatically determine what files are included in php.
What I'm getting at is that I would like to make either a C/C++ or a C# application that runs in the background and as you're developing on your local machine, it can display included files by php as you launch pages running on your local apache.
What I thought about was to modify the function in php source code, but then I thought that would be a bad idea because then each new version of php, I'd have to go back and make the same modifications and I doubt everyone would do that.
So my question is, is it remotely possible to get all the included files that your php application used and then somehow display them to the user without using get_included_files() in your php program?
You could go outside of PHP completely and rely on the underlying operating system to report these details. It would be difficult to match the request to the includes though so it would only work in a development situation.
If the OS is Linux/UNIX, you can run strace on the executable (assuming using Apache with mod_php, other situations more difficult).
If the OS is Windows, I'm not sure what to use but possible one of the SysInternals utilities (most are GUI but likely there is a console equivalent of strace or a version of strace for Windows).
Another option would be to use xdebug. It would show you much more information including profiling details, memory usage, etc. It is used as a PHP extension and it does make it easy to profile a whole request in one snapshot. Once you have a trace file, you can use WinCacheGrind (Windows), kCacheGrin (UNIX, maybe OS X too) and something else for OS X. I'd suggest trying this as it is the simplest approach and is quite powerful if you are looking to get this done rather than do exploratory programming.
http://xdebug.org/
If you are interested in doing exploratory programming, my suggested route would be to look at how xdebug works and see if you can write a hook to the functions you want to trace.
I have never been a fan of the windows command line. I have tried tools like powercmd and liked them, but most are not distributed for free and I don't relish the thought of paying for something that I think I could write myself. I want to write my own command line wrapper similar to powercmd that allows for these properties:
Custom fonts and colors
Opacity of windows
Multiple windows opened at same time in a panel (maybe like tabbed browsing)
Ability to resize windows
I am reaching out to you guys now to help me decide on whether I should attempt this with C# in visual studio or whether I should do it in Java with Swing. I am comfortable with both. Has anyone ever done a command line wrapper like this? If so what language did you use and what was your experience? Thanks for any feedback.
Grant-
If you want to do a windows command line, I would recommend C#. Java's enforced platform independence will make you fight too much to pass along commands to the underlying OS.
There's already Console2 that hits the big bullet points - resizable, opacity, tabs, modifiable fonts.
It's written in C++ and under the hood it wraps cmd.exe (or whichever command shell you tell it to use) so those may be two strikes against it if you're really interested in developing your own shell in a managed language.
Since you asked, I wrote one myself in C# - the Process class is just too useful. The main thing here is I/O redirection. While I never managed it fully myself, you need this so that subprocess output doesn't appear in another console window. You can also kill programs, find existing ones, etc.
Also, C#'s Console manipulation is very handy.
While I am not a Java programmer, I can imagine that both of those important features would be quite hard to use, considering that Java is platform-independent.
C# has several benefits over Java for this type of project, not the least of which is better integration with Windows, which is (presumably) the only platform you're developing this for. The Java Swing library is not nearly as fine-tuned looking on windows machines as C# forms tend to be, and with the ability to use WPF, C# seems the clear winner to me.
I would not use Java and Swing for this. C# will let you communicate directly with the .Net framework and allow you the ability to build a more powerful command line tool. IT will be a hassle to get Java access to some Windows System calls.
Just wanted to let you all know that I did end up writing a command line wrapper with C#. It turned out really well. I have a couple more little things I want to add and then I will put up the source code as well as a place to download the .exe. I posted a video of it in action in case anyone wanted to provide feedback or ideas. Thanks for the help.
http://www.youtube.com/watch?v=-NM-XcYwLDc
I would like to write simple scripts in C#. Stuff I would normally use .bat or 4NT .btm files for. Copying files, parsing text, asking user input, and so on. Fairly simple but doing this stuff right in a batch file is really hard (no exceptions for example).
I'm familiar with command line "scripting" wrappers like AxScript so that gets me part of the way there. What I'm missing is the easy file-manipulation framework. I want to be able to do cd(".."), copy(srcFile, destFile) type functionality.
Tools I have tried:
NANT, which we use in our build process. Not a good scripting tool. Insanely verbose XML syntax and to add a simple function you must write an extension assembly. Can't do it inline.
PowerShell. Looks great, but I just haven't been able to switch over to this as my primary shell. Too many differences from 4NT. Whatever I do needs to run from an ordinary command prompt and not require a special shell to run it through. Can PowerShell be used as a script executor?
Perl/Python/Ruby. Really hate learning an entirely new language and framework just to do batch file operations. Haven't been able to dedicate the time I need to do this. Plus, we're a 99% .NET shop for our toolchain and I really want to leverage our existing experience and codebase.
Are there frameworks out there that are trying to solve this problem of "make a batch file in C#" that you have used?
I want the power of C#/.NET with the immediate-mode type functionality of a typical cmd.exe shell language. Am I alone in wanting something like this?
I would try to get over the PowerShell anxiety because it is the shell of the future. All of the software coming out of Microsoft is using it as their management interface and especially version 2.0 is ridiculously useful.
I'm a C# developer most of the time but PowerShell has solved that whole "WindowsApplication42" problem of temp projects just piling up. PowerShell gives you full access to the .NET framework in a command line shell so even if you don't know how to do something in PowerShell, you most likely know how to do it in .NET.
IronPython and IronRuby do let you leverage all of your .NET "experience and codebase" (they don't answer your objection to learning new languages, however).
If you have any bash nerds, you can always try cygwin.
Also remember that Python was originally intended as a "glue" langauge. If you used the aforementioned IronPython, it's pretty easy to tie together pre-written C# classes.
If you are bind to MS, PowerShell is surely the way to go. But I don't like it much.
I personally use MSBuild script more, and would like to see Mono C# Shell one day comes to Windows.
I think CS-Script might be the ideal solution for you.