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
I

Ibrahim Bello

@Ibrahim Bello
About
Posts
43
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Javascript Multiple Select with Selenium
    I Ibrahim Bello

    Hi, I am testing a webpage using selenium. I want to select all the items in a multi-select listbox. It seems selenium doesn't provide a "select all items" function even though it has an "unselect all items". I have been unable to use the add_selection function for this purpose. I write a javascript code to select all the items using eval_script(). I'm using python.

    script = """
    multiselect = document.getElementsByTagsName("name");
    alert(multiselect);
    """

    The alert statement above displays that the object is an HTML Collection. Interestingly alert(multiselect.length); returns "0" even though I'm sure that the list is populated. This makes multiselect.item(2) for example to evaluate to "undefined". To select all the items I'm simply using:

    script = """
    for(var k = 0; k < multiselect.length; k++)
    {
    multiselect.item(2).selected = true;
    }
    """

    I run the script by simply: sel.eval_script(script). How do I get around this? Is Javascript the best way? Thanks :)

    Web Development question javascript python html testing

  • Problem reading from text file
    I Ibrahim Bello

    Problem solved and in 3 ways! 1. The "Keep it Simple Stupid" Advice works! Instead of creating an array of MATERIAL i.e Material*, I simply created an array of Material, and accessed each Material by the . notation rather than the ->. i.e.

    g_ptrMaterials = new Material [g_numberOfRows];
    Material mat;
    mat.temperature = 200.00; // for example

    2. One can stuff the structures into a vector:

    vector vctr;
    Material mat;
    mat.temperature = 200.00; // for example
    mat.density = bla bla;

    vctr.push_back(mat);

    3. Lastly I modified the initial code. I don't know why it works ...

    MATERIAL* arrMaterial = new MATERIAL[g_numberOfRows];
    g_ptrMaterial = &arrMaterial[0];

    arrMaterial[i] = new Material; //everything works fine now

    Perhaps the problem was mixing the malloc and new allocators? I suspected the problem was with the memory allocation, when the compiler continuously indicated errors in xmemory, dbgheap, and what not. It wasn't a v e r y pleasant experience. Anyway, I went for the first option, but one can go for any of the 3 options I suppose, without any harm. Thanks guys :)

    C / C++ / MFC help csharp c++ visual-studio graphics

  • Updated program-having a pointer error
    I Ibrahim Bello

    Oh yes, that's right, Guess I'm just used to leaving my parameter names out :)

    C / C++ / MFC help question lounge career

  • Problem reading from text file
    I Ibrahim Bello

    Thanks Karl. The filePath is the absolute path to the text file I'm accessing. Accessing the file doesn't seem to give issues both in debug and release. A section of the code checks for file failure:

    if(!file.fail())
    {
    //...
    }

    C / C++ / MFC help csharp c++ visual-studio graphics

  • Problem reading from text file
    I Ibrahim Bello

    I didn't explicity create any extra threads, so I'll say it's single-threaded.

    C / C++ / MFC help csharp c++ visual-studio graphics

  • Updated program-having a pointer error
    I Ibrahim Bello

    That's good. As for the prototype, this is OK:

    void Gen2Rand (int*, int*);

    . No need for specifying variable names in prototype. Just let the compiler know what data type to expect for that function. Cheers!

    C / C++ / MFC help question lounge career

  • Updated program-having a pointer error
    I Ibrahim Bello

    You've not stated what problems if any that you're having? PS: In your function prototypes, you don't need to specify any variable names for the parameters. Just the data types are OK. This is Ok:

    void DrillOneProb (int, int, int);

    C / C++ / MFC help question lounge career

  • Problem reading from text file
    I Ibrahim Bello

    OK, actually this program works fine, but only when run from Visual Studio. However, when I click on the .exe or launch it from windows command prompt, I get an error: "Unhandled exception at 0x775e59c3 in Materials.exe: 0xC0000005: Access violation reading location 0x54a075d8" and Windows shuts the program down. The Requirement The program is to read from a text file a list of tabulated data of a given material: Temperature, Density, Viscosity... etc. For example: Temperature Density Viscosity ... ... 50 0.2 0.3 ... ... 100 0.25 0.33 ... ... The aim of the program is to read these values (several) of them, store to memory and do some sorts of interpolations. I created a structure, each holding the properties of the material at a given temperature. I then dynamically create an array of structures based on the number of data. If I had 100 readings, I create 100 arrays to structure. .h file

    struct Material {
    float temperature;
    float density;
    float viscosity;
    };

    typedef Material* MATERIAL;

    The above go into the header file .cpp file

    MATERIAL* g_ptrMaterial; //global variable

    void ReadFile (char* filePath)
    {
    vector<string> Tokens;
    int i = 0;
    string val;
    char c;

    ifstream file(filePath); //instantiate and open file
    
    if (!file.fail())
    {
    	//cout << "Enter to begin...";
    	//cin >> c;
    	//cout << "Reading from File ...";
    	g\_numberOfRows = getNumberOfRows(file); //gets number of readings
    	g\_ptrMaterial = new MATERIAL\[g\_numberOfRows\];
    
    	getline(file, g\_fileHeader); //remove column headers i.e. Temperature, Density, etc
    
    
    	while (getline(file, val))
    	{
    		g\_ptrMaterial\[i\] = (MATERIAL) malloc(sizeof(MATERIAL));
    		
    		Tokens = GetTokens(val);
    		
    		if (!Tokens.empty())
    		{
    			//convertToFloat: converts string type to float type
                                g\_ptrMaterial\[i\]->temperature = convertToFloat(Tokens.at(0)); 	
    			g\_ptrMaterial\[i\]->density = convertToFloat(Tokens.at(1));
    			g\_ptrMaterial\[i\]->viscosity = convertToFloat(Tokens.at(2));
    
    			i++;
    		}
    	}
    }
    	
    else
    {
    	cerr << "FILE NOT FOUND!";
    	exit(1);
    }
    

    }

    //separates the input line into column readings
    vector<string > GetTokens (string val)
    {
    stringstream ss(val);
    string temp;
    vector<std::string > Tokens;

    while (ss >> temp)
    {
    	Tokens.push\_back(temp);
    }
    
    return Tokens;
    

    }

    Debugging What I di

    C / C++ / MFC help csharp c++ visual-studio graphics

  • ASP.NET Gridview DataBound event retaining previous value
    I Ibrahim Bello

    1. Why not do your pagination in the PageIndex_Changing event of the gridview rather than in the RowCommand event? 2. Where you have:

    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
    String feeID = ds.Tables[0].Rows[i]["TRANTYPEID"].ToString();
    Decimal feeAmount = Convert.ToDecimal(ds.Tables[0].Rows[i]["TRANSACTIONAMOUNT"]);

    you can substitute with:

    int pageOffset = 10 * gvCardFeesRReport.PageIndex;

    for (int i = 0; i < gvCardFeesRReport.Rows.Count - 1; i++)
    {
    String feeID = ds.Tables[0].Rows[i + pageOffset]["TRANTYPEID"].ToString();
    Decimal feeAmount = Convert.ToDecimal(ds.Tables[0].Rows[i + pageOffset]["TRANSACTIONAMOUNT"]);

    3. If all these don't work, try populating your gridview programmatically to achieve more control over your data. Hope this helps

    ASP.NET csharp css asp-net help

  • ASP.NET Gridview DataBound event retaining previous value
    I Ibrahim Bello

    Try calling gvCardFeesRReport.DataBind() after setting the Page Index property of the gridview in your RowCommand event handler. Do like this: gvCardFeesRReport.PageIndex = 0; gvCardFeesRReport.DataBind(); Cheers!

    ASP.NET csharp css asp-net help

  • Using profile as custom class (getting null while taking data from profile _
    I Ibrahim Bello

    It updates the current profile with the values provided. It saves to the SQLEXPRESS database(ASPNETDB)in your local App_Data folder (by default).

    ASP.NET help tutorial question

  • ASP.NET Gridview DataBound event retaining previous value
    I Ibrahim Bello

    You have to post your code for us to know...

    ASP.NET csharp css asp-net help

  • Using profile as custom class (getting null while taking data from profile _
    I Ibrahim Bello

    Try calling: Profile.Save(); after setting values for your profile...

    ASP.NET help tutorial question

  • How to set CustomValidor for FileUpload
    I Ibrahim Bello

    Change ControlToValidate attribute of the custom validator from "FileUpload1" to "drp_Category"

    ASP.NET help tutorial

  • ASP.NET Application Deployment Problem [modified]
    I Ibrahim Bello

    I have a dropdown that binds to all the Roles defined on my website: DropDownList1.DataSource = Roles.GetAllRoles(); DropDownList1.DataBind(); The application works fine when I'm debugging from Visual Studio, but when in IIS the dropdownlist goes blank... I also have a checkboxlist that I bound to strings stored in an xml file in my application folder. This doesn't load as well, but it does when I'm debugging, or viewing in browser from Visual Studio. How do I resolve this issue? Here are some information that might be useful: 1. I am using a customized role provider which stores roles in an sql database (created from aspnet_regsql tool) on my local machine. <roleManager enabled="true" defaultProvider="CustomRoleProvider"> <providers> <add name="CustomRoleProvider" connectionStringName="ASPNETDBConnectionString" applicationName="/" type="System.Web.Security.SqlRoleProvider" /> </providers> <connectionStrings> <add name="ASPNETDBConnectionString" connectionString="Data Source=.;Initial Catalog=aspnetdb;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> 2. Development Tools: Visual Studio 2005 and SQL Server 2000 3. OS: Windows XP Thanks!

    modified on Thursday, August 20, 2009 8:55 AM

    ASP.NET csharp asp-net database sysadmin help

  • access drop down list on details view
    I Ibrahim Bello

    Glad that worked for you :)

    ASP.NET database help tutorial question

  • access drop down list on details view
    I Ibrahim Bello

    Do this: DropDownList ddl = (DropDownList)dtv.Rows[index].FindControl("ddlTemplate"); ddl gets the reference to the dropdown in the item template, i.e ddlTemplate. Let me know how it goes.

    ASP.NET database help tutorial question

  • Gridview in ASP.Net with C# [modified]
    I Ibrahim Bello

    If this suggestion helped you, kindly say so, so the thread will be marked as resolved.

    ASP.NET csharp asp-net design tutorial

  • Gridview in ASP.Net with C# [modified]
    I Ibrahim Bello

    1. Try putting a breakpoint in the code provided and see if the Row's Cell Text ever evaluates to "0". Does it ever enter the function i gave you? 2. Have you hooked the Row_Deleting method to the control calling it? If not add: OnRowDeleting = "GridView1_RowDeleting" to this: OnRowDeleting = "GridView1_RowDeleting" CssClass="GridRowGrayBorder"> Or alternatively in Page_Load add: GridView1.RowDeleting+=new GridViewDeleteEventHandler(GridView1_RowDeleting); Hope this helps

    ASP.NET csharp asp-net design tutorial

  • Gridview in ASP.Net with C# [modified]
    I Ibrahim Bello

    Change: protected void Page_Load(object sender, EventArgs e) { PopulateGrid(); } to: protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) { PopulateGrid(); } } Does this help? :)

    ASP.NET csharp asp-net design tutorial
  • Login

  • Don't have an account? Register

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