Want to develop a query refinement tool just like Google Suggest so that i will get recommended options when i enter keywords in the search textbox i.e( if i type "car"
i will get the recommended options as rental cars,used cars,cars for sale etc) want to develop the tool in c#/ASP.Net dont know where to start.please give some suggestions.
This can be achieved by using javascript and let's say some web service / page method. You send the values that user gave you to a web service. The web service translates the text, make some database (or other storage) request and return the results to the page as json (or some other format that suits you).
Look at this article if you need some example code:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=515
By the way, if you need more articles, just put "asp.net autocomplete" into Google. That should give you plenty of resources.
Related
As a DBA/SQL Server Developer, I'm often asked to produce web pages where users can view the data in the database and edit them, and see the edits they've made straight away (without refreshing the page). I know nothing about ADO.NET or C#, but I would like to be able to give users this very simple functionality. Essentially I'm looking for three things:
to display a table of data in a webpage retrieved from a SQL Server stored procedure
to display a text box in the same webpage where users can input data
to display a button in the webpage that takes the inputted data from the text box, runs it through the stored procedure as a parameter, and refreshes the table.
Ideally I'd like this all to happen without the user having to refresh the webpage.
My questions are: is this kind of thing possible? How difficult is it to achieve? And how do I do it? I don't have the time to learn web development in full. I wouldn't need the vast majority of skills I'd learn even if I did learn it in full. I just really need this basic functionality, to produce ultra simple pages when user requests come in.
If anyone knows of any examples of just this kind of thing, that I can copy, they would be greatly appreciated!
You don't really need to use MVC, WebForms or even C# for that matter. Using one of those would be killing a ant with a rocket launcher.
Look into node.js and pug, using a RESTFUL API to deliver the information you need. I don't believe you will need more than two hours to provide your users with the interface you told us.
Node has a awesome package called express, it sets up everything for you and uses Pug on the starter template.
You can check out a tutorial right here.
Actually it will also take 2 hours doing with Webforms or MVC . I recommend using Entity Framework to make it super simple.
Webforms may be a bit older technology but will be faster to develop this specific page (assuming you only targeting Desktop users). Otherwise MVC is the way to go.
You can Check the tutorial.
https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/introduction/getting-started
Can I use C# to auto search websites, then return the search results?
Is there a web crawler that would do the same thing if I give it a top domain (ex: I tell it find the word "funny" on stackoverflow.com, and it would tell me all the times "funny" appeared)?
These web sites allow searching via their search bar.
Do I need the web sites cooperation to automate searches?
NOTE: I only plan to be doing about one or two searches a day, so I doubt I'll be blocked, or asked to authenticate myself.
If your planning on crawling through an entire website to count words like that if you dont cache it you will get blocked, youll be requesting every page of the website essentially. Perhaps consider integrating google domain search's instead?
Here is a link to googles page detailing how to interface with c#
http://code.google.com/apis/gdata/client-cs.html
EDIT: Sorry that wasn't quite right : http://gsalib.codeplex.com/
http://answers.oreilly.com/topic/2165-how-to-search-google-and-bing-in-c/
I would look into building an RSS aggregator. RSS is standardized, so that's probably the most reliable way to collect search results from various sources.
EDIT: For sites that don't support RSS
For the sites that don't support RSS, you can look into using a screen scraper. Check out this article on The Code Project to get you started:
http://www.codeproject.com/KB/aspnet/weather.aspx
...web sites allow searching via their search bar ... Can I use C# to auto search websites, then return the search results?
Yes, if the website provides a URL where the search-term is provided as a query-string argument to a URL.
http://yourTargetDomain?searchterm=foo
But unless the website has specifically designed the search results from that URL to be structured data, the website won't "tell [you] all the times 'funny' appeared" but will send you back a search response that is suitable for a browser to display, so you would have to parse the results out of this stream of HTML.
For example:
http://philadelphia.craigslist.org/search/tls?query=ladder&srchType=A&minAsk=&maxAsk=
I'm working on a program in Visual C#.NET and I need some help.
I need it to be able to take in some text through a text box, then somehow send that text to google, and bring back the resulting URLs (not the full results, just the URLs) and then display those in my program. How would I do that?
Use the WebClient class to send the query to Google and read the response.
Alternatively, use a .NET library that interacts with the Google search API, like this one (this was just the first Google result).
There are also REST libraries for .NET, if you go with the newer custom search.
Unfortunately the Google Web Search API is deprecated and no longer available. However the next best thing IMO is Google Custom Search Engine.
I've got a site which produces charts such as the one below
I'd like to encourage visitors to embed the generated graphic on their own sites and blogs. Is it possible to include views for that chart in google Analytics? I want to be able to see when a site embeds the image so that it's tracked in the analytics reports.
I'd envision some API that I can call from the server-side method which generates the PNG, but haven't been able to find anything specific.
Thanks!
This is indeed possible, have a look at the Google Analytics for Mobile Websites documentation. This details how to build a request to google analytics on the server, with quite a few different code samples (C# included).
While this documentation revolves around tracking page views, this concept could be extended to other types of activity you can record in google analytics, such as Events. In your specific situation I think I would want to setup the view of the chart as an Event, as this will not 'mess up' your true traffic (though you could use an advanced segment to exclude the chart traffic if you chose to register them as page views).
The documentation for event tracking is available here. Looking through it should give you a good idea of how you could express viewing your charts. Once you got an idea of how you wanted to track the event in GA, write the javascript and then view the URL (beacon) it generates to send the information to google. You'll be able to use that as a template to send event information from the server.
In regards to actually serving the image, you have a lot of options. If you app is written in MVC, look at the FileResult class (and the asssociated File() method available on the Controller class). If you working in a Webforms app, you will be using a Response.WriteFile() or something to that affect. This wrox article has an example of the idea behind this. The example is for creating a no leaching / hotlinking image handler, but the concept of writing an image to the HttpReponse is the same.
I want to provide an autocomplete option for a text in my web applciation . I have the master data in the SQL server database table. I beowsed in google and found how to use autocomplte. all the examples use web service to do this. I cannot create a web service to impltement this. Is it possible to implement autocomplete by looking up values from database in code behind ? If so any one can provide any sample links for reference ?
Thanks in advance,
Jebli
It depends on the volume of data. There are 2 options:
send it to the client pre-emptively (perhaps as json or html) in the page source
let the client query it based on their input
The second is common if the data-volume is non-trivial, as you can query when (for example) they've entered 3 characters; very useful for names and other long lists.
Re the web-service; this doesn't have to be a full/complex web-service; just a simple route or ashx (for example) that returns the filtered data.
The jquery autocomplete plugin supports both scenarios, although this is now partly obsoleted by jquery ui plugin.
Is it possible to implement autocomplete by looking up values from database in code behind
Well, that is at the server - so you're essentially talking about the same "web service" that you say you can't do... I also think you should separate out the 2 functions (create page vs provide auto-complete results) into separate files (/pages/whatever).
A simple way would be to make a new aspx page that takes the autocomplete query as querystring parameters, looks up the result in a database and returns the response as XML og JSON.