dimanche 28 juin 2015

Cannot Click button when table row with button is appended

http://ift.tt/1RIfuRa

$('#insertBtn').click( function(){
    $('#mytable > tbody:last-child').append('<tr><td>'+$('#fnameText').val()+'</td><td>'+$('#lnameText').val()+'</td><td>'+$('#pointText').val()+'</td><td><button type="button" class="deleteClass">Delete</button></td></tr>');
    $('#textTable input').val('')
});

$(".deleteClass").on("click",function() {
    alert('row deleted');
});

Try typing anything into the textboxes. Then click on the insert button. Then click on the delete button on the first column. Notice the alert didn't trigger even though the button has the intended class

What is wrong with my code?

Load ajax success data on new page

My ajax call hits the controller and fetches a complete JSP page on success. I was trying to load that data independently on a new page rather than within some element of the existing page. I tried loading it for an html tag but that didn't work either. I tried skipping the success function but it remained on the same page without success data. My ajax call is made on clicking a normal button in the form and the code looks like as shown below.

$.ajax({

    url : '/newpage',
    type : 'POST',
    data : requestString,
    dataType : "text",
    processData : false,
    contentType : false,
    success : function(completeHtmlPage) {
        alert("Success");
        $("#html").load(completeHtmlPage);
    },
    error : function() {
        alert("error in loading");
    }

});

Javascript keep element at element's position

I have multiply divs in my html where i want to overlay a window. It is no problem to set the overlay to the correct position of my div with position: aboslute and top and left but when i resize the window or scroll the overlay is not moving with the element. How can i do that simple?

    function showDetails(e, elem) {
        var parentPosition = getPosition(e.currentTarget);
        var overlay = document.getElementById("overlay");
        overlay.style.top = parentPosition.y;
        overlay.style.left = parentPosition.x;
    }

html:

<body>
   <div class="content">
      <div class="button" onclick="showDetails(event,this)"></div>
      <div class="button" onclick="showDetails(event,this)"></div>
      <div class="button" onclick="showDetails(event,this)"></div>
   </div>
   <div id="overlay"></div>
</body>

Different width of column in the HTML table

I am trying to make the width of tds different in the HTML tale but I am unable to do so.

HTML Code

<table class="TFtable" border="1">
        <tr>
            <th >Heading1</th>
            <th >Heading2</th>
            <th >Heading3</th>
        </tr>
        <tr>
            <td>Text jshdf hjkhsdk jhfkhds fkjhf sdjkh dsfkjh</td>
            <td >Text</td>
            <td >Text</td>
        </tr>
        <tr>
            <td>Text</td>
            <td>Text</td>
            <td>Text</td>
        </tr>
        <tr>
            <td>Text</td>
             <td>Text</td>
            <td>Text</td>
        </tr>
    </table>

CSS

.TFtable {
    width: 50%;
    border-collapse: collapse;
    table-layout: fixed;
}

.TFtable tr {
    padding: 7px;
    border: #4e95f4 1px solid;
}

/* provide some minimal visual accomodation for IE8 and below */
.TFtable tr {
    background: #FFFFFF;
}

/*  Define the background color for all the ODD background rows  */
.TFtable tr:nth-child(odd) {
    background: #FFFFFF;
}

/*  Define the background color for all the EVEN background rows  */
.TFtable tr:nth-child(even) {
    background: #BCCECE;
}

.TFtable td{
table-layout: fixed;
width: 20px;
height:auto;
overflow: auto;
}

Link to JSFiddle.

Here

Upload is reading PHP variable as null

I am having trouble getting a picture to load from mysql database. The directory is randomly generated and gets stored in the database just fine. When the page refreshes the img returns a broken link, echos 'not set.', and inspect element tells me that $default_pic isn't defined. I can't figure out what is going on here can anyone help?

<?php
error_reporting(E_ALL); ini_set('display_errors', 1);
$listingid = $_SESSION['edit_listing'];
if(isset($_FILES['listingpic'])){
    if($_FILES['listingpic']['type']=="image/jpeg"||$_FILES['listingpic']['type']=="image/png"||$_FILES['listingpic']['type']=="image/gif"){
        if($_FILES['listingpic']['size']<1048576){
            $chars = "abcdefghijklmanopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
            $rand_dir_name = substr (str_shuffle($chars), 0, 15);
                                    mkdir("userdata/listingpics/$rand_dir_name/") or die("directory error");
            if(file_exists("userdata/listingpics/$rand_dir_name/".$_FILES['listingpic']['name'])){
                echo "File already exists.";
            }
            else{
                move_uploaded_file($_FILES['listingpic']['tmp_name'], "userdata/listingpics/$rand_dir_name/".$_FILES['listingpic']['name']) or die("Failed to move file.");
                $listing_pic_name = $_FILES['listingpic']['name'];
                $listing_pic_query = mysql_query("UPDATE properties SET default_pic='$rand_dir_name/$listing_pic_name' WHERE id='$listingid'"); 
                $default_pic = "userdata/listingpics/$rand_dir_name/".$_FILES['listingpic']['name'];//<-PROBLEM
                header("Location: ../list_property/upload.php?id=".$listingid);
            }
        } else echo "File must not exceed 1MB.";
    } else echo "File must be a JPEG, PNG, or GIF image.";
} else echo "Not set.";

?>
<form action="" method="POST" enctype="multipart/form-data">
    <img src="<?php echo $default_pic; ?>" width="50%" height="50%"/><br>
    <br>
    <input type="file" name="listingpic" />
    <input type="submit" name="uploadpic" value="Upload Picture">
</form>

Uncaught TypeError: Cannot read property 'length' of undefined when trying to populate responsive datatable using php?

I am trying to fill responsive datatable with ajax request to a php script , the response is returned a JSON_encode format , i can see the response in xhr requests: ["abc","def","ght","jkl"]

Here is the code i am using

Name

                                    </tr>
                                </thead>
                             <tfoot>
        <tr>
            <th>Name</th>

        </tr>
    </tfoot>
    </table>




    $('#dataTables-example').DataTable({
            responsive: true,
               "ajax": "search_autocomplete.php",


    });

});

here is the php script-

   if ($result->num_rows >0) {
// output data of each row
while($row = $result->fetch_assoc()) {


    $list[] =$row['name'];

    }       
      echo json_encode( $list );            

}

loading image using css animation VS loading using gif image

I encounter a problem showing loading css animation while doing heavy js operation, so I wonder if css animation is taking more resources then showing simple loading gif image, I made the following tests 1 created page with loading css

  1. created page with loading css animation
  2. created page with loading gif image
  3. compare their resources using chrome task manager

here are the results look like css animation is using more CPU,and more memory so basically I want to consult about using css animations, Isn't that too heavy? should I avoid using it in loading cases?

loading example using css animation

loading example using gif image

css loading animation compare to gif loading image

Here is the code for loading with css animation

style

            /* beautiful loading screen */
            #loadingWrap{
                width: 100%;
                height: 100%;
                top: 0px;
                z-index: 250;
                background-color: rgba(255, 255, 255, 0.46);
            }
            .glyphicon.spin {
                font-size: 36px;
                -webkit-animation: spin 1.822s infinite linear;
                -moz-animation: spin 1.822s infinite linear;
                -o-animation: spin 1.822s infinite linear;
                animation: spin 1.822s infinite linear;
                -webkit-transform-origin: 50% 58%;
                transform-origin:50% 58%;
                -ms-transform-origin:50% 58%; /* IE 9 */
                line-height: 0px;
            }

            @-moz-keyframes spin {
                from {    -moz-transform: rotate(0deg);  }
                to {    -moz-transform: rotate(360deg);  }
            }

            @-webkit-keyframes spin {
                from {-webkit-transform: rotate(0deg);}
                to {-webkit-transform: rotate(360deg);}
            }
            @keyframes spin {
                from { transform: rotate(0deg); }
                to {transform: rotate(360deg); }
            }
            #loadingIcon {
                z-index: 10;
                position: absolute;
                right: 20px;
                bottom: 20px;
                line-height: 0px;
            }

html

        <div id="loadingWrap">
            <div id="loadingIcon">
                <i class="glyphicon glyphicon glyphicon-cog spin">Q</i>
            </div>
        </div>

here is the code for loading using simple gif

style

    #loadingWrap{
        width: 100%;
        height: 100%;
        top: 0px;
        z-index: 250;
        background-color: rgba(255, 255, 255, 0.46);
    }
    #loadingIcon {
        z-index: 10;
        position: absolute;
        right: 20px;
        bottom: 20px;
        line-height: 0px;
        background: url(../1-0.gif) no-repeat center center;
        width: 20px;
        height: 20px;
    }

html

    <div id="loadingWrap">
        <div id="loadingIcon">
        </div>
    </div>

controling an img with screen.width

trying to make an img hit the left side of my screen and return to the right. going right to left is super easy but i cant seem to find the left side of my screen for a reference point. using screen.width is there a way to get the left side of the screen? ive tried (screen.width-screen.width) and just guessing screen.width-1920 this is my code for right to left.

if(parseInt(el.style.left) > (screen.availWidth - 100))el.style.left = 0;
if(parseInt(el.style.top) > (screen.height))el.style.top = 0;
el.style.left = parseInt(el.style.left) + rn1 + 'px';
el.style.top = parseInt(el.style.top) + rn2 + 'px';

How to add header in a row of a table

Using bootstrap v3.0.2.

<table class="table data-table table-bordered no-bottom-margin usage-detail-table">
    <thead>
        <tr>
            <th></th>
            <th>Used</th>
            <th>Deleted</th>
            <th>Total</th>
        <tr>
    </thead>
    <tbody>
        <tr>
            <th>{{'update-profile.detail-usage.personal.files' | translate}}</th>
            <td>{{usageDetails.personalDiskUsage | commaSeparatedNumber}} bytes</td>
            <td>{{usageDetails.personalDeletedDiskUsage | commaSeparatedNumber}} bytes</td>
            <td><b>{{usageDetails.totalPersonalUsage | commaSeparatedNumber}} bytes</b></td>
        </tr>
        <tr>
            <th>{{'update-profile.detail-usage.shared.files' | translate}}</th>
            <td>{{usageDetails.sharedDiskUsage | commaSeparatedNumber}} bytes</td>
            <td>{{usageDetails.sharedDeletedDiskUsage | commaSeparatedNumber}} bytes</td>
            <td><b>{{usageDetails.totalDeleted | commaSeparatedNumber}} bytes</b></td>
        </tr>
        <tr>
            <th>Total</th>
            <td><b>{{usageDetails.totalUsed | commaSeparatedNumber}} bytes</b></td>
            <td><b>{{usageDetails.totalDeleted | commaSeparatedNumber}} bytes</b></td>
            <td><b>{{spaceUsed | commaSeparatedNumber}} bytes<br>({{spaceUsed | sizeText}})</br></b></td>
        </tr>
    </tbody>
</table>

Table want to give the first column element the same look as the table header. But <th> tag is not working. How to add row headers here?

These are the additional css class:

.usage-detail-table > tbody > tr > td {
    text-align: right;
    padding-right: 20px;
}

.usage-detail-table > thead > tr > th {
    text-align: right;
    padding-right: 20px;
}

Redirection from a webpage in android webview

So I have this form with me. which I would like to include in my webview.

    <html>
    <head>
    <meta name="viewport" content="user-scalable = yes">

    <link rel="stylesheet" href="assets/css/bootstrap.css">
    </head>
    <body>
           <!--LOGIN FORM -->
    <div class="border" Style="width:100%;max-width:100%;height:100%;">
    <div class="bs-example form-horizontal">
    <div id="msg-info" style="display:none;" ></div>
      <form class="form-horizontal" id="login-user" name="login-user" action='' method="POST">

        <fieldset>

        <div id="legend">

            <legend class="">Reigstered Members Login<span class="text-center">&nbsp;&nbsp;&nbsp;<img id="spinner" src="images/loading.gif" style="display:none;"/></span></legend>

        </div>

        <div class="control-group">

            <!-- Username -->

            <label class="control-label" for="username" style="text-align:left;"><strong>User ID</strong>&nbsp;<small>(It can be Account No, Mobile No or Email)</small></label>

            <div class="controls">

            <input type="text" id="username" name="username" placeholder="" class="form-control">

            </div>

            <!-- Password-->

            <label class="control-label" for="password" style="text-align:left;"><strong>Password</strong></label>

            <div class="controls">

            <input type="password" id="password" name="password" placeholder="" class="form-control">

            </div>

            <label class="control-label" for="password">&nbsp;</label>
            <!-- Button -->

            <div class="controls"> 
                <input type="button" id="login-btn" name="login" class="btn btn-success" value="Login &raquo;" />&nbsp;&nbsp;&nbsp;&nbsp;
            </div>
          </div>  
         </fieldset>
        </form>
      </div>

            <p><font color="red">Note:</font> Those of you who have not yet registerd can register from here, Note you have to update your mobile no with the society so that registration can be completed</p> 


      </div>
    <br><br><br><br>
<script>
$("#login-btn").click(function(){
    validateForm();
});
$("#login-user").keypress(function(event){
    if(event.keyCode == 13  || event.which == 13){
        validateForm();
    }
});
function validateForm(){
    var flag=true;
    if($("#username").val()==''){
        $("#msg-info").addClass("alert alert-danger");
        $("#msg-info").html('Enter valid User ID.');
        $("#msg-info").show("slow");    
        flag=false;
        return false;
    }
    if($("#password").val()==''){   
        $("#msg-info").addClass("alert alert-danger");
        $("#msg-info").html('Enter valid Password.');
        $("#msg-info").show("slow");
        flag=false;
    }
    if(flag){
        $("#msg-info").hide("slow");
        //
        $('#spinner').show();
        jQuery.post('validations/loginStore.php', $('form[name=login-user]').serialize(), function(data) {
            data=JSON.parse(data);
            $("#msg-info").removeClass("alert-danger");
            if(data.update){
                //redirect to secure page
                if(data.role=='admin'){
                    window.open('app/dashboard.php?page=societylist&profile=dash', '_parent');
                } else {
                    window.open('app/dashboard.php?page=home', '_parent');
                }
            } else {
                $("#msg-info").addClass("alert alert-danger");
            }
            if(typeof(data.msg)!='undefined' && data.msg !='' && !data.update){

                    $("#msg-info").html(data.msg);
                }
           $("#msg-info").show();
           $('#spinner').hide();
        });
    }
}
</script>
        </body>
         </head>

This works perfectly fine on the web but when I try to load it in my webview, the redirection does not happen. Any way I can achieve this? I am also posting my android code below. The webview loads fine.. The only issue is with redirection

Android Code

public class LoginActivity extends ActionBarActivity {

WebView myWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    myWebView = (WebView) findViewById(R.id.webView);
    WebSettings webSettings = myWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);

    webSettings.setLoadsImagesAutomatically(true);
    webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);

    myWebView.loadUrl("http://ift.tt/1Jr7JQz");



    myWebView.setWebViewClient(new WebViewClient());
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    // Check if the key event was the Back button and if there's history
    if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.canGoBack()) {
        myWebView.goBack();
        return true;
    }
    // If it wasn't the Back key or there's no web page history, bubble up to the default
    // system behavior (probably exit the activity)
    return super.onKeyDown(keyCode, event);
}

}

Kindly assist me on what I am doing wrong or if I am missing something

How to make a webpage mobile friendly with css media queries

I have added some css media queries but it doesn't seem to make any change, I mean I have added this code

@media screen and (min-width:10px) and (max-width:640px) {
.leftSideBar{display:none !important;}
.rightSideBar{display:none !important;}
}

but the left and right sidebars are still visible i have also tried changing the range of min-width and max-width it still doesn't make any difference, am i missing something here ? do i have to add something more than this in my css to make it work ?

Remove x-axis scroll from website

I have website i.e. onlinecliniq.com There is scroll at x-axis. I have checked complete HTML and found that container below menu i.e usman_content_topb is going outside of and causing the scroll. Can you please help me remove it.

I think problem is due to width:1060px; in internal div i.e. usman_main.

How to keep alignment between two html tables when adding data

I have two tables. When I adding data to the first table, the alignments are crashing. Does anyone have an idea to keep alignment between this two ?!This is an image of my tables.

samedi 27 juin 2015

Make dropdown child 100% of container

I have a dropdown inside a black container of 600px and i would like to have the red childrens show in a width of 100% of container instead of 100% of page width as it happens now. I need this to be in % because the website is responsive.

Please take a look at Jsfiddle Demo

<div id="navcontainer">
    <ul>

        <li>
            <a href="#">Eggs</a>

            <ul>
                <li><a href="">sub menu</a></li>

                <li><a href="">sub menu</a></li>

                <li><a href="">sub menu</a></li>

                <li><a href="">sub menu</a></li>
            </ul>
        </li>
    </ul>
</div>

Load HTML/PHP into div, iframe alternative

I have an html/php page which I want to place into a div, but i'd prefer not to use an iframe. The page relies on a get request to work. Is there any purpose built framework/solution for this type of problem.

Sitemap - Wordpress site on subdomain

Im trying to get a definite answer regarding the issue. I have an html website which contains a Wordpress blog under it in a subdomain as a folder.

I currently have site map on both the html site and the blog itself. Is that the way to go ? I have also noticed that the sitemap on the html site doesn't include any of my pages/posts from the blog, should it include them as well?

Create a custom HTML element which accepts an argument

I was wondering if it would be possible to create a custom HTML element which could be created dynamically via Javascript which could be passed an argument when being created and would store that piece of data.

I'm working with node.js and webkit.

Any help would be appreciated! Thanks!

PHP + Windows 7 + AMPPS: [function.copy]: failed to open stream: No such file or directory

I am new to PHP and AMPPS. I am trying a very simple file upload screen using this example:

http://ift.tt/VrDUcc

  1. The HTML asks user to upload a file.
  2. Then the Action Calls and "uploader.php".
  3. This uploader.php is supposed to move a file from source to target.
  4. file_uploads = On // In PHP INI file
  5. upload_tmp_dir = "C:\Users\t_dutta\Documents\Projects\AMPPS\Domains\test-domain2\tempfiles"
  6. The time stamp of temp directory above does get updated every time I run the HTML form.
  7. In the code, I have pasted various versions of copy function I tried.

HTML Form (form.html) code:

<form action="php/uploader.php" method="post"
                    enctype="multipart/form-data">
<input type="file" name="file" size="50" />
<br />
<input type="submit" value="Upload File" />

PHP Code (uploader.php):

<?php
$file_path = "\\temp";
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
$path = $root . "\\finalfiles\\";
$real_path = realpath($path);

if( $_FILES['file']['name'] != "" )
{    
    echo $_FILES['file']['name'] . "<p></p>";
    echo $_SERVER['DOCUMENT_ROOT'] . "<p></p>";
    echo $real_path . "<p></p>";

//Copy Function 1st Version
copy ($_FILES['file']['name'], $_SERVER["DOCUMENT_ROOT"]) or 
die("<p>Could not copy file!</p>");

//Copy Function 2nd Version
//copy ($_FILES['file']['name'], $root) or 
//     die("<p>Could not copy file!</p>");

//Copy Function 3rd Version
//copy ($_FILES['file']['name'], $path) or 
//     die("<p>Could not copy file!</p>");

//Copy Function 4th Version
//copy ($_FILES['file']['name'],"C:\Users\t_dutta\Documents\Projects\AMPPS\
//Domains\test-domain2\finalfiles") or die("<p>Could not copy file!</p>");

 }
   else
   {
       die("No file specified!");
   }
   ?>
   <html>
   <head>
   <title>Uploading Complete</title>
   </head>
   <body>
   <h2>Uploaded File Info:</h2>
   <ul>
   <li>Sent file: <?php echo $_FILES['file']['name'];  ?>
   <li>File size: <?php echo $_FILES['file']['size'];  ?> bytes
   <li>File type: <?php echo $_FILES['file']['type'];  ?>
   </ul>
   </body>
   </html>

Error Message:

PN.txt
C:/Users/t_dutta/Documents/Projects/AMPPS/Domains/test-domain2
C:\Users\t_dutta\Documents\Projects\AMPPS\Domains\test-domain2\finalfiles

Warning: copy(PN.txt) [function.copy]: failed to open stream: No such file or directory in C:\Users\t_dutta\Documents\Projects\AMPPS\Domains\test-domain2\php\uploader.php on line 13
Could not copy file!

refresh of page within the iframe

I put a ' refresh ' the page to redirect it after 45 seconds. As I do for this page to load only within the iframe? Thanks

<html>
<head>
<title>My title</title>
<meta http-equiv="refresh" content="45;URL=http://otherpage.com.br"> </head> 
</head>
<body>
<div>
<iframe style="border: medium none ; overflow: hidden; width: 800px; height: 300px;" src="page2.html" frameborder="0" scrolling="no"></iframe>
</div>
</body>
</html>

change an objects color after scrolling

hey I what a make a object which can change color after scrolling (down) 100px and change back to default after srolling back (up). Im using this code but not working

JQuary:

$(window).scroll(function() {

//After scrolling 100px from the top...
if ( $(window).scrollTop() >= 100 ) {
$('#menu').css('background', '#fff');

//Otherwise remove inline styles and thereby revert to original stying
} else {
$('#menu').removeAttr('style');

}
});​

and my html:

<header>
<table>
<tr>
<td  id="menu" class="title">
TITLE
</td>
<td style="width:40px;">
<div class=" ico">    
<img src="search.svg" alt="search" style="width: 25px;" />
</div>
</td>
<td style="width: 40px;">
<div class=" ico">
<img src="menu.svg" alt="search" style="width: 25px;"/>
</div>
</td>
</tr>
</table>
</header>
.
.
.
</body>
</html>

How to spilit HTML form into 2 Columns

Currently this is my code.

<table class="table table-bordered">
    <tbody>
        <tr>
            <td>        
            <form name="form" ng-submit="" role="form">
                <div class="form-group">
                    <label for="CustomerName">Customer Name</label>
                    <i class="fa fa-key"></i>
                    <input type="text" name="CustomerName" id="CustomerName" class="form-control" ng-model="CustomerName" required />
                    <span style="color:red" ng-show="form.CustomerName.$dirty && form.CustomerName.$error.required" class="help-block">Customer Name is required</span>
                </div>

                <div class="form-group">
                    <label for="CustomerAddress">Customer Address</label>
                    <i class="fa fa-key"></i>
                    <textarea type="text" name="CustomerAddress" id="CustomerAddress" class="form-control" ng-model="CustomerAddress" rows="4" required ></textarea>
                    <span style="color:red" ng-show="form.CustomerAddress.$dirty && form.CustomerAddress.$error.required" class="help-block">Customer Address is required</span>
                </div>

                <div class="form-group">
                    <label for="CustomerCity">Select City</label>
                    <i class="fa fa-key"></i>
                    <select name="CustomerCity" id="CustomerCity" class="form-control" ng-model="CustomerCity" required>
                        <option value="" ng-selected="selected">-- Select City -- </option>
                        <option value="Chhatarpur">Chhatarpur</option>
                    </select>
                    <span style="color:red" ng-show="form.CustomerCity.$dirty && form.CustomerCity.$error.required" class="help-block">City is required</span>
                </div>

                <div class="form-group">
                    <label for="CustomerMobile">Mobile Number</label>
                    <i class="fa fa-key"></i>
                    <input type="text" name="CustomerMobile" id="CustomerMobile" class="form-control" ng-model="CustomerMobile" maxlength="10" required />
                    <span style="color:red" ng-show="form.CustomerMobile.$dirty && form.CustomerMobile.$error.required" class="help-block">Mobile Number is required</span>
                </div>

                <div class="form-group">
                    <label for="PaymentOption">Payment Option</label>
                    <i class="fa fa-key"></i>
                    <div>
                        <input type="radio" name="myRadio" ng-model="myRadio" value="1" required> Cash on delivery<br />
                        <input type="radio" name="myRadio" ng-model="myRadio" value="2" required> Card on delivery<br />
                    </div>
                </div>

            </form>
            </td>

            <td>
                <div class="form-group">
                    <label for="PaymentOption">Payment Option</label>
                    <i class="fa fa-key"></i>
                    <div>
                        <input type="radio" name="myRadio" ng-model="myRadio" value="1" required>Cash on delivery<br />
                        <input type="radio" name="myRadio" ng-model="myRadio" value="2" required>Card on delivery<br />
                    </div>
                    <span style="color:red" ng-show="form.myRadio.$dirty && form.myRadio.$error.required" class="help-block">Mobile Number is required</span>
                </div>

                <div class="form-actions">
                    <button type="submit" ng-disabled="form.$invalid" class="btn btn-danger">Place order</button>
                </div>

            </td>                       

        </tr>
    </tbody>
</table>

Please note that tag is inside first (i.e.first column). I want to make second column fields also the part of this form.

Where should i move form tag now. i tried putting it just after , but its not working, as i think after first tag should be

I am also ok to use container, row and column classes of twitter bootstarp, but there also the same problem (everything should be inside column class)

Please help me on this.

how to load the information that i typed-in on the same webpage when i click a button in php

I am working in php. I have a form which has a text field and select, option field. I want the information that I type on the text field or that I have chosen on option menu will be load automatically on the same page without loading the particular page.

How to delete the oldest child in Firebase JavaScript?

I want to limit the amount of data in my Firebase app by deleting the oldest child every time a new one is added.

HTML/CSS : Create a side border that is thin at top and thick at bottom (trying to avoid using border images)

I want to create a side panel with a right border that is almost 0px at the top but gradually increases to 5px at the bottom.

I am trying to avoid border images as I want to use least of external resources such as images.

How can I do that. I tried to search a lot for this but couldnot find it. So if somebody can point me to a similar question , that is also helpful.

Below is the link: http://ift.tt/1FI2Fzi

If you notice, the left is a div with a beige color border on left panel at right(left to image) which is having variable length.

angular - using element replace with in directive not removing previous element on update

In my directive i am using custom template. for that reason and my style purpose i am using element.replaceWith() - it works.

But when i update the collection the old elements and the data still exist. In case if i remove the element.replaceWidth() method it all works fine.

How can i use element.replaceWith() in the directive as well update the new collection?

code snippet:

  element.html(getTemplate(scope.value, scope.index));
  $compile(element.contents())(scope);
  element.replaceWith(element.contents()); //using this old elements exist.

In my demo, please click on next button to load new collection.

Demo

Why I can't pass angularJS paramater on onClick html event?

I'm trying to concat a string with a AngularJS expression in html. See the example above:

angular.module("app", []);
function MyCtrl($scope){
    $scope.item = "Hello";
    $scope.say = function(text){
        alert(text);
    };
}
<script src="http://ift.tt/1oMJErh"></script>
<script src="http://ift.tt/1mQ03rn"></script>
<script>
    function openFunctionJS(param){
        alert(param);
    };
</script>
<div ng-app="app" ng-controller="MyCtrl">
    <a ng-click="say(item + ' World')">Say {{item}} World by ngclick</a><br/>
    <a onclick="openFunctionJS('{{item}}')">Say {{item}} World by onclick</a>
</div>

http://ift.tt/1GIE7rR

But it doesn't work. My entire function is in JavaScript and I don't want to change it right now if possible.

What am I doing wrong?

Javascript (mouseover mouseleave) html elements not returning

so I'm new to frontend and JavaScript, coming from Rails but I'm working on a project for class and I'm having some trouble. Its a spotify clone, so far at this moment we're using just plain old JS. And I've been following along as such.

We're adding a play button so when you hover over a table row a play button appears where the track number exists and when your mouse leaves the row, the play button disappears but the track number does not reappear.

This is the main issue so far.

The next issue is when I run the console along side the browser window and hover over a row, I get the following error:

Uncaught TypeError: Cannot set property 'innerHTML' of null

Below the //The problem is occurring here comment is where I think the issue is occuring but I've included the rest of the file just incase you need to see.


album.js

//Example Album
var albumPicasso = {
    name: 'The Colors',
    artist: 'Pablo Picasso',
    label: 'Cubism',
    year: '1881',
    albumArtUrl: '/assets/images/album_covers/01.png',
    songs: [
        { name: 'Blue', length: '4:26' },
        { name: 'Green', length: '3:14' },
        { name: 'Red', length: '5:01' },
        { name: 'Pink', length: '3:21' },
        { name: 'Magenta', length: '2:15' }
    ]
};

//Another Example Album
var albumMarconi = {
    name: 'The Telephone',
    artist: 'Guglielmo Marconi',
    label: 'EM',
    year: '1909',
    albumArtUrl: '/assets/images/album_covers/20.png',
    songs: [
        { name: 'Hello, Operator?', length: '1:01' },
        { name: 'Ring, ring, ring', length: '5:01' },
        { name: 'Fits in your pocket', length: '3:21' },
        { name: 'Can you hear me now?', length: '3:14' },
        { name: 'Wrong phone number', length: '2:15' }
    ]
};

var createSongRow = function (songNumber, songName, songLength) {

    var template =
        '<tr class="album-view-song-item">' +
        '   <td class="song-item-number" data-song-number="' + songNumber + '">' + songNumber + '</td>' +
        '   <td class="song-item-title">' + songName + '</td>' +
        '   <td class="song-item-duration">' + songLength + '</td>' +
        '</tr>'
    ;
    return template;
};

var setCurrentAlbum = function(album) {

    // #1
    var albumTitle = document.getElementsByClassName('album-view-title')[0];
    var albumArtist = document.getElementsByClassName('album-view-artist')[0];
    var albumReleaseInfo = document.getElementsByClassName('album-view-release-info')[0];
    var albumImage = document.getElementsByClassName('album-cover-art')[0];
    var albumSongList = document.getElementsByClassName('album-view-song-list')[0];

    // #2
    albumTitle.firstChild.nodeValue = album.name;
    albumArtist.firstChild.nodeValue = album.artist;
    albumReleaseInfo.firstChild.nodeValue = album.year + ' ' + album.label;
    albumImage.setAttribute('src', album.albumArtUrl);

    // #3
    albumSongList.innerHTML = 
        '<thead>' +
            '<tr>' +
                '<th class="table-head-aligner">#</th>' +
                '<th class="table-head-aligner">Title</th>' +
                '<th class="table-head-aligner">Duration</th>' +
            '</tr>' +
        '<thead>'
    ;
    // #4
    for (var i = 0; i < album.songs.length; i++) {
        albumSongList.innerHTML += createSongRow(i + 1, album.songs[i].name, album.songs[i].length);
    }
};

var songListContainer = document.getElementsByClassName('album-view-song-list')[0];
var songRows = document.getElementsByClassName('album-view-song-item');
var playButtonTemplate = '<a class="album-song-button"><span class="ion-play"></span>'


//The problem is occurring in here somewhere
window.onload = function() {
    setCurrentAlbum(albumPicasso);

    songListContainer.addEventListener('mouseover', function(event) {
        if (event.target.parentElement.className === 'album-view-song-item'); {
            event.target.parentElement.querySelector('.song-item-number').innerHTML = playButtonTemplate;
        } 
    });

    for (var i = 0; i < songRows.length; i++) {
        songRows[i].addEventListener('mouseleave', function(event) {
           this.children[0].innerHTML = this.children[0].getAttribute('.song-item-number');
        });
    }
};


album.html

<!DOCTYPE html>
<html>
    <head>
        <title>Bloc Jams</title>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" type="text/css" href="http://ift.tt/1GIE5QB">
        <link rel="stylesheet" type="text/css" href="http://ift.tt/1G498Ii">
        <link rel="stylesheet" type="text/css" href="styles/normalize.css">
        <link rel="stylesheet" type="text/css" href="styles/main.css">
        <link rel="stylesheet" type="text/css" href="styles/album.css">
    </head>
    <body class="album">
        <!-- nav bar -->
        <nav class="navbar">
            <a href="index.html" class="logo">
                <img src="assets/images/blocjams.png" alt="bloc jams logo"/>
            </a>
            <div class="links-container">
                 <a href="collection.html" class="navbar-link">collection</a>
            </div>
        </nav>

        <main class="album-view container narrow">
            <section class="clearfix">
                <div class="column half">
                    <img src="assets/images/album_covers/01.png" class="album-cover-art"/>
                </div>
                <div class="album-view-details column half">
                    <h2 class="album-view-title">The Colors</h2>
                    <h3 class="album-view-artist">Pablo Picasso</h3>
                    <h5 class="album-view-release-info">1909 Spanish Mountains</h5>
                </div>
                <table class="album-view-song-list">

                </table>
            </section>
        </main>
        <script src="scripts/album.js"></script>
    </body>
</html>

browse ftp file in firefox browser linux

I want to set users upload file to my server in browser. I use <input type="file" /> for upload file.

some of my users want to upload file from ftp server to my server. in windows this users can set ftp URL in address bar and select file to upload. but Linux users can't upload file from ftp with file browse.

so how can my Linux users upload files from ftp to my server with input HTML tag? or how can my Linux users access ftp from file browser? Not that my users use Firefox.

html center positioning of two divs

Is there a better way to positioning the to tables in the middle?

Code: http://ift.tt/1HnLY3z

#layout {
  display: table;
  margin: 40px auto;
}

#tetrisfield, #nextstone {
  border-collapse: separate;
  border: 10px solid gray;
}

#nextstone {
    margin-bottom: 150px;
}

html,body {
  margin: 0px;
  height: 100%;
  color: white;
  background-color: black;
  text-align: center;
}

#tetrisfield td, #nextstone td {
    width: 23px;
    height: 23px;
    background-color: rgba(255, 255, 255, 0.1);
}

Currently I insert the tables in another centered table. My problem is - if I work with position relative or absolute and want to resize the window, the tables overlaped.

Centering two elements responsively with definite gap

For a particular layout that I am creating, I am required to center two elements horizontally in a div as though they were a single element as shown in this image.

http://ift.tt/1dq03Q0

Between these two, I also need to have a gap (as shown above) that remains definite even the the browser window width changes.

What would be the best way to do this with css?

I tried doing this floats inside the div but could not get the gap between the elements to be the same responsively.

I have also done some research online but in vain.

Any help would be appreciated.

PHP included HTML relative path of external JS & CSS

I am trying to use PHP to read, then modify and echo an HTML file.

The included HTML file contains external JS, CSS references - all relative paths

for example...

<script src="js/myJavascript.js"></script>

Problem : The location of the PHP modifier file is not the same as the location of the included HTML file, and therefore the external includes are not loaded. I guess...

The solution of using absolute paths to reference external resources in the HTML file is not ideal to say the least...

What can be done to tell PHP that the path context of the included HTML file is the same as the directory from which it is being included and NOT the directory of the modifier file?

Thanks!

CSS unordered list indent space to the left and right

Basically I have navigation bar inside my "main" div, and its indented to the left.

enter image description here

I cannot figure out where does this indentation come from, I tried padding/margin 0, padding-left/margin-left 0 but still nothing, It won't move even one inch!

I even tried mozilla firebug inspector to try to find out if I selected it right, basically no solution.

And here is html/css file if someone would have time to take a sneaky-beaky onto HTML code:

body {
  background-color: #000;
  color: white;
}

/* Style for tabs */
#main {
  color: 111;
  width: 600px;
  margin: 8px auto;
}

#main > li, #main > ul > li
{ list-style:none; float:left; }

#main ul a {
  display:block;
  padding:6px 10px;
  text-decoration:none!important;
  margin:1px 1px 1px 0;
  color:#FFF;
  background:#444;
}

#main ul a:hover {
  color:#FFF;
  background:#111;
}

#main ul a.selected {
  margin-bottom:0;
  color:#000;
  background:snow;
  border-bottom:1px solid snow;
  cursor:default;
}

#main div {
  padding:10px 10px 8px 10px;
  *padding-top:3px;
  *margin-top:-15px;
  clear:left;
  background:snow;
  height: 300px ;
}

#main div a {
  color:#000; font-weight:bold;
}
#male, #female, #all, #new {
  color: black;
}
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>2015 Race Finishers</title>
    <meta charset="utf-8">
    <link rel="stylesheet" href="my_style.css">
  </head>
  <body>
    <header>
      <h2>2015 Race Finishers</h2>
    </header>
    <div id="main">
      <ul class="idTabs">
        <li><a href="#male">Male Finishers</a></li>
        <li><a href="#female">Female Finishers</a></li>
        <li><a href="#all">All Finishers</a></li>
        <li><a href="#new">Add New Finishers</a></li>
      </ul>
      <div id="male">
        <h4>Male Finishers</h4>
        <ul id="finishers_m"></ul>
      </div>
      <div id="female">
        <h4>Female Finishers</h4>
        <ul id="finishers_f"></ul>
      </div>
      <div id="all">
        <h4>All Finishers</h4>
        <ul id="finishers_all"></ul>
      </div>
      <div id="new">
        <h4>Add New Finisher</h4>
        <form id="addRunner" name="addRunner" action="service.php" method="POST">
          First Name: <input type="text" name="txtFirstName" id="txtFirstName" /> <br>
          Last Name: <input type="text" name="txtLastName" id="txtLastName" /> <br>
          Gender: <select id="ddlGender" name="ddlGender">
          <option value="">--Please Select--</option>
          <option value="f">Female</option>
          <option value="m">Male</option>
          </select><br>
          Finish Time:
          <input type="text" name="txtMinutes" id="txtMinutes" size="10" maxlength="2" />(Minutes)
          <input type="text" name="txtSeconds" id="txtSeconds" size="10" maxlength="2" />(Seconds)
          <br><br>
          <button type="submit" name="btnSave" id="btnSave">Add Runner</button>
          <input type="hidden" name="action" value="addRunner" id="action">
        </form>
      </div>

    </div>
    <footer>
      <h4>Congratulations to all our finishers!</h4>
      <br>Last Updated: <div id="updatedTime"></div>
    </footer>
    <script src="scripts/jquery-1.6.2.min.js"></script>
    <script src="scripts/my_scripts.js"></script>
    <script src="scripts/jquery.idTabs.min.js"></script>
  </body>
</html>

This is just for learning purpose, but I would really love if I could somehow solve this problem, biggest thing is that I have no clue where does it come from.

Collapsing navbar content margin - span class bars

I have been working on this navbar template for a few days. Almost done, but it is not just as I wanted. Navbar is working fine, but how can I overcome spaces on four sides: 3px on the left (most probably 1px border+1px space+1px border) 10px on top, 10 px bottom, 33px on the right. Can you help me overcome them?

Second, Span class bars are not showing, the same code works on another page? What am I missing?

Here is the example of my template:

http://ift.tt/1RHZ6QD

DIV Expanding Unexpectedly

I have a small problem with some of my code right now. I'm currently creating a navigation bar for a web page. Kind of like those that run across horizontaly across the screen. But my problem is that my navigation bar apparently has a really large height, disabling access to the content below it.

HTML:

<html>
    <head> head.... <head>
    <body>
    <div id="nav_bar><ul><li><div class="nav_box"></div></li>..More LIs...</div>
    </body>
</html>

nav_bar is positioned absolute with a top value. nav_box is usually hidden, and expands using css when hovered over a li. If you need anything, just comment. Thanks!

PHP Not Inserting Content in mySQL Database: Text, Images, Anything

So here is my dilemna that I've been reviewing and trying to break through for the last few days. I've created a basic login/register PHP system, which works fine. I've implemented a blog system that displays posts. I've written an add post function which does not post to the database, and it doesn't throw back an error function either.

I don't really understand because my register system works and adds new users, but the 'add blog post' does nothing. I can add from the database and it displays fine, but nothing here.

<?php
    error_reporting(E_ALL & ~E_NOTICE);
    session_start();

    if (isset($_SESSION['id'])) {

        $userId = $_SESSION['id'];
        $username = $_SESSION['username'];
    } else {
        header('Location: login.php');
        die();
    }

    if ($_POST['submit']) { 
        $title = strip_tags($_POST['title']);
        $subtitle = strip_tags($_POST['subtitle']);
        $content = strip_tags($_POST['content']);

        mysqli_query($dbCon, $userREQ3);
        $userREQ3 = " INSERT INTO `logindb`.`blog` 
        (`title`, `subtitle`, `content`) VALUES ('$title','$subtitle','$content')";

    }
?>

<!DOCTYPE html>
 <html>

   <head>

   </head>

   <body>
     Welcome, <?php echo $username; ?>, You are logged in. Your user id is <?php echo $userId; ?>.

    <a href="index.php">Index</a>
    <form action="logout.php">
        <input type="submit" value="Log me out!">
    </form>

    <form method="post" action="admin.php">
        Title: <input type="text" name="title"/><br>
        Subtitle: <input type="text" name="subtitle"/><br>
        <br>
        <br>
        Content: <textarea name="content"></textarea>
        <input type="submit" value="Write Post"/>
    </form>

   </body>
</html>

SVG or DIVS? Creating iOS 7 photo collections using web technologies

I have reached to a point in a project where I need to build something like (introduced in) iOS 7 photo collections, in which an array of photos is displayed and you can hover over any one of them to view the full size image.

Something like this enter image description here

Looking through the webs I found this site Selfie City. That uses a similar technique in the graphs located at the bottom half of the page. On looking through their source code I discovered the effect was created in svg. I can recreate the same effect using divs but not SVGs.

Is there any advantage in using SVGs over divs for this effect? Will having a number of divs (100 in my case) effect the page's performance i.e. slow it down?

P.S : If someone can link me to a plugin or library that can be used to recreate this effect, it would be great. I have been looking but not quite found one yet.

How can I get special links from text in Android

I am having a problem getting the information of linked text in text message.
I was able to read sms messages by accessing content://sms/inbox and then access proper (in this case, body) column. But body contains plain text of the message, no information about the link.
For instance, if I have a text message like: call me HERE, which HERE is internally linked to phone number, is there anyway to find that HERE is internally linked and also the link for that? In other words, how can I get a information like call me <a href="tel:12345">HERE</a>

What software or IDE should I use to design front-end of a website?

I have a knowledge of HTML, CSS and Javascript. It is difficult to design website on Notepad++, and I think Dreamweaver is for beginners. Tell me how professional designers work? How websites like Facebook, Twitter are Designed?

Note: I am not talking about static website. I want to design dynamic website with PHP.

Anyone could change this for me? Rating system css from "high to low" to "low to high"

currently I want to use this rating system from http://ift.tt/1ebTRMj . But currently it works when you hover from right to left. Feel free to try it out in the link given. But I wanted to have a rating system which hovers from left to right.

I do not have any basic knowledge on css. Any answers would be very appreciated. Thank you.

&:hover {
    //Apply styles to this and all subsequent radio buttons
    /*  This is the reason why it has to go from high-to-low
        In CSS4, we should be able to use !, which will select
        up the DOM (select elements _before_ this one)  */
    &:before, ~:before {
      transition:none;
      background:#2ecc71;
      box-shadow:inset 0 0 4px rgba(0,0,0,0.4);
    }
  }

JQuery not working in seperate .js file

I'm having an issue with my JQuery code.

When I add this code in script tags on my HTML file, it will work, however when I place it in a separate js file, it will not work. I know it's not an issue with referencing the correct file name and location.

Here is my code:

//Populate date select options
var num = [i];
var by = '<option value="2009">2009</option>'
var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var lst = "";
var lst1 = "";
var lst2 = "";
var i;
for (i = 1; i <= 12; i++) {
    lst = lst + '<option value="' + i + '">' + months[i-1] + '</option>';
} 
for (i = 1; i <= 31; i++) {
    num.push(i);
    lst1 = lst1 + '<option value="' + i + '">' + num[i] + '</option>';
}
for (i = 10; i <= 30; i++) {
    num.push(i);
    lst2 = lst2 + '<option value="20' + i + '">20' + num[i] + '</option>';
}
$(document).ready(function(){
    $("#month").html(lst);
});
$(document).ready(function(){
    $("#day").html(lst1);
});
$(document).ready(function(){
    $("#year").html(by + lst2);
});

Thanks for reading!

Table column are not getting divided from center

This is how my page looks like.

enter image description here

This is code for same.

<table class="table table-bordered">
    <tbody>
        <tr>
            <td>
                <h4>Name & address</h4> 
                <div class="Name">
                    <input ng-model="Name" type="text" placeholder="Name" class="form-control"/>
                </div>              

                <div class="Name">
                    <textarea class="form-control" ng-model="Address" placeholder="Address.." rows="4"></textarea>
                </div>

                <div class="Name">
                    <select ng-init="City=Chhatarpur" ng-model="City" class="form-control">
                        <option value="" ng-selected="selected">City</option>
                        <option value="Chhatarpur" ng-selected="selected">Chhatarpur</option>
                    </select>
                </div>

                <div class="Name">
                    <!--<input  type="text" value="+91" class="form-control" size="2" disabled/>-->
                    <input  ng-model="Mobile" type="text" placeholder="Mobile Number" class="form-control" maxlength="10"/>
                </div>  
            </td>

            <td>
                <h4>Date/time of delivery</h4>
                <div ng-if="(CurrentHour>=18 && CurrentHour<24) || (CurrentHour>=1 && CurrentHour<9)" >
                    <input type="radio" ng-model="order.delivery" value="5"> Tomorrow (09:00-12:00) <br/>
                    <input type="radio" ng-model="order.delivery" value="6"> Tomorrow (12:00-15:00) <br/>
                    <input type="radio" ng-model="order.delivery" value="7"> Tomorrow (15:00-18:00) <br/>
                    <input type="radio" ng-model="order.delivery" value="8"> Tomorrow (18:00-21:00) 
                </div>


                <h4>Payment option </h4>
                <input type="radio" ng-model="order.payment" value="Cash on delivery"> Cash on delivery <br/>
                <input type="radio" ng-model="order.payment" value="Card on delivery"> Card on delivery
                <button style="margin-top:20px;" type="button" class="btn btn-lg btn-primary btn-block" ng-click="">Place order</button>
            </td>
        </tr>
    </tbody>
</table>

It looks like left column taking more width than right one. I want both columns should use 50% of screen width.

What is wrong here. Can some-one please help.

Checking ALL links within links from a source HTML, Python

Struggling with my code right now. I'm going to try my best to get the description across.

My code is to search a Link passed in the command prompt, get the HTML code for the webpage at the Link, search the HTML code for links on the webpage, and then repeat these steps for the links found. I hope that is clear.

It should print out any links that cause errors.

Some more needed info:

The max visits it can do is 100, the code should be compilable on linux machines. If a website has an error, a None value is returned. Python3 is what I am using

eg) s = readwebpage(url)... This line of code gets the HTML code for the link(url) passed in its argument.... if the link has an error, s = None.

In the pictures provided below, when the command..

python3 VisitURL.py **http://ift.tt/1HnD0l1

I put ** around http:// because I can't post more than 2 links hehe

is passed in terminal, this is the output of the code.

The HTML code for that website has links that end in p2.html, p3.html, p4.html, and p5.html on its webpage. My code reads all of these, but it does not visit these links individually to search for more links. If it did this, it should search through these links and find a link that ends in p10.html, and then it should report that the link ending with p10.html has errors. Obviously it doesn't do that at the moment, and it's giving me a hard time.

My code that needs help

Please help :)

HTML frame issues and dilemma

Background: We need to use a frame in the front end of our application.

Problem:

  1. The tag frameset and frame doesn't work. Weird thing is if we try this in a plain html file, it works but when we do it in a jsp file, it doesn't.

  2. We tried using iframe instead but with this, we cannot remove the scrollbars at the side.

Can anyone help? are there better alternatives?

by the way, the browser requirements in our application: the minimum requirement is IE6 (yeah i know we no longer shouldn't be using this because its old and phased out but that is what our client wants)

That is all. Thanks :-)

Any performance difference between window.myObject.myProperty and myObject.myProperty

When creating a global object in a <script> tag in HTML, it's my understanding that the global object is put into the DOM object window. But to reference the global object, you don't need to explicitly use window. as a prefix.

<script>
  myGlobalObject = {};
  myGlobalObject.myProperty = "testing";
  window.myGlobalObject.myProperty2 = "testing2";

  //get value from global
  var retrievedValue = myGlobalObject.myProperty;
  //get another value
  var anotherVal = window.myGlobalObject.myProperty2;
</script>

I think that I also read somewhere that the browser will first look through the window object, and it will match anything with the same name? So, I guess using window. becomes immaterial? Just looking for a definitive clarification. Obviously, it's more typing to add window. to everything. Is there any downside to NOT prefixing a global object with window.?

Session_start function not starting properly

I'm trying to use the session_start() function to write a login system using PHP. However, the document I am initializing my session in has the session_start(); on the top of it. I've made sure that nothing is being sent as headers by the document before the session_start(); is processed. However, the error:

Cannot send session cache limit - headers already sent..

is still persisting.

<?php session_start(); ?> // The very beginning of my document



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://ift.tt/kkyg93">

<html xmlns="http://ift.tt/lH0Osb">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>WorldOfConquer - WoC</title>
<link rel="SHORTCUT ICON" href="Style/favicon.ico">

<meta name="description" content=" WorldOfConquer - WoC, The best classic 1.0 server.">
<meta name="keywords" content="WorldOfConquer - WoC, The best classic 1.0   server.">

    <meta http-equiv="ROBOTS" content="INDEX,FOLLOW">
    <meta name="ROBOTS" content="INDEX,FOLLOW"> 
    <meta name="REVISIT-AFTER" content="2 days">
    <meta name="Author" content="Laviniu">
    <meta name="LANGUAGE" content="EN">
    <meta name="AUDIENCE" content="ALL">
    <link href="Style/index.css" type="text/css" rel="stylesheet">

How I initialize my session :

$rows = mysql_num_rows($query);
if ($rows == 1) {
$_SESSION['login_user']=$username;
echo "You have successfuly logged on!";

Google Maps v3: plot different sets of markers

I am trying to plot on a google map a set of fixed markers and a marker for the user position. For these two sets of markers I would like to use a different image for the marker, however something weird is happening: when loading the page, the "fixed" markers get plotted properly but then immediately one disappears (the last one in the array) and then the user position shows up. In addition, the first fixed location gets the user location marker image, and the user positioning marker gets the image of the fixed markers. Ideally, the locations in the array will be plotted entirely (all 4) and with red_dot.png image on the marker, and the user positioning with the bluedot_retina.png on the marker.

It's really strange and I am struggling figuring out what is the root cause. Appreciate any help with this issue. thanks!

<script>

      var locations = [
            ['location a', 37.60756088, -122.42793323],
            ['location b', 37.759736, -122.426957],
            ['location c', 37.752950, -122.438458],
             ['location d', 37.763128, -122.457942]
          ];
      var map;
      var i;
      var marker;
      var google_lat = 37.757996;
      var google_long = -122.404479;
      var myLatlng = new google.maps.LatLng(google_lat, google_long);

      //google.maps.visualRefresh = true;  

      function initialize() {

        var mapOptions = {
          zoom: 12,
          center: myLatlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);

        var image = new google.maps.MarkerImage(
          'images/bluedot_retina.png',
          null, // size
          null, // origin
          new google.maps.Point( 8, 8 ), // anchor (move to center of marker)
          new google.maps.Size( 17, 17 ) // scaled size (required for Retina display icon)
       );

        marker = new google.maps.Marker({
              flat: true,
              position: myLatlng,
              icon: image,
              optimized: false,
              map: map,
              visible: true,
              title: 'I might be here'
        });

        setMarkers(map, locations);
      } //initialize();

      var image_dot = new google.maps.MarkerImage(
          'images/red_dot.png',
          null, // size
          null, // origin
          new google.maps.Point( 8, 8 ), // anchor (move to center of marker)
          new google.maps.Size( 8, 8 ) // scaled size (required for Retina display icon)
      );

      function setMarkers(map, locations) {

          for (var i = 0; i < locations.length; i++) {
          var beach = locations[i];
          var myLatLng1 = new google.maps.LatLng(beach[1], beach[2]);
          marker = new google.maps.Marker({
            position: myLatLng1,
            icon: image_dot,
            map: map
          });
        }
      }

      google.maps.event.addDomListener(window, 'load', initialize);

</script>

<script type="text/javascript">

        var Tdata;

        $.ajax({
                method : "GET",
                url: "get_location.php",
                success : function(data){
                    Tdata=JSON.parse(data);
                   // console.log(data.lat);
                    console.log(Tdata.lat);
                    myFunction();
                }
        });

        function myFunction(){
                var interval = setInterval(function() { 
                    $.get("get_location.php", function(Tdata) {
                        var JsonObject= JSON.parse(Tdata);
                        google_lat = JsonObject.lat;
                        google_long = JsonObject.long;
                        console.log(google_lat, google_long);  
                        // $('#data').html('google_lat, google_long');
                        myLatlng = new google.maps.LatLng(google_lat, google_long);
                        marker.setPosition(myLatlng);
                        map.setCenter(myLatlng);
                    });
                }, 1000);
        }

</script>

Color style property not applying in div, in Joomla

[Last update: what seems the problem to be: 'color' style property is not inherited inside 'div p' in joomla2.5.]

The red color is not applying:

<div style="color:red;">
<p>paragraph</p>
</div>

Instead, this works:

<div style="color:red;">
paragraph
</div>

Problem only in Joomla2.5. The same code works in plain text files. Why this mess? Makes you feel very unsafe.

JQuery Button Data Returning As Null?

I have a button and when I click it, I want the html object (aka button) to be passed as a parameter to another javascript function. I want the javascript function to print the data-hi from the element in the button.

HTML BUTTON

<button type = "button" onclick = "whoIsRdns(this)" class="dns-information btn btn-xs btn-info pull-right" data-toggle="modal" data-target = "#whois_rdns_modal" data-path="{{ path( '_who_is_rdns', { 'peer': peer.number, 'ip': peer.mac } ) }}" data-hi = "hi2">
<i class="icon-search"></i>
</button>

JS FUNCTION(W/ JQUERY)

    function whoIsRdns(thisButton){

    //Enable jQuery properties from the param of the HTML object
        var btn = $(thisButton);

        var test = btn.data('hi');
        console.log('Value is ' + test);

}

Why would test return as null?

Change background color from input

I'm using angular. I have a input that looks like:

<input class="form-control" type="text" ng-model="newBook.color">

basically when this is changed, I want a div's background color to be changed.

My controller has some lines that look like:

$scope.newBook = {};
$scope.newBook.color = "";

$scope.color = ->
  return "background-color: " + $scope.newBook.color;

and then the div I want to change:

<div ng-style="{{color()}}"></div>

However, I get the error: Error: [$parse:syntax] Syntax Error: Token ':' is an unexpected token at column 17 of the expression [background-color:]

Can I merge these two CSS terms together?

I'm wondering if it's possible to merge the following two features of my .css together, making it less clogged and unprofessional.

.trl {
    display: flex;
    justify-content: center;
}

.trl > a {
    margin: 0 25;
}   

My attempts resulted with the content being displayed at the default left of the page. Thanks in advance,

-Tysuna.