Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
B

binarymax

@binarymax
About
Posts
24
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Esitmating and budgeting with a "Compute Hour"
    B binarymax

    Hi, so with the return of utility computing (aka cloud computing), I am curious what the best way to estimate what a budget would be based on concurrent users, and possibly application complexity? In other words, how can I estimate how many 'compute hours' I would need to pay for every month? Suppose I have 100 business users on a SaaS application, using either EC2 or Azure or similar. If we estimate that of these 100 users, there are about 50 concurrent users through an 8 hour work day, then 160(hours per month)*50(users) = 8000 "compute hours" per month. but somehow I don't think that's right. And also if your application is multithreaded and possibly taking advantage of more than one core per user per hour, then your estimate goes up. Maybe I dont understand the concept completely but with the pricing plans available today then it seems like it would be cheaper to go the traditional route of having dedicated web and DB servers with a reputable hosting provider. For example, Azure costs[^] 0.12 per compute hour. So if we take my estimate 8000hrs * $0.12 = $960 per month = $9.60 per user per month (and thats just computing time not to mention bandwidth, storage, db, etc). Does this also seem expensive to anyone? Am I missing something completely? Thanks!

    IT & Infrastructure cloud hosting question asp-net database

  • How to check that the provided e-mailid is valid or not?
    B binarymax

    Hi, I think you should definitely use a regular expression. A quick google search for "valid email regular expression" leads to a good example here: http://www.codetoad.com/asp_email_reg_exp.asp[^] That source is in the older ASP (not .NET), but the function should still work. --EDIT -- actually you'll need to change around the function a bit but you get the idea.

    ASP.NET csharp asp-net help tutorial question

  • Anti fraud voting system w/o login.
    B binarymax

    Well I think no matter what you are not going to be able to stop very motivated repeat voters. Even major democractic elections using physical voting machines and verified official IDs still run into voter fraud and they've been doing it for years! However there are probably measures you can take to stem fraud to a minimum. Your first task is to make sure scripts can't vote, only people...so definitely use a CAPTCHA. Also have the user enter an email address with a unique link embedded inside, so they need to check their email and click on a link to make the vote count. This wont stop people with multiple emails voting, but you could also look into doing some simple data mining after the vote takes place to notice any glaring issues...like if there are 10 votes in 10 minutes from the same IP. Another critical note: whatever this voting system is going to elect, it better not be important! Because if it is, someone motivated enough will probably be able to crack, or at least bias, whatever system you have in place. Good luck!

    ASP.NET help question learning

  • To format infragistics calendar control
    B binarymax

    Sorry, forgot to note obviously to change

    c.DateTimeFormat.ShortDatePattern = "dd/MMM/yyyy";

    ASP.NET help

  • To format infragistics calendar control
    B binarymax

    I was curious as well so did some digging here: WebDateChooser Format - Infragistics Community[^]

    this.WebDateChooser1.Format = Infragistics.WebUI.WebSchedule.DateFormat.Short;

    System.Globalization.CultureInfo c = new System.Globalization.CultureInfo("en-US");
    c.DateTimeFormat.DateSeparator = "/";

    c.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy";
    this.WebDateChooser1.CalendarLayout.Culture = c;

    This quote is also worth noting: Unfortunately WebDateChooser supports only "3 fields" format and MMM/MMMM is not supported in edit mode, but only M/MM.

    ASP.NET help

  • Getting a Value of a Hidden Field in Gridview
    B binarymax

    You can access the text property for the cell even if it is invisible. I'm not sure why you are grabbing the column object from the grid and expecting to get a value from that. I'm also not sure why you are adding to the List in a foreach and then looping through the entire list every foreach iteration? I think you might want to try something this instead:

    foreach (GridViewRow row in GridView1.Rows)
    {
    CheckBox chkbx = (CheckBox)row.FindControl("myCheckBox");
    // only add non empty staff names
    if (chkbx != null && chkbx.Checked)
    {
    int Staff_ID = obj.Get_User_Id(Convert.ToString(row.Cells[2].Text),Convert.ToString(Session["ActiveDatabase"]));

                        obj.Responsibility\_Caretaker\_Remove(Convert.ToInt32(row.Cells\[1\].Text), Staff\_ID,Convert.ToString(Session\["ActiveDatabase"\]));
                }
    
            }
    

    Hope this helps.

    ASP.NET csharp asp-net sharepoint database

  • GridView ButtonField Image vs Button and RowCommand
    B binarymax

    It is not a question :) Its just some information that I thought would be useful since I think it is a bug with the .NET framework.

    ASP.NET visual-studio sysadmin

  • GridView ButtonField Image vs Button and RowCommand
    B binarymax

    I thought I would post this because it was driving me nuts. When you are firing a RowCommand from a GridView ButtonField when the ButtonField is of type Image, Page.IsPostBack is false Button column as image:

    <asp:GridView ID="gvMyGrid" runat="server" AutoGenerateColumns="false" Width="200px" >
    ...
    <asp:ButtonField CommandName="Up" ButtonType="Image" ImageUrl="Images/up.gif" />
    </Columns>

    When you are firing a RowCommand from a GridView ButtonField when the ButtonField is of type Button, Page.IsPostBack is true Button column as button:

    <asp:GridView ID="gvMyGrid" runat="server" AutoGenerateColumns="false" Width="200px" >
    ...
    <asp:ButtonField CommandName="Up" ButtonType="Button" Text="Up" />
    </Columns>

    Code Behind:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then
    'This code will be reached on first load and also when the user clicks a Gridview ButtonField Image!!!
    End If
    End Sub

    Protected Sub gvMyGrid_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles gvMyGrid.RowCommand
    ...
    End Sub

    ASP.NET visual-studio sysadmin

  • GridView row dissappearing on SelectedIndexChanged
    B binarymax

    I can use DataKeyNames which is nice to know but unfortunately it doesnt solve the problem :( Also, even if I set visible=false on the first column the data is still bound as index 0 so cells[0] returns the formid as expected.

    ASP.NET help wpf wcf performance question

  • GridView row dissappearing on SelectedIndexChanged
    B binarymax

    Thanks for the reply, The FormID is bound because that is the PK that I don't want the user to see, but when the row is selected then I use FormID to lookup data so I can populate a panel with record details. Even when it is visible I still have the same problems. oGrid.SelectedIndex and SelectedRow are behaving as expected.

    ASP.NET help wpf wcf performance question

  • GridView row dissappearing on SelectedIndexChanged
    B binarymax

    Good questions, the row that is dissappearing is the last row you selected. So if I select the 5th row, and then the 7th row, row 5 dissappears. Right that page load is entirely in an !IsPostback block and it initially binds the data. PopulateIncidents is a function that re-binds the data. ShowIncidentDetails shows a panel with details about the row you selected, if I remove that the problem persists. Also I removed Me.gvIncidents.Columns(0).Visible = False from page load and still the same problem. The part that is causing the problem is having the SelectedIndexChanged event. I can strip out all the code from SelectedIndexChanged and the problem stays the same. If I remove the event entirely then the problem goes away, but I need the event in order to select the row, so I really can't remove it. Thanks.

    modified on Tuesday, May 5, 2009 5:57 AM

    ASP.NET help wpf wcf performance question

  • GridView row dissappearing on SelectedIndexChanged
    B binarymax

    Right, it might help if I show the code!

    <asp:GridView ID="gvIncidents" runat="server" AllowSorting="true" AutoGenerateColumns="false" onrowcommand="gvIncidents\_RowCommand">
    <HeaderStyle ForeColor="#606060"></HeaderStyle>
    <Columns>
        <asp:BoundField DataField="FormID" HeaderText="" />
        <asp:BoundField DataField="FormType" HeaderText="Type" />
        <asp:BoundField DataField="FormDateTime" HeaderText="Date/Time" />
        <asp:BoundField DataField="Description" HeaderText="Description" />
        <asp:BoundField DataField="DateCreated" HeaderText="Date Created" />
        <asp:ButtonField CommandName="Import" Text="Import" ButtonType="Button" />
        <asp:ButtonField CommandName="Deny" Text="Delete" ButtonType="Button" />
    </Columns>
    </asp:GridView>
    

    In my page load:

            ...
            Me.gvIncidents.DataSource = dtIncidents
            Me.gvIncidents.DataBind()
            Me.gvIncidents.Visible = True
            Me.gvIncidents.Columns(0).Visible = False
            ...
    

    Handlers:

    Protected Sub gvIncidents\_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvIncidents.RowDataBound
    
        Try
    
            With e.Row
                If .RowType = DataControlRowType.DataRow Then
    
                    .CssClass = "gridrow"
    
                    'Change the cursor on mouseover
                    .Cells(2).Attributes.Add("onMouseOver", "this.style.cursor='hand';")
                    .Cells(2).Attributes.Add("onclick", ClientScript.GetPostBackEventReference(gvIncidents, "Select$" + .RowIndex.ToString()))
    
                Else 'Header
                    .CssClass = "gridtitle"
    
                End If
            End With
    
        Catch ex As Exception
            Throw ex
        End Try
    
    End Sub
    
    Protected Sub gvIncidents\_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvIncidents.SelectedIndexChanged
        Dim oGrid As GridView
        Dim oRow As GridViewRow
    
        Try
            oGrid = CType(sender, GridView)
            oRow = oGrid.SelectedRow
    
            PopulateIncidents() 'temporary hack to stop the rows from dissappearing
    
            ShowIncidentDetails(CType(oRow.Cells(0).Text, Integer))
    
        Catch ex As Exception
    
        End Try
    End Sub
    
    ASP.NET help wpf wcf performance question

  • GridView row dissappearing on SelectedIndexChanged
    B binarymax

    Hi, I have a crazy problem where when I select any row(call it rowA) in a gridview, and then when I select any different row (call it rowB), rowA dissappears. If I then select another row (rowC), rowB dissappears, and so on. These rows are not in any specific order and it happens with any case. I really want all the rows to stay there! As a temporary hack I am re-binding on every select, and I am pretty sure this causes a performance issue so I really don't want to keep it this way. Is there any way for me to select different rows while by default keeping them all visible? Many thanks in advance! Max.

    ASP.NET help wpf wcf performance question

  • About the multiple instances of same form
    B binarymax

    Keep a list of the open pages in a Session object. For each event that would open a page (clicking a link, clicking a button, etc), check the target page versus the session list and see if it exists. Open the page for the user based on that.

    ASP.NET help question

  • Detecting changes on a page
    B binarymax

    If storing the data in a session is a problem for you then JavaScript will work, yes. Hope I've helped with your problem!

    ASP.NET database question

  • Detecting changes on a page
    B binarymax

    Well I dont know enough about your situation to make that call. You could even do it at the database level if you are using stored procedures, but in most cases thats probably not a good idea. Also what are you trying to accomplish specifically? If you dont want the user changing stuff why not just make the fields readonly? If you have a specific reason why not and in a situation where you are already loading data from a database during a request, keeping it in a session object, and then showing that data to a user in a textbox, then on postback you will already have that data on your server and won't need to go back to the database to do your comparison, the original data is already there on the server. Personally I think it would be best practice to check it on the server. Since either way you are going to be testing equality on some field (be it a string or a changed-flag). Are you validating any other fields on the page with javascript? Then you could lump your comparison in there with the validation, but then you'd need to create hidden fields and it might be too complex and not worth the small performance gain you would get when substituting a string compare with the changed field bool. Sorry for rambling :)

    ASP.NET database question

  • Detecting changes on a page
    B binarymax

    In Javascript you can compare the object's "value" property with its "defaultValue" property. Alternatively on the server you can have an object that has the value set on Page_Load or similar, and then on Postback you can compare whats in the Textbox with what your object's value is.

    ASP.NET database question

  • Scroll bars of TreeView should be invisble when they are disabled by using CSS class
    B binarymax

    Are you using overflow:scroll? If you use overflow:auto instead does it fix it? See here: http://www.w3schools.com/Css/pr_pos_overflow.asp[^]

    ASP.NET css

  • passing parameters using POST from an ASPX page to different page
    B binarymax

    This is true and probably sufficient for many cases, but be aware you are changing from POST to GET and then have the limitations of the querystring, such as: maximum of 2083 characters in the URI(This is IE, not sure for FF/Opera/other), and of course there are potentially security risks if you are sending any sensitive data it will be shown and can be easily altered by the end user. If you are trying a to re-post without relying on the querystring to a different page in your application there are probably workarounds (maybe by populating fields on an intermediate page, or manually building a response...then having one of them autopost to your ultimate target?) But I have never tried these before.

    ASP.NET csharp sysadmin tutorial question

  • Thread locking and ASP.NET [modified]
    B binarymax

    Hi, I have some short questions about locking threads in ASP.NET. Normally I use C# console/winforms but in this case I need to write it in VB for ASP.NET. My questions are there any drawbacks to this code in a high-volume of requests? Is this completely wrong for an ASP.NET application? If so what do you recommend? The purpose here is to lock a timestamp and be sure it is set uniquely throughout all the sessions on the web server:

    Protected Shared TimeStamp As Date
    Protected Shared Sub SetUniqueTimeStamp()
    
        Try
            ' Request the lock, and block until it is obtained.
            Monitor.Enter(TimeStamp)
            ' When the lock is obtained, set the Timestamp.
            TimeStamp = Now
        Finally
            'Guarantee at least 1ms tick for uniqueness
            Thread.Sleep(1)
            ' Ensure that the lock is released.
            Monitor.Exit(TimeStamp)
        End Try
    
    End Sub
    

    This is just an example based on some code I altered from this at MSDN: Monitor.Enter Method[^] Many thanks in advance!

    modified on Tuesday, April 14, 2009 10:02 AM

    ASP.NET csharp asp-net winforms com sysadmin
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups