|
You're nearly there:
"UPDATE Profile SET [Pic] = @Pic WHERE Id = 11651658"
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
So I separated some write functions, that update a XML file into separate classes, that generate a thread in the background to open, update and write the XML file using streamreader and streamwriter.
So I'm new to threads on vb managed code, and just found that StreamReader is not thread safe. I did some research and one MSDN article says I need to wrap the streamreader in textreader and synchronize.
I did some more research, stumbled across monitor.enter and monitor exit, and the singleton class, so that only 1 instance of the class can run at a time.
So I have a file called "Landing.xml" and I'm interested in only have 1 instance of the class work the file at a time.
Just looking for suggestions, or help with implementing. Will post code is someone asks.
|
|
|
|
|
Well I tried using monitor and so far so good. So I have like 15 of these class files that handle 1 xml file each, and they seem to be queuing up correctly, and waiting politely for the previous instance of itself to complete before firing again.
So the Yandex and Baidu bots have visited, and the updates were handled without error this time over the last 3 hour test period.
Well time will tell, will check the results again in the morning.
Still interested in the Singleton concept. Not quite sure how to implement it in vb
|
|
|
|
|
i want to retrieve images from a database and display them in a tiled view(at least three on a row) but i don't know how to go about that could someone please shed light on this for me?
|
|
|
|
|
Use an HTTP Handler.
Help people,so poeple can help you.
|
|
|
|
|
Hi all!
I have established a linq connexion with my database with this code behind.
And with manually set paging for 10 records.
data is shown in ListView.
How do I get the header sorting I'm using a linkbutton. Also I want to be able to insert a dropdownlist in the header. How do I receive this functionality.
With thanks in advance.
private void DisplayData(int startRow)
{
using (Origo.Vefur.Linq.dbMainDataContext db = new Linq.dbMainDataContext(Origo.WMMain.Helpers.Global.ConnectionString))
{
var empList = from el in db.owm_USERs
where el.showOnWeb == 1
select el;
ListView1.DataSource = empList.Skip(startRow).Take(10);
ListView1.DataBind();
}
}
My list view looks now like this
<asp:ListView ID="ListView1" runat="server"
onselectedindexchanged="ListView1_SelectedIndexChanged1"
onsorted="ListView1_Sorted" onsorting="ListView1_Sorting">
<LayoutTemplate>
<table id="Table1" runat="server" class="TableCSS">
<tr id="Tr1" runat="server" class="table-header">
<th align="left"><asp:LinkButton ID="lnkID" CommandArgument="id" CommandName="Sort" Text="id" runat="server" /></th>
<th align="left"><asp:LinkButton ID="lnkName" runat="server">Nafn</asp:LinkButton></th>
<th align="left">
<asp:dropdownlist runat="server" id="ddlWrokplace"
DataTextField="workplace" DataValueField='<%# Eval("workplace") %>' SelectedValue='<%# Eval("workplace") %>'></asp:dropdownlist>
</th>
But neither the sorting links nor the dropdown list are working properly
|
|
|
|
|
|
Is there a way to change or specify how virtual paths are resolved?
I'm creating a site on my machine, but for purposes of demonstration, I want to deploy it to a sub folder of an existing web site. So, on the web host, I have
wwwroot (which is the parent site)
wwwroot/demosite (which is the demo web site)
Of course, this means that a virtual path of "~/demosite.master" ain't gonna work, because that would resolve to "/demosite.master" instead of the desired "/demosite/demosite.master".
I tried using inline code, but of course that isn't allowed (some far-sighted MSoftie probably knew I was going to need to do this, and this is some sort of weird personal vendetta to prevent me from actually getting anything done).
What I want to do is to make the code change the various virtual paths used throughout the demosite, so that I don't have to remember to do it when I deploy to it's actual production server.
So, for localhost (when developing) and deployment onto the actual production server, I want to use the current virtual path, but for the demo version, I need to change the virtual path root.
Is that possible, and if so, how?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
When you deploy the site, you need to make sure that the "demosite" folder is an application. In IIS Manager, right-click on the folder and select "Convert to Application". Your app-relative paths (~/demosite.master ) will then resolve to the correct path.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm not sure I can change that, since the deployment is to a web host.
I was actually hoping for a web.config approach, or some other technique.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I am not sure if this trick may work for you, but you can create one section in configuration file indicating if you are running site for production or for testing.
if you config section says isTestMode="true" it means for testing otherwise production.
you need to add condition on every location that may be for one time. hope this may help you.
Thanks
-Amit Gajjar (MinterProject)
|
|
|
|
|
Hi All,
I am trying to update a database table using entity framework, but some how I dont know why, but entity framework is updating the other column of the table which I am not setting up in my code. In my update statement after else statement, I am calling to update only column docid (rq.doc_id = doc_id) but I dont know why it is updating even the request_status column also. It is updating with 4 spaces and updating thats all.
I am actually not resetting the request_status value. It is very strange for me.
Can any body please help me in resolving this and getting rid of this problem.
I have my code as below
Using _databasefactory As New DatabaseFactory()
Dim context = _databasefactory.DatabaseContext
If Not String.IsNullOrEmpty(temp_doc_id) AndAlso Not String.IsNullOrEmpty(doc_id) Then
Dim reqs = (From r In context.requests Where r.claim.claim_no.Equals(claim_no) AndAlso r.temp_doc_id.Equals(r.temp_doc_id)) 'r.empl_accnt_no.Equals(emplacctnumber) AndAlso _
Dim res = 0
If reqs Is Nothing Then
Dim rq = New request()
rq.claim = (From r In context.claims Where r.claim_no.Equals(claim_no)).FirstOrDefault()
rq.empl_accnt_no = emplacctnumber
rq.manual_claim_no = ManualClaimNo
rq.doc_id = doc_id
rq.temp_doc_id = temp_doc_id
rq.request_status = "OANEW"
rq.last_update_ts = DateTime.Now
rq.create_ts = DateTime.Now
rq.comments = String.Empty
context.AddTorequests(rq)
Return context.SaveChanges()
ElseIf reqs.Count() <= 0 Then
Dim rq = New request()
rq.claim = (From r In context.claims Where r.claim_no.Equals(claim_no)).FirstOrDefault()
rq.empl_accnt_no = emplacctnumber
rq.manual_claim_no = ManualClaimNo
rq.doc_id = doc_id
rq.temp_doc_id = temp_doc_id
rq.request_status = "OANEW"
rq.last_update_ts = DateTime.Now
rq.create_ts = DateTime.Now
rq.comments = String.Empty
context.AddTorequests(rq)
Return context.SaveChanges()
Else
Dim rq = reqs.FirstOrDefault()
'If Not rq.claimReference.IsLoaded Then
' rq.claimReference.Load()
'End If
rq.doc_id = doc_id
res = context.SaveChanges()
Return res
End If
End If
End Using
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
I have problem with Composite Control in ASP.NET. Im making a classlibrary with this content \/ , but the problem is, that i cannot see it in toolbox, but i register it in web.config file, compile it and add a reference to it. And another problem is that my composite control cannot raise an event.
<pre>
namespace MyCompControl
{
public class CreateArticleEventArgs : EventArgs
{
public bool IsValid { get; private set; }
public Article article { get; private set; }
public CreateArticleEventArgs(bool IsValid, Article article)
{
this.IsValid = IsValid;
this.article = article;
}
public CreateArticleEventArgs(bool IsValid)
{
this.IsValid = IsValid;
this.article = null;
}
}
[
AspNetHostingPermission(SecurityAction.Demand,
Level = AspNetHostingPermissionLevel.Minimal),
AspNetHostingPermission(SecurityAction.InheritanceDemand,
Level = AspNetHostingPermissionLevel.Minimal),
DefaultEvent("Submit"),
DefaultProperty("ButtonText"),
ToolboxData("<{0}:CreateArticle runat=\"server\"> </{0}:CreateArticle>"),
]
public class CreateArticleControl : Control, INamingContainer
{
private Label labelHeader;
private Label labelIntro;
private Label labelImage;
private Label labelImageText;
private Label labelText;
private Label labelFileUploadStatus;
private TextBox textBoxHeader;
private TextBox textBoxIntro;
private TextBox textBoxText;
private TextBox textBoxImageText;
private FileUpload fileUpload;
private Button buttonCreateArticle;
private static readonly object EventCreateArticleKey = new object();
#region Create Article Event Delegate
[
Category("Action"),
Description("Raised when the user clicks the button.")
]
public event EventHandler CreateArticle
{
add
{
Events.AddHandler(EventCreateArticleKey, value);
}
remove
{
Events.RemoveHandler(EventCreateArticleKey, value);
}
}
#endregion
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
HttpContext.Current.Trace.Warn("OnLoad");
if (!Page.IsPostBack)
{
EnsureChildControls();
}
}
protected override void CreateChildControls()
{
HttpContext.Current.Trace.Warn("CreateChildControls");
labelHeader = new Label();
labelHeader.Text = "Header:";
Controls.Add(labelHeader);
textBoxHeader = new TextBox();
Controls.Add(textBoxHeader);
labelIntro = new Label();
labelIntro.Text = "Intro:";
Controls.Add(labelIntro);
textBoxIntro = new TextBox();
Controls.Add(textBoxIntro);
labelText = new Label();
labelText.Text = "Text:";
Controls.Add(labelText);
textBoxText = new TextBox();
Controls.Add(textBoxText);
labelImage = new Label();
labelImage.Text = "Image Upload:";
Controls.Add(labelImage);
fileUpload = new FileUpload();
Controls.Add(fileUpload);
labelFileUploadStatus = new Label();
labelFileUploadStatus.Text = "";
Controls.Add(labelFileUploadStatus);
labelImageText = new Label();
labelImageText.Text = "Image Subscription:";
Controls.Add(labelImageText);
textBoxImageText = new TextBox();
Controls.Add(textBoxImageText);
buttonCreateArticle = new Button();
buttonCreateArticle.ID = "buttonInsertArticleID";
buttonCreateArticle.Text = "Insert Article";
buttonCreateArticle.Click += new EventHandler(buttonCreateArticle_Click);
}
protected override void Render(HtmlTextWriter writer)
{
labelHeader.RenderControl(writer);
textBoxHeader.RenderControl(writer);
labelIntro.RenderControl(writer);
textBoxIntro.RenderControl(writer);
labelText.RenderControl(writer);
textBoxText.RenderControl(writer);
labelImage.RenderControl(writer);
fileUpload.RenderControl(writer);
labelFileUploadStatus.RenderControl(writer);
labelImageText.RenderControl(writer);
textBoxImageText.RenderControl(writer);
buttonCreateArticle.RenderControl(writer);
}
protected virtual void OnCreateArticle(CreateArticleEventArgs e)
{
EventHandler SubmitHandler = (EventHandler)Events[EventCreateArticleKey];
if (SubmitHandler != null)
{
SubmitHandler(this, e);
}
}
void buttonCreateArticle_Click(object source, EventArgs e)
{
string filepath = "";
if (fileUpload.HasFile)
{
filepath = HttpContext.Current.Server.MapPath("~/pictures/") + fileUpload.FileName;
fileUpload.SaveAs(filepath);
}
OnCreateArticle(
new CreateArticleEventArgs(true, new Article()
{
Author = HttpContext.Current.User.Identity.Name,
CreationDate = DateTime.Now,
Header = textBoxHeader.Text,
Intro = textBoxIntro.Text,
Image = filepath,
ImageText = textBoxImageText.Text
}));
}
}
}
<add tagPrefix="mycc" assembly="MyCompControl" namespace="MyCompControl" />
<mycc:CreateArticleControl ID="cac" runat="server" oncreatearticle="cac_CreateArticle">
</mycc:CreateArticleControl>
protected void cac_CreateArticle(object sender, EventArgs e)
{
throw new NotImplementedException();
}
<>
A would be glad for any advice...
|
|
|
|
|
Actually i'm using color extender to pick the color in asp.net...but while i'm picking the color it generate the hex decimal values....but i need only rgb values...Pls any one guide me....
|
|
|
|
|
This has already been answered in the C# forum. Please do not post the same question in more than one place.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I've been rewriting code and taking things that are not time sensitive, and putting them in a thread.
I have an issue in which search bots come like yandex, in which it rips through about 4 pages in less than 1 second, and my threads can't keep up.
Is there a way to see if the thread with the same name is running so I can have the next thread wait a couple of seconds.
Dim updateXML As New Thread(New ThreadStart(AddressOf uX_Container.update_SearchBot_Record_XML_ThreadProc))
updateXML.Name = "update_SearchBotRecord"
updateXML.Priority = ThreadPriority.Lowest
updateXML.IsBackground = True
updateXML.Start()
|
|
|
|
|
I've had problems with Yandex (and Baidu) in the past, they both hit harder than google. Given that I had 0% interest in the Russian/Chinese market where I was, I blocked them. I tried using robots.txt, but they didn't play well.
You might find this[^] discussion helpful I went down the URLRewrite route, it worked pertty well, but needed IIS7 plus the module installed.
You might also like to read Bye bye Crawler Blocking the Parasites[^]
Of course, if you want to be listed from yandex, the above is really bad advice.
|
|
|
|
|
Thanks for the article, I need to know that stuff anyway. Google is actually pretty courteous crawling at a rate of about 2 minutes each.
I think my strategy is wrong here. Perhaps for crawlers and bots, I should make them wait for the whole process to complete on a single thread. But on human users, I can put data writes on background threads so there experience is faster.
|
|
|
|
|
Dont you think Asp.net 4.0 should have pagination plugins? Because it stress me out a lot. But,in MVC i think is not that hard.
|
|
|
|
|
For MVC you can use nuget package PagedList[^].
I prefer to have such plugins downloadable by nuget rather than build into language/framework. As you won't always need that and can keep things more simple. Too many contros means you will never know about them so won't use them anyway
--
"My software never has bugs. It just develops random features."
|
|
|
|
|
Yes, i also think the same.
|
|
|
|
|
Hi,
I'm sending mail to newly register Users in html format(Asp.net C#). It works fine but sometimes Some Unwanted html code(that dose not exist in my webpage) showing after mail body even mail content is correct. if anyone know the solution, plz help.
Here is that unwanted code that User getting.
<HTML xmlns:pstyle='margin-top><HEAD>.wlEmoticon { behavior: url(#default#.WLEMOTICON_WRITER_BEHAVIOR) } img { behavior: url(#default#IMG_WRITER_BEHAVIOR) } .wlWriterEditableSmartContent { behavior: url(#default#.WLWRITEREDITABLESMARTCONTENT_WRITER_BEHAVIOR) } .wlWriterEditableSmartContent > .wlEditField { behavior: url(#default#.WLWRITEREDITABLESMARTCONTENT_>_.WLEDITFIELD_WRITER_BEHAVIOR) } blockquote { behavior: url(#default#BLOCKQUOTE_WRITER_BEHAVIOR) } #extendedEntryBreak { behavior:
Thanks in Advance
<div class="signature">Mukesh</div>
|
|
|
|
|
With all do respect, how are we suppose to know where to look.
You should add a watch to your message body and run the program in debug, then make a copy of the body text, and send it to yourself. Then inspect both message body content and compare the two.
Then inspect the message content of the other email with the extra text and make a comparison as well. If the extra html only appears after relaying through the other mail server, then that mail server is injecting the html.
|
|
|
|
|
hi jkirkerx,
thanks for your quick reply.It's working fine now.
Mukesh
|
|
|
|