AleMonteiro 238 Can I pick my title?

Yes, you should use WebBrowser, and the post that clicks the button would help you, because you need to type the text and then click the button, right?

AleMonteiro 238 Can I pick my title?

You need help with the code or with the logic of the optimization?

Maybe if you explain the logic somebody can help with the code.

AleMonteiro 238 Can I pick my title?

You could:

  1. Make the height of the frame smaller
  2. Make the header fixed or absolute so it will on top of the frame
  3. Plan your interface with carefullness
AleMonteiro 238 Can I pick my title?

Yes, it's possible. If not handled properly many input text accept the <script> tag.
Then that JS is saved on the DB and when the signature is displayed the javascript could be executed also(again, if not properly handled by the developer).

This is called XSS (Cross Site Scripting).

A simple example:

<div>
<h2>My Signature Yeah!</h2>
<script type="text/javascript">
alert('My script was saved on the DB and now it'll be executed every time my signature is displayed');
</script>
</div>
AleMonteiro 238 Can I pick my title?

Whats the action on your <form> element?

AleMonteiro 238 Can I pick my title?

I think this can help you: https://css-tricks.com/capturing-all-events/

But if you're really a noob in JavaScript, you should first learn how JS works before trying to do those "hardcore stuff".

AleMonteiro 238 Can I pick my title?

Hi darren, can you be a little more specific? What vars are undefined/null? What browser are you using?

Anyway, you should check if cssSheets, rules, and rule are defined.
I think that this function run on a page without CSS files, or with a file without rules would throw errors, but I did not test it.

AleMonteiro 238 Can I pick my title?

You can do it by seaching rules inside the css sheets.
I took some time to play with this:

<html>
    <style type="text/css">
        body {
            background: "#F00";
            background-image: url(http:\\teste.png);
            color: #FFF;
            font-weight: bold;
        }
    </style>
    <body>
        <script type="text/javascript">
        var seachHttp = function () {
            var cssSheets = document.styleSheets, // Loaded CSS Sheets
                i =0, il = cssSheets.length, // Counter and limit for sheets
                j, jl, rules, rule, // Counter and vars for Rules inside a Sheet
                stylesToSearch = [ // Properties to Seach HTTP ON
                    'background',
                    'background-image',
                ],
                k, kl=stylesToSearch.length, // Counter for properties
                s, // Current Property
                v // Current Value;


            for(;i<il;i++) { // Loop Sheets
                rules = cssSheets[i].rules || cssSheets[i].cssRules;
                for(j=0,jl=rules.length;j<jl;j++) { // Loop Rules
                    rule = rules[j];
                    for(k=0;k<kl;k++){ // Loop Styles
                        s = stylesToSearch[k]; 
                        v = rule.style[s]; // Get Value from Current Style
                        if (  v !== undefined && v.toString().toLowerCase().indexOf("http") > -1 ) { // Seach for HTTP Content
                            alert("Found HTTP at " + rule.selectorText + " " + s + " = " + rule.style[s]);
                        }   
                    }
                }
            }
        }

        seachHttp();
        </script>
    </body>
</html>

Notes: IE alerts two times(one for background and another for background-image); FF and GC alert only for background-image;

AleMonteiro 238 Can I pick my title?

But you see Jim, unsupported by facts is very far from "junk". Isn't it?

When Galileu said that the Earth moved arround the sun(and not the other way arround) it was an alternative view, that got him killed, but in any case, he was right. His alternative science latter became the "real" science.

A example about alternative medicine would be Acunpunture: an estern medicine that until today is called as alternative medicine by some people, but there's a lot of scientific studies that prove the healing factor of it.

From thefreedictionary.com

Alternative(just some of the options):

2.
    a. Existing outside traditional or established institutions or systems: an alternative lifestyle; alternative energy.
    b. Espousing or reflecting values that are different from those of the establishment or mainstream: an alternative newspaper.

People, at least in Brazil, usually refer to "alternative medicine" for anything that isn't done by an graduated doctor, but medicine is much greater than that.

From thefreedictionary.com

Medicine:

1.
  a. The science and art of diagnosing and treating disease or injury and maintaining health.
  b. The branch of this science encompassing treatment by drugs, diet, exercise, and other nonsurgical means.
  2. The practice of medicine.
  3. A substance, especially a drug, used to treat the signs and symptoms of a disease, condition, or injury.
  4. Something that serves as a remedy or corrective: medicine for rebuilding the economy; measures that were harsh medicine.
  5.
    a. Shamanistic practices or beliefs, especially among Native Americans.
    b. Something, such as a ritual …
AleMonteiro 238 Can I pick my title?

First of all, if you have an CustomerId, you should use equals instead of like. If you use Like you can ending with the wrong customer.
Like this:

WHERE (CustomerID = '" + CustomerID+ "')

Now for the part that doesn't work. On your second query you are not setting the CustomerId nor the Name on your sql string. And you're also using a connection named con that doesn't exists.

You could try like this:

SqlCommand cmd = new SqlCommand(@"insert into finalTable (AccountNumber, CustomerName) VALUES ('" + CustomerId + "', '" + Name + "' )", con1);
cmd.ExecuteNonQuery();

Or you could use a more elegant way with SQL Parameters: http://www.dotnetperls.com/sqlparameter

AleMonteiro 238 Can I pick my title?

"It doesn't matter, the customer wants like this!" - This drives me crazy!

I just disagree with the "Alternative"... In many contexts alternative is just used to distinguish from the mainstream version of something. Like alternative society... all alternative society are junk? The same occurs with medicine, alternative medicine is much used to refer to estern medicine, that isn't known or mainstream on the western society.
If anyone think that anything that isn't mainstream is 'junk', I'd suggest reading a little more.
I'm very skeptical and never trust anything that the mainstream media, or any other, tries to push down my throat.

By the way, if anybody would like to listen to one of the greatest artist from Brazil: Raul Seixas - Sociedade Alternativa

AleMonteiro 238 Can I pick my title?

What happens when you change the selected value on izvestajSelect? Does it call the ajaxIzvestaj function?

AleMonteiro 238 Can I pick my title?

If you want to pass the result of the first ajax to the second, you should do something like:

xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        var firstResult = xmlhttp.responseText;
        document.getElementById("opcije").innerHTML = firstResult;
        //call the function that will make the next request
        ajaxIvestaj(firstResult);
    }
}

About the $table var, I couldn't fint it anywhere in your code.

AleMonteiro 238 Can I pick my title?

Hi filipgothic, when you get the result from the first request, just call the second one, simple as this:

xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        document.getElementById("opcije").innerHTML = xmlhttp.responseText;

        //call the function that will make the next request
        ajaxIvestaj();

    }
}
AleMonteiro 238 Can I pick my title?

I really didn't understand how you got it to work, but I'm glad you did =)

berserk commented: thank you for the support :) +2
AleMonteiro 238 Can I pick my title?

The correct MIME type is

application/x-bittorrent

http://x-bittorrent.mime-application.com/

AleMonteiro 238 Can I pick my title?

Oh, sorry, I forgot this thread... did you fix the problem?

And I was wrong... ViewState only store the values for the dynamic controls, but it does not regenerate those controls.

You'll have to store each added row somewhere(DB, Session, file and etc) and then create those rows at Page_Load. Something like:

if ( IsPostBack ) {
    AddStoredTableRows();
}
AleMonteiro 238 Can I pick my title?

Glad you like it ^^

I had a few JS pages for testing performance of loops and closures that I'd like to share... but I can't find them! =x I'm not that well organized.

AleMonteiro 238 Can I pick my title?

You're welcome.
Just mark as solved if it is =)

AleMonteiro 238 Can I pick my title?

It's hard to solve a problem that you can't see for your self. Each time you try some fix you ask your users to test it for you?

I'd suggest trying to reproduce the problem first. If you see the problem it's easy to test various alternatives.

Anyway, a really bad but quick fix would be to replace the space with an hifen and make it the color the same as the background.

AleMonteiro 238 Can I pick my title?

None! I use Windows as my main SO and I gave up AV more than 5 years, ago and I only had one problem with malware because I plugged in a infected USB. After that I started using AutoRun Exterminator and had no more problems!

Why don't I use AV? I helped lots of family and friends to clean their PC from malware and viruses, and guess what? They'll all had some kind of AV, including Norton, Macfe, AVG and Avast.

So, what do I do to keep my pc working:
- Check Startup Programs and Services at least 2 times a week(and certainly after installing some new software)
- Check what is really running at least once a week(I use Process Explorer);
- Check for unwanted open ports with netstat
- Run CCleaner and Spybot once a week (there lots of similar)
- Download softwares from the original publisher or trusted sources.
- Read the instructions of any installer and only install what you really want (this seems so basic but I know lots of people that go 'next' without reading anything, then they don't know why Baidu is installed or why they have 20 tool bars on the browser)
- Use high secure browser settings to surf on unknown websites
- Down't download any exes that you don't know that it's safe!
- Use virtual machines to install uknown softwares before installing them in your real SO.
- …

RikTelner commented: I see what you got there :P +2
AleMonteiro 238 Can I pick my title?

Your difficulty seems to be on the DataBase Schema, am I right?
If so, you should post your DB tables.

AleMonteiro 238 Can I pick my title?

If you just need to redirect, just use Response.Redirect, like:

protected void DataGrid1_EditCommand(object source, DataGridCommandEventArgs e)
    {
        DataGrid1.EditItemIndex = e.Item.ItemIndex;
        Response.Redirect("MyPage.aspx?index=" + e.Item.ItemIndex);
    }
AleMonteiro 238 Can I pick my title?

berserk, take a deep breathe and debug the code!
You need to understand where it fails so you can figure out how to fix it.
First of all, when you check a checkbox, does it trigger the change listener? Does it save in the cookies? Does it save correctly?

diafol commented: For the deep breath quote. Ha ha ha +15
AleMonteiro 238 Can I pick my title?

Did you check the console for errors?
You need to have the references for jQuery and jQuery.cookie.

AleMonteiro 238 Can I pick my title?

You're missing the call for repopulateCheckboxes();

Try like this:

// only code to be executed on page load goes inside here, functions are better left outside so it can be used for other pieces of code 
$(function() {
  var $checks = $("input:checkbox");
  $checks.on("change", function(){
    var checkboxValues = {}, allChecked = true;
    $checks.each(function(){
          checkboxValues[this.id] = this.checked;
          allChecked = allChecked && (this.checked === true || this.checked === "checked" );
    });
    $.cookie('checkboxValues', checkboxValues, { expires: 7, path: '/' })
    if ( allChecked ) {
      $('#chkSelectDeselectAll').attr("checked", "checked");
    }
    else {
      $('#chkSelectDeselectAll').removeAttr("checked");
    }
  });
  $.cookie.json = true;
  repopulateCheckboxes();
});


  function repopulateCheckboxes(){
    var checkboxValues = $.cookie('checkboxValues');
    if(checkboxValues){
      Object.keys(checkboxValues).forEach(function(element) {
        var checked = checkboxValues[element];
        $("#" + element).prop('checked', checked);
      });
    }
  }
AleMonteiro 238 Can I pick my title?

GI753, can you post the code where you use IsNumeric? It isn't in the code you posted.

Could be something like this:

if (age_val ==null || age_val =="" ) {
        alert("Please enter your age");
        return false;
}
else if ( ! IsNumeric(age_val) ) {
    return false;
}

And I just realized that your IsNumeric function is returning at the wrong moment, should be like this(ajusted for recieving arguments):

function IsNumeric(numcheck) {
    var num = '0123456789';
    for (i=0; i < numcheck.length; i++) {
        if(num.indexOf(numcheck.charAt(i)) == -1) {
            alert("Please enter numeric value");
            return false;
        }
    }
    return true;
}

If you can use jQuery and want some out of the box, I suggest using jQuery Meio Mask, quite useful.

AleMonteiro 238 Can I pick my title?

In your page you should wrap that JS code inside a <script> tag and only call it on the page load, like:

$(function() {

    // ...Code to be executed when the DOM has finished loading

});

You should also use Developer Console to see if any errors are ocurring, and debug the script if needed.

AleMonteiro 238 Can I pick my title?

Hi dipanjana, have you tried something yet?
If not you should take a look at those resources:
http://www.codeproject.com/Articles/12666/GridView-Delete-with-Confirmation
http://asp.net-informations.com/gridview/gridview-delete.htm

If you already got something that is not working, paste your code so we can take a look.
Good luck.

AleMonteiro 238 Can I pick my title?

Oh! Spammer! That hurted a bit! lol
The 11st commandment should be "Thou shalt not spam"
The vice is not for posting, it's just for checking it out ^^

AleMonteiro 238 Can I pick my title?

beserk, take a look at this fiddle: http://jsfiddle.net/aLhkoeed/6/
Your method is repopulateCheckboxes, but you're calling repoulateFormElements();

If you wanna do it with localStorage, take a look at this similar thread: https://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/494426/keeping-sortable-order-on-refresh

About the reload question from Diafol, if you're using AJAX to send some data to the server, you should also use it to get some data. I mean, the response from your AJAX method could be the updated table so you can update the user interface without reloading.
Another way is to make another AJAX request when the first one is completed.

AleMonteiro 238 Can I pick my title?

Jim, I'd say a vice! =P

AleMonteiro 238 Can I pick my title?

Oh! There's so much to to and so little time to do it!!
This what I've been doing in the past years:

  • Reading about health, science, governaments, ufos and conspiracy therories
  • Estudying and plying with unknown(for me) tech stuff like security/hacking/deepweb/bitcoins
  • Drinking beer with friends
  • Playing Mind Games(sudoku, 2048 etc)/MMORPGs/Counter Strike/Chess
  • Watching documentaries/animes/movies/series
AleMonteiro 238 Can I pick my title?

innerHTML will give you the HTML inside the node, if you want plain text use .innerText;

AleMonteiro 238 Can I pick my title?

I'm sure that manufactures tinker with the releases. I don't know if they all do it, but I'm certain that Samsung does it. I had an Galaxy SII and a Motorola Xsomething(can't remember the model) and both OS were pretty different from each other and from the one that comes with Nexus.

Some news about it: http://www.osnews.com/story/26751/Battle_of_the_Androids_Google_Android_vs_Samsung_Android
http://www.technobuffalo.com/2014/01/29/google-reportedly-wants-samsung-to-dial-back-heavy-android-modifications/

AleMonteiro 238 Can I pick my title?

Hi beserk.

First detail: you're missing an ');' on the jQuery :checkbox change event listener.

Where do you call repopulateFormELements() ? On window load? It isn't explicit in your code.

And one more thing... why do you handle checkbox with jQuery and also with inline onClick?
I'd remove the checkOne function and would update the change listener to something like this:

var $checks = $(":checkbox");
$checks.on("change", function(){
  var checkboxValues = {}, allChecked = true;
  $checks.each(function(){
        checkboxValues[this.id] = this.checked;
        allChecked = allChecked && (this.checked === true || this.checked === "checked" );
  });
  $.cookie('checkboxValues', checkboxValues, { expires: 7, path: '/' })
  if ( allChecked ) {
    $('#chkSelectDeselectAll').attr("checked", "checked");
  }
  else {
    $('#chkSelectDeselectAll').removeAttr("checked");
  }
});
AleMonteiro 238 Can I pick my title?

To check if a var is a number you should use

if ( Number(a) === a ) {
    // It's a number!
}
else {
    // It's not a number
}

Another detail, in you validateNumber function you may throw an error, but you are not handling that error when you call the validateNumber function.
You should put in a try{} catch{} and set the number 0 if there's an error.

AleMonteiro 238 Can I pick my title?

Yeah Dave, sorry for not letting it clear. JSON.stringify is ment to serialize only data properties. I use it a lot for my AJAX requests and results.

But it's quite simple to log methods also:

function Animal(name, age)
    {
        this.breathe = function ()
        {
            alert("I am breathing");
        };
        this.eat = function ()
        {
            alert("I am eating");
        };
        this.sleep = function ()
        {
            alert("I am sleeping");
        };
        this.name = name;
        this.age = age;
    }
    var _log = function (label, obj, logFunctions)
    {
        var _ldata = logFunctions === true ? {
                data: obj,
                methods: []
            } : obj;

        if ( logFunctions === true) {
            for(var j in _ldata.data) {
                if ( typeof _ldata.data[j] === 'function') {
                    _ldata.methods.push({
                        name: j,
                        execution: _ldata.data[j].toString()
                    });
                }
            }
        }
        if (typeof console.log === 'function')
        {
            console.log(label + ": " + JSON.stringify(_ldata, undefined, '\t'));
        }
        document.write(label + ": " + JSON.stringify(_ldata, undefined, '\t'));
    };
    var _logF = function(label, obj) { return _log(label, cat, true); };
    var cat = new Animal("Joey", 14);

    _log("Animal", cat);
    _logF("Animal", cat);
AleMonteiro 238 Can I pick my title?

The confirmation box is quite simple:

$(".btn_dlt").click(function(){

        if ( ! confirm('Are you sure you want to delete this?') ) {
            return;
        }

        var btn_dlt = $(this); 
        $.ajax({
            type: "POST",
            url: "./delete-action.php", 
            data: { id: btn_dlt.attr("id") } 
        }).done(function( msg ) { 
            alert(msg);
            if(msg == "Success"){  
                btn_dlt.closest('.tr').remove();
            }else{
                $('#err_msg').html(msg);  err_msg field
            }
        });
    });
AleMonteiro 238 Can I pick my title?

Ivan, you won't be able to create it in only one input.
You need a select for the country DDI a input:text for the number itself.

Take a look at this on how to use icons with select: http://designwithpc.com/plugins/ddslick

The best you can do later is try to make the select and input "look and feel" like just one input, but they'll be actually two.

AleMonteiro 238 Can I pick my title?

Thanks for the replay, I'll take a look at Index Servers.

The search at first will be only by name and file type. I'd like to add tags too, but it's not a pre-req.

About numbers I'd say 50k initial files with 100+ modifications(delete/insert), per day, accross different folders.

AleMonteiro 238 Can I pick my title?

I don't really bother analysing the built-in functions of browsers or IDEs.
The basic commands are all(happily) the same, but each browser may have it's own built-in functions. The same occurs with CSS properties.
I usually have a fix.js to handle commum missing methods on base objects and I really just want to know if the object has what it's supposed to.

And from time to time we can't scape debbuging JS trough developer consoles, but I think it's a slow method.

I've been using just a log function to expose the object as JSON in the console:

var _log = function(label, obj) {
    if ( typeof console.log === 'function' ) {
        console.log(label + ": " + JSON.stringify(obj, undefined, '\t'));
    }
};

The JSON lib: http://www.json.org/js.html

AleMonteiro 238 Can I pick my title?

Meanwhile I found this DbfDotNet. Any toughts?

AleMonteiro 238 Can I pick my title?

gnarly... just learned a new word!
And you're right about it, my concept of JavaScript is not entirely rational.
But just let me try to make my point: I've been doing a lot of frontend with JS for the last 8 years, and the only thing that keeped me from going, totally, crazy is trying new things and having fun with it.

Forgot to mention early, as said in the video posted by Dave, there's some libs for class creation in JS.
http://dkraczkowski.github.io/js.class/
http://classify.petebrowne.com/#/api
http://joose.it/

I tried js.class a couple of years ago, it works well, but it just doesn't feel right to me. One problem that I remember is that Visual Studio intellisense didn't seem to work.

AleMonteiro 238 Can I pick my title?

Good night dani people.

I'm current developing a project that needs an web API to list all directories and files, and also provide a method to search by name.

I already got it working with Sytem.IO.DirectoryInfo at real time.

//Folders
foreach (DirectoryInfo info in _dirInfo.GetDirectories())
{
}

//and files
IEnumerable<FileInfo> filesInfo = _dirInfo.GetFilesByExtensions(extensions);

The aim is to provide a fast and smart(thumbs and media type) web service to browse the contents of specified media folders.

Worried about performace with multiple clients listing large folders I'd like to ask suggestions for better solutions.
Is indexing in a file or database worth? Or is DirectoryInfo the way to go?

Thanks all!

AleMonteiro 238 Can I pick my title?

If both databases are at the same server(MySQL Instance) you can just prefix the tables with the database name.

FROM database_1.calendar AS C LEFT JOIN database_2.history AS H

Make sure that the user logged in has permission to access both databases.

AleMonteiro 238 Can I pick my title?

As I understand it, the purpose of the closure when defining the object is just about code organization and keeping some desired functions hidden from the global context.
The objects will still be generic and dynamic even if defined inside a closure to(just to wrap it all).

People need to learn to respect LiveScript for what it is;
in order be able to learn how it is.

And in general, probably stop demanding rigid behavior expected from old static procedural languages.

I ain't arguing any of that! Rigid behavior is the last I want! I have so much fun with JS because it's so dynamic and there's so many ways of acomplishing the same functionality.
As I said in another post, being able to modify any object or method, from the browser, APIs or whatever, it's just too much intriguing!

document.getElementById = function() { alert("I don't care! =P"); };
AleMonteiro 238 Can I pick my title?

Ivan, if you want people to type the e-mail and mobile number you need to use an input text instead of a select. Selects are only a drop down to choose an option, no typing allowed.

Here's a very simple fiddle that starts what you want: http://jsfiddle.net/u61hsoym/3/

And let me say that showing Images inside a <select> is very tricky it requires JavaScript to do it.

AleMonteiro 238 Can I pick my title?

But than, why would he need "Animal"?

It's just about the code specific for Cat inside Cat function. And all the code for Animal inside the Animal function.

The point is to use inheritance inside the function itself, sou you don't need to set Cat.prototype after the Cat function declaration.

AleMonteiro 238 Can I pick my title?

RealDesktop seems cool, gonna try it sometime.

Just a curiosity about Xubuntu, is it based on Ubuntu or Debian? I tought Ubuntu has been discontinued, what about Xubuntu?