AleMonteiro 238 Can I pick my title?

What does dr.Item("dob").ToString returns?

If dr.Item("dob") is a valid date, this should work:

TempDate = new Date(dr.Item("dob").ToString("yyyy-MM-dd"))
txtDate.Text = TempDate.ToString("yyyy-MM-dd")
AleMonteiro 238 Can I pick my title?
AleMonteiro 238 Can I pick my title?

Try using like this:

TempDate = dr.Item("dob").ToString
txtDate.Text = TempDate.ToString("yyyy-MM-dd")
AleMonteiro 238 Can I pick my title?

Good to know Bill.

Just mark the thread as solved please.

Good weekwend too.

AleMonteiro 238 Can I pick my title?

Bill, it's all about CSS.

If you just want to bring the body content up, set margin-top: -10px;. Or decresce the first heading font-size.

AleMonteiro 238 Can I pick my title?

Oh, I didn't notice that... but your are making a lot of selects, so they can return in only one datatable.
You have to use an DataSet, like this:

SqlDataAdapter sda = new SqlDataAdapter(sc);
    DataSet ds = new DataSet();
    sda.Fill(dt);

And then use ds.Tables, for each select there'll be an table.

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?

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?

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?

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?

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?

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 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?

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?

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?

Ok, so you can't use an select like from the posts tables. Because if you do, it'll insert for all posts, not only the one that the user selected the tags.

You need to insert the tags for each post, like this:

INSERT INTO post_tag(post_id, tag_id) 
SELECT
    $post_id, tag_id 
FROM
    tag
WHERE
    tag IN ('$music','$sport','$tech')
AleMonteiro 238 Can I pick my title?

Ok, now I got the picture.

Now let me ask, what do you want to do? For each post you want to insert each tag into the post_tag table? I mean, if you have 10 posts and 3 tags, you want to have 30 records in the post_tag table?

AleMonteiro 238 Can I pick my title?

Post your posts table also

AleMonteiro 238 Can I pick my title?

You should debug and see if the line Response.Redirect("admin/default.aspx"); is being executed.

If it is being executed, I'd guess that something on admin/default.aspx is redirecting back to the login.aspx.

AleMonteiro 238 Can I pick my title?

Please post a picture from your database diagram, so we can know how your database is structured.

For what I deduced, your select will return for each post 3 records, one for each tag. So, if you have 10 posts and 3 tags, it will return 30 records.

AleMonteiro 238 Can I pick my title?

You can use XmlDocument to parse your xml string and use it to go throw it.
See this example: http://www.csharp-examples.net/xml-nodes-by-name/

AleMonteiro 238 Can I pick my title?

There's a saying here in Brazil that could be translated to something like "Each crazy person has it's own habbits" (Cada louco com sua mania).

Let me show you some examples:

I don't break line to {, but I add space in ( something ), and I don't it it's ().

Some people don't use space between parameters, I do, like ( param1, param2 )

But a co-worker, adds line break to { and don't add space in (param)

Another co-worker add a lot of blank lines, just like this:

public function add() {

    // Code only here

}
// First Line break
// Seconds Line break
public function close() {

    // Code only here

}

About the php tag, I use like this:

<?php echo 'something'; ?>

OR

<?php
    $myVar = 'something';
    //something
    echo $myVar;
?>

So... who knows... every person grow up learning and experiencing something different. No one has the same standarts of another, in anything.

Yes, there are lot's of published coding standarts, but how far should we take them?

For me, if the code is readable, I'm fine with it.

I think is much better to have the thinking aligned about structure, performance and naming standarts over writing with the same syntax.

Sorry about the bad english, I'm not felling so good today. But I like the topic, that's why I wrote such a mess.

Seeya.

AleMonteiro 238 Can I pick my title?

Don,

I used the term "exclusive database" to say an database per client. I mean, each PC that'll run the software will have it's own local database.

Good luck with your project.

AleMonteiro 238 Can I pick my title?

You forgot to call the .DataBind() method of your combobox. Without this it won't show the itens in the select.

I made a few changes in your code, try it like this:

Imports MySql.Data.MySqlClient

Public Class MainForm


    Private Sub MainForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        Try

            Dim conn As New MySqlConnection
            Dim str As String = " host = localhost ; username = 'username'; password = 'password'; database= vb_timeclock; pooling = false;"
            conn.ConnectionString = str
            conn.Open()

            Dim strSQL As String = "SELECT distinct ID, Employee FROM employees"
            Dim da As New MySqlDataAdapter(strSQL, conn)
            Dim ds As New DataSet

            da.Fill(ds, "employees")
            With (cmbEmployee)

                .Items.Add("Select")
                .DataSource = ds.Tables("emplyees")
                .DisplayMember = "Employee"
                .ValueMember = "ID"
                .SelectedIndex = 0
                .DataBind()

            End With

        Catch ex As Exception
            ' Its nice to show the message so you know what happened
            MessageBox.Show("Problem connecting to databese: " & ex.Message)

        End Try
AleMonteiro 238 Can I pick my title?

In my opnion, you can't let the end user change the database, NEVER EVER. Any and every change in the database should be done by the software, or only, in very specific cases, by the database administrator.

In your example, you want to let the user change the description in directly in the database. But what it the user add a description contaning &"'^~><-+{]\|%$#@!*&¨?°¬¢£³²¹, would the software accept it?
What it the user remove the description field?

There's many ways that the user can mess up a software by editing the database himself, in my opnion this should never happen.

About the database itself, if every copy of your software will have an exclusive database, I can't suggest anything... lol... I never made an client application with a exclusive database. But I'd guess MSAccess, MySQL or FireBird.
I would never make an application based on a excel database.

However, if your software will connect to a central database, I recommend SQL Server or Oracle. Both have very easy .NET interfaces and are great handling large number of records, large number of connections, and have a lot of nice features that help development and maintanace.

AleMonteiro 238 Can I pick my title?

You're welcome.

Just mark the question as solved please =)

AleMonteiro 238 Can I pick my title?

There's lots of ways of doing it, the more sofisticated are with JavaScript, but it can be done easily done only with CSS, using position fixed.

See a example:

<!DOCTYPE html>
<html>

<body>
    <style type="text/css">

        #content {
            width: 500px;
            font-size: 30px;
        }

        #banner {
            position: fixed;
            top: 50px;
            right: 50px;
            width: 100px;
            height: 100px;
            background: #0F0;
            color: #FFF;
            font-size: 30px;
        }

    </style>
    <div id="content">
        nonononononononononnoon<br/>
        nonononononononononnoon<br/>
        nonononononononononnoon<br/>
        nonononononononononnoon<br/>nonononononononononnoon<br/>
        nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>
        nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>
        nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>
        nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>
        nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>nonononononononononnoon<br/>
    </div>

    <div id="banner">
        Something
    </div>


</body>
AleMonteiro 238 Can I pick my title?

Let's go to the points:

  1. You need to wait until the DOM is loaded so you can get the reference of an object.

    // This won't work
    var movingBox = document.getElementById("moveBox");
    var topOfBox = movingBox.style.top.value;

    // This should work
    var movingBox, topOfBox;

    window.onload = function() {
    movingBox = document.getElementById("moveBox");
    topOfBox = movingBox.style.top.value;
    };

  2. It's a silly error:

    // "heightIn" is a string, not the value of the heightIn variable
    // This will set the height to an string with value 'heightInpx'
    document.getElementById("moveBox").style.height = "heightIn" + 'px'

    // This should work
    document.getElementById("moveBox").style.height = heightIn + 'px'

AleMonteiro 238 Can I pick my title?

You should seach for javascript scrolling banner or javascript floating banner or javascript fixed banner. There's a lot of results, but only a few demos.

Also, this is not an PHP question, it's DHTML/CSS/JavaScript.

If you don't want to use javascript search for CSS scrolling/floating banners.

Good luck

AleMonteiro 238 Can I pick my title?

I suggest you do it like this:

var Jspeed=200;   //Global variables that I want to change
var CSpeed=200;

function changeSpeed(ClownSpeed, JuggleSpeed) {
    // This will get the values as string
    CSpeed = document.getElementById('txtClownSpeed').value; 
    Jspeed = document.getElementById('txtJuggleSpeed').value;

    // Convert to int: it will throw error if the value is not an number
    CSpeed = parseInt(CSpeed);
}

<form>
  <p id="controlText">Enter Clown Speed: </p> <input type="text" id="txtClownSpeed" > <br />
  <p id="controlText">Enter Juggle Speed:</p> <input type="text" id="txtJuggleSpeed">
  <button type="button" onclick="changeSpeed();" >Change Speed</button>
</form>

Just so you know, in your code there's a lot of errors, let me show you:

function changeSpeed(ClownSpeed, JuggleSpeed) {
 // This is setting the value of parameter as the value global var, not the opossite
 // Another thing, JavaScript is case sensitive, so CSpeed is different then Cspeed
 ClownSpeed = Cspeed;
 JuggleSpeed = Jspeed;

 // You were expecting CSpeed = ClownSpeed
}




<form>
  <p id="controlText">Enter Clown Speed: </p> <input type="text" id="ClownSpeed" > <br />
  <p id="controlText">Enter Juggle Speed:</p> <input type="text" id="JuggleSpeed">
  //ClownSpeed is not an value, it's a object
  //To use like this you it should be: changeSpeed(ClownSpeed.value, JuggleSpeed.value)
  <button type="button" onclick="changeSpeed(ClownSpeed, JuggleSpeed);" >Change Speed</button>
</form>
AleMonteiro 238 Can I pick my title?

You need to post your form and then get the value, something like this:

Form:

<form action="MyPage.php" method="post">

    <select name="mySelect">
        <option value="1">My First Option</option>
    </select>

    <button type="submit">Submit</button>
</form>

MyPage.php:

$selectedOption = $_POST["mySelect"];
// Do something
AleMonteiro 238 Can I pick my title?

Which line throws the error?

AleMonteiro 238 Can I pick my title?

Yes, that'd better. The CSS gradient will ajust the effect when the div resizes.

AleMonteiro 238 Can I pick my title?

Violet, if it's an small image you can use repeat-y, but the result will depend much on kind of image, it could be ridiculous for some images with effects.

The other option is to make a bigger image so it will only show more or less of it. How much bigger depends on how much the banner area can increase.
The problem with this option is that with you use an vertical gradient, when the banner height is low the gradient won't show properly.

In my opnion, handling multiple size images background is not that simple. If it will be an fixed image you can try and sort things out. But if the idea is to make a dynamic image spot (change image every day i.e.) this will be really painful, I'd suggest to set an fixed size, or have multiple sizes of the image and change with JS according to the new size of the space.

AleMonteiro 238 Can I pick my title?

Div's width by default is 100% of it's parent.
In your case I think it would be easier to use an <span>, wich the width just wrap it's content.

Or you can set display: inline to the div, wich will make it just wrap it's content.

AleMonteiro 238 Can I pick my title?

Sorry, I don't have any tutorials or code to land you in this case. I don't code much in PHP.

AleMonteiro 238 Can I pick my title?

Sorry, never heard about it and I didn't find anything on google.

AleMonteiro 238 Can I pick my title?

The loop seems fine. Try trimming the word, maybe it's getting an white space from the text file.
And just to be sure reset the value of the text box before inserting the dashes.

AleMonteiro 238 Can I pick my title?

Just a guess, but I think you have to use "" instead of '' to assing the variables into the text.

Try like this: "<th>{$header}</th>\n" and "<th>{$value}</th>\n"

AleMonteiro 238 Can I pick my title?

I'm not sure, but maybe this will help you:

<!DOCTYPE html>
<html>
    <head>
        <title>TEST</title>

        <style type="text/css">
            /* Generated by F12 developer tools. This might not be an accurate representation of the original source file */
        #wrapper {
            border: 1px solid red; width: 100%; height: 43em;
        }
        #page {
            margin: 0px auto; border: 1px solid magenta; width: 75%; height: 40em;
        }
        #banner {
            background: #000; /* using image as background here must take care of repeat-y so when the browser resize and this banner height increase the background will also increase*/
            border: 1px solid blue; 
            min-height: 65px; /* use min-height instead of height so when the browser resize the banner can increase it's height to wrap the elements that break line */
            position: relative;
            min-width: 260px; /* min width so the cnes logo doesn't go on top of the other one */
        }
        #logo1 {
            border: 1px solid red; 
        }
        #logoText {
            width: 350px;
        }
        #logoText p {
            border: 1px solid blue; color: white;
        }
        #cnes {
            border: 1px solid yellow; top: 0px; height: 60px; right: 0px; position: absolute;
        }

        /*css style to make divs stay inline without the use of float*/
        .inline
        {
            position: relative;
            display: -moz-inline-stack;
            display: inline-block;
            zoom: 1;
            vertical-align: top;

            *display: inline;
        }

        </style>

    </head>

    <body>
        <div id="wrapper">       
            <div id="page">      
                <div id="banner">

                    <div id="logo1" class="inline">
                        <img src="http://antobbo.webspace.virginmedia.com/test/responsive/small_LOGO.gif">                           
                    </div>
                    <div id="logoText" class="inline">                   
                            <p>This is an extra bit</p>
                    </div>
                    <div id="cnes">  
                        <img src="http://antobbo.webspace.virginmedia.com/test/responsive/cnes.jpg" >                                        
                    </div>
                </div>
            </div>
        </div>
    </body>

</html>
AleMonteiro 238 Can I pick my title?

Do you mean a database engine called Profile or a database profiler(tool for testing performance)?

AleMonteiro 238 Can I pick my title?

Using AJAX you can show the content to the user in the browser, but not download it.

For downloading a file see this link: http://php.net/manual/en/function.readfile.php

or this one: http://www.terminally-incoherent.com/blog/2008/10/13/php-file-download-script-straming-binary-data-to-the-browser/