AleMonteiro 238 Can I pick my title?

Did the code throw any errors?

AleMonteiro 238 Can I pick my title?

tuperntyne, you forgot to add the jQuery reference is the left panel. That's why it didn't work.

I updated it for you, check: http://jsfiddle.net/Z4hZh/2/

I tested the animations and it all seemns to work, verify if theres any problem there please.

AleMonteiro 238 Can I pick my title?

While, I use the counter to distinguish the parameters. In each iteration of the loop an p1 parameter is added, but if you don't use the counter all p1 parameters will have the same value, and that's not the desired result.
That's why we use the conuter, to add an different value for the p1 parameter in each iteration.

About the incorrect syntax, try adding an ; to the end of the select statement.

And try this code, I think it'll be a littler faster too:

SqlCommand sc = con.CreateCommand();
sc.CommandType = CommandType.Text;

int i = 0;
System.Text.StringBuilder sql = new System.Text.StringBuilder();

foreach (DataRow row in dt_blah.Rows)
{
    // Use ´i´ to keep the parameters names different
    sqlAppendFormat("select blah blah blah .. where S = @s1 and p = @p1{0} ; ", i);    

    sc.Parameters.AddWithValue("@p1" + i, row["Category"]);

    i++;
}

// I removed this from the loop because all @s1 parameters have the same value
sc.Parameters.AddWithValue("@s1", ddl.SelectedValue);

sc.CommandText = sql.ToString();
con.Open();
    SqlDataAdapter sda = new SqlDataAdapter(sc);
    DataTable dt = new DataTable();
    sda.Fill(dt);
    con.Close();
AleMonteiro 238 Can I pick my title?

There is no static guide for DB options, it all depends on your utilization of the engine.

I found this PDF very usefull.

You should also check this microsoft page: http://technet.microsoft.com/en-us/sqlserver/bb671430.aspx

<M/> commented: :) +0
AleMonteiro 238 Can I pick my title?

cooling,

is this MySQL or SQL Server?

AleMonteiro 238 Can I pick my title?

Michael, if I'm not mistaken, Samsung Galaxy is Android, isn't it?

AleMonteiro 238 Can I pick my title?

I suppose is the image path

AleMonteiro 238 Can I pick my title?

I don't know how this is implemented inside the site, because I don't know Wordpress.

But the functionality itself is just some images exactly positioned and in each step that you choose something the image source is changed. The JS implementation is very simple, the hard work is creating the images.

AleMonteiro 238 Can I pick my title?

Alright, I'll start it soon and keep you all informed about the progress =)

AleMonteiro 238 Can I pick my title?

I'm really not sure if I can help you, proabally not, I've never done something like that myself.

But from what I readed, you could just store the mysql.dll files and it would work. But from my knowlodge, I'd think you would also need to store the mysql database files(because is there that mysql store the tables, records and user information).

Those files are stored in c:\ProgramData\Mysql(in Windows 7). You can verify that in your my.ini, at your MySQL installation folder.

I'd suggest you to setup a virtual machine where you could do those tests.

Sorry I can't help more.

Good luck.

AleMonteiro 238 Can I pick my title?

Hi JorgeM, nice job, very small code.

I took the liberty to change a few things, hope you don't mind.

This is a version with just a small code ajustment: http://jsfiddle.net/grFQp/5/

And this is a version with a closed scope, so it could be easy of use, without worring about variable names being used in another part of the page: http://jsfiddle.net/Q4ang/4/

JorgeM commented: you are a master of JavaScript +12
<M/> commented: :) +0
AleMonteiro 238 Can I pick my title?

Is anybody developing an Android App for DaniWeb?

If nobody is, I'm planning on doing so, and if someone wants to participate, you'll be welcome.

If someone is developing, and wants help, I'd like to participate.

Cheers.

Ps.: I was not sure if I should post this here or in Community Feedback, if this is the case, please move the post.

AleMonteiro 238 Can I pick my title?

The target machine will have MySQL arealdy installed?

AleMonteiro 238 Can I pick my title?

To check if a database exists, use this select (from here):

SELECT
    SCHEMA_NAME 
FROM
    INFORMATION_SCHEMA.SCHEMATA 
WHERE
    SCHEMA_NAME = 'DBName'

If it doesn't exists, execute the creation script.

AleMonteiro 238 Can I pick my title?

Do you have link that we could test this? Maybe an http://jsfiddle.net/ ?

Just by looking at your code I coudln't find the problem.

AleMonteiro 238 Can I pick my title?
AleMonteiro 238 Can I pick my title?

I'm not sure this will work, but I'd try something like it:

SELECT 
    Facility.[Facility Name]
FROM 
    Facility
        LEFT OUTER JOIN Reservation 
            ON (
                    Facility.FacilityID = [Reservation].FacilityID
                AND [Check-in time] = '" & Integer.Parse(cboHour.Text) & "' 
                AND [Check-in date] = '" & lstDate.SelectedItem.ToString & "' 
            )
WHERE 
    [Reservation].ReservationID Is NULL
    AND Facility.[Facility Type] = '" & cboFacilityType.Text & "'
    AND Facility.FalicityID NOT IN (
        SELECT R.FalicityID FROM [Reservation] AS R
        WHERE 
            [Check-in date] = '" & lstDate.SelectedItem.ToString & "' 
            AND [Check-in time] BETWEEN DATEADD(hour, -R.Durantion, '" & Integer.Parse(cboHour.Text) & "' ) AND '" & Integer.Parse(cboHour.Text) & "'
    )
AleMonteiro 238 Can I pick my title?

Try like this:

var contentString = '<div id="content">'+
    '<span id="firstHeading" class="firstHeading">Zooqc, Co Ltd</span>'+
    '<div id="bodyContent">'+
    '<p>we are professional manufacturer and distributor of fashion accessory products, welcome to visit our office and facilities.</p>'+
    '</div>'+
    '</div>';

And also you should check your css for firstHeading class.

AleMonteiro 238 Can I pick my title?

I'm not sure, but try like this (it may have syntax issues):

SELECT  SUM( ct.num_prod ), mc.catagory_name
FROM (
    SELECT  COUNT(`product_id`) as num_prod, sub.category_id as cat_id
    FROM  `product_table_1` as p
    INNER JOIN fm_product_sub_category as sub
        ON ( p.sub_cat_id = sub.sc_id )
    GROUP BY
        sub.category_id

    UNION ALL

    SELECT  COUNT(`product_id`) as num_prod, sub.category_id as cat_id
    FROM  `product_table_2` as p
    INNER JOIN fm_product_sub_category as sub
        ON ( p.sub_cat_id = sub.sc_id )
    GROUP BY
        sub.category_id

    UNION ALL

    SELECT  COUNT(`product_id`) as num_prod, sub.category_id as cat_id
    FROM  `product_table_3` as p
    INNER JOIN fm_product_sub_category as sub
        ON ( p.sub_cat_id = sub.sc_id )
    GROUP BY
        sub.category_id

    UNION ALL

    SELECT  COUNT(`product_id`) as num_prod, sub.category_id as cat_id
    FROM  `product_table_4` as p
    INNER JOIN fm_product_sub_category as sub
        ON ( p.sub_cat_id = sub.sc_id )
    GROUP BY
        sub.category_id

    UNION ALL

    SELECT  COUNT(`product_id`) as num_prod, sub.category_id as cat_id
    FROM  `product_table_5` as p
    INNER JOIN fm_product_sub_category as sub
        ON ( p.sub_cat_id = sub.sc_id )
    GROUP BY
        sub.category_id
) 
AS ct , 
fm_product_main_category AS mc

WHERE 
    ct.cat_id = mc.category_id

GROUP BY 
    ct.cat_id

The main difference between our approches, is that yours select all product from all tables and then cont them. My approach count the products from each table and then sum them.

<M/> commented: :) +0
AleMonteiro 238 Can I pick my title?

pixelsoul, besides live() being deprecated, there is no event that you can use with it to know when an content has been changed.

The change() event is only for inputs, textareas and selects.
The load() event is only for window, img, scripts and frames.

So I don't see any use of live() is this operation.

But maybe I'm forgetting something, who knows =P

AleMonteiro 238 Can I pick my title?

If the page use jQuery Ajax you could set up an global event handler and run your function after the events: http://api.jquery.com/category/ajax/global-ajax-event-handlers/

Another option is to set a timer(setInterval) to run your function periodically.

AleMonteiro 238 Can I pick my title?

Oh, I never used it. It's been a while since I used MySQL. And last time I did, there was no Workbench.

AleMonteiro 238 Can I pick my title?

You can't call .ToString() in a null object. Check if the var is null before using it.

AleMonteiro 238 Can I pick my title?

The problem is making a loot of separeted querys, that's not good. Always go for the least number of database connections possible.

Try like this:

SqlCommand sc = con.CreateCommand();
sc.CommandType = CommandType.Text;

int i = 0;
string sql = string.empty;

foreach (DataRow row in dt_blah.Rows)
{
    // Use ´i´ to keep the parameters names different
    sql += String.Format("select blah blah blah .. where S = @s1{0} and p = @p1{0}", i);    

    sc.Parameters.AddWithValue("@s1" + i, ddl.SelectedValue);
    sc.Parameters.AddWithValue("@p1" + i, row["Category"]);

    i++;
}

sc.CommandText = sql;
con.Open();
    SqlDataAdapter sda = new SqlDataAdapter(sc);
    DataTable dt = new DataTable();
    sda.Fill(dt);
    con.Close();
<M/> commented: :) +0
AleMonteiro 238 Can I pick my title?

I know MySQL Browser, but you have to write the querys your self.

AleMonteiro 238 Can I pick my title?

As JorgeM said, you should change this line also:

 <a href="./images/collection/a01.jpg" class="preview"><img src="./images/collection/a01.jpg" alt="gallery thumbnail" /></a>
AleMonteiro 238 Can I pick my title?
AleMonteiro 238 Can I pick my title?

Yeah, I didn't realised that. I think I had some troubles at the time that I used it.

Sorry, but I don't have much time to make an example for you now, maybe tomorrow, but I can't promise.

But if you google HTMLAgilityPack examples, or tutorial, you'll find a lot of links about it.

Hope you can make it =)

AleMonteiro 238 Can I pick my title?

If you just want to display the data the same way you got it, I suggest you use the WebBrowser component to display this exatcly HTML.

If you really want to extract the data from the HTML, manipulate it and display it on your own component, then I suggest you use and HTML parser to extract the data.

I've used HtmlAgilityPack in a couple of projects and liked it very much.
Take a look at: http://htmlagilitypack.codeplex.com/

AleMonteiro 238 Can I pick my title?

Nice to hear that you were able to make it work.

But, I think you took the easy way out... let me explain: Your problem was the last div, that's correct. But why did the last div give you trouble? It was because your loop got the ID from the div and use it to add the functionality, but the last div didn't have any id, and that's why the error occured.

So, the best solution is to update your function to verify if the ID is valid, something like this:

for(var i=0; i < childrenLength; i++) {
    var childrenId = children[i].id;

    // Check if the Id is valid
    if ( childrenId == undefined || childrenId == null || childrenId == '' ) {
        continue; // Goes to the next iteration of the loop
    }
    // If you want to add the function only to a specific set of divs, you should increment this validation

    var dragVar = document.getElementById(childrenId);
    Drag.init(dragVar, dragVar);

    var numberIDx=childrenId.split('-');
    numberID=numberIDx[2];

    resize1 = new resize();resize1.init({id:'event-resize-'+numberID,direction:'y',limit:{x:[100,580],y:[21,1004]}});

}
AleMonteiro 238 Can I pick my title?

You didn't say what the problem is.

AleMonteiro 238 Can I pick my title?

Your infowindow problem seems to be an CSS problem and also you have an empty div that occupies space.
Try removing the empty div and change <h1> to <span>

AleMonteiro 238 Can I pick my title?

Post your addResizeFunctionality(); function

AleMonteiro 238 Can I pick my title?

Really don't know... try adding info log in the DummySectionFragment onCreateView to check if the URL is set at that point.

Also, I think that this would be a better code:

public static class setLV extends AsyncTask<URL, Void, String[]>{

        @Override
        protected String[] doInBackground(URL... arg0) {

            String[] headlines=new String[20];

            for(int i=0; i<=19; i++){
                headlines[i]="welcome " + Integer.toString(i);  
            }

            return headlines;
        }
        protected void onPostExecute(String[] result) {
            sarr_headlines = result;
            la = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, 0, sarr_headlines);
            lv_headlines.setAdapter(la); 
         }
    }

Inside doInBackground() you shouldn't access anything that is used by the UI Thread.

AleMonteiro 238 Can I pick my title?

Try inverting like this:

public View onCreateView(LayoutInflater inflater, ViewGroup container,  Bundle savedInstanceState) {

            View rootView = inflater.inflate(R.layout.fragment_main_dummy, container, false);
            lv_headlines = (ListView) rootView.findViewById(R.id.headlines);

            new setLV().execute(url);

            return rootView;
        }
AleMonteiro 238 Can I pick my title?

Just use (assets.Quantity * stock_names.value) as Total

<M/> commented: :) +0
AleMonteiro 238 Can I pick my title?

Dani, I'm talking about member badges at http://www.daniweb.com/stats/get_badge

AleMonteiro 238 Can I pick my title?

Yes, .on('change') is the same as .change()

This is from api.jquery.com: Event handlers are bound only to the currently selected elements; they must exist on the page at the time your code makes the call to .on().

You should call .on('change') after inserting new elements. And you should call .off('change') to prevent add double handlers.

$('tr[id^=system_type_] input')
    .off('change')
    .on('change', function() {
        alert('a');
        console.log($(this).val());
    });
AleMonteiro 238 Can I pick my title?

I sincerely don't know the cause for your problem, but when the problem occurs you can try somethings:

-> Stop and Start the MySQL Service (run -> net stop mysql; net start mysql)
-> Force kill MySQL ( run -> taskkill /IM mysql.exe /T /F)
-> Restart IIS ( run -> iisreset ), maybe something from PHPMyAdmin is stuck on mysql
-> Verify if there's something else "stuck" on task manager (something from Wamp)

Beside that, I'll suggest something else.

Instead of using Wamp Server, wouldn't be better to install all the components your self?
I have the following setup:
-PHP installed and configured on IIS
- MySQL
- MySQL Administrator

The setups are not difficult, just follow the instructions and google the problems =)

I never installed PHPMyAdmin, but I shoudln't be hard.

AleMonteiro 238 Can I pick my title?

I'd say that the first on consume less resources, but the second is more reliable.

And I will suggest a third:
- Delete only the records that will no longer exists
- Update the records that already exists but need to be updated
- Insert the new records

The implementation is a little more complex, but the result is the best in my opnion.

Also, you should create the sql stataments and execute them only once. In example:

DELETE FROM MyTable WHERE Product_ID = 1 AND Detail_ID IN ( 1, 2, 3, 4 );

UPDATE MyTable SET Value = 'Something' WHERE Product_ID = 1 and Detail_ID = 5;
UPDATE MyTable SET Value = 'Something Else' WHERE Product_ID = 1 and Detail_ID = 6;

INSERT INTO MyTable(Product_ID, Detail_ID, Value)
    (1, 7, 'Value...'), (1, 8, 'Value...'), (1, 9, 'Value...');
AleMonteiro 238 Can I pick my title?

I think this should work:

SELECT 
    relfirstname, rellastname, relrel, count(*) AS kamote 
FROM
    RelativeTable 
WHERE
    effectivedate = '" & frmNew.DTPicker2.Value.ToString() & "' AND 
    empnumber = '" & frmNew.empnotxt.Text & "' 
GROUP BY 
    relfirstname, rellastname, relrel
AleMonteiro 238 Can I pick my title?

Using AsyncTask you can only update the UI(the ListView in this case) on the onPostExecute method. And inside onPostExecute you can call getApplicationContext() to get the context.

AleMonteiro 238 Can I pick my title?

It's not possible, but you could do it from code.

This is not an working code, just the logic idea:

string strConn = @"Data Source=$(MyDocumentsFolder)\My App\MyAppDatabase.sdf";
string strFlag = "$(MyDocumentsFolder)";

if ( strConn.IndexOf(strFlag) > 0 ) {
    strConn = strConn.Replace(strFlag, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
}
AleMonteiro 238 Can I pick my title?

on() is not the same as live().

live() is used to attach handlers to an selector. If an element is created after the call of live() it would have the same handler.

on() only attach handler to existing elements. If you create an element after the call of on(), it will not have the handler attached to the event

AleMonteiro 238 Can I pick my title?

You're welcome. If your problem is solved, please mark the thread as such =)

AleMonteiro 238 Can I pick my title?

3rd rock from the sun

Your favorite ritual to think about your code?

AleMonteiro 238 Can I pick my title?

When you use innerHTML, scripts are not executed. That's your problem.

So, I suggest that you don't return any JavaScript code on your ajax response.
Instead, just return the divs and then execute a function to add the resize functionality.
Something like this:

function addResizeFunctionality() {
    var
        div = document.getElementById('event-box-container')
        , children = div.childNodes
        , childrenLength = children.length;

    for(var i=0; i < childrenLength; i++) {
        var childrenId = children[i].id;
        var resize = new resize();
        resize.init({id: childrenId, direction: 'y'});
    }

}
LastMitch commented: Nice Work! +11
AleMonteiro 238 Can I pick my title?

Please, post your AJAX request so we can analyse it.

AleMonteiro 238 Can I pick my title?

The first thing that I'd look into would be startup programs.

Run -> msconfig -> Startup tab

AleMonteiro 238 Can I pick my title?

I've used HightCharts with .NET with great success and I recommend it.

To obtain sofisticated user experience I suggest requesting data with AJAX in JSON format. The JS parser will be easy and fast. This way it's possible to achieve drill down funcionality that is really something else =)