C# - Most Efficient Way To Get The <title> Of A URL?

May 24, 2010

It's simple to do a webrequest, get the page and parse the html to get the title of the page. But I'm wondering if there is a more efficient way that is faster, and doesn't require downloading the whole html?

View 2 Replies


Similar Messages:

How To Display Icon IN Title Bar Of Browser With Title

Dec 9, 2010

How to Display Icon IN title bar of Browser with title?

View 7 Replies

When Select A Title, That Title Should Be Returned To Model?

Mar 29, 2011

In my application I have the following message:Object reference not set to an instance of an object.

@Html.DropDownList("Title",ViewData["PersonTitle"] as SelectList, Model.Person.Title)

The dropdownlist contains simple strings (person titles). When you select a title, that title should be returned to my model. Controller code:

ViewData["PersonTitle"] = new SelectList(new[] { "Dhr.", "Mevr." });

Why is this not working ? Edit: The purpose is to change

@Html.EditorFor(model => model.Person.Title)

into something like this

@Html.DropDownList("Title",ViewData["PersonTitle"] as SelectList, Model.Person.Title)

View 2 Replies

C# - More Efficient Database Access?

Jan 16, 2011

I am new to databases and linq, so my problem may be considered trivial. I currently start all my db requests in each class with:

DataClassesDataContext db = new DataClassesDataContext()


Then I proceed to make whatever linq request I need within the method and carry on with the main application logic.

Now, two interesting queries:

1) I believe I have seen people wrapping db usage within 'using'. Such as:

using (DataClassesDataContext db = new DataClassesDataContext())
{
...
}

If this is correct, then doesn't it mean that my class can't use a member 'db' variable anymore, but rather those db requests need to be made within each function call? Also, what exactly would happen if I don't use 'using' within the calls?

2) Running my app with SQL Profiler enabled, I see lots of connections opening and closing. Does this means that each

DataClassesDataContext call makes a separate connection? It seems inefficient, so is the right way to actually make the DataClassesDataContext object a static within each class being used?

View 2 Replies

VS 2008 What's The Most Efficient Way To Sort A Gridview(vb.net)

Oct 28, 2010

What's the best way to do this? I have seen quite a few examples that use a Dataview etc. what is the best method. I'm thinking about speed issues when a grid has a few thousand records etc.

this is how I populate the gridview:

Code:

[code]....

View 5 Replies

VS 2008 Efficient Listview Sorting?

Jan 29, 2011

I have a requirement where 15 listviews have to be loaded on a web page.But only one shown at a time. Number of columns will be only 2 for each and Number of rows for every listview is very limited.The thing I am not able to decide is the sorting method.1. If I am using the datasource control, it automatically sorts my listview.2. If I am programmatically populating listview , I will have to sort my datatable and rebind to the listview.To use the second method I have to store the datatables in sessions.So taking that into consideration, will datasource control be more efficient ?

View 4 Replies

Most Efficient Endless Loop In C# (carousel)

Jan 19, 2011

Assuming a list of objects, each with an ID, what's the most efficient way of building a carousel, so that each object knows what its previous and next item is. The Last Item's previousId will link to the first item. The first item's previousId will link to the last.

I need the ID of the previous and the ID of the next, as this will be used to populate next and previous buttons on a web page.

I know I could iterate over them, adding placeholders for _next and _prev id, but what's the most efficient way to do this?

I figure my object should look like this:

class Item {
public int Id { get; set; }
public string ItemName { get; set; }
public int Next { get; set; }[code]....

I think I'm looking at this wrong way. Is there a better way of doing this?

View 2 Replies

MVC :: What Is The Efficient Way To Display Comment Data

Jan 20, 2010

I am making a blog application and for the sake of my question I have 2 tables: Posts & Comments. I would like to loop through the posts and use a nested loop to display the comments relating to a specific post. Currently, I am using this code:

[Code]....

Obviously this is a simplified version. Is this the most efficient method of displaying this kind of data?

View 3 Replies

C# - Which Is More Efficient For Rendering A Server Control

Feb 4, 2010

I am outputting the entire HTML for my server control as follows:

public override void Render(HtmlTextWriter output)
{
output.Write(myStringBuilder.ToString());
}

myStringBuilder is a StringBuilder object that is manually built in a separate private method.Is this an efficient way to do it? Or is it better to pass the HtmlTextWriter to my private method and make multiple calls to HtmlTextWriter.Write()?

View 1 Replies

WCF / ASMX :: Efficient Way To Transmit XML Messages

Aug 26, 2010

What is the most efficient way to transmit messages in WCF? I've done a few basic walkthroughs of WCF and upon analyzing the XML transmission I saw that they were very large by default... Containing what appears to me, as a lot of unnecessary information, for my needs. I'm looking for a way to send the shortest messages possible. How can I trim as much as possible from the XML? Can I remove all the header information. What approach for sending the shortest messages possible using XML in WCF?

View 3 Replies

C# - What's More Efficient SQL Or Flat File Access

Jul 22, 2010

I am looking at upgrading a realtime program ASP.NET C#, that takes very frequently updated data and moves it from one database to another.

Currently using a middle man app, that pulls from one and inserts into another using SqlBulkCopy.

Is it better to have the source db server write a flat file and the middle man collect from that flat file?

View 6 Replies

ADO.NET :: Efficient Way To Insert Couple Of Times?

Jan 18, 2011

I would like to use insert statement to the same table with different values, lets say 5 times. What is the efficient way to do this?

View 2 Replies

Fastest And Efficient Way Of Creating File In .NET?

Jul 28, 2010

I've an arraylist having 30000 items in it, what's the best way of creating a text file on the fly from an ASP.NEt page? Currently I'm using the code below but it times out with large data,

Using fileStr As New FileStream(sFileName, FileMode.Create, FileAccess.Write)
Using writer As New StreamWriter(fileStr)
writer.WriteLine("Error Messages") [code].....

View 3 Replies

Javascript - Most Efficient Way To Count Clicks?

Jan 20, 2011

I'm starting to run a few ads on a website, and I'm trying to decide the best way to track performance.

Specifically,What's the most efficient way to count clicks? About the only way I can think of is to link the ad to another page with the ID of the ad as an argument (e.g. adserver.aspx?id=1234). The other page would then update the database and do a redirect to the advertiser's link. However, it seems inefficient to have to load a separate page for this. Are there any other options? Also, it seems like I might need to know stuff like how many clicks occurred in a given week. But storing a separate database row with a date for every single click seems excessive. Has anyone else done something like this? Would it make sense to maybe create a new row for each week and increment a counter for all clicks that occurred that week?

View 2 Replies

Most Efficient C# SharePoint List Iteration?

Mar 8, 2011

I'm doing some custom code for a SharePoint webpart in C#. Specifically, I'm making a quiz, my main point here addressing the list that holds the question, answer choices, and correct answer.

At the last stage of the quiz I need to check the answers selected by the user against the correct answer in the list. Currently, I'm doing the following to check if each is correct, which I'm assuming isn't very efficient because it iterates through each question. Is there a method, specifically for the SPList foreach loop, that would be more efficient?

// 1. Store questions and answers in class
List<submittedAnswers> answeredQuestions = new List<submittedAnswers>();
// 2. From POST pull answered question IDs and answer IDs (which correspond to the question primary key and answer choice number both stored in the list)
// INSERT BEAUTFIUL AND EFFICIENT WHILE LOOP HERE
// 3. Loop through each question is list, if question was given, test if correct/incorrect
using (SPWeb myWeb = mySite.OpenWeb())
{
SPList answerList = myWeb.Lists[questionList];
foreach (SPListItem quizEntry in answerList.Items)
{
int pullAnswerId = int.Parse(quizEntry["Answer"].ToString()); // Pull answer number from list
int pullQuestionId = int.Parse(quizEntry["ID"].ToString()); // Pull primary key of question
submittedAnswers result = answeredQuestions.Find(delegate(submittedAnswers e) { return e.questionId == int.Parse(quizEntry["ID"].ToString()); });
if (result != null)
{
if (result.responseId != pullAnswerId) // If the response was different from the answer
incorrectAnswers++;
else
correctAnswers++;
}
}
}
// C# quiz grading magic here....

View 4 Replies

What Is A Quick And Efficient Way To Perform Listbox Search

Aug 2, 2010

I have a listbox on my site that is populated with data. I then have a textbox that is used to enter a search phrase and with each letter that is added the listbox is narrowed down or repopulated using javascript. I use one listbox to store all the items and a secondary showing the listing results. This makes it east to check against all items and then populate the second listbox with all the results according to the search.

Currently this process can cause a delay in updating the listbox (eg when the textbox is emptied all the items need to be repopulated from the listbox with all the data).

What is a quick and efficient way to perform this listbox search?

View 3 Replies

C# - Efficient And Proper Linq Queries From Database

Nov 9, 2010

A sample linq query from MSDN: var expensiveInStockProducts = from p in products where p.UnitsInStock > 0 && p.UnitPrice > 3.00M select p; Does this query select EVERY column from the database table immediately, or does it return some sort of pointer that retieves the actual column data on demand? ie. If there are 50 columns in my table and I only use a single p.UnitsInStock in my actual code, then am I retrieving 50 times more data than I expected?

View 2 Replies

C# - Efficient Gridview Paging Without Datasource Control?

Mar 25, 2010

I am trying to do efficient paging with a gridview without using a datasource control. By efficient, I mean I only retrieve the records that I intend to show.I am trying to use the PagerTemplate to build my pager functionality.In short, the problem is that if I bind only the records that I intend to show on the current page, the gridview doesn't render its pager template, so I don't get the paging controls.It's almost as if I MUST bind more records than I intend to show on a given page, which is not something I want to do.

View 1 Replies

Web Forms :: Efficient Way For Polling Data To The Server

May 6, 2010

Is there any efficient way for polling data to the server?I have to know if there's an update in the table tblalert. I used the PageMethods and setInterval in javascript to run the method. But the SQL Server having too much stress, lets say 200 users log at the same time... and the set interval is set to 3 secs

View 7 Replies

DataSource Controls :: Most Efficient Database Call?

Jun 24, 2010

I am wondering what the most efficient method is for retreiving a single cell of data from my database. I have a price table in my DB that I just need to look up one price at a time. Currently I load a dataset and call ds.tables(0).rows(0).item(0) for the value. I just want to make sure this is the best way do this.

View 1 Replies

C# - Most Efficient Way To Design Database For Tagging System?

Jan 16, 2011

Im new to database design and I would like to know what is the best way to design a tagging system such as the one that stackoverflow has?

I found multiple ways to design such a system on the web, but not sure which one is the most optimal.

View 1 Replies

Efficient Design - Passing Parameters Back And Fourth?

Apr 21, 2010

I am developing an application that will have 200+ sessions at any given time. I am also relatively new at asp.net development. This application will be hosted on a remote server along with its SQL Server 2008 database. Each session will constantly use SQL select, update, insert, and delete commands. Do you think it would matter if I used server-side logic to perform all the SQL commands, passing parameters back and fourth? Or should I do some more research on client-side database manipulation? Would it be too much load if i used strictly server-side?

View 7 Replies

DataSource Controls :: How To Write Efficient Stored Procedure

Mar 26, 2010

what are the steps required to write efficient stored procedure. like not to use sp_ as a prefix because it is in master database

View 2 Replies

C# - Find The Most Efficient Way To Do Source Control In A Small Dev Environment?

May 14, 2010

I work in a group of 4 .Net developers. We rarely work on the same project at the same time but it does happen from time to time.We use TFS for source control. My most recent example is a project I just placed into production last night that included 2 WCF services and a web application front end. I worked out of a branch called "prod" because the application is brand new and has never seen the light of day. Now that the project is live, I need to branch off the prod branch for features, bugs, etc...

So what is the best way to do this?

Do I simple create a new branch and sort of archive the old branch and never use it again?

Do I branch off and then merge my branch changes back into the prod branch when I want to deploy to production?

And what about the file and assembly version. They are currently at 1.0.0.0. When do they change and why? If I fix a small bug, which number changes if any? If I add a feature, which number changes if any?

What I am looking for is what you have found to be the best way to efficiently manage source control. Most places I have worked always seem to bang heads with the source control system in on way or another and I would just like to find out what you have found that works the best.

View 6 Replies

Efficient Ways To Convert DataSets To GenericCollection (Of ObjectType)?

Feb 24, 2010

I currently have a function that gets some data from the database and puts it into a dataset. The return type on my function is GenericCollection (Of CustomerDetails)

If I do this:

Dim dataset As DataSet = Read(strSQL.ToString) 'Gets Data from DB

What's the most efficient way to map the dataset results to an collection of objects. More importantly, since I'm using GenericCollection, is there a way to do this in which I can call a function from the ObjectType class (CustomerDetails) that would have a means to converting that specific object.

Or is there a way in which I can use a function that would handle all types?

Is there a way to do something like:

Return returnedResults.TransformDataSet(dataset)

In which returnedResults is an object collection Of CustomerDetails, or would it simply be easier to have TransformDataSet return an object collection Of CustomerDetails by itself?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved