AleMonteiro 238 Can I pick my title?

I think that one of the most rewarding badges would be Post Quality Score.

AleMonteiro 238 Can I pick my title?

What you got so far?

AleMonteiro 238 Can I pick my title?

Hello everybody.

I'm starting to build an event calendar for employees in my company, and the first thing I needed was an working calendar to build from, so I wrote a simple one.

Hope it can be usefull for someone.

Cheers.

JorgeM commented: great job. would like to see your progress as you further develop it... +12
LastMitch commented: Nice! +11
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?

Your .cs file is an codebehind page?

AleMonteiro 238 Can I pick my title?

Violet, sorry, I know nothing about WordPress.

The only framework like WordPress that I know a little of is Joomla, and I also don't know if it supports what you want.

But let me ask, are you planning to develop and WebSite to take pictures or an Android App?

AleMonteiro 238 Can I pick my title?

Big and complicateds softwares are nothing more than small pieces of code put toggether.

In my opnion, being a programmer is one thing, being a software developer is something more. You need to have the vision of what group of small pieces of code put toggether will achieve the funcionality you desire.
And not only code, what will you use to store your data? How would you integrate your solution with another one? Do you need to consume an 3rd part service or use an 3rd part library? Do you have access to them? Are they open source? Do you need to buy them/the use of them? How would you distribute your software? Will you charge the use of you software? How? What kind of user is your target? And so many more questions...

If you want to develop complete software solutions, you'll need much more knowlodge than just a programming language.

I'll tell something about me: I learned allmost everything that I know in software development by myself, but I did a couple of one week classes too.
I've been working with IT from the past 6 years now, and this is the things that I worked and still work with most of the time:

  • Programming Languagues/Markup Languages
  • Microsoft ASP.NET, Windows Forms, WCF, WPF (C# and VB)
  • Windows Batch, Shell Scripting
  • PHP
  • Java (For Android)
  • JavaScript/JQuery/VBScript/ActionScript
  • XML/HTML/MXML/CSS
  • SQL (Procedures, Triggers and Querys)
  • DataBases
  • SQL Server 2000, 2005 and 2008
  • MySQL 4 and 5
  • Oracle 10 and …
AleMonteiro 238 Can I pick my title?

You're welcome.

Just mark the thread as solved please.

AleMonteiro 238 Can I pick my title?

First of all, that's not a good practice. The best way, in my opnion, would be to have an code behind that uses your class, get the message and set it to the html.

But, if you really want to do it...

If you just want to write something exatly after the last thing was wrote, use:
System.Web.HttpContext.Current.Response.Write("My Text")

If you want to write the text in some specific place, I only know a very ugly work arround, using JavaScript:

System.Web.HttpContext.Current.Response.Write(@"

    <script type=""text/javascript"">

        // Set a timeout of 1 second, in case the script is added at the beging of the page
        // and the DOM is not ready yet.
        setTimeout(function() {

            document.getElementById("YourElementId").innerHTML = "Your Text";

        }, 1000);

    </script>

");
AleMonteiro 238 Can I pick my title?

I did this exatcly same thing, but not for a blog, it was to an commercial building security system. So they can register anyone who enters the building.

I used Android 2.0 and C# 3.5 on the server side. It's not that difficult and I could share the code if you want to.

But I don't know any blog or any other tool that has this funcionality built in, maybe there is.

AleMonteiro 238 Can I pick my title?

DateDiff returns an Int not an BigInt, that's why you get the error.

One work arround is to get the minutes and then multiple by 60, to get the seconds, like this:

ABS(CONVERT(BigInt, (DateDiff(minute, grn_date, getDate()))) * 60)

I found the answer in this forum: http://www.sqlservercentral.com/Forums/Topic964359-392-1.aspx

And here it's a more sofisticated analysis: http://sqlanywhere.blogspot.com.br/2010/10/getting-bigint-from-datediff.html

AleMonteiro 238 Can I pick my title?

Michael, thanks for the response.
That's exatcly what I was planning to use, but my doubt is on the server side. How to perform the best match between the tree tables.

AleMonteiro 238 Can I pick my title?

I never used asp.net membership providers, so I can't help much with that.

But in plain SQL, it would be like this:

UPDATE [myUserTable] SET [myLockedField] = 0 WHERE [myUserIdField] = @UserId

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?

In your gridview itemtemplate button, you should add the commandArgument, like this:

<asp:button .... CommandArgument='<%#Eval("UserId") %>' />

Then, in the BackEnd, on your RowCommand event, you can get the userId like this:

int UserId = int.Parse(e.CommandArgument.ToString())

AleMonteiro 238 Can I pick my title?

Hello guys, I'm in need of some thinking help.

I want to build an auto-complete text input to find cars, but I want it to search for Car Models and Car Manufactor too.

In example, if the user type 'For', the suggestions would be
'Ford - Car 1'
'Ford - Car 2'
'Some car that start with 'For''

If the user type 'H', the seggestions would be
'Honda - Civic'
'Hatch - Some hatch car'
'Some car that start with 'H''

In the database, there's 3 tables, Car, CarModel and CarManufactor. The Car table has the fields CarModelId and CarManufactorId, that are reference two the other tables.

I thoght in two options till now:
1. Search each field in each table and then join them toggether
2. Pre fill a table with all possibilites and them search only there using RegEx to make the best match.

Does anyone have better ideas or suggestions?

Thanks very much!

AleMonteiro 238 Can I pick my title?

Did you try the JS fix?

AleMonteiro 238 Can I pick my title?

Oh I see... Well, I guess you can try to fix with JS (jquery in my example):

/* CSS to fix */
a.linkStyle.fixClick {
    color:#2a00ff;
}

// Try fixing with JS
$("a.linkStyle").click(function() {
    $(this).addClass("fixClick");
});
AleMonteiro 238 Can I pick my title?

Violet, good night.

I openned your link in safari and I confirmed the error. But I didn't find anything that could resolve the issue.

And in my opnion, I'd say this is working well enough. I wouldn't lost much of my time trying to solve this, if I were you.
The link stays pink when you click in another one, or when you return to the page. That's good enough.

So I say: Move on girl ^^

AleMonteiro 238 Can I pick my title?

I'd suggest you wrap the input hidden and the button in a <div> or <span>, that has an specific class(in this case I set as cl_id).
The result should look something like:

<div class="cl_id">
    <input type="hidden" id="hdn<?php echo $cl_id ?>" name="hdn<?php echo $cl_id ?>" value="<?php echo $cl_id ?>" />
    <input type="button" id="btnget<?php echo $cl_id ?>" name="btnget<?php echo $cl_id ?>" value=">>" />
</div>

Then you can loop all your inputs like this:

$(function() { // Onload

    $("div.cl_id").each(function() { // for each div

        var $this = $(this), // the <div>
            $input = $this.children("input:text"), // the input hidden
            $btn = $this.children("input:button"), // the input button
            cl_id = $input.attr("id").replace("hdn", ""); // the cl_id 

        // If you want to add an click listener to your button, you could do it like this:
        $btn.click(function() {
            alert("Button with cl_id " + cl_id + " clicked!");
        });
    });

});
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?

Why did someone vote the post down without even commenting why or replying something?
This isn't very nice or helpfull to anyone.

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?

Farhad, I don't know bPopUp, so I can't help you.

But you should try the suggetion made by soapyillusion.

AleMonteiro 238 Can I pick my title?

How are you oppening the popup?

AleMonteiro 238 Can I pick my title?

Check this sample, I got it from Google Maps Docs and just modify it a little bit:

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps JavaScript API v3 Example: Info Window Simple</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">

    var beaches = 
    [
      ['Bondi Beach', -33.890542, 151.274856, 4],
      ['Coogee Beach', -33.923036, 161.259052, 5],
      ['Cronulla Beach', -36.028249, 153.157507, 3],
      ['Manly Beach', -31.80010128657071, 151.38747820854187, 2],
      ['Maroubra Beach', -33.950198, 151.159302, 1]
    ];

    function initialize() {

        var myOptions = {
            zoom: 10,
            center: new google.maps.LatLng(0, 0),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        }

        var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

        setMarkers(map, beaches);
    }   



function setMarkers(map, locations) {

    var bounds = new google.maps.LatLngBounds();

    for (var i = 0; i < locations.length; i++) 
    {

            var beach = locations[i];

            var coords = new google.maps.LatLng(beach[1], beach[2]);

            var contentString = '<div id="content">'+
                'Info Window Test:' +  beach[0] + 
                '</div>';

            var infowindow = new google.maps.InfoWindow({content: contentString});

            var markerImage = new google.maps.MarkerImage
            (
                "http://www.alawar.com/games_img/games/sky-bubbles/sky-bubbles-deluxe-logosmall.gif",
                new google.maps.Size(44, 44, "px", "px"),
                new google.maps.Point(0, 0),
                new google.maps.Point(0, 0),
                new google.maps.Size(20, 20, "px", "px")
            );

            var marker = new google.maps.Marker({
                position: coords,
                map: map,
                icon: markerImage,
                title: beach[0],
                zIndex: beach[3]
            });

            google.maps.event.addListener(marker, 'click', 
                function (infowindow, marker) {
                    return function () {
                        infowindow.open(map, marker);
                    };
                }(infowindow, marker)
            );

            bounds.extend(coords);
            map.fitBounds(bounds);
    }
}

</script>
</head>
<body onload="initialize()">
  <div id="map_canvas"></div>
</body>
</html>
Jessfly commented: Nice +0
AleMonteiro 238 Can I pick my title?

It's easier than you think... something like this:

SELECT
    City, Count(CustomerId) as CustomerCount
FROM
    ContactInfo
GROUP BY
    City
AleMonteiro 238 Can I pick my title?

http://support.microsoft.com/kb/308470

http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET

Please google a little bit before posting basic questions like this. A simple search and you would have found those links.

We are here to help and guide, not be your search engine.

AleMonteiro 238 Can I pick my title?

Yes you can. You can make an entire mail client with C#.

Take a look: http://www.codeproject.com/Articles/34495/Building-your-own-Mail-Client-using-C

AleMonteiro 238 Can I pick my title?

See the comments:

$('.available, .unavailable, .selected').click(function(){
        // Save the reference for better performance and cleaner code
        // Use $ before the name to identify jquery objects
        var $this = $(this), 
            thisId = $this.attr('id'); 
        // Instead of getting the attr class use the method hasClass()
        //var ID = $(this).attr('class');
        if ($this.hasClass('unavailable')) {
            alert ('Seat is already booked. Please select another seat.');
        }
        else if ($this.hasClass('selected')) {
            alert ('You have now unselected this seat.');
            $this.html('<img src = "free.gif"/>');
            $this.removeClass('selected').addClass('available');
            y--;
            $("#seats").html("Number of seats selected: " + y);

            // This doesn't work because it's plain text.
            //$("#list").remove(thisId);

            // This is not pretty, but should work
            var listHtml = $("#list").html();
            listHtml = listHtml.replace(thisId + "<br/>", "");
            $("#list").html(listHtml);
        }
        else {
            alert ('You have now reserved this seat. You can unselect it by clicking the seat again.');
            $this.html('<img src = "selected.gif"/>');
            $this.removeClass('available').addClass('selected');
            y++;
            $("#seats").html("Number of seats selected: " + y);

            // A better approach would be to add an <span>, <li> or <div> with an specific ID or class so you could remove it latter using .remove()
            // It's <br/> and not </br>
            $("#list").append(thisId + "<br/>");
        }
    });
AleMonteiro 238 Can I pick my title?

No, there's not. Because the site wasn't design for it.

But, you could use the image link: http://www.hermosawavephotography.com/potd/2013/1302_5DII_4429.jpg

AleMonteiro 238 Can I pick my title?

Edit the post and remove the link

AleMonteiro 238 Can I pick my title?

Sorry, I didn't realised it before, but this won't work.

Your functions create html content and insert them into the opbox <div>, and <textarea> don't render html.

If you really want to display in an <textarea> you will need to write only text and not html. And I'm not sure, but I think <textarea> display line breaks as /n and not <br/>

AleMonteiro 238 Can I pick my title?

I really don't have any idea about what a mdi is, but I'll take two huge guesses, maybe it'll help, who knows...

  1. Does the mdi child form is transparent as well?
  2. Maybe when the panel is moved, some event is fired and triggers an routine that updates the panel opacity/background
AleMonteiro 238 Can I pick my title?

You're welcome.

Just mark the question as solved please =)

AleMonteiro 238 Can I pick my title?

As JorgeM and naphets said, the second <img> source is an php page, not an image.

But just to make it clear, note that the point is that the php page returns HTML content. An url with .php extension could return an jpeg/bitmap content(when reading a image from a database in example), but it's not the case.

AleMonteiro 238 Can I pick my title?

Just change the <div> to an <input type="text" > or an <textarea> and adept the genformChanged function

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?

What's your problem about it? What doesn't work? Did you write anything yet?

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?

To align horizontally you just need the span(with the label class).
I used an div for each row to align vertically.

I suppose you could work only with margins, but as you are seeing for your self, the headache is bigger ^^

AleMonteiro 238 Can I pick my title?

Can't you bring up a form with the text when clicking the button?