How do i make a simple web based notepad application - textbox

I have to make formatting available for a text box in a web based application just like the options available here to make selected text bold or in italics. I don't know where to start. can anyone please guide me.
Thanks

Why reinvent the wheel? Use something that already exists:
TinyMCE
CKEditor

Here's a list of ten different rich text editors that will do what you need.
http://www.queness.com/post/212/10-jquery-and-non-jquery-javascript-rich-text-editors

Depends on what you're going to be coding in, but I'm sure most languages have built-in types for text boxes that can handle formatted text (not unlike the one I'm typing in right now), and probably have a method that returns the contents of the box.
All you'd need is to figure out is the format code, if you want to store this text and open it elsewhere.

If you want to create from "scratch", you can use any JavaScript framework to ease your work. There are many "good" frameworks out there:
jQuery, ExtJS, GWT, YUI, etc. Just choose the one that suits to your need.
http://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks

Related

How to replace string of a webpage using firefox addon?

I want to create an addon whose xpi installation will enable to replace a string of a website with other string.
For example , replacing all "the"s in a webpage with "change".
Actually, wanted to create an addon for a site due to which some complex word occuring multiple times could changed to a simpler word with a toolbar button click or by selection of the word and changing the word via clicking an option in the context-menu
Thnaks advance. Will give some more info if required.
This is a great question.
This is a simple thing to do, however it is very tricky to do it right. Right - means that it is done in a way that is safe from XSS attacks, and done very efficiently. It is common to see people not walking the tree, and doing all kinds of non-performant stuff.
What people do is copy paste this add-on and just modify the replaceText function -
https://addons.mozilla.org/en-US/firefox/files/browse/361576/file/data/content-script.js

How to make inline LabelFields

I'm working in a Blackberry app (OS 5.0) and need to show recent tweets of the user.
I'm able to get the data from Twitter's end. Now after parsing the entities (hashtags, urls, user-mentions etc), I need to display them with separate formatting (color, bold etc). So I'm using different LabelFields for different parts of the tweet.
But LabelFields are by default block elements. How do I put those LabelFields inline, so that it looks like how it is shown in Twitter?
like this:
Others have suggested RichTextField but you'd have to write your own text filter to colour the syntax - it's going to be a lot of effort. If having the clickable links inline is a must then personally I'd use a BrowserField but that would mean your logic would have to output a full screens worth of tweets into html (screens don't like having more than one browserfield - it's doable with more than one but there's some hacks) and manage the click events - more complications.
Alternatively you could do something like this: http://devblog.blackberry.com/2009/10/how-to-use-table-view-layout/ You wouldn't have clickable regions within the text body but it'd still be using native fields instead of 'cheating' with markup, probably the best way.
I've found that there's a component in Blackberry SDK called ActiveRichTextField which automatically scans its contents and parses links making them focusable and clickable. Furthur it'll also parse entities if Twitter app is installed in that device. For now it solves my problem. Thanks guys.

Send keys to a twebbrowser?

How do I programatically send keys to a TWebBrowser to fill in data fields like Name and address?
If you want to fake input you need to use the SendInput API.
However, that's going to require you to make sure that field in question has the input focus. I suspect you would be better off poking the data in through the DOM (IWebBrowser2.Document).
I guess you want just to fill in some data in some edit boxes.
If yes, this might be useful for you http://delphi.about.com/od/twebbrowser/a/submit_web_form_2.htm
The most robust way would be to use the DOM as suggested previously. However if you end up going via the simulated input route, the Delphi SendKeys unit will make things much easier.
Article and download available here: http://delphi.about.com/od/adptips2004/a/bltip1104_3.htm

How to get rid of stupid "pad" labels produced by RTML functions?

I am unlucky to be in charge of maintaining some old Yahoo! Store built using their RTML-based platform.
Recently I've noticed that HTML code generated by some RTML functions is sprinkled all over with "padding images" (or whatever is the conventional name for those 1x1 pixel images used to enforce layout). I have nothing against using such images, but... all those images are supplied with an ALT attribute like this:
<img href="http://.../image1x1.gif" alt="pad">
With all due respect to the original authors of RTML, but they must have been smoking something when they came up with this "accessibility enhancement"... :-(
Anyway, here are my questions:
Does anybody know a list of all RTML functions that generate HTML with all these "pad" images?
Is there any way to get rid of all those alt="pad" attributes without rewriting a lot of RTML code?
NB: This may sound a little cynical, but improved accessibility is not the main goal here. The main goal is to stop exposing those moronic alt="pad" attributes to Google and other smart search engines. So client-side scripting is not going to help, as far as I know.
Thank you!
P.S. Probably, most of you are really lucky and never heard of RTML. Because if somebody would establish a prize for software products based on
commercial success
------------------
usability
ratio, this RTML-based "platform" would probably win the first place.
P.P.S. Apparently someone from Yahoo! finally listened, because I can no longer find those silly "pad" tags in the RTML generated for our store. Nevertheless, one of the ideas offered in response to my original question does provide a very practical solution - not just to the original problem but to any similar problem with RTML platform. See the winning answer - it's really good.
The only way I see is to have your own website front-end that will filter whatever you want from the RTML site....
for example, your rtml site is at http://rtmlusglysite.yahoo.com/store/XYZ01134 , you could host a simple PHP front-end at http:://www.example.com that would be acting like a "filtering" HTTP web proxy, so http://rtmlusglysite.yahoo.com/store/XYZ01134/item1234.rtml would be accessed by http://www.example.com/item1234.html
It's not an ideal solution, but it should work, and you could do some more fancy stuff.
Nice try from the other posters, but there is a very simple RTML command that will do it. . .
TEXT PAT-SUBST s GRAB
MULTI
HEAD
BODY
TEXT #var-with-alt-tag-equals-pad-in-it
frompat "alt=\"pad\""
topat ""
The above RTML will find all instances of alt="pad" and replace it with nothing.
Well you're right on RTML being relatively untraveled :)
Do you have a way to add your own attributes to these images tags? If so, would it be possible to override the alt attribute? If you specify alt="", I would think that would override Yahoo's... Otherwise consider putting a useful alt tag in there for the blind and dialup types.
It's the first time I'm hearing about this platform, but here is an idea: if you can add javascript to the pages, you could write a function that will run after the page has loaded and remove all the alt="pad" attributes from the page.
Unfortunately this solutions works only with browsers that know about scripting, so lynx or some other text based browsers might not support it.
I have shared a link official RTML guide from yahoo. Hope it will help. Thanks!
List of available RTML books and resources

What is the best way to print screens from an ASP.NET page .NET1.1/.NET2.0

I have seen examples of printing from a windows application but I have not been able to find a good example of any way of doing this.
I've used the print style sheet
here's and article http://alistapart.com/stories/goingtoprint/ that will go through the way to set that up. Rather than setting up a special page that would need to be maintained as well.
If you just need to print your web page from the client-side use window.print(). Sample could be found here: http://www.javascriptkit.com/howto/newtech2.shtml. I would suggest preparing a special version of your page first with no dynamic content and with a layout which would look nice on print.
If you need to send something to printer on the server-side that would be a little bit more complicated. Check out this MSDN article on how to do the basic printing.
The browser prints your pages. If you need to tweak the page so it looks better on the printer, use CSS #media selectors.
Restating what others have said, you just need to call window.print() in javascript. That and build a separate css for print.

Resources