I have no doubt that for client applications, AsParallel() will bring some out-of-the-box performance gains. But what if I would use it in a web environment. Let's say I have a widget framework that loops over all widgets to get their data and render output. This would parallelize great no?
I do have my doubts on using AsParallel() in this scenario. What if I have a large number of visitors for my site, isn't IIS going to use multiple threads to handle all requests? Aren't there going to be locking issues presented after a while, or threads dying because all processors are in use?
It's just a thought, what do you think about this?
I have an application that takes a long time to open odbc connections (like 20 sec) also takes forever using arcmap and arcsde
but when I try the connection on the odbc data source administrator, it tests it really fast
Does anyone have any idea of what my be causing this?
btw the application works fine in another computer with another database
thanks.
Hi Experts,
I have a website running now. I have to implement some logging routines as well as
some handler for unhandeled exceptions. I was looking at ELMAH also which seems good to me.
I need something very light and easy to use. Can someone recommend any other option I can choose from.
Thanks
Parminder
The sample page for the MaskedEdit says "Tip: Type 'A' or 'P' to switch AM/PM". Are these keys hardcoded? Does the control automatically change itself for cultures that use 12-hour designators that don't start with A or P? Or is just broken for those?
example:
Arabic (Saudi Arabia) - AM: ?
Arabic (Saudi Arabia) - PM: ?
Chinese (Taiwan) - AM: ??
Chinese (Taiwan) - PM: ??
Greek (Greece) - AM: pµ
Greek (Greece) - PM: µµ
Korean (Korea) - AM: ??
Korean (Korea) - PM: ??
Albanian (Albania) - AM: PD
Albanian (Albania) - PM: MD
Persian (Iran) - AM: ?.?
Persian (Iran) - PM: ?.?
Vietnamese (Vietnam) - AM: SA
Vietnamese (Vietnam) - PM: CH
Afrikaans (South Africa) - PM: nm
Punjabi (India) - AM: ?????
Punjabi (India) - PM: ???
Syriac (Syria) - AM: ?.?
Syriac (Syria) - PM: ?.?
If this control doesn't handle this situation, does anyone know of a control that does?
Dim db As New SQLDataContext
Try
Dim deleteBoatPics = (From boat In db.Photos
Where boat.boatid = id)
db.Photos.DeleteOnSubmit(deleteBoatPics)
db.SubmitChanges()
Catch ex As Exception
End Try
I'm getting an error that says:
Unable to cast object of type 'System.Data.Linq.DataQuery`1[WhiteWaterPhotos.Photo]' to type 'WhiteWaterPhotos.Photo'.
I have two separate db.SubmitChanges() because when the button is pressed, I have it delete the records from 1 table, and then the next.
I'm lost, can someone help me out?
I want to update a class library (a single DLL file) in a production web application. This web app is pre-compiled (published). I read an answer on StackOverflow (sorry, can't seem to find it anymore because the Search function does not work very well), that led me to believe that I could just paste the new DLL in the bin folder and it would be picked up without problems (this would cause the WP to recycle, which is fine with me because we do not use InProc session state).
However, when I tried this, my site blows up and gives a FileLoadException saying that the assembly manifest definition does not match the assembly reference. What in the world is this?! Updating the DLL in Visual Studio and re-deploying the entire site works just fine, but it is a huge pain in the rear. What is the point of having a separate DLL if you have to re-deploy the entire site to implement any changes?
Here's the question: How can I update a DLL on a production web site without breaking the app and without re-deploying all of the files?
Hi,
I am confused, wanted to confirm the below statement -
We can create multiple event handle method for the same event?
I think yes, beacuse it is overloading concept? right?
Please correct my understanding or advise.
Thanks.
how can i programmatically restart page lifecycle? i do some stuff in controls events which affects these controls. to see changes i have to draw page again. how can i do it?
Hello,
I have tried to set EnableViewStateMac to false but sometime the aspx page still gets the Invalid ViewState error. Modifying machine.config is impossible in this case. Don't know what to do. Please help!
Hi every one!
Does Page class adds ViewState for Controls created in CreateChildControls, I mean I have a page which I add some controls to the page and all of them are Literal and EnableViewState is false, my question is are there any ViewState entry gor them in Page's ViewState?
Thank you.
I'm starting a web application that contains the following projects:
Booking.Web
Booking.Services
Booking.DataObjects
Booking.Data
I'm using the repository pattern in my data project only. All services will be the same, no matter what happens. However, if a customer wants to use Access, it will use a different data repository than if the customer wants to use SQL Server.
I have StructureMap, and want to be able to do the following:
Web project is unaffected. It's a web forms application that will only know about the services project and the dataobjects project.
When a service is called, it will use StructureMap (by looking up the bootstrapper.cs file) to see which data repository to use.
An example of a services class is the error logging class:
public class ErrorLog : IErrorLog
{
ILogging logger;
public ErrorLog()
{
}
public ErrorLog(ILogging logger)
{
this.logger = logger;
}
public void AddToLog(string errorMessage)
{
try
{
AddToDatabaseLog(errorMessage);
}
catch (Exception ex)
{
AddToFileLog(ex.Message);
}
finally
{
AddToFileLog(errorMessage);
}
}
private void AddToDatabaseLog(string errorMessage)
{
ErrorObject error =
new ErrorObject
{
ErrorDateTime = DateTime.Now,
ErrorMessage = errorMessage
};
logger.Insert(error);
}
private void AddToFileLog(string errorMessage)
{
// TODO: Take this value from the web.config instead of hard coding it
TextWriter writer = new StreamWriter(@"E:\Work\Booking\Booking\Booking.Web\Logs\ErrorLog.txt", true);
writer.WriteLine(DateTime.Now.ToString() + " ---------- " + errorMessage);
writer.Close();
}
}
I want to be able to call this service from my web project, without defining which repository to use for the data access. My boostrapper.cs file in the services project is defined as:
public class Bootstrapper
{
public static void ConfigureStructureMap()
{
ObjectFactory.Initialize(x =>
{
x.AddRegistry(new ServiceRegistry());
}
);
}
public class ServiceRegistry : Registry
{
protected override void configure()
{
ForRequestedType<IErrorLog>().TheDefaultIsConcreteType<Booking.Services.Logging.ErrorLog>();
ForRequestedType<ILogging>().TheDefaultIsConcreteType<SqlServerLoggingProvider>();
}
}
}
What else do I need to get this to work? When I defined a test, the ILogger object was null.
Thanks,
How can i make a cached object re-cache it self with updated info when the cache has expired? I'm trying to prevent the next user who request the cache to have to deal with getting the data setting the cache then using it is there any background method/event i can tie the object to so that when it expires it just calls the method it self and self-caches.
Currently, I cannot use Paypal Pro on my host (GoDaddy) because it requires Full trust level.
After digging in Google, it seems a workaround is possible by adding
AllowPartiallyTrustedCallersAttribute to the Paypal assembly. I have seen code samples that use AllowPartiallyTrustedCallersAttribute in their AssemblyInfo.cs file, however, I've yet to run into a code example that also happens to be using PayPal.
My question is where should the AllowPartiallyTrustedCallersAttribute be added in my project if my objective is to make the PayPal assembly work? I have tried adding it to my AssemblyInfo.cs for the project that contains the entire website, but I have not been successful.
At this point, any insight or shot in the dark would be greatly appreciated. Even if someone could point me in the general direction of some documentation I would be grateful.
AllowPartiallyTrustedCallersAttribute Reference:
http://msdn.microsoft.com/en-us/library/system.security.allowpartiallytrustedcallersattribute.aspx
I have an aspx page that is supposed to reference a code-behind variable but I am receiving an error of "The name [variable] does not exist in the current context"
Here is the aspx code
<%@ Control Language="C#" AutoEventWireup="true" Inherits="IPAM.Website.Controls.controls_event_header" Codebehind="event_header.ascx.cs" %>
<%# strEventLink %>
<h3><%# strEventDate %></h3>
<%# strLinks %>
Here is part of the aspx.cs code declaring those variables:
public string strEventLink = "";
public string strEventDate;
public string strLinks = "";
Here is the part of the aspx.cs code where it sets those variables:
strEventLink = "<h2>" + parent.Name + "</h2>";
strLinks += "<p><font size=\"+1\"><a href=\"" + Page.ResolveUrl("~" + strScheduleLink) + "\"><b>" + strScheduleLinkText + "</b></a></font></p>\n";
strEventDate = ei.DateSpan;
Please help me with this problem
I have a page that performs a long-running task (10 to 15 seconds) in the page_load method.
I have client-side javascript code that will display a decent "page loading" animated gif to the user.
I am able to invoke the JavaScript method from the code-behind, to display the "page loading" animated gif, however, the long-running task is hanging up the UI such that the animated gif doesn't actually display until after the long-running task is complete, which is the exact opposite of what I want.
To test this out, in my page_load method I make a call to the JavaScript method to display the animated gif. Then, I use Thread.Sleep(10000). What happens is that the animated gif doesn't display until after Thread.Sleep is complete.
Obviously I am doing something incorrect.
Any advice would be appreciated.
Thanks.
Chris
I'm working on application for tracking vehicles. There will be about 10k or more vehicles. Each will be sending ~250bytes in each minute. Data contains gps location and everything from CAN Bus (every data that we can read from vehicle computer and dashboard). Data are sent by GSM/GPRS (using UDP protocol). Estimated rows with this data per day is ~2000k.
I see there 3 main blocks.
1.
Multithreaded Socket Server (MSS) - I have it. MSS stores received data to the queue (using NServiceBus).
2.
Rule Processor Server (RPS) - this is core of this system. This block is responsible for parsing received data, storing in the database, processing rules, sending messages to Notifier Server (this will be sending e-mails/sms texts).
Rule example.
As I said between received bytes there will be information about current speed. When speed will be above 120 then: show alert in web application for specified users, send e-mail, send sms text.
(There can be more than one instance of RPS).
3.
Web application - allows reporting and defining rules by users, monitoring alerts, etc.
I'm looking for advice how to design communication between RPS and Web application.
Some questions:
- Should Web application and RPS have separated databases or one central database will be enough?
I have one domain model in web application. If there will be one central database then can I use the same model (objects) on RPS? So, how to send changed rules to RPS?
I try to decouple this blocks as much as possible. I'm planning to create different instance of application for each client (each client will have separated database). One client will be have 10k vehicles, others only 100 vehicles.
When extending a COM class in unmanaged C++ where the original class has private interfaces, one way to do this is through the concept of blind aggregation. The idea is that any interface not explicitly implemented on the outer aggregating class is 'blindly' forwarded to the inner aggregated class.
Now .NET as far as I can figure out does not support COM aggregation natively. A somewhat tedious workaround is to create a .NET class where you implement all the required COM interfaces directly on the .NET class and simply forward to an instance of the actual COM class for any methods you don't want to override.
The problem I have is when the original COM object has one or more private interfaces, i.e. undocumented interfaces that are nonetheless used by some consumers of the original class. Using blind aggregation in unmanaged C++ this is a non-issue as the calls to the private interfaces are automatically forwarded to the original class, however I can't find any way of doing the same thing in .NET. Are there any other ways of accomplishing this with .NET?
there is one linkbtn , on click i have to display word document content inside any textBox which supports, i used simple textbox but am facing the formatting problem. and also it does not show image. there is any idea for problem in display word document content inside any textBox .
i dont know about richtextbox, can i get any help, please send me desired code to [email protected]
Hello all,
I need to create a newsletters by URL. I to do next:
Create a WebClient;
Use WebClient's method
DownloadData to get a source of page
in byte array;
Get string from source-html byte
array and set it to the newsletter
content.
But I have some troubles with paths. All elements' sources were relative (/img/welcome.png) but I need absolute (http://www.mysite.com/img/welcome.png).
How can I do this?
Best regards, Alex.
I want to redirect all url errors
The url I want to cath is ~/bla/foo
It should redirect to ~/error404.aspx
bla exists as a folder. foo does not exist.
I already set the webconfig to point to my error but I just doesn't work. I get this error:
Server Error in application /.
-------------------------------------------------- ------------------------------
The source can not be found.
Description: HTTP 404. Perhaps you are looking for the source (or a dependency thereof) removed or is temporarily unavailable or has changed its name. Check the spelling of the URL.
Requested URL: / bla/foo.asox
I google translate this error cuz VS here is language specific.
What can I do to resolve this??? I want to point to ~/error404.aspx
Hello, Actually I'm trying to capture person's current and permanent address. In this case if d current and permanent address same means no need to enter twise. Here I'm using a checkbox. If d checkbox s checked the current address plased in permanent address too. Help me to do tat.
I have users login to my application via Active Directory and then pull from their AD information to garner information about that user like so:
Dim ID as FormsIdentity = DirectCast(User.Identity, FormsIdentity)
Dim ticket as FormsAuthenticationTicket = ID.Ticket
Dim adDirectory as New DirectoryEntry("LDAP://DC=my,DC=domain,DC=com")
Dim adTicketID as String = ticket.Name.Substring(0, 5)
Session("people_id") = adDirectory.Children.Find("CN=" & adTicketID).Properties("employeeID").Value
Session("person_name") = adDirectory.Children.Find("CN=" & adTicketID).Properties("displayName").Value
Now, I want to be able to impersonate other users...so that I can "test" the application as them, so I added a textbox and a button to the page and when the button is clicked the text is assigned to a session variable like so:
Session("impersonate_user") = TextBox1.Text
When the page reloads I check to see if Session("impersonate_user") has a value other than "" and then attempt to query Active Directory using this session variable like so:
If CStr(Session("impersonate_user")) <> "" Then
Dim adDirectory as New DirectoryEntry(LDAP://DC=my,DC=domain,DC=com")
Dim adTicketID as String = CStr(Session("impersonate_user"))
Session("people_id") = adDirectory.Children.Find("CN=" & adTicketID).Properties("employeeID").Value
Session("person_name")= adDirectory.Children.Find("CN=" & adTicketID).Properties("displayName").Value
Else
[use the actual ticket.name to get this info.]
End If
But this doesn't work. Instead, it throws an error on the first Session line stating, "DirectoryServicesCOMException was unhandled by user code There is no such object on the server."
Why? I know I'm giving it a valid username! Is something strange happening in the casting of the session? The code is essentially the same between each method except that in one method rather than pulling from ticket.Name I pull from a session variable for the login I'll be looking up with AD.
I have a Web API which I am calling using the JQuery ajax function. When I test the service directly (using the Chrome RESTEasy extension) it works fine, however when I call it using the JQuery ajax function I get an error. I'm calling it on port 81:
$.ajax({
url: "http://127.0.0.1:81/api/people",
data: JSON.stringify(personToCreate),
type: "POST",
contentType: "application/json;charset=utf-8",
statusCode: {
201: function (newPerson) {
callback(newPerson);
}
},
success: function (newPerson) {
alert("New person created with an Id of " + newPerson.Id);
},
error: function (jqXHR, textStatus, errorThrown) {
alert('Error. '+textStatus+'. '+errorThrown);
}
});
...but when I trace it using FireBug Lite the response comes from port 82:
{"Message":"No HTTP resource was found that matches the request URI 'http://127.0.0.1:82/api/people'.","MessageDetail":"No action was found on the controller 'People' that matches the request."}
I think the error is, effectively, due to cross-site scripting being blocked, but I'm not actually cross-site scripting, if you see what I mean.
Has anyone else come across this and been able to fix it?
Edit:
Routing config (global.asax.vb) is:
RouteTable.Routes.MapHttpRoute(name:="DefaultApi", routeTemplate:="api/{controller}/{id}", defaults:=New With {Key .id = System.Web.Http.RouteParameter.Optional})
Controller:
Public Function PostValue(ByVal departmentid As Integer, ByVal emailaddress As String, ByVal firstname As String, ByVal lastname As String) As Guid
Dim context As New WSMModelDataContext
Dim bllPeople As New PeopleBLL(context)
Return bllPeople.Create(firstname, lastname, emailaddress, departmentid)
End Function
When I debug it, it doesn't get as far as running the controller, although when calling it through RESTEasy it routes correctly and the controller executes successfully. The only difference seemes to be that wen called through RESTEasy it is (correctly) using
http://127.0.0.1:81
but for some reason when called via JQuery/ajax it seems to be using
http://127.0.0.1:82.