text:
Q: jQuery Mobile PHP Form - Get Checked Radio Button Value I am using a jQuery Mobile Form script I found online. Everything is working fine, except the input="radio" buttons. I am not a jQuery expert by any means, so I am hoping someone here can help me.
THE SETUP
The form script contains 3 files: send.php, contact.js, and the mobile markup. Examples of the problematic pieces of code are below:
Mobile Markup:

  <fieldset data-role="controlgroup" data-type="horizontal">
   <legend>Doctor Type:</legend>
   <input type="radio" name="doctortype" id="dmd" value="dmd"/>
    D.D.
   <input type="radio" name="doctortype" id="dds" value="dds" />
    D.O.
  </fieldset>

Contact.js
$('#send-feedback').live("click", function() {
var url = 'api/send.php';
var error = 0;
var $contactpage = $(this).closest('.ui-page');
var $contactform = $(this).closest('.contact-form');
$('.required', $contactform).each(function (i) {
    if ($(this).val() === '') {
        error++;
    }
}); // each
if (error > 0) {
        alert('Please fill in all the mandatory fields. Mandatory fields are marked with an asterisk *.');
} else {
    var doctortype = $contactform.find('input[name="doctortype"]').val();
    var firstname = $contactform.find('input[name="firstname"]').val();
    var surname = $contactform.find('input[name="surname"]').val();
    var dob = $contactform.find('input[name="dob"]').val();
    var zip = $contactform.find('input[name="zip"]').val();
    var how = $contactform.find('select[name="how"]').val();
    var email = $contactform.find('input[name="email"]').val();
    var message = $contactform.find('textarea[name="message"]').val();

    //submit the form
    $.ajax({
        type: "GET",
        url: url,
        data: {doctortype:doctortype, firstname:firstname, surname:surname, dob:dob, zip:zip, how:how, email:email, message:message},
        success: function (data) {
            if (data == 'success') {
                // show thank you
                $contactpage.find('.contact-thankyou').show();
                $contactpage.find('.contact-form').hide();
            }  else {
                alert('Unable to send your message. Please try again.');
            }
        }
    }); //$.ajax

}
return false;
});

Send.php
<?php
header('content-type: application/json; charset=utf-8');

if (isset($_GET["firstname"])) {
$doctortype = strip_tags($_GET['doctortype']);
$firstname = strip_tags($_GET['firstname']);
$surname = strip_tags($_GET['surname']);
$dob = strip_tags($_GET['dob']);
$zip = strip_tags($_GET['zip']);
$how = strip_tags($_GET['how']);
$email = strip_tags($_GET['email']);
$message = strip_tags($_GET['message']);
$header = "From: ". $firstname . " <" . $email . ">";

$ip = $_SERVER['REMOTE_ADDR'];
$httpref = $_SERVER['HTTP_REFERER'];
$httpagent = $_SERVER['HTTP_USER_AGENT'];
$today = date("F j, Y, g:i a");

$recipient = 'MYEMAIL@gmail.com';
$subject = 'Contact Form';
$mailbody = "
Doctor Type: $doctortype
First Name: $firstname
Last Name: $surname
Date of Birth: $dob
Zip Code: $zip
How Did You Learn About Us: $how
Message: $message

IP: $ip
Browser info: $httpagent
Referral: $httpref
Sent: $today
";
$result = 'success';

if (mail($recipient, $subject, $mailbody, $header)) {
    echo json_encode($result);
}
}
?>

THE RUB
The form works fine by itself. User fills out info, clicks "Send", and I receive an email with the information. However, I am not able to get the value of the checked radio to parse and send.
I've spent numerous hours trying to get the checked radio value to pass through the necessary steps.
And therein lies the problem. I've looked at countless similar posts on SO and other various places online, including the jQuery Mobile documentation. To no avail.
Any help is much appreciated!

A: What is your jQuery doing? It seems unnecessary to do any jQuery/JavaScript. The form should send the value of your radio button to $_GET['doctortype'] without it (assuming your form method is get).


text:
Q: How to create multiple table in Magento(extension) admin panel I create customize menu in admin panel(customized extension) in Magento. I want to know how to create block and Model for admin menu.
Here I just go through this tutorial and create admin panel menu.
for example :
--News
   --Managed News

And also i create Different children menu in my customize menu.
for example:
--News
  --Managed News
  --News Details
  --News Management. and so on.

Here my code for create children menu in custom menu.

app/code/community///etc/adminhtml.xml

 <menu>
         <news translate="title" module="magentostudy_news">
            <title>News</title>
            <sort_order>65</sort_order>
            <children>
                <manage translate="title" module="magentostudy_news">
                    <title>Manage News</title>
                    <action>adminhtml/news</action>
                    <sort_order>50</sort_order>
                </manage>
                <weaves translate="title" module="magentostudy_news">
                    <title>News Details </title>
                    <action>adminhtml/details</action>
                    <sort_order>60</sort_order>
                </weaves>
            </children>
         </news>
    </menu>

And i create adminhtml/NewsController.php for first child menu and also create block(Include grid, edit,form and tabs) , model and sql (dynamic table).
But when i create same procedure adminhtml/Detailscontroller.php for second child menu.It willn't create dynamic table in my magento database.How to create dynamic table for custom module and also how to create
admin child menu's functionality (model, controller, sql and view). Guide me please.
Thanks in advance...

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can i get keys for here-map navigation edition? On the document it says that the here map representative was suppose to share the credentials for navigation edition.But the representative told to create the credentials on portal

The keys created from then here map's portal only works on lite and explore editions,
so, how can to get the credentials for here map navigation edition sdk


text:
Q: How do I show errors after validation with a custom form frontend? I'm struggling to understand how I should achieve a decent error-handler at frontend (serverside). The code is written in functions.php in a specific theme (if that matters). Down below a custom post type named pupil is created upon submit.
$pupil = new Pupil();
add_shortcode('wppb-register', array($pupil, 'frontEndRegistration'));

//Check if visitor is trying to save a new pupil
$pupil->checkFrontEndRegistration();

In the pupil-class I show (return) this content (form):
//Show public register-form
public function frontEndRegistration($atts, $content="", $errors = null) {
     $class_errors = array();

    if (is_array($errors) && !empty($errors)) {

        foreach($errors as $key=>$err) {
            if ($err === true) {
                $class_errors[$key] = ' error';
            }
        }
    }
    $content .= '
    <form id="adduser" name="adduser" method="post" action="">' .
            '

'.$this->getRelatedCoursesPupil(null, array('args' => array('fetchContent' => 'returncontent')))
    .  '

        Förnamn*
        <input name="first_name" id="first_name" value="" class="regular-text' . $class_errors['first_name'] . '" type="text">

        Efternamn*
        <input name="last_name" id="last_name" value="" class="regular-text' . $class_errors['last_name'] . '" type="text">

        Ålder*
        <input name="age" id="age" value="" class="regular-text" type="text">

        E-post
        <input name="email" id="email" value="" class="regular-text" type="text">

        Telefon hem*
        <input name="homephone" id="homephone" value="" class="regular-text" type="text">

        Mobiltelefon*
        <input name="cellphone" id="cellphone" value="" class="regular-text" type="text">

        Adress
        <input name="adress" id="adress" value="" class="regular-text" type="text">

        Postnr
        <input name="postnr" id="postnr" value="" class="regular-text" type="text">

        Ort
        <input name="ort" id="ort" value="" class="regular-text" type="text">

        Övrigt
        <textarea name="description" id="description" class="description"></textarea>

    <input type="hidden" name="action" value="newpupil-frontend" />
    ' . wp_nonce_field( 'newpupil-frontend', 'newpupil-frontend') .

    '

    <input type="submit" value="OK" name="addusersub" id="addusersub" />
    </form>
    ';

    return $content;
}

Here I'm doing the actual checking before saving it to database.
//Save pupil
public function checkFrontEndRegistration() {

        if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "newpupil-frontend") {

            //Required fields
            $errors = array();
            if (!isset($_POST['first_name']) || strlen($_POST['first_name']) == 0) {
                $errors['first_name'] = true;
            }
            if (!isset($_POST['last_name']) || strlen($_POST['last_name']) == 0) {
                $errors['last_name'] = true;
            }
            if (!isset($_POST['age']) || strlen($_POST['age'] == 0)) {
                $errors['age'] = true;
            }
            if (!isset($_POST['homephone']) || strlen($_POST['homephone']) == 0) {
                $errors['homephone'] = true;
            }
            if (!isset($_POST['cellphone']) || strlen($_POST['cellphone']) == 0) {
                 $errors['cellphone'] = true;
            }

            //Add new pupil-cpt into post-table when there are no errors
            if (empty($errors)) {
                //Remove hook temporarily
                remove_action( 'save_post' , 'postsubmitted');

                $pupil = array(
                    'post_title'    => 'unregistered',
                    'post_status'   => 'private',           // Choose: publish, preview, future, draft, etc.
                    'post_type' => 'pupil',
                    'post_author' => 5500
                );
                //save the new post and return its ID
                $post_id = wp_insert_post($pupil);

                //Save everything relevant for this new pupil
                saveform_db($post_id, $_POST, true);        //True says that it's frontend-saving

                //Rehook temporarily removed hook
                add_action( 'save_post' , 'postsubmitted');
            }
            else {
                throw new Exception('Pupils must be entered');
                //$this->frontEndRegistration('', '', $errors);
            }

        }

    }

It works fine,  but I can't figure out how to show the errors when user hasn't typed in required fields.
Instead of throw new Exception(Pupils must be entered); I want to show the same frontendRegistrationform() but with the errors that are set when there are no value in the required fields.
I guess I oould use sessions, but is there any better way?

A: This is a pretty basic solution. First I am assuming that you are not saving the data/form, and just returning to the same page.. In your $formContent you would do something like this.
<?php
$formContent = '
    ....

        Förnamn*
        <input name="first_name" id="first_name" value="" class="regular-text' . $class_errors['first_name'] . '" type="text">'
    . ( array_key_exists( 'first_name', $class_errors ) ? "
You must enter your first name." : "" ) . '

";

If you wanted to access the errors on the form itself, I would personally recommend doing the error checking through JavaScript. This way, you can actually prevent the page from submitting, rather than submitting, cancelling, and redirecting back. With jQuery, it would be something like:
$('form').submit(function(event){
    var $form = $(this);

    // if any empty fields with the required class are found
    if ($form.find('input.required:empty').length) {
        event.preventDefault(); // cancel form submission
        $form.find('input.required:empty').after('
This field is required');
    }
});

Obviously you could customize each field's message by reading the label attached to that input, or putting individual checks on each field. You can also work in some custom validation here, like Phone number validation, email, etc.
That's my preferred method.
For the PHP side, you should be able to store your error classes either on a class variable, or a global variable. Since the post.php page points back to itself, there is no redirection between your form submission checking, and re-rendering the page. You should be able to store the errors in a class variable and use it within both functions.
Very high level:
class myFormStuff {
    protected $error_classes;

    // happens first, on init most likely
    function checkFrontEndRegistration(){
        $this->error_classes['first_name'] = "Dude, where's your name at?";
    }

    // Happens way later in the page reload, when rendering the form
    function frontEndRegistration() {

        if ( array_key_exists( 'first_name', $this->error_classes ) ) {
            echo '
' . $this->error_classes['first_name'] . '
';
        }
    }
}


text:
Q: PowerMockito when not working, its calling real static method I have to write Junit tests for the below test class. The method is calling a static method of another class and I'm trying to mock it but when is calling the real method.
class SomeService {

    public String getModifiedString(String value) {
         ....
         modifiedValue = ValueModifier.staticModifyValue(value, regex);
         ....
         return modifiedValue;
    }
}

Test class I created for this is:
@Runwith(PowerMockitoRunner.class)
@PrepareForTest(ValueModifier.class)
public class TestClass {

   @InjectMocks
   private SomeService service;

   @Before
   public void setUp() {
      PowerMockito.mockstatic(ValueModifier.class);
      MockitoAnnotations.initMocks(service);
   }

   @Test
   public void testMethod() {
       doReturn("someString").when(ValueModifier.staticModifyValue(anyString(),anyString()));
        // please note that I'm not calling any service method yet, but its still calling the real static
        // method and failing with exception related to that method.
   }
}

Please help. What am I doing wrong here.
I'm not allowed to change any code, my job is to write unit tests only.


text:
Q: Sqlite ambiguous column name that isn't ambiguous, includes table name I have the following SELECT statement for sqlite that is coming back with Error: ambiguous column name: msgs.msgcontent1 however that column name is not ambiguous! Can anyone help me figure out what I am missing here?
SELECT
  phone_lookup.normalized_number AS number ,
  contacts.display_name AS name ,
  msgs.msgcontent1
FROM
  contacts2.contacts ,
  temp.msgs
  INNER JOIN contacts2.phone_lookup ON ( contacts.name_raw_contact_id = phone_lookup.raw_contact_id )
  INNER JOIN temp.msgs ON ( contacts.phone_lookup.normalized_number = msgs.sender ) ;

The following the is statement I used to create the table that contains the troublesome column:
CREATE TEMP TABLE msgs
AS SELECT
  PART."_ID" ,
  ADDR."_ID" ,
  DATETIME( SUBSTR( COALESCE( PDU."DATE" , SMS."DATE" ) , 1 , 10 ) , 'localtime' , 'unixepoch' ) AS dt ,
  COALESCE( PDU.READ , SMS.READ ) AS read ,
  COALESCE( SMS.ADDRESS , ADDR.ADDRESS ) AS sender ,
  COALESCE( SMS.BODY , COALESCE( PART.TEXT , PART."_DATA" ) ) AS msgcontent1
FROM
  mmssms.PDU
  LEFT OUTER JOIN mmssms.SMS ON ( PDU."DATE" = SMS."DATE" )
  LEFT OUTER JOIN mmssms.PART ON ( PART.MID = PDU."_ID" )
  LEFT OUTER JOIN mmssms.ADDR ON ( ADDR.MSG_ID = PDU."_ID" )
WHERE
  COALESCE( SMS.BODY , COALESCE( PART.TEXT , PART."_DATA" ) ) IS NOT NULL AND ADDR."_ID" IN
    (
      SELECT
        MIN( ADDR."_ID" )
      FROM
        ADDR
      GROUP BY
        ADDR.MSG_ID
      ORDER BY
        ADDR."_ID"
    ) AND PART."_ID" IN
    (
      SELECT
        MAX( PART."_ID" )
      FROM
        mmssms.PART
      GROUP BY
        PART.MID
      ORDER BY
        PART."_ID"
    )
UNION ALL
SELECT
  PART."_ID" ,
  ADDR."_ID" ,
  DATETIME( SUBSTR( COALESCE( PDU."DATE" , SMS."DATE" ) , 1 , 10 ) , 'localtime' , 'unixepoch' ) AS dt ,
  COALESCE( PDU."READ" , SMS."READ" ) AS read ,
  COALESCE( SMS."ADDRESS" , ADDR."ADDRESS" ) AS sender ,
  COALESCE( SMS."BODY" , COALESCE( PART."TEXT" , PART."_DATA" ) ) AS msgcontent2
FROM
  mmssms.SMS
  LEFT OUTER JOIN mmssms.PDU ON ( PDU."DATE" = SMS."DATE" )
  LEFT OUTER JOIN mmssms.PART ON ( PART."MID" = PDU."_ID" )
  LEFT OUTER JOIN mmssms.ADDR ON ( ADDR."MSG_ID" = PDU."_ID" )
WHERE
  COALESCE( SMS."BODY" , COALESCE( PART."TEXT" , PART."_DATA" ) ) IS NOT NULL
ORDER BY
  DATETIME( SUBSTR( COALESCE( PDU."DATE" , SMS."DATE" ) , 1 , 10 ) , 'localtime' , 'unixepoch' ) DESC ,
  ADDR."_ID" ASC ;

And finally, although I don't believe it's relevant to the issue, I begin the sqlite commands with the following pragma and attach statements to make sure I have access to everything:
PRAGMA temp_store = MEMORY ;
ATTACH '/data/data/com.android.providers.contacts/databases/contacts2.db' AS contacts2 ;
ATTACH '/data/data/com.android.providers.telephony/databases/mmssms.db' AS mmssms ;

A: It look likes temp.msgs after FROM is not required as it already is in INNER  JOIN clause. So this query must work:
SELECT
  phone_lookup.normalized_number AS number ,
  contacts.display_name AS name ,
  msgs.msgcontent1
FROM
  contacts2.contacts
  INNER JOIN contacts2.phone_lookup ON ( contacts.name_raw_contact_id = phone_lookup.raw_contact_id )
  INNER JOIN temp.msgs ON ( contacts.phone_lookup.normalized_number = msgs.sender ) ;

If you need to specify the same table in two places (FROM and JOIN clauses) then you must use distinct aliases for each and refer to columns using these aliases.
More info: SQLite Query Language: SELECT


text:
Q: UIButton inside UIView goes out of bounds I'm struggling with a problem that probably it's really stupid.
I've created an UIView and inside the UIView I've placed an UIButton and a UISwitch.
The UIView scales it's width based on the screen size keeping from left and right 45px, the UISwitch keeps it's frame size and the UIButton has its frame size changed based on the UIView frame size.
The problem is that the UIButton's text goes out of bounds for no reasons, this is the result I get:

The Blue background is the one of the UIButton and the Yellow background is the one of the UIView
I'm not able to align the text of the UIButton on top, this is what I've tried:
[_privacyButton setTitleEdgeInsets:UIEdgeInsetsMake(0,0,0,0)];
_privacyButton.titleLabel.baselineAdjustment = UIBaselineAdjustmentNone;

And also from the Storyboard I've set the vertical aligment top
Please someone help me, this UIButton is driving me crazy

A: You need to set constrains for the particular unbutton, i am unable to see you uiswitch, where you place it?.


text:
Q: Nonlinear Regression with linear method from Python's scikit-learn/ sklearn using a polynom I am trying to do a regression analysis for some data, say 20 variables
$\left( {{x_1},{x_2},{x_3},...} \right)$ where the underlying probability distribution is known (e. g. ${x_1} \in {\rm N}({\mu _1},{\sigma _1})$ , ${x_2} \in U({a_2},{b_2})$ and so on).
The variables are assumed to be uncorrelated. The overall behavior of $y = f({x_1},{x_2},{x_3},...)$ is nonlinear.
Now, I would like to use a method of the scikit-learn module (e.g. Lasso, Lars, Ridge, Bayesian Regression etc.) for a metamodel-fit.
For taking into account the cross-influences and non-linear behaviour of some variables in y, I want to use a polynomial, i. e. I don't just give the vector $\overrightarrow x  = \left( {{x_1},{x_2},{x_3},...} \right)$ to the regression method, I rather feed it $\left( {{x_1},{x_2},{x_3},...,{x_1}*{x_1},{x_1}*{x_2},...} \right)$ which is a polynomial of degree two or more.
My question is: Which method (Lasso etc.) is best for this problem? How can I give the information to the regression method that the underlying distributions (mean and std deviation) and correlation of the higher order terms is known. For example ${{x_1}}$ and ${{x_1}*{x_1}}$ are highly correlated and both their distributions are known by ${\mu },{\sigma }$. How can I add this information to the regression analysis? Otherwise without this additional information, I guess it will fit a poor model.
Any ideas?

A: You wrote you want to use sklearn anyway, did you take a look at the sklearn.preprocessing.PolynomialFeatures class? This should solve the first part of your problem.
For the other part, why not actually try and measure? Run e.g. LassoCV on the polynomial dataset and check if holding out very correlated features changes performance?
Embedding this information sounds rather complicated, I'd go for the simpler approach of either removing correlated features beforehand or running a PCA on it. And see how things change.


text:
Q: How to get future date based on another date in android? I want to choose date by date picker dialog and based on that I need to get a date after 20days. For eg: If I choose 2-5-2021, need to get 22-5-2021.But I got parseException. How to achieve this?
My code is,
Calendar calendar = Calendar.getInstance();
Date date = null;
try {
  date = new SimpleDateFormat("dd/MM/yyyy").parse(transactionDate.getText().toString());
} catch (ParseException e) {
  e.printStackTrace();
  Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
}
  calendar.setTime(date);
  calendar.add(Calendar.DAY_OF_MONTH, 20);
  Toast.makeText(this, (CharSequence) calendar.getTime(), Toast.LENGTH_SHORT).show();

A: Use this function and pass the parameters as your present date and the no of days you want to add(20).
public static String getCalculatedDate(String dateFormat, int days) {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat s = new SimpleDateFormat(dateFormat);
        cal.add(Calendar.DAY_OF_YEAR, days);
        return s.format(new Date(cal.getTimeInMillis()));
    }

A: Found a solution for this:
public void getCalculatedDate() {
    try {
        String date = selectedDate.getText().toString();
        SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy");
        Date parseDate = format.parse(date);
        Calendar cal = Calendar.getInstance();
        cal.setTime(parseDate);
        cal.add(Calendar.DAY_OF_MONTH, 20);
        newDate.setText(format.format(cal.getTime()));

    } catch (Exception e) {
        Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
    }
}

Note:  selectedDate which is got from date picker dialog.


text:
Q: unable to provide a input as "dot" in the textfield i have this code for  validating text field number.
This code works fine, but only problem is it does not allow me to enter .(dot) .
My textfield is for amount, amount can be 222.234234 , or 222
So what code i should add  in order to enable users to enter periods with the below scrits
function ValidateNum(input,event)
    {
        var keyCode = event.which ? event.which : event.keyCode;
        if((parseInt(keyCode)>=48 && parseInt(keyCode)<=57) || parseInt(keyCode)==08 ||  parseInt(keyCode)==09 || parseInt(keyCode)==127 )
        {
           return true;
        }
        return false;
    }

textfield
<input type="text" name="from_amount" onkeypress="return ValidateNum(this,event)" id="from_amount" placeholder="    Type to convert" />`

So please help me to solve this problem.

A: Keycode for . is 190.
You can check this list here-> http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes

A: Why not validate the entire string instead of validating each inputted character?
Do this:
//I am assuming that input is the text element
function validateNumber(input) {
    //newer browsers should have .trim(). Otherwise you can do something like:
    //   input.value.replace(/^\s+|\s+$/g, "");
    return /^\d+(\.\d+)?$/.test(input.value.trim());
}

Will your current validation-function account for the case when a use enters only the . character? What about multiple . characters? How about the value 123., or 1.43.3, or 1..2? It looks like the current function only validates the inputted character without looking at the context of that character (i.e., what surrounds it).
On another note, consider using something like jQuery or binding to the input element instead of using the onkeypress attribute. That method of binding is more-or-less deprecated and not recommended. Also this method of validation prevents keypress events which can be confusing. It's probably better to validate the entire form after they have filled it in, or mark the text-field as invalid as they are writing in it.
You can also use the HTML5 type value of number instead of text to constrain what the user can input into that field. That way you wouldn't even have to do any validation.


text:
Q: How to make stderr of OS commands ran with "!" go to Sql*plus spool? Background
I have a long Sql*plus script that for some reason needs to run some unix commands using the exclamation mark syntax.
I write to a spool in order to have a log file at the end of the process.
The problem is that if an OS command fails, the stderr is lost and doesn't go to the spooled file.
Example code
spool mylog.txt
!echo alter user xxx identified by yyyy;
alter user xxx identified by yyyy;
!echo cp file1 folder1/
!cp file1 folder1/
!echo alter user yyy identified by xxx;
alter user yyy identified by xxx;
!echo cp file2 folder2/
!cp file2 folder2/
spool off

If one cp fails, I wouldn't know just by looking at mylog.txt
Obviously doing !cp file1 folder1/ &> mylog.txt would only mess up the log beeing spooled to in unpredictable ways.
Question
What can be done in order for the the stderr of the unix commands be writen to the file beeing spooled to ?
Update
I tried lc.'s suggestion, appending  2>&1  at the end of every cp command in order to redirect stderr to stdout but I get this:
Enter value for 1:

Update 2
SET DEFINE OFF made it to not prompt for a value. It allowed me to discover that it's not only stderr that doesn't get spooled: stdout doesn't either. It seems that everything executed with "!" is un-spool-able.

A: Actually, the stdout and stderr are not lost but they won't go in the spool file.
Given the script echo.sql :
spool sql.out
select 1 from dual ;
!echo 1
!invalid command
spool off

If you launch your script from a shell as so :
sqlplus *connect string*  @echo.sql > host.out 2> host.err

You will get the output from your sql command in sql.out, the output from echo in host.out and the error message in host.err. If you're launching your script non interactively -from a cron or something- you'll have to capture stdout/stderr as you would do any other non sql*plus script.
Edit regarding comment
With the option SET TERMOUT ON in the script file you will have the output of your sql commands both in the spool file and stdout.
So finally, if you want everything in one file you can call your script as so :
sqlplus *connect string*  @echo.sql &>echo.log

You will still have the output of just the sql in the spool file.

A: You can append a 2>&1 to each command to redirect stderr to stdout.

A: If you want to send shell command output to your sqlplus spool file, you can't do it while SPOOL has the file locked for writing.  Here's the sequence in the .sql script that worked for me:
SPOOL out.log
...sql stuff here...
SPOOL OFF
host ps -eaf | grep something 1>>out.log
SPOOL out.log APPEND
...more sql stuff...


text:
Q: Pass currency value to custom field using JavaScript button I need to populate a currency custom field Value_Of_WE_Spend__c on a custom object WE_FEP__c with the value from an opportunity currency custom field Annual_Settlement_Value__c.
I've written the below code, which works without the recToCreate.Value_Of_WE_Spend__c... section but when the button's clicked with this section included, the following error message is displayed:

{"faultcode:'soapenv:Client', faultstring "GBP 10,000.00' is not valid
  for the type xsd:double',}

{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}

try{
    var recToCreate = new sforce.SObject("WE_FEP__c");
    recToCreate.Account_Name__c = '{!Opportunity.AccountId}';
    recToCreate.Name = '{!Opportunity.Name}';
    recToCreate.Description__c = '{!Opportunity.Description}';
    recToCreate.Value_Of_WE_Spend__c = '{!Opportunity.Annual_Settlement_Value__c}';

    var result = sforce.connection.create([recToCreate]);

    if(result[0].success == "true"){
    window.location = "/" + result[0].id + "/e";
    }
    else{
        alert("An Error has Occurred. Error:" + result[0].errors.message);
    }
}
catch(e){
    alert("An Error has Occurred. Error:" + e);
}

A: You need to use the text function to convert the currency field in the actual value. This should fix the issue:
recToCreate.Value_Of_WE_Spend__c = '{!TEXT(Opportunity.Annual_Settlement_Value__c)}';


text:
Q: Appending arrays in python gives weird formatting I'm currently trying to parse through large csv files by using chunks with pandas and read_csv() in python. However, when I add all the rows from the chunk to an array and print the array, the formatting seems off for each item in the array (or essentially each array in the array). I have the following code:
chunksize = 10
data = []

for chunk in pd.read_csv("testData.csv", chunksize=chunksize):
    for value in chunk.values:
        data.append(value)
    print(data)

gives me the following output:

"[array(['WSPY', 'PKYJ', 62048, 96988], dtype=object), array(['QHWL',
'PXWE', 77146, 70056], dtype=object), array(['RSMQ', 'YLSK', 19495,
76992], dtype=object),...]

As opposed to:

[['WSPY', 'PKYJ', 62048, 96988], ['QHWL', 'PXWE', 77146, 70056],
['RSMQ', 'YLSK', 19495, 76992], ...]

Is there a reason why the formatting would be different and how I could fix that?

A: From your display, I reconstructed a dataframe:
In [71]: [np.array(['WSPY', 'PKYJ', 62048, 96988], dtype=object), np.array(['QHW
    ...: L', 'PXWE', 77146, 70056], dtype=object), np.array(['RSMQ', 'YLSK', 194
    ...: 95, 76992], dtype=object)]
Out[71]:
[array(['WSPY', 'PKYJ', 62048, 96988], dtype=object),
 array(['QHWL', 'PXWE', 77146, 70056], dtype=object),
 array(['RSMQ', 'YLSK', 19495, 76992], dtype=object)]

In [74]: df = pd.DataFrame(_71)
In [75]: df
Out[75]:
      0     1      2      3
0  WSPY  PKYJ  62048  96988
1  QHWL  PXWE  77146  70056
2  RSMQ  YLSK  19495  76992

Because of the mix of string and numeric data, the values array is object dtype
In [81]: df.values
Out[81]:
array([['WSPY', 'PKYJ', 62048, 96988],
       ['QHWL', 'PXWE', 77146, 70056],
       ['RSMQ', 'YLSK', 19495, 76992]], dtype=object)

and with the chunked kind of iteration, we get a list of 1d object arrays, one for each row of the dataframe:
In [82]: data = []
    ...: for value in df.values:
    ...:     data.append(value)
    ...:
In [83]: data
Out[83]:
[array(['WSPY', 'PKYJ', 62048, 96988], dtype=object),
 array(['QHWL', 'PXWE', 77146, 70056], dtype=object),
 array(['RSMQ', 'YLSK', 19495, 76992], dtype=object)]

the dataframe values could be made into a list of lists:
In [89]: df.values.tolist()
Out[89]:
[['WSPY', 'PKYJ', 62048, 96988],
 ['QHWL', 'PXWE', 77146, 70056],
 ['RSMQ', 'YLSK', 19495, 76992]]

Usually in Python, formatting of objects is supposed to mean something, showing us the identity as well as values of the object.  List formatting is simplest. numpy arrays formatting can be simple if the dtype is numeric, but becomes more complicated with it contains objects, no numeric elements.  As you learn the language you'll learn to read to display as well.


text:
Q: in style and style I would like to know if there is a difference between the two sentences below and why do we need to use 'in' on the first sentence.
"The kitchen is Mexican in style." "The kitchen is Mexican style."
Thank you so much in advance.

A: The first sentence is correct. The second is wrong.
We don't say that something is style although objects are often described as stylish, meaning fashionable or trendy rather than in a particular taste or design.
It would be correct to say:

The castle is Roman in style
The canoes were Caribbean in style

meaning that the castle/canoes have typical design features of the place or period.
However, you can also say:

The castle was constructed in the Roman style
The canoes were fashioned in the Caribbean style.

or

The kitchen was designed in (the) Mexican style

More examples at:
http://dictionary.cambridge.org/dictionary/english/style
http://www.learnersdictionary.com/definition/style


text:
Q: Allowed signatures for iPOJO @Bind/@Unbind methods In all iPOJO examples I've seen, the @Bind and @Unbind callbacks take only the service instance as an argument, i.e.
// @Requires
// private Foo foo;

@Bind
public void bindFoo(Foo foo) { ... }

@Unbind
public void unbindFoo(Foo foo) { ... }

Blueprint also allows you to have
public void bindFoo(ServiceReference reference) { ... }

public void bindFoo(Foo foo, Map<String, Object> properties) { ... }

Can iPOJO callbacks also get access to service properties or ServiceReference? Or should whiteboard handler be used for this instead?

A: Callbacks can have one of these signatures:

*

*Without any argument: the method is just a notification (method())

*With the service object : the object is the implicated service object
(method(Service svc))

*With an OSGi service reference: the service
reference appearing or disappearing (method(ServiceReference ref))

*With the service object and the OSGi service reference
(method(Service svc, ServiceReference ref))

*With the service object and the service properties inside a Map (method(Service svc, Map
properties))

*With the service object and the service properties inside a Dictionary (method(Service svc, Dictionary properties))

So, are supported:
@Bind
public void bind() { ... }

@Bind
public void bind(Service svc) { ... }

@Bind
public void bind(ServiceReference ref) { ... }

@Bind
public void bind(Service svc, ServiceReference ref) { ... }

@Bind
public void bind(Service svc, Map properties) { ... }

@Bind
public void bind(Service svc, Dictionary properties) { ... }

So no problem to access the service properties. Except if you really need the ServiceReference, it's probably better to not use this OSGi-specific object (reduce testability).


text:
Q: Size of forms and its controls are smaller than usual When I add new form to my project, size of the Form and controls are really small that e.g. the text of button can not be read. But when I run the solution it is normal.This image shows the form before and after the execution.
Could you please help me to solve the problem


text:
Q: How to implement Here Maps routing I'm having trouble getting Here Maps' routing system working on web, for now by following the official documentation.
The part that isn't clear is that I don't know how to call the routingCallback() function, or actually where to call it, and what are it's parameters.
The documentation states the following:
"A route can be added to the map only after it has been calculated. For this reason, the routing manager must be given an observer to be called when the route is ready. The observer watches the Manager's property "state""
What exactly is this "observer" object? When should I call the routingCallback() function?
I am using the exact same code that can be found in the documentation.
Thanks!

A: I can see the confusion, they don't show where/how to attach the observer.
Note however that you don't call the routingCallback yourself, the routing manager
calls that function automatically once the async call is done
e.g.
var routingManager = new nokia.maps.advrouting.Manager();
routingManager.addObserver("state", routingCallback, routingManager);


text:
Q: How to Bind Dropdown List with Web Services in ASP.NET using C# can any one help me to How to Bind  Dropdown List with Web Services in ASP.NET using C#
    [WebMethod]
public DataTable dropdwnfill()
{
    DataTable ds;
    SqlCommand cmd = new SqlCommand("select itemname from tbl_pro", con);
    SqlDataAdapter dap = new SqlDataAdapter(cmd);
    ds = new DataTable();

    dap.Fill(ds);
    ds.TableName = "MyDt";
    return ds;
}

thanks in advance

A: If i understand the requirement correctly, you want to populated a drop-down control from server side, but that to be invoked from UI (e.g a ajax call).
First of all, you can do the  same with page-method also.
Populate the required data in server side method (say dropdwnfill()) and return a collection of row.
Then consume that method through ajax call from UI and populate the drop down.
see below :
/*structure to be return*/
   public class DropDownValue
    {
        public string name { get; set; }
        public string value { get; set; }
    }
/*server side page-method*/
        [WebMethod]
        public static List<DropDownValue> dropdwnfill()
        {
           // sample data population in list
            DropDownValue dropDownValue1 = new DropDownValue();
            dropDownValue1.name = "TestName1";
            dropDownValue1.value = "1";

            DropDownValue dropDownValue2 = new DropDownValue();
            dropDownValue2.name = "TestName2";
            dropDownValue2.value = "2";

            List<DropDownValue> lst = new List<DropDownValue>();
            lst.Add(dropDownValue1);
            lst.Add(dropDownValue2);

            return lst;

        }

/*Consume in UI*/
$(document).ready(function () {
        $("[id*=btnLoadDropDown]").click(function () {
            $.ajax({
                type: "POST",
                url: "default.aspx/dropdwnfill",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                error: function (jqXHR) {
                    //do required stuff for error
                    alert(jqXHR.responseText);
                }.bind(this),
                success: function (msg) {
                    var option = '';
                    if (msg.d.length > 0) {
                        for (i = 0; i < msg.d.length; i++) {
                            option += '<option value="'+ msg.d[i].value + '">' + msg.d[i].name + '</option>';
                        }
                        $('#drpTest').append(option);
                    }
                }.bind(this)
            });
            return false;

        });
    });

/*UI element Design*/
<div>
<asp:DropDownList ID="drpTest" runat="server" AutoPostBack ="false" Width="356px"> </asp:DropDownList>
</div>
<asp:Button ID ="btnLoadDropDown" runat ="server" Width="354px" Text="Load Drop Down" AutoPostBack ="false"/>

Secondly , the purpose of web service is to expose a end-point.
So, you can also create a web service to get only data from server, and then populate the drop down as shown earlier.
To create/consume a web-service, you can refer :  How to create web service (server & Client) in Visual Studio 2012?


text:
Q: Faulty Assembly Logic? I'm trying to write a compiler for my custom language, and the output is NASM Assembly:
BITS 64
section .text
    global _start

_start:
    push rbp
    mov rbp,rsp

    ; --- (+) 1, 1 --- ;
    mov rax,1
    mov rbx,1
    add rax,rbx

    ; --- (if) rax --- ;
    cmp rax,0
    jz after_if_1

    ; --- (write) '3 --- ;
    mov ecx,str_3
    mov rdx,15
    mov rbx,1
    mov rax,4
    int 80h

    ; --- (+) 2, 2 --- ;
    mov rax,2
    mov rbx,2
    add rax,rbx

    ; --- (if) rax --- ;
    cmp rax,0
    jz after_if_2

    ; --- (write) '2 --- ;
    mov ecx,str_2
    mov rdx,15
    mov rbx,1
    mov rax,4
    int 80h

    ; --- (+) 3, 3 --- ;
    mov rax,3
    mov rbx,3
    add rax,rbx

    ; --- (if) rax --- ;
    cmp rax,0
    jz after_if_3

    ; --- (write) '1 --- ;
    mov ecx,str_1
    mov rdx,15
    mov rbx,1
    mov rax,4
    int 80h

after_if_3:
after_if_2:
after_if_1:
    pop rbp
    mov rax,1
    syscall

section .data
    str_1 db 33h,2bh,33h,20h,69h,73h,20h,6eh,6fh,74h,20h,7ah,65h,72h,6fh
    str_2 db 32h,2bh,32h,20h,69h,73h,20h,6eh,6fh,74h,20h,7ah,65h,72h,6fh
    str_3 db 31h,2bh,31h,20h,69h,73h,20h,6eh,6fh,74h,20h,7ah,65h,72h,6fh

I'm no expert in assembly, and why it always skips to the end? (jz after_if_1 gets triggered even though rax isn't zero) This is almost certainly my fault, but why?
NOTE: when I change the first "cmp rax,0" to "cmp eax,0" it magically worked as intended. This is confusing.


text:
Q: I am using appendChild in a 'contact; form to print a nice message upon submission, but the message disappears immediately I'm making a very basic 'contact us' form, and I want to have a little "Thanks for your feedback" message appear on the page (not as an alert), upon successful form validation. The problem is, I hit the submit button, and the thankyou message appears for a split second and then disappears.
Code:
window.onload = init;

function init()
{
document.getElementById("contactForm").onsubmit=validate;
}

function validate()
{
//if statements to appear here returning false if any conditions are met
addMessage();
return true;
}

function addMessage()
{
var p = document.getElementById("content");
var l = document.createElement("p");
var m = document.createTextNode("Thanks for your message!");

l.appendChild(m);
p.appendChild(l);
}

What am I doing wrong? I am pretty new to javascript. Thanks!

A: You are returning true after calling addMessage(), so the message is displayed and then the form is submitted immediately.
If you want to prevent immediate form submission, you can either use standard alert() (it waits for user to press OK button) or prevent form submission by returning false and then submitting the form explicitly by calling form.submit() method when user clicks some button after he has read the message.
Actually, message like "Thanks for your message!" should be displayed on target page specified in action attribute of the form and loaded after form is already sent. It's not a good idea to say something that assumes the form is sent while it is not yet.

A: Both Firefox 15 and IE 9 update the DOM before submitting the form, so I can't see it's an issue. But anyhow, you can delay submission by calling it from setTimeout, that way it's pretty much guaranteed that the DOM will update to display the message, then the form will be submitted, e.g.

Success!!
<form onsubmit="return validate(this);">
  <input type="text" name="foo" value="bar">
  <input type="submit">
</form>

Note that calling the form's submit method doesn't dispatch a sumbit event, so the submit handler isn't called again. This is contrary to the DOM 2 HTML standard, but browsers never followed it anyway.
It's been changed in the new "living" HTML specification so that a submit event must not be dispatched if submission is from the form's submit method.


text:
Q: Ruby on Rails: MySql Gem does not work: uninitialized constant Mysql::Error I have the following installed:
Mac Os 10.7.2 (MacPro Pro, Processor Core i7)
rails 3.1.0
ruby 1.9.2
mysql 5.5.19, for osx10.6 (i386)
I can install the mysql gem without problems:
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
I can also login and create a database and a dummy table.
But when I want to set up the mysql db using rake
rake db:setup RAILS_ENV="production" --trace
Then I receive the following error:
uninitialized constant Mysql::Error
Is it possible that the MySQL version is wrongly installed?
I used the "Mac OS X ver. 10.6 (x86, 64-bit)", but when I run mysql -V then it says "i386". Isn't this the 32 bit version?
The full output is:
Ver 14.14 Distrib 5.5.19, for osx10.6 (i386) using readline 5.1

A: Did you run bundle install? Also rather than the old mysql gem, it is recommended to use the mysql2 gem.
And then when you are inside your project's root directory, run your app using bundler:
bundle exec rails s

When you use bundle, you don't need to install gems using gem install ..., just use bundle install.


text:
Q: use ctypes call windows api function to set color profile I am trying to use ctypes to call windows api function to set color profile. According to the document, I have to first install color profile and then associate it to the monitor. In my case, I want to associate to the display 1. mscms.AssociateColorProfileWithDeviceW(None,profile_path,Device.DeviceName)  return 0. I check the color management. the profile is not associated. Does someone know what's wrong here? Thanks!
here is the code:
import ctypes
from ctypes import wintypes
import win32api as w
import win32con as c
mscms = ctypes.CDLL("Mscms.dll")
profile_path = r'C:\Windows\System32\spool\drivers\color\test.icm'
#install profile
res = mscms.InstallColorProfileW(None,profile_path)
Device = w.EnumDisplayDevices(None,0,0)
associateProfile = mscms.AssociateColorProfileWithDeviceW(None,profile_path,Device.DeviceName)
print('associateProfile: ',associateProfile)

A: Perhaps this may be of some help, here is a list of functions you can use to manage color profiles.
Specifically, InstallProfileColorW might be what you're looking for.
I don't think this is currently supported in pywin32 and would require you to either use ctypes or cffi yourself to create the particular bindings, or perhaps write a Python extension that does this for you.


text:
Q: Problems implementing Admops in AndroidStudio I try to implement a banner-Ad in my App. I tried to do it like this (https://developers.google.com/admob/android/quick-start?hl=de#import_the_mobile_ads_sdk, https://developers.google.com/admob/android/banner?hl=de)
This is a part of my AndroidManifest.xml
        <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="ca-app-pub-8724409258852440~2528XXXXXX"
        android:resource="@array/preloaded_fonts" />

Now I get this Error:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.zimmer.myapp, PID: 11441
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider:
java.lang.IllegalStateException: The
com.google.android.gms.ads.APPLICATION_ID metadata must have a String
value.
at android.app.ActivityThread.installProvider(ActivityThread.java:7244)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalStateException: The com.google.android.gms.ads.APPLICATION_ID metadata must have a String
value.
at com.google.android.gms.internal.ads.zzzo.attachInfo(com.google.android.gms:play-services-ads-lite@@19.6.0:9)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@19.6.0:3)
at android.app.ActivityThread.installProvider(ActivityThread.java:7239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at com.google.android.gms.internal.ads.zzzo.attachInfo(com.google.android.gms:play-services-ads-lite@@19.6.0:6)
at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@19.6.0:3)
at android.app.ActivityThread.installProvider(ActivityThread.java:7239)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
at android.app.ActivityThread.access$1300(ActivityThread.java:237)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
I/Process: Sending signal. PID: 11441 SIG: 9

I don't understand what I did wrong because I did it exactly as in the guide. Does somebody has an idea?

A: I restored my project and after this it worked. Maybe this can help someone.


text:
Q: How can I use an SSL certificate with my Next JS deployment? I have a Next.js deployment on an EC2 instance. I want to install an SSL certificate. The only way I can think of is to use a custom server config, but this seems to remove certain optimizations that I'd rather keep. Keep in mind I am starting the server using 'next start'.
The solutions I found online only apply to local deployments and they also involve using a custom server config.
Thanks

A: an option is to use nginx and host configs
https://medium.com/today-i-solved/how-to-deploy-next-js-on-aws-ec2-with-ssl-https-7980ec6fe8d3

A: One of the quickest solutions is to:

*

*Dockerize Next.js application

*Set up a Docker Compose environment with two containers: the Next.js application itself and NGINX (the image is available on DockerHub to it's a matter of pulling it)

*Configure NGINX as a reverse proxy that handles the SSL part

With this approach, the question becomes a duplicate of this other SO. Details and code examples (in particular for the third point) are available there.


text:
Q: css, javascript -- where to start? I am a C/C++ programmer with more than 10 years of experience. I also know python and perl, but I've never used this languages for a web development.
Now for some reasons I want to move into the web development realm and as part of that transition I have to learn css, javascript, (x)html etc.
So I need an advice for a good sources of information for such topics. For a while I don't want to read lengthy tutorials, I want something quick and dirty, something to start with.

A: You can learn style and best practices on A List Apart web site.

A: Since you are an experienced programmer, a good place to start with javascript might be Javascript: The Good Parts by Douglas Crockford. It is a brief but thorough tour of, well, the best parts of javascript (and pretty much all you'll need for quite a while).
Your approach to CSS and HTML will have to be very different. I suggest trying to make a static site or two, checking reference material if you get stuck. Pick a site that you like, and try recreating the basic layout in HTML. Got the layout? Try making it look pretty. Repeat.

A: I would highly recommend you look at Dev Opera, its full of up to date information with a strong focus on webstandards. In particular, the Web Standards Curriculum is a great resource for beginners to get started.
I really wouldn't rely on the W3 Schools site, its content isn't kept as up to date and the examples often show bad-practice. If you know what you're doing it can be good as a quick resource for a single technique, but for a beginner it could easily lead you down the wrong path.

A: I found http://htmldog.com/ to be useful when learning HTML/CSS. It teaches w3c compliant HTML and CSS, unlike many other sites. Looking at other people's CSS is also really useful. CSS is pretty simple (ignoring all the browser incompatibilites), so even will little CSS knowledge you can figure out what other people are doing.
Javascript is more complicated. Javascript has a pretty strange object system (it uses prototypal inheritance), so it's best to pick up a book. Crockford's Javascript: The Good Parts is an excellenent book to learn the fundamentals of javascript. The thing about javascript is that are basically two parts to it: the language, and the DOM (document object model). Most of the time, javascript is used in the browser, which means it has to interact with HTML via the DOM. Many people don't realize that javascript can be used outside of a web browser. JS: The Good Parts will teach you the javascript core, then you can look up the DOM interaction elsewhere.

A: I won't suggest w3schools for CSS and XHTML, but htmldog.com. I would suggest something about unobtrouse JavaScript for JS.

A: My favourite CSS tutorial site has always been www.htmldog.com. The reason I like it so much is that not only does it teach you CSS, it also teaches you to drop any bad html habits you may have picked up over the years. In my view learning to write clean, semantic html is an important precursor to really getting to grips with css.
As for javascript, w3schools is probably best

A: For CSS, how about CSS in a Nutshell, by O'Reilly?  Nice and thin.

A: Opera recently put a lot of effort into getting people to write a bunch of tutorials. The quality is high, and they pay attention to feedback (unlike W3Schools). It covers HTML, CSS and JavaScript and I haven't come across a better starting point.

A: The W3Schools site has a try it yourself section that i think will be perfect for you.
W3Schools CSS
W3Schools Javascript

A: W3Schools is a good place to start.
However, you might also benefit by poking around the Mozilla Developer Centre (MDC), which has lots of information about HTML, CSS, and JavaScript. I now almost exclusively use the MDC for looking things up—it has lots of examples, lots of detail (if you want to go into it), and it shows you many different things that you can do with the item you're looking up.
Also, for JavaScript, after you've learnt the basics ("A re-introduction to JavaScript" on the MDC is a good place to start), Douglas Crockford's JavaScript page and John Resig's "Learning Advanced JavaScript" make for excellent reading.
Steve

A: W 3 Schools is a neat beginner/novice reference and tutorial site.
The site covers most technologies used in web-development.

A: Install firebug.

*

*It helps inspecting html.

*You can edit CSS on the fly.

*Has a JavaScript console.

Here is a nice article explaining the some features of firebug.


text: Q: How to smooth velocity in the edges of a path I'm trying to take off and land a helicopter and I wanted to know if there is a function that could smooth only the beggining and end of the path and keep a constant velocity in the middle ?


text:
Q: How to insert multiple data to a table with auto_increment primary key column? So I'm using SQLite 3.6 and tried to insert multiple data to my table which has 3 columns (1 AI PK) using
INSERT INTO 'tablename'
      SELECT 'data1' AS 'column1', 'data2' AS 'column2'
UNION SELECT 'data3', 'data4'
UNION SELECT 'data5', 'data6'
UNION SELECT 'data7', 'data8'

somehow it didn't work and I got this error

table transport_type has 3 columns but 2 values were supplied

Is there any other way to input multiple data?

A: If you are not providing data for all columns in a table, or the data you provide is not in the same order as the columns in the table, you must provide a list of column names:
INSERT INTO tablename(column1, column2)
SELECT ...

Related examples:

*

*Omitting some columns to use their default value.
Technically this is the same as above, but this demonstrates usage for non-auto-increment columns.
INSERT INTO myTable(column1, column7, column21)
SELECT 'one', 'seven', 'twenty-one';

*Inserting columns in a different order than was defined.
Given a table with the following definition:
CREATE TABLE myTable (
    column1 VARCHAR(255),
    column2 VARCHAR(255),
    column3 VARCHAR(255),
    column4 VARCHAR(255)
);

We can specify a column list to insert rows where the data is given out of order. Note the columns are specified in a different order than the definition.
INSERT INTO myTable(column3, column4, column2, column1)
SELECT 'three', 'four', 'two', 'one';


text:
Q: Mac OSX Server: svn via ssh command line and encrypted passwords When I log into our mac mini server running OSX 10.6 via ssh and use svn I get the message:

ATTENTION!  Your password for authentication realm:

can only be stored to disk unencrypted!  You are advised to configure
 your system so that Subversion can store passwords encrypted, if
 possible.  See the documentation for details.
You can avoid future appearances of this warning by setting the value
 of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
 '/Users/xxxxxxxx/.subversion/servers'.

I dont' want to store the password unencrypted though.
I've found some details on how to use GNOME keychain in linux to sort this, but nothing on how to use macosx's keychain.
Anyone got any ideas?
Thanks a lot!

A: I know this question is a little old, but I just found the solution...  You can do it remotely via SSH by invoking security(1) before doing your svn up.
$ security unlock-keychain ~/Library/Keychains/login.keychain
password to unlock /Users/username/Library/Keychains/login.keychain:
$ svn up

A: I think it depends on the svn implementation you're using. AFAIR, it works when using the version from open.collab.net:
http://svnbinaries.open.collab.net/

A: The subversion client that comes with 10.6 can store credentials in the keychain, but I believe that you have to be logged in graphically for it to have access to the keychain.  The "login" keychain is unlocked automatically when you log in graphically if its password is the same as the one you actually use to login, which may be the reason.
It is also possible to use Kerberos to authenticate if you configure it through Apache on your subversion server.  I believe you would need to compile your own copy of the subversion client, however.


text:
Q: What should be the SDK path for android studio preview version? I want to install android studio preview version beta 3.4
But I am confused that should I download the whole SDK again or give the same path as the stable version of Android studio has.

A:
Should I download the whole SDK again or give the same path as the
  stable version of Android studio has.

YES Use the same SDK. Just map the path. No need to download all SDKs again.


text:
Q: Time Difference calculation Android and iOS I have a web site running on IIS that will take two time variables, calculate those variables and produce a time differnce in -Minutes (eg StartTime = "18:00", EndTime = "18:30", Diff = "-30")
I have this working perfectly in VBScript using the DateDiff() function. I have searched high and low, looking for a similar solution for both Android and iOS so I can build the time calculation into my mobile app and have it available off line(if there is not internet connectivity for example).
This is part of the code I use in VBScript:
   //Grab the values from the form controls

    occtime = occDate.Value //from form controls
    testTime = testDate.Value //from form controls

    //work out the time difference in minutes. Should always a negative number.
    timeCalc = DateDiff("n", testTime, occtime)

Using either a time variable, HH:MM or using a full date dd/mm/yyyy HH:MM will give me the result I need, however I'm struggling getting this to work in either iOS(Swift) or Android Studio.
Thanks in Advance for any help.

A: For iOS please try this Swift code in the XCode playgorund:
import Foundation

let curerntDate = NSDate()
let futureDate = NSDate(timeInterval: 36*60*60, sinceDate: curerntDate)

let currentCalendar = NSCalendar.currentCalendar()
let differenceDateComponents = currentCalendar.components([.Era, .Year, .Month, .Day, .Hour, .Minute, .Second], fromDate: curerntDate, toDate: futureDate, options: NSCalendarOptions(rawValue: 0))
print(differenceDateComponents)

A: Swift 2.2 compatible extension:
extension NSDate {
        func yearsFrom(date:NSDate) -> Int{
            return NSCalendar.currentCalendar().components(.Year, fromDate: date, toDate: self, options: []).year
        }
        func monthsFrom(date:NSDate) -> Int{
            return NSCalendar.currentCalendar().components(.Month, fromDate: date, toDate: self, options: []).month
        }
        func weeksFrom(date:NSDate) -> Int{
            return NSCalendar.currentCalendar().components(.WeekOfYear, fromDate: date, toDate: self, options: []).weekOfYear
        }
        func daysFrom(date:NSDate) -> Int{
            return NSCalendar.currentCalendar().components(.Day, fromDate: date, toDate: self, options: []).day
        }
        func hoursFrom(date:NSDate) -> Int{
            return NSCalendar.currentCalendar().components(.Hour, fromDate: date, toDate: self, options: []).hour
        }
        func minutesFrom(date:NSDate) -> Int{
            return NSCalendar.currentCalendar().components(.Minute, fromDate: date, toDate: self, options: []).minute
        }
        func secondsFrom(date:NSDate) -> Int{
            return NSCalendar.currentCalendar().components(.Second, fromDate: date, toDate: self, options: []).second
        }
        func offsetFrom(date:NSDate) -> String {
            if yearsFrom(date)   > 0 { return "\(yearsFrom(date))y"   }
            if monthsFrom(date)  > 0 { return "\(monthsFrom(date))M"  }
            if weeksFrom(date)   > 0 { return "\(weeksFrom(date))w"   }
            if daysFrom(date)    > 0 { return "\(daysFrom(date))d"    }
            if hoursFrom(date)   > 0 { return "\(hoursFrom(date))h"   }
            if minutesFrom(date) > 0 { return "\(minutesFrom(date))m" }
            if secondsFrom(date) > 0 { return "\(secondsFrom(date))s" }
            return ""
        }
    }

For Android these methods working good:
public static int calcDaysDiff(Date day1, Date day2) {
        Date d1 = new Date(day1.getTime());
        Date d2 = new Date(day2.getTime());
        Calendar date1 = Calendar.getInstance();
        date1.setTime(d1);
        Calendar dateCpy = (Calendar) date1.clone();
        Calendar date2 = Calendar.getInstance();
        date2.setTime(d2);
        //checks if the start date is later then the end date - gives 0 if it is
        if (date1.get(Calendar.YEAR) >= date2.get(Calendar.YEAR)) {
        if (date1.get(Calendar.DAY_OF_YEAR) >= date2.get(Calendar.DAY_OF_YEAR)) {
            return 0;
        }
        }
        //checks if there is a daylight saving change between the two dates
        boolean isDate1Summer = TimeZone.getDefault().inDaylightTime(d1);
        boolean isDate2Summer = TimeZone.getDefault().inDaylightTime(d2);
        int offset = 0;
        //check if there as been a change in winter/summer time and adds/reduces an hour
        if (isDate1Summer && !isDate2Summer) {
            offset = 1;
        }
        if (!isDate1Summer && isDate2Summer) {
            offset = -1;
        }
        return calcDaysDiffAux(dateCpy, date2) + checkFullDay(dateCpy, date2, offset);
    }

    // check if there is a 24 hour diff between the 2 dates including the daylight saving offset
    public static int checkFullDay(Calendar day1, Calendar day2, int offset) {
        if (day1.get(Calendar.HOUR_OF_DAY) <= day2.get(Calendar.HOUR_OF_DAY) + offset) {
            return 0;
        }
        return -1;
    }

    // find the number of days between the 2 dates. check only the dates and not the hours
    public static int calcDaysDiffAux(Calendar day1, Calendar day2) {
        Calendar dayOne = (Calendar) day1.clone(),
                dayTwo = (Calendar) day2.clone();

        if (dayOne.get(Calendar.YEAR) == dayTwo.get(Calendar.YEAR)) {
            return Math.abs(dayOne.get(Calendar.DAY_OF_YEAR) - dayTwo.get(Calendar.DAY_OF_YEAR));
        } else {
            if (dayTwo.get(Calendar.YEAR) > dayOne.get(Calendar.YEAR)) {
                //swap them
                Calendar temp = dayOne;
                dayOne = dayTwo;
                dayTwo = temp;
            }
            int extraDays = 0;

            while (dayOne.get(Calendar.YEAR) > dayTwo.get(Calendar.YEAR)) {
                dayOne.add(Calendar.YEAR, -1);
                // getActualMaximum() important for leap years
                extraDays += dayOne.getActualMaximum(Calendar.DAY_OF_YEAR);
            }
            return extraDays - dayTwo.get(Calendar.DAY_OF_YEAR) + dayOne.get(Calendar.DAY_OF_YEAR);
        }
    }


text:
Q: SSH Ubuntu -> Windows XP -> Linux I'm developing cross-platform, and I have the following situation:

*

*a PC with Windows 7 + Ubuntu in a virtual machine where I develop and compile the code located in the office

*a PC with Windows XP in the lab

*an embedded device running Linux with buttons that I need to press

What I normally do is to make changes in Ubuntu, send them via SSH to the embedded device, walk from the office to the lab, open Putty on the Windows XP, and run the program and press the buttons in the embedded system to try the changes. I'm getting tired of walking!
I cannot install new stuff in the lab computer, but I have Notepad++ that would do for simple changes. How can I sync the code between the Ubuntu virtual machine, Windows XP and an embedded system? Can I compile using Ubuntu from the Windows XP machine?

A: Thanks for the comments.
What I'm doing to deal with this is to share a folder between ubuntu and winxp.
access to ubuntu and the embedded system with putty from xp. Compile in ubuntu and edit the code in xp with notepad++.


text:
Q: Duplicate items appearing in shopping cart I'm trying to basically build a shopping cart on a static site. Items are displayed on a table. I built this shopping cart from scratch, no external jQuery shopping cart libraries used.
There's one feature I can't seem to get to work: When a user adds an item that already exists in the shopping cart, it should only increase the quantity instead of adding the item to the table.
Here's a JSFiddle link with everything I've implemented so far and a working demo, but you can also see the code below.
Here's the JS that adds the item:
$( "#addBtn" ).click(function() {
  var item = $("#orderMenu option:selected").text();
  var qty = $("#orderQty option:selected").text();

  var newRowContent = "
" + qty + "	" + item + "	";

  $("#cart-info tbody").append(newRowContent);
});

Here's the simplified HTML, for the sake of simplicity:

            #
            Item

<select id="orderMenu">
    <option>Foo</option>
    <option>Bar</option>
</select>

<select id="orderQty">
    <option>1</option>
    <option>2</option>
    <option>3</option>
</select>

<button id="addBtn">ADD TO CART</button>

Here's the pseudocode I'd like to convert to jQuery but have no idea how.
(Apologies for the weird pseudocode/jQuery hybrid, I'm still learning jQuery)
for each  in #cart-info {
    if (.html() == item) {
        qtyCell = the previous
        oldQty = Number(qtyCell.text())
        newQty = oldQty + qty
        qtyCell.html(newQty)
        exit for loop
    }
}

The website itself is written purely in HTML/CSS/JS, so it is a completely static site.
Thank you very much in advance!

A: Check this fiddle
new fiddle
Use the value of each option to determine if it has already been added to the table:
$( "#addBtn" ).click(function() {
  var item = $("#orderMenu option:selected").text();
  var item_val = $("#orderMenu").val();
  var qty = $("#orderQty option:selected").text();

  var newRowContent = "
" + qty + "	" + item + "	";
  if ($("#cart-info tbody [data-val='"+item_val+"']").length < 1)
      $("#cart-info tbody").append(newRowContent);
    else {
        var new_qty = parseInt($("#cart-info tbody [data-val='"+item_val+"']").prev('.qty').text())+parseInt(qty);
        $("#cart-info tbody [data-val='"+item_val+"']").prev('.qty').text(new_qty);
    }
});

EDIT:
fixed fiddle url
EDIT 2
new fiddle updating quantities

A: You can achieve it on

*

*Maintaining a list

An array which consists of key-pair value(JSON) item ID and it's quantity as field
Ex:-
var items = [
      {
        itemID:101,
        name:"Mobile:"
        qty:1
      },
      {
        itemID:102,
        name:"Pen Drive"
        qty:3
      }
]

*

*On adding a new item push the respective itemID, qty, name, etc.. into the list

*On already exists then query with itemID and increment the qty field
The cart you are displaying is available in cart-info tbody so in that case make sure you have an unique ID in row(tr)
Ex:
1	Mobile

Finally update the text of the respective id with your updated quantity


text:
Q: recording sound recognize android I develop an app where the user can record an sound, maybe a clap or other sounds. The android system should save it, since the user delete the command. With that recording sound the user can select any commands that the device maybe show an intent or others. Now my question: Is it possible that when the microphone are on that the device when it hear the recording voice start the intent and when it is possible how can I do that? I think that I maybe do it with getMaxAmplitude() but I need an method to decide the length of that amplitude.

A: https://code.google.com/p/musicg/ may help you.
You can find the demo app in the site.
The features described in the site as follows:

*

*Clap Api - Detect whether the input audio is a clap

*Whistle Api - Detect whether the input audio is a whistle

*Read PCM WAVE Headers

*Read audio data

*Trim the audio data

*Save the edited audio file

*Read amplitude-time domain data

*Read frequency-time domain data

*Render audio wave form image (Requires Java 2D & Java Image I/O, Android non-compatible)

*Render audio spectrogram image (Requires Java 2D & Java Image I/O, Android non-compatible)


text:
Q: Launching multiple instances of QGIS (Mac)? Often I need to work on two qgis projects at the same time. How can I launch two separate instances of QGIS?

A: This is not necessarily specific to QGIS but is a question I often get with QGIS users needing to reference two projects at the same time.
open a terminal window and type:
open -n /Applications/QGIS.app

Or for QGIS3, open a terminal window and type:
open -n /Applications/QGIS3.app

this format will work with any application:
open -n /Applications/Application.app

A: You can make an Automator script to launch as many QGIS instances as you want.
Create a new Automator application process.
Add « Run shell script action »
and type this:

/Applications/QGIS3.8.app/Contents/MacOS/QGIS
done

If you stop the running process, QGIS will still run and you'll be able to launch a third, a fourth, etc instance of QGIS.

A: Under MacOS 10.15.7 Catalina, opening the app directly in Automator would not create a new instance if QGIS was already running.
This Automator code worked for me: make a new Automator Application, add "Run Shell Script" with options "Shell: /bin/zsh" and "Pass input: as arguments", with this command:
open -n -a  /Applications/QGIS.app/Contents/MacOS/QGIS $argv

Save this as "QGIS New Instance.app" in your /Applications folder. This has the advantage that you can drop a file on the Automator Application and have it open in QGIS. Of course, you have to adjust the path to where you keep QGIS.


text:
Q: PHP windows 64bit We have a PHP application installed for a client on his windows server, using Apache and Mysql. Now the client wants to upgrade his server and is asking
"Does the application, apache web server, and mysql support Windows 64 bit?"
Now, I see there is a mysql version for windows 64bit, but I can't find anything official for Apache and PHP, but only binaries from 3rd-party sites.
Does anyone know if there is an official Apache and PHP release for windows 64bit (or a trustworthy 3rd-party at least)? For Apache I could use IIS so it's not really a problem, so it's mainly PHP I'm interested in.
Alternatively, will there be a problem if I run the standard latest binaries that are offered from the PHP site?
As always, thanks in advance

A: I'm using Windows 7 64Bit and use the XAMPP for 32 Bit.
So you can just install Apache, PHP and MySQL for 32Bit systems on a 64Bit machine.

A: You can get a WAMP stack on 64bit windows system. However there' might be some problems with some dll extensions for example CURL as described in this article.


text:
Q: jquery ui draggable when set containment draggable div jumping I am trying to use jQuery-UI draggable which is working fine, but I have a strange behavior. When I am setting a containment, the draggable div jumps from one side to another. When I am disabling it, then I can smoothly drag the container.

$('.bJS_issueTeaser').draggable({
  'cursor': 'move',
  axis: "x",
  containment: "parent"
});
.b_ct_issueTeaser {
  width: 37.665rem;
  overflow: hidden;
  max-width: 100%;
  margin-top: 60px;
  position: relative;
  min-height: 250px;
}
.bJS_issueTeaser {
  width: 50.0745rem;
  position: absolute;
}
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -0.67rem;
  margin-right: -0.67rem;
}
.c_teaser {
  width: 240px;
  height: 100px;
  padding-left: 0.67rem;
  padding-right: 0.67rem;
}
.c_teaser-inner {
  position: relative;
}
.c_description {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 2rem;
  background: rgba(255, 255, 255, 0.5);
  padding: 0.67rem 1.34rem;
}
.img-fluid {
  display: block;
  max-width: 100%;
  height: auto;
}

                Lorem ipsum

                Lorem Ipsum

                Lorem ipsum

jsFiddle


text:
Q: How to get label value which loads with javascript I have a link like that. It's getting from instagram api.
http://localhost:60785/access_token.aspx/#access_token=43667613.4a1ee8c.791949d8f78b472d8136fcdaa706875b

How can I get this link from codebehind?
I can take it with js but i can't get it after assign to label. I mean:
<script>
    function getURL(){
        document.getElementById('lblAccessToken').innerText = location.href;
    }
</script>

This js function is in body onload event. How can I reach this innerText value from codebehind?

A: If you are using ASP.NET 4.0 and jQuery, its fairly easy. Otherwise you may have to deal with mangled id and have to deal with DOMReady on your own. Try this
Markup
<asp:Label ID="lblAccessToken" runat="server" ClientIDMode="Static"></asp:Label>

JavaScript
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
    $(document).ready(function(){
        var myToken = GetHashParameterByName("access_token");
        $("#lblAccessToken").html( myToken );
    });

    function GetHashParameterByName(name) {
        var match = RegExp('[#&]' + name + '=([^&]*)')
                .exec(window.location.hash);
        return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
    }
</script>

You want the value on Page_Load right? I haven't figured out a way myself to fetch the hash value on Page_Load.I usually do one of these things

*

*Pass the hash value to a jQuery ajax method and store it there.

*Grab the hash value and redirect to the same page after converting it to a querystring

JavaScript
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
    $(document).ready(function(){
        var myToken = GetHashParameterByName("access_token") || "";
        if(my_token !=== ""){
            window.location = window.location.split("/#")[0] + "?access_token=" + myToken;
        }
    });

    function GetHashParameterByName(name) {
        var match = RegExp('[#&]' + name + '=([^&]*)')
                .exec(window.location.hash);
        return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
    }
</script>

Now at Page_Load, grab it like
string token = Request.QueryString["access_token"];

Please note that it takes one more round trip to the server and so not very efficient. But this is what I do.


text:
Q: In the light of the FREAK TLS vulnerability, how may I disable insecure cipher suites manually in Safari? A research group named SMACK has released a vulnerability known as FREAK which can be used for man-in-the-middle (MITM) attack. The vulnerability is due to an old ghost created by USA Government (NSA, more specifically) where in, years ago, they convinced several organizations to use weaker keys, known as export-grade keys for any software that was to be used outside the borders of USA. While the use of strong keys is wide spread now, several servers still have support for the weaker keys.
The group discovered that this vulnerability can be exploited by using a client and making a connection via a weak key. Once the key is generated by the server, it is reused until the server is restarted which can potentially be months. The group was able to crack this weak server key in 7.5 hours using Amazon EC2. Once this is cracked, potentially all the communication can be downgraded to use weak keys and MITM'ed.
The attack mainly addresses OpenSSL (e.g. Android) clients and Apple TLS/SSL clients (Safari) in conjunction with vulnerable web servers but not Firefox, Chrome or IE.
How may I disable some or all of the insecure Cipher Suites manually on the client side by e.g. editing some configuration files in Safari, using an appropriate Safari extension or modifying binaries directly to immediately fix the vulnerability especially in older Safari versions probably not updated by Apple? Is it possible at all?
The Cipher Suites in question are:
CipherSuite TLS_RSA_EXPORT_WITH_RC4_40_MD5         = { 0x00,0x03};
CipherSuite TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5     = { 0x00,0x06};
CipherSuite TLS_RSA_EXPORT_WITH_DES40_CBC_SHA      = { 0x00,0x08};
CipherSuite TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA   = { 0x00,0x0B};
CipherSuite TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA   = { 0x00,0x0E};
CipherSuite TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA  = { 0x00,0x11};
CipherSuite TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA  = { 0x00,0x14};
CipherSuite TLS_DH_anon_EXPORT_WITH_RC4_40_MD5     = { 0x00,0x17};
CipherSuite TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA  = { 0x00,0x19};

and maybe some more.

A: Safari on OS X uses Secure Transport for SSL/TLS, the same implementation which is linked in cURL, App Store, etc. Secure Transport does not have any user configurations available. Therefore, it is not possible to modify Safari cipher suites.
Anyway, Apple recently released Security Update 2015-002 which fixes this issue.

Impact: An attacker with a privileged network position may intercept
  SSL/TLS connections
Description: Secure Transport accepted short ephemeral RSA keys,
  usually used only in export-strength RSA cipher suites, on connections
  using full-strength RSA cipher suites. This issue, also known as
  FREAK, only affected connections to servers which support
  export-strength RSA cipher suites, and was addressed by removing
  support for ephemeral RSA keys.
CVE-2015-1067 : Benjamin Beurdouche, Karthikeyan Bhargavan, Antoine
  Delignat-Lavaud, Alfredo Pironti, and Jean Karim Zinzindohoue of
  Prosecco at Inria Paris

You can examine Secure Transport client with something like, curl "https://www.howsmyssl.com/a/check" | tr ',' '\n'. As someone pointed out, it is also a good idea to use Firefox or Chrome which use NSS instead.


text:
Q: Dynamically create checkboxes and calculate total depending on checkboxes ticked I get addons data from the server, and need to dynamically create the viewmodel with a number of checkboxes, and then total these checkboxes according to the checkbox selected and its price.
My viewModel is below:
var addonsData = [
    { sku: 201, name: "addon A", price: 1 }
    { sku: 201, name: "addon B", price: 2 }
    { sku: 201, name: "addon C", price: 10 }
];

function viewModel(addonsData) {
    for (var i = 0; i < addonsData.length; i++) {
      // addonsData[i] somehow add this to the viewmodel dynamically?
    }

    this.addons = addonsData;
    this.total = ko.computed(function(){
        var x = 0;
        return x;
    });
}

ko.applyBindings(new viewModel(addonsData));

Would greatly appreciate guidance on the above viewmodel and also the HTML view.

A: The simpliest way is to use ko.mapping.fromJS
Take a look at this fiddle
var addonsData = [{
    sku: 201,
    name: "addon A",
    price: 1
}, {
    sku: 201,
    name: "addon B",
    price: 2
}, {
    sku: 201,
    name: "addon C",
    price: 10
}];

function viewModel(ad) {
    var self = this;

    var mapping = {
        create: function (item) {
            item.data.selected = ko.observable();
            return item.data;
        }
    };
    this.addons = ko.mapping.fromJS(ad, mapping);

    this.selectedItems = ko.computed(function () {
        return ko.utils.arrayFilter(self.addons(), function (item) {
            return item.selected();
        });
    });
    this.total = ko.computed(function () {
        return self.selectedItems().length;
    });

    this.totalPrice = ko.computed(function () {
        var t = 0;
        ko.utils.arrayForEach(self.addons(), function (item) {
            if(item.selected())
               t += item.price;
        });
        return t;
    });

}

ko.applyBindings(new viewModel(addonsData));

See fiddle
I hope it helps.


text:
Q: Textbox Losing value under Jquery Modal Dialog Box I am using the script below for Modal Dialog box.I have a textbox and a button under dialog box div but when i click on button textbox value remains null why ? Can anyone help please
  //Everything is working fine but textboxes are losing their values on button click

 $("#dialog").dialog({ modal: true });
         $("#dialog").dialog({ resizable: false });
         $("#dialog").dialog({
             buttons: {
                 //'Confirm': function () {
                 //    $("[id*=btn_Confirm_View]").click();
                 //},
                 'Cancel': function () {
                     $(this).dialog('close');
                 }
             }
         });

         $("#dialog").dialog({ draggable: false });
         $("#dialog").dialog({ closeOnEscape: false });

         $("#dialog").dialog({
             width: 'auto',
             autoOpen: false,
             show: {
                 effect: "blind",
                 duration: 1500
             },
             hide: {
                 effect: "scale",
                 duration: 300
             }

         });

         $("#dialog").dialog({
             close: function (event, ui) {

             }

         });
  //Everything is working fine but textboxes are losing their values on button

A: I got the solution ... :)
Here is my Modified Code...
  //    $("#dialog").dialog({ modal: true });
                 $("#dialog").dialog({ resizable: false });
                 $("#dialog").dialog({
                     buttons: {
                         //'Confirm': function () {
                         //    $("[id*=btn_Confirm_View]").click();
                         //},
                         'Cancel': function () {
                             $(this).dialog('close');
                         }
                     }
                 });

                 $("#dialog").dialog({ draggable: false });
                 $("#dialog").dialog({ closeOnEscape: false });

                 $("#dialog").dialog({
                     width: 'auto',
                     autoOpen: false,
                     show: {
                         effect: "blind",
                         duration: 1500
                     },
                     hide: {
                         effect: "scale",
                         duration: 300
                     }

                 });
//I Added these two lines and now they are working fine
                 $("#dialog").parent().appendTo(jQuery("form:first"));
                 $("#dialog").dialog({
                     close: function (event, ui) {

                     }

                 });


text:
Q: Creating a custom IFS code in non Office 365 excel versions? I've read that the function  IFS  isn't available in Excel version 2016 (that it's not 365).
Is there a way to write a custom code that does just what IFS do but in Excel 2016?
How can I do it? Where do I write it? Please bear with me; I have no programming or coding experience. I use Excel as a freelancer and stumbled upon the IFS formula, but I can't use it. It would be a lifesaver if you guys could teach me how.
I don't want to come across as demanding, but if the result of that code is that I can use the function as any other, I would be so thankful!


text:
Q: How to use response.redirect in  with ajax, if i want to use class name ajax like in link ()? My code is here:
ajax.js
$(document).ready(function(){
$('a.ajax').live('click', function(){
    var link = $(this).attr('href');
    $('#contents').html('

');
    $('#contents').load(link + ' .fill-1', function(){
        if($('#contents').html() == ""){
            $('#contents').html('

The link could not be found.

');
        }
    });
    return(false);
})
})

register.aspx

and HTML code in register.aspx file (i have my problem here)

<form name="reg" id="reg" runat="server">
  <asp:button text="Register" onclick="Register" runat="server" />

and a tag with ajax (old method)
  Register
</form>
  <asp:label id="JavaFocus" runat="server" />


text:
Q: Convert rows as column using python i have file.txt with below content.
jega
divya
ramya

i need output file like below
jega divya ramya

Could anyone help me on this with python code?

A: I am not sure what you exactly want to do. Below code get input.txt as input file and create output.txt
with open('input.txt', 'r') as f:
    rows = f.readlines()

with open('output.txt', 'w') as f:
    f.write(' '.join([ele.strip() for ele in rows]))


text:
Q: rhash -M argument not working in zsh on macOS I need to have the equivalent command of rhash -M Filename.jpg in macOS zshell. The above command works in ubuntu 16.04 but if i try the same command in zsh. It gives me error zsh: command not found: rhash. Any help is appreciated.

A: Not familiar with rhash, but it seems to generate an MD5 sum, so on a Mac, you can do:
md5 -q SomeFile
7df25d6181c015d4cf3e003d5d84a0d9

If that is not perfect, run man md5 to find alternative output formats.

If you have hombebrew, you can also install rhash with:
brew install rhash


text:
Q: Jupyter Notebook Variables not loading suddenly in Visual Code I have been using the Jupyter:Variables on Visual Code for a while and haven't changed anything, however, the variables are no longer loading. I have used to different laptops and they are both experiencing the same issue. The variable just gets stuck loading.
Screenshot of variable window


text:
Q: Macro works but too slow I found this macro that does the job but it takes very long to execute. I would like it to go over rows 4 to 350 instead of all rows. Plus I would like it not to ask which sheet but execute on sheet name Data. The macro is used to delete empty rows.
Sub DeleteBlankRows()
    Dim wks As Worksheet
    Dim lngLastRow As Long, lngLastCol As Long, lngIdx As Long, _
        lngColCounter As Long
    Dim blnAllBlank As Boolean
    Dim UserInputSheet As String

    UserInputSheet = Application.InputBox("Enter the name of the sheet which you wish to remove empty rows from")

    Set wks = Worksheets(UserInputSheet)

    With wks
        'Now that our sheet is defined, we'll find the last row and last column
        lngLastRow = .Cells.Find(What:="*", LookIn:=xlFormulas, _
                                 SearchOrder:=xlByRows, _
                                 SearchDirection:=xlPrevious).Row
        lngLastCol = .Cells.Find(What:="*", LookIn:=xlFormulas, _
                                 SearchOrder:=xlByColumns, _
                                 SearchDirection:=xlPrevious).Column

        'Since we need to delete rows, we start from the bottom and move up
        For lngIdx = lngLastRow To 1 Step -1

            'Start by setting a flag to immediately stop checking
            'if a cell is NOT blank and initializing the column counter
            blnAllBlank = True
            lngColCounter = 2

            'Check cells from left to right while the flag is True
            'and the we are within the farthest-right column
            While blnAllBlank And lngColCounter <= lngLastCol

                'If the cell is NOT blank, trip the flag and exit the loop
                If .Cells(lngIdx, lngColCounter) <> "" Then
                    blnAllBlank = False
                Else
                    lngColCounter = lngColCounter + 1
                End If

            Wend

            'Delete the row if the blnBlank variable is True
            If blnAllBlank Then
                .Rows(lngIdx).Delete
            End If

        Next lngIdx
    End With

    MsgBox "Blank rows have been deleted."

End Sub

A: It looks like you want to delete rows if all cells in that row are blank.
Your actual code checks every single cell from every row and column in your datarange.
You can improve speed just checking if the full row is blank or not. As example:

Yellow cells are blank cells
Red cells are complete blank rows (all cells in that row are blanks).
This code will delete the red rows, that means it will delete entire row but only if all cells are blank.
Dim rng As Range
Dim i As Long
Dim MyRow As Range, DeleteRange As Range
Dim MiF As WorksheetFunction

Set MiF = WorksheetFunction

Set rng = Range("C7:M34") 'define range here

For i = 1 To rng.Rows.Count
    If MiF.CountA(rng.Rows(i)) = 0 Then
        If DeleteRange Is Nothing Then
            Set DeleteRange = rng.Rows(i) 'first time, we can't use Union
        Else
            'we unite all complete blank rows into one final "big" range
            Set DeleteRange = Union(DeleteRange, rng.Rows(i))
        End If
    End If
Next i

'we delete if something is found
If Not DeleteRange Is Nothing Then DeleteRange.EntireRow.Delete

'clear variables
Set DeleteRange = Nothing
Set rng = Nothing
Set MiF = Nothing

After executing code, output is like this.


text:
Q: How to incorporate the C++ standard library into a Zig program? In reading the documentation for zig, I was under the impression that zig could compile both C and C++ code. Consequently, I thought you could import a C++ file's header via @cImport and have zig build succeed. However, I can't seem to get this to work for a C++ library integration.
I first create my project, zig init-lib and then add my import to src/main.zig via the @cImport directive. Specifically, I @cInclude("hooks/hooks.h") the C++ header file of this library. If I attempt to zig build at this point, the build fails, unable to find the header. I fix this by modifying build.zig to lib.addIncludeDir("/usr/include/library").
Since this C++ library is now being parsed and uses the C++ standard library, the next error I get when I zig build is that the stdexcept header is not found. To fix this, I modify build.zig to lib.linkSystemLibrary("c++").
Lastly, and the error I'm stuck on now, is an assortment of errors in /path/to/zig-linux-x86_64-0.9.1/lib/libcxx/include/<files>. I get stuff like unknown type name '__LIBCPP_PUSH_MACROS, unknown type name 'namespace', or unknown type name 'template'.
Googling this, the only thing of partial relevance that I could find was that this is due to clang's default interpretation of .h files is as C files which obviously don't have namespace or template keywords, but I don't know what to do with that knowledge. LLVM on MacOs - unknown type name 'template' in standard file iosfwd
Does anyone have any insight as to how to actually integrate with a C++ (not pure C) library through zig?

A:
Specifically, I @cInclude("hooks/hooks.h") the C++ header file of this library.

@cImport() is for translating C header files into zig so they can be used without writing bindings. Unfortunately, it does not support C++ headers. To use a C++ library, you'll have to write C bindings for it and then @cImport() those headers.
// src/bindings.cpp
#include <iostream>

extern "C" void doSomeCppThing(void) {
    std::cout << "Hello, World!\n";
}

// src/bindings.h
void doSomeCppThing(void);

// build.zig
const std = @import("std");

pub fn build(b: *std.build.Builder) void {
    const target = b.standardTargetOptions(.{});

    const mode = b.standardReleaseOptions();

    const exe = b.addExecutable("tmp", "src/main.zig");
    exe.setTarget(target);
    exe.setBuildMode(mode);

    exe.linkLibC();
    exe.linkSystemLibrary("c++");
    exe.addIncludeDir("src");
    exe.addCSourceFile("src/bindings.cpp", &.{});

    exe.install();
}

// src/main.zig
const c = @cImport({
    @cInclude("bindings.h");
});

pub fn main() !void {
    c.doSomeCppThing();
}


text:
Q: Difference between Pointer Datatypes C I'm new to C/C++ Programming and I'm still learning some differences between pointer datatypes. But I struggled with these one:
int *const x1;
const int *x2;
char *x3[3];
char (*x4)[3];
double* x5, x6;

I think the first one should be a integer variable that points to a constant memory address
And x2 should be a integer Pointer which is const, right?
I don't know if thats right. So can anyone explain me the differences between them?

A: int *const x1;  // const pointer to int
                // x1 is const pointer, so it cannot point to anything else (once initilized),
                // but what it points to can changed

const int *x2;  // pointer to const int
                // x2 can points to something else,
                // but what it points to cannot be changed

char *x3[3];    // array of three pointers to char
                // (array of pointers)

char (*x4)[3];  // pointer to array of three char
                // (single pointer)

double* x5, x6; // x5 is pointer to double, x6 is just a double

A: For problems such as this you can check with cdecl, e.g. for your third example:
char *x3[3];

cdecl returns:

declare x3 as array 3 of pointer to char

and for your fourth example:
char (*x4)[3];

cdecl returns:

declare x4 as pointer to array 3 of char

A: You read C declarators backwards. "int * const" is therefore a constant pointer to int (you can change the int, but not make the pointer point elsewhere after initialization); whereas "const int *" is a pointer to a constant int (change the pointer all you like, but not the int it's pointing to).
"The C declarator syntax is an experiment that failed." according to Bjarne Stroustrup.

A:  int *const x1;

constant pointer to int, that means the pointer cannot be changed to point anything.
const int *x2;

pointer to int constants. Here the integer is constant, which means you cannot change the value.
char *x3[3];

array (of length 3) of pointers to char
char (*x4)[3];

pointer to an array (of length 3) of char
double* x5, x6;

x5 is pointer to double, x6 is just a double variable


text:
Q: I test webOS app with Ripple and get "PalmServiceBridge is not defined when " I test app with Ripple for webOS, I get:
Uncaught ReferenceError: PalmServiceBridge is not defined

Is this a Ripple bug?

A: I would say it's a bug with Ripple.  If it's going to emulate webOS devices it'll need to provide a shim for PalmServiceBridge.  I'm not very familiar with Ripple so I'm not positive how it's supposed to do its magic.


text:
Q: Android image view makes app slow In my app I have a list view, which contains an image view. The image is loaded from bas64 encoded string. First the string is decoded and then converted it to bitmap and then the bitmap is loaded to the image view.
All the decoding is done in an async task and concurrency is handled according to the below documentation.
Processing Bitmaps Off the UI Thread
The problem is the app is scrolling slow, and all other async tasks are not executing after that.
any possible solutions?

A: You probably insterting a huge Bitmap into a tiny ImageView like assume the image is FHD 1920x1280 and your ImageView is 192x128. You should load a smaller or same size Bitmap into ImageView. I guess this is a reason of scroll lags. Also it could be that your layout is too complex and should be optimized.
As for

async tasks are not executing after that

nobody can tell you anything without seeing your code.

A: If you are getting image URL from server you can store if you want to in local DB. Don't store base64 in database just store the image URL's.But for image loading you can simply use libraries that are available like Glide or Picasso for image loading. Your list view is lagging as you are doing heavy operation like decoding base64 and loading that bitmap. Just give it a try, it will work. You can load image using single line code like
ImageView imageView = (ImageView) findViewById(R.id.my_image_view);

Glide.with(this).load("http://goo.gl/gEgYUd").into(imageView);

A: you might need to put images into a folder "drawable-nodpi", since normaly android app will try to resize large image first, then load it, then show show the original image(by resize again), this process will cost much CPU which make your app respond slow. So just create a "drawable-nodpi" folder as the "drawable" folder, cut/paste all large images in the new folder