diff to web display? - c#

I want to create a diff between two pieces of text (code but i may also want forum post) and highlight the difference in a webpage. What lib might i use to do that? I dont mind if highlighting is done in javascript. I am using asp.net with C#

You can use the DiffPlex library.
It is the same diff'ing library that is used by CodePlex.com to show source code diffs. You can see an example of its output here.

I've used jsdifflib

Related

Dummies guide to making dropzone.js work?

I'm trying to implement a drag-n-drop fileupload to my website and found a piece of java called Dropzone.js, it holds everything i need . . . i just have no idea of how to use it!
So far I've been programming only in razor ASP.NET (c#) / HTML / CSS, but so far no javascript / jquery.
It's razor webpages, so no mvc.
Due to my current lack of knowledge in java, i apologize in advance but i'm stuck !!
What i'd like to know is:
I'f i've understood things correct, i should not modify Dropzone.js directly, i should use it as a library and integrate it in my other scripts, e.g. in another .js file. Correct?
Any help in this will be greatly appreciated.
Kind regards,
Daniel A. Rischel
.. Edited as per requested.
Well, you're wrong somewhat. It might not be related to the question but please note these scripts are JavaScript and
java != javascript
Got the point? :) Please try to note this in future. Also, Java code cannot be added to these server-side language, because java itself is a language. You can use JavaScript or its library (jQuery) and create some plugins.
I'f i've understood things correct, i should not modify Dropzone.js directly, i should use it as a library and integrate it in my other scripts, e.g. in another .js file. Correct?
True, you need to link this plugin dropzone.js to the site using
<script href="/link/to/dropzone.js"></script>
Then you'll use this script on the whole of the page where it is linked.
And you should never edit the source code of a plugin, untill or unless you know what you're doing. Because you might mess up with the code.
I'd really like to see some source code examples of what a single file drag-n-drop fileupload form would look like. I've googled extensively but not found something i can use yet.
Did you try to read their documentations? They have a good code explaination on the default (main) page of their website too. And really it depends on just the way you style it. Its just a plugin, you will need to add your own CSS code to style the form. This plugin won't style the form for you, all it will do is to handle the upload events and get back with the result. So, which means that form creation and elements is all upto you!
If there is a dummies tutorial in making this work, i'd really like to be pointed in the right direction!
There is no perfect answer to provide you with, however I will provide you with some basics
http://www.javascriptoo.com/dropzone-js
https://stackoverflow.com/questions/tagged/dropzone.js?sort=newest&pageSize=15 (stackoverflow tag)
In the second link, you can go and see what are the very basic of the issues that are handled with what code. Easy methods will be hanlded by you! You'll need some guidance in just the hard jobs. Good luck for that!
My suggestion for you is to first undertand and learn jQuery, then learn how to make ajax calls. After that you'll know how to create and handle the events. The basic code will be
$('input[type=file]').change(function () { // change in value
// send the file via ajax
}
http://jquery.com
This method will be best as you will know what code you're using and what it will do. Using plugin is easy method then this one. But my preference is with the second one; creating your own plugin.

C# data scraping from websites

HI I am pretty new in C# sphere. Been in php and JavaScript since the beginning of this year. I want to scrap posts and comments from a blog. The site is http://www.somewhereinblog.net
What I want to do is
1. I want to log in using a software
2. Then download the html
3. Then use regular expressions, xpath whatever comes handy to separate the contents of posts and comments
I been searching all over. Understood very little. Though I am quite sure I need to use 'htmlagilitypack'. I dont know how to add a library to c# console or form application. Can someone give me some help? I badly need this. And I am not too into C# just a week. So would be grateful if there is some detailed information. Waiting eagerly.
Thanks in advance brothers.
Using Webclient you can login and download
Instead html-agility-pack I like CsQuery because lets you use jQuery syntax inside a string in C# code, so you can download to a string the html, and search and do things in it like with jQuery and HTML page.

jQuery + C# code to resolve URL's from user-supplied text

I'd like to add some kind of simple URL resolution and formatting to my C# and jQuery-based ASP.NET web application. I currently allow users to add simple text-based descriptions to items and leave simple comments ('simple' as in I only allow plain text).
What I need to support is the ability for a user to enter something like:
Check out this cool link: http://www.really-cool-site.com
...and have the URL above properly resolved as a link and automagically turned into a clickable link...kinda like the way the editor in StackOverflow works. Except that we don't want to support BBCode or any of its variants. The user experience would actually be more like the way Facebook resolves user-generated URL's.
What are some jQuery + C# solutions I should consider?
There's another question with a solution that might help you. It uses a regex in pure JS.
Personally though, I would do it server-side when the user submits it. That way, you only need to do it once, rather than every time you display that text. You could use a similar regex in C#.
I ended up using server-side C# code to do the linkification. I use an AJAX-jQuery wrapper to call into a PageMethod that does the work.
The PageMethod both linkifies and sanitizes the user-supplied string, then returns the result.
I use the Microsoft Anti-Cross Site Scripting Library (AntiXSS) to sanitize:
http://www.microsoft.com/download/en/details.aspx?id=5242
And I use C# code I found here and there to resolve and shorten links using good olde string parsing and regular expressions.
My method is not as cool as the way FaceBook does it in real time, but at least now my users can add links to their descriptions and comments.

Free watermark for my wizards.Where can I find them?

I have written some wizards in c# and I would like to make look like more professional by adding some watermarks on the welcome and complete page.
I am struggling to find any source where I can download some free to use EG Database related watermarks that I can use in a Database script generator that I have written.
Any suggestions?
I am pretty useless at making them.
thanks
PS
Not sure where I should post it .I put under c# but again not sure
You can try to download watermark tools, these links might be helpful:
http://www.softpedia.com/get/Multimedia/Graphic/Graphic-Others/Fast-Watermark-Free.shtml
http://www.mydigitallife.info/2009/11/20/download-free-watermark-image-to-watermark-or-add-logo-to-photos-in-batch/
http://www.freedownloadscenter.com/Best/free-watermark.html
And you can search for more on Google. Don't forget to scan these tools for spyware, etc.
Or you can create your own watermark here: http://www.webwatermarks.com/
Please consider checking Google. When I looked up "Free Watermarks" there were several viable hits.
Also try looking into "Stock Photography" and some combination thereof with "Free Watermarks"

Rich Text Editor on a web page

I am trying to add a rich text editor in my web page where users can write reviews and format what they have written...something similar to the editor in which we write our posts on this site...
can anyone point me to the right direction regarding this...any tutorial that would help me build such a component...
Also i want a free product....(Forgot to mention earlier...)
Something in the likes of TinyMCE or FCKeditor, perhaps.
They're quite complete, and customisable.
The editor used on Stack Overflow is the WMD Editor.
The current version used on the site has been updated by Jeff Attwood and other site users and you can read about it here and get a copy of the code for your own site.
I think you'd be better off using (and perhaps modifying) an existing component rather than writing your own from scratch.
I've been using the Telerik r.a.d Editor, and been very happy with it.
after much research here is what i did...
i needed a control that was free and easy to use..all the editors that i went through came with a licence so i decided to make my own control!!!!
well..i couldnt do that on my own so i used the help of a few sites....
javascript Rich Text Editors
http://aspalliance.com/1092_Rich_Text_Editor_Part_I
http://ws.aspalliance.com/1092_Rich_Text_Editor_Part_II and a few others too...
so the best option for me was to build my own control so that i could customize it according to my needs....
http://freetextbox.com/
here is yet another one: NicEdit

Categories

Resources