text:
Q: How can I skip strike force missions like FOB Spectre? I finished "Old Wounds" and see that the next mission is "Time and Fate" but I'm forced into "FOB Spectre," a strike force mission. I'd like to finish my Veteran run without doing these strike force side-missions. Is there a way to bypass them and get back to the campaign?

A: Not directly that I am aware of. They are quite quick to bypass, since you only get a certain number of tries based on the number of campaigns you completed. I failed 3 times completing mine, and then ran out of "credit" but from then on forward you don't have to do them at all even if you have credit since the rest of the campaign doesn't include any.
It seems that the idea is that the FOB Spectra has to be played once as part of a campaign run through. I am guessing the purposes is to introduce everyone to the format and make players aware of it's existence.
I did try various ways to skip doing the one but it seems that you have to try it at a minimum once.


text:
Q: variable not defined in a switch case statement Here is my switch case statement. The compiler keeps stating totalShare is not defined even though it's defined in case 1. I'm a beginner with C++ and just started to learn about stack.
switch (option)
{
    case 1:
    {
        string newStock;
        double share;
        double price;

        cout << "Enter a new stock: " ;
        cin >> newStock;

        cout << "Enter a number of shares: " ;
        cin >> share;

        cout << "Enter price [for that number of shares]:  " ;
        cin >> price;

        //share x price
        double sharePrice = share * price;

        //add to stack
        newStockStack.push(sharePrice);

        //total share
        double totalShare;
        totalShare += share;
        break;
    }

    case 2:
    {
        //calculate stacks
        double theTotal;
        while (!newStockStack.empty())
        {
            theTotal += newStockStack.top();
            newStockStack.pop();
            return theTotal;
        }
        // FORMULA
        //((every share x price)+ (every share x price)) / total number of shares

        double LifoPrice;
        LifoPrice = (theTotal / totalShare);
        cout << "The Lifo price for the stock is: " << LifoPrice << endl;
        break;
    }

A: double totalShare; is present inside the "case 1" block
That means, totalShare is local to that block i.e. its scope is within case 1 only and it is not visible outside that block.
But then you have LifoPrice = (theTotal / totalShare); inside the "case 2" block. That is why, your compiler complains that totalShare is not defined (within the case 2 block).
Solution:
Define that variable inside such a scope that would allow its usage wherever you want. In this case, since you need that variable within multiple case blocks, consider declaring that variable outside the switch statement. Because it is a good practice to limit the scope of the variables, if you need that variable only inside the switch statement then you can declare it inside the switch statement but before all the case blocks that need totalShare.

A: The variable totalShare is declared in the block scope under the label case 1:.
case 1:
{
    //...

    //total share
    double totalShare;
    totalShare += share;
    break;
}

So in the block scope under the label case 2: it is not visible
LifoPrice = (theTotal / totalShare);

You may declare the variable before any case label.
Or if the compiler supports the C++ 17 Standard then you may declare it in the switch statement.

redpajama_set_name: RedPajamaStackExchange


text:
Q: FSCalendar Swift issue with one week view Trying to use the FSCalendar framework for displaying a 1 week view.
I have currently got the one week view displaying however when I click on a day that has Data it expands the calender again to the month long view. I read on the docs to use
 func calendar(_ calendar: FSCalendar, boundingRectWillChange bounds: CGRect, animated: Bool) {
        calendar.fs_height = bounds.height + 10
        self.view.layoutIfNeeded()
    }

for auto resizing the view but I don't want to resize it back to the month style view I want to keep it as the week long bar at the top of my view controller. Has anyone any ideas how to keep it as one week?

A: Create a IBOutlet for FSCalendar.
@IBOutlet weak var calendar: FSCalendar!

Then, set FSCalendarScope to week.
calendar.scope = .week


text:
Q: Wait for a function ends in angular
I have been reviewing all the answers about this question but I really do not understand how to do it. What I am trying to do is, before I save the info of the form, to check if at least one contact has an email. I have tried everything (obviously with no success)  I show you my code. This first part is in my save form function:
const comprobar = await this.gestionMailContactos(altaRaw['contactos']);

      comprobar.then(() => {
        if (!comprobar) { return false; }
      });

And the function I call is:
async gestionMailContactos (contacto): Promise<any> {
    let hayMail = false ;
    let probar = new Promise((resolve, reject) => {
      contacto.forEach((element, index) => {
        this.formularioService.getContacto(element)
        .subscribe( (data: any) => {
          if (data.email !== null) { hayMail = true; resolve(hayMail); }
          if (index === contacto.length - 1) {resolve(hayMail); }
        });
      });

    });

    probar.then(() => {
      if (!hayMail ) {
        Swal.fire({
          title: 'Alta Inmueble',
          text: 'Al menos un contacto debe tener email',
          icon: 'warning'
        });
        return false;
      } else {
        return true;
      }
    });

comprobar always returns undefined. Any help appreciated!


text:
Q: Why does powershell launch tiny? My powershell window launches tiny, despite the defaults being fine.

To adjust I have to go into properties for the window, which fixes it but also displays an error.

What can I do to have it launch properly?

A: You need to change the properties from an elevated PowerShell command.
One way to do so:

*

*From the Start menu, type pow and wait for Windows PowerShell to appear in the results list.

*When it does, right click it and then choose Run as Administrator.

*When the User Access Control dialog appears, choose Yes.  (Pro tip: Press Left and then hit Enter)

*When the PowerShell window appears, make your property changes and then exit.

Next time you start the PowerShell window, your changes should now 'stick.'
I think (but am not certain) that this happens because the PowerShell shortcut is in a protected directory (e.g. C:\ProgramData\Microsoft\Windows\Start Menu\Programs\System Tools), one that is considered higher integrity than the average directory.
Hope this helps...
-- Lance


text:
Q: Error con ship en la api de fedex Estoy usando, la api de fedex para generar una guía, desde mi aplicación web. Al ejecutar el script de ejemplo desde el navegador o desde la línea de comando, me envía el siguiente mensaje y no me genera la guía. El ejemplo que descargue venia con la versión 21 y tuve que cambiar a la versión 23 en  ->setMajor(23). La pruebas la estoy haciendo con la versión de php 7.2.
Gracias.
Mensaje que me envía:

object(FedEx\ShipService\ComplexType\ProcessShipmentReply)[34]
  protected 'name' => string 'ProcessShipmentReply' (length=20)
  protected 'values' =>
array (size=3)
  'HighestSeverity' => string 'ERROR' (length=5)
  'Notifications' =>
    array (size=1)
      0 =>
        object(FedEx\ShipService\ComplexType\Notification)[54]
          ...
  'Version' =>
    object(FedEx\ShipService\ComplexType\VersionId)[84]
      protected 'name' => string 'VersionId' (length=9)
      protected 'values' =>
        array (size=4)
          ...

Mi código:
use FedEx\ShipService;
use FedEx\ShipService\ComplexType;
use FedEx\ShipService\SimpleType;

$userCredential = new ComplexType\WebAuthenticationCredential();
$userCredential
    ->setKey(FEDEX_KEY)
    ->setPassword(FEDEX_PASSWORD);

$webAuthenticationDetail = new ComplexType\WebAuthenticationDetail();
$webAuthenticationDetail->setUserCredential($userCredential);

$clientDetail = new ComplexType\ClientDetail();
$clientDetail
    ->setAccountNumber(FEDEX_ACCOUNT_NUMBER)
    ->setMeterNumber(FEDEX_METER_NUMBER);

$version = new ComplexType\VersionId();
$version
    ->setMajor(23)
    ->setIntermediate(0)
    ->setMinor(0)
    ->setServiceId('ship');

$shipperAddress = new ComplexType\Address();
$shipperAddress
    ->setStreetLines(['Address Line 1'])
    ->setCity('Austin')
    ->setStateOrProvinceCode('TX')
    ->setPostalCode('73301')
    ->setCountryCode('US');

$shipperContact = new ComplexType\Contact();
$shipperContact
    ->setCompanyName('Company Name')
    ->setEMailAddress('test@example.com')
    ->setPersonName('Person Name')
    ->setPhoneNumber(('123-123-1234'));

$shipper = new ComplexType\Party();
$shipper
    ->setAccountNumber(FEDEX_ACCOUNT_NUMBER)
    ->setAddress($shipperAddress)
    ->setContact($shipperContact);

$recipientAddress = new ComplexType\Address();
$recipientAddress
    ->setStreetLines(['Address Line 1'])
    ->setCity('Herndon')
    ->setStateOrProvinceCode('VA')
    ->setPostalCode('20171')
    ->setCountryCode('US');

$recipientContact = new ComplexType\Contact();
$recipientContact
    ->setPersonName('Contact Name')
    ->setPhoneNumber('1234567890');

$recipient = new ComplexType\Party();
$recipient
    ->setAddress($recipientAddress)
    ->setContact($recipientContact);

$labelSpecification = new ComplexType\LabelSpecification();
$labelSpecification
    ->setLabelStockType(new SimpleType\LabelStockType(SimpleType\LabelStockType::_PAPER_7X4POINT75))
    ->setImageType(new SimpleType\ShippingDocumentImageType(SimpleType\ShippingDocumentImageType::_PDF))
    ->setLabelFormatType(new SimpleType\LabelFormatType(SimpleType\LabelFormatType::_COMMON2D));

$packageLineItem1 = new ComplexType\RequestedPackageLineItem();
$packageLineItem1
    ->setSequenceNumber(1)
    ->setItemDescription('Product description')
    ->setDimensions(new ComplexType\Dimensions(array(
        'Width' => 10,
        'Height' => 10,
        'Length' => 25,
        'Units' => SimpleType\LinearUnits::_IN
    )))
    ->setWeight(new ComplexType\Weight(array(
        'Value' => 2,
        'Units' => SimpleType\WeightUnits::_LB
    )));

$shippingChargesPayor = new ComplexType\Payor();
$shippingChargesPayor->setResponsibleParty($shipper);

$shippingChargesPayment = new ComplexType\Payment();
$shippingChargesPayment
    ->setPaymentType(SimpleType\PaymentType::_SENDER)
    ->setPayor($shippingChargesPayor);

$requestedShipment = new ComplexType\RequestedShipment();
$requestedShipment->setShipTimestamp(date('c'));
$requestedShipment->setDropoffType(new SimpleType\DropoffType(SimpleType\DropoffType::_REGULAR_PICKUP));
$requestedShipment->setServiceType(new SimpleType\ServiceType(SimpleType\ServiceType::_FEDEX_GROUND));
$requestedShipment->setPackagingType(new SimpleType\PackagingType(SimpleType\PackagingType::_YOUR_PACKAGING));
$requestedShipment->setShipper($shipper);
$requestedShipment->setRecipient($recipient);
$requestedShipment->setLabelSpecification($labelSpecification);
$requestedShipment->setRateRequestTypes(array(new SimpleType\RateRequestType(SimpleType\RateRequestType::_PREFERRED)));
$requestedShipment->setPackageCount(1);
$requestedShipment->setRequestedPackageLineItems([
    $packageLineItem1
]);
$requestedShipment->setShippingChargesPayment($shippingChargesPayment);

$processShipmentRequest = new ComplexType\ProcessShipmentRequest();
$processShipmentRequest->setWebAuthenticationDetail($webAuthenticationDetail);
$processShipmentRequest->setClientDetail($clientDetail);
$processShipmentRequest->setVersion($version);
$processShipmentRequest->setRequestedShipment($requestedShipment);

$shipService = new ShipService\Request();
$shipService->getSoapClient()->__setLocation('https://ws.fedex.com:443/web-services/ship');
$result = $shipService->getProcessShipmentReply($processShipmentRequest);

var_dump($result);
// Save .pdf label
// file_put_contents('/path/to/label.pdf', $result->CompletedShipmentDetail->CompletedPackageDetails[0]->Label->Parts[0]->Image);
var_dump($result->CompletedShipmentDetail->CompletedPackageDetails[0]->Label->Parts[0]->Image);

A: por la ayuda aquí le dejo la solución a esta pregunta. Lo que estaba sucediendo es que en la configuración del envió esta internacional y tenia que ser nacional. Lo que se tiene que hacer es cambiar la forma de envío en la siguiente línea.
Actual:
$requestedShipment->setServiceType(new SimpleType\ServiceType(SimpleType\ServiceType::_FEDEX_GROUND));

Modificada:
$requestedShipment->setServiceType(new SimpleType\ServiceType(SimpleType\ServiceType::_FEDEX_EXPRESS_SAVER));


text:
Q: Truncated a text with ellipsis that be next to a title I would like to have a summary next to a title and if the summary is too long, I would like it be truncated as classical ellipsis like that:

My TitleThis is a very long text that I want to...

I don't want the width of the summary to be defined, I would like that it takes all the room on the same line. I tried to use overflow: hidden and text-overflow: ellipsis but I can not put the truncated text next to the title. If the text is next to the title, the summary is not truncated; if the text is truncated, it is not next to the title.
These are some of my attempts:

  My Title
  This is a very long text that I want to shorten This is a very long text that I want to shorten This is a very long text that I want to shorten This is a very long text that I want to shorten  shorten

   My Title

This is a very long text that I want to shorten This is a very long text that I want to shorten This is a very long text that I want to shorten This is a very long text that I want to shorten

with css
.title {
    white-space: nowrap;
}

.inline {
    display: inline;
}

.tiny {
    font-size: 70%;
 }

.shortening {
    white-space: nowrap;
    overflow: hidden !important;
    text-overflow: ellipsis;
}

A: I've made a fiddle for you. Indeed, as Brian Glaz said in the comments, move the .shortening styles to the .title. Also, I added a wrapper around the text, so that it knows how much width it may take up.
If you have any questions left, let me know.

A: You need to set a width on shortening like width:200px; without a cutoff there is no reason to truncate the text.


text:
Q: Is it possible to draw gradient effect in background without using image?
Can i set background gradient without using image using only colors.
please tell me. Thanks

A: You can create online gradient using:-
http://angrytools.com/gradient/
and Put into drawable folder as a xml file
set background as image

A: Yes you can do that just by adding colors.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
    android:startColor="#83a4d4"
    android:endColor="#b6fbff"
    android:angle="45"/>
    <corners
     android:bottomRightRadius="10dp"
     android:bottomLeftRadius="10dp"
     android:topLeftRadius="10dp"
     android:topRightRadius="10dp"/>
</shape>

A: Yes you can do that!
You can use a Shape Drawable to achieve that gradient effect.
The syntax for a Shape Drawable XML file can be found here :
http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
Say you make a grad_bg.xml with the following content :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:angle="270" android:startColor="#00A4FF" android:endColor="#FFFFFF"/>
</shape>

Once you have your XML ready in the res/drawables/ folder of your app, you can set it as a background to and View element from layouts like LinearLayout to widgets like Buttons and TextViews using the following attribute in the view's tag :
android:background="@drawable/grad_bg"

or in code like this :
button.setBackgroundResource(R.drawable.grad_bg);

All the best :)

A: Just as an FYI, it's also possible to create gradients programmatically. Here is an example of a method you could use to return a linear gradient:
public static GradientDrawable createGradient(int startColor, int endColor, GradientDrawable.Orientation orientation) {
    GradientDrawable returnGradient;

    returnGradient =
            new GradientDrawable(
                    orientation,
                    new int[] {startColor, endColor}
            );

    return returnGradient;
}

And to call it:
int startColor = getResources().getColor(R.color.accent);
int endColor = getResources().getColor(R.color.primary);
GradientDrawable.Orientation orientation = GradientDrawable.Orientation.TOP_BOTTOM;

GradientDrawable gradient = createGradient(startColor, endColor, orientation);

myView.setBackground(gradient);


text:
Q: Matching partial Attribute values with selector Trying to get matches of attributes with wildcards to find out how many elements of a type are on the page
I think I should be able to use queryselectorAll on a partial attribute value as shown below, but no elements found :(

$999.99

$999.99

var el=document.querySelectorAll('[data-test|=unitprice]');
console.log(el.length);  // = 0

el.length shows 0 elements found.
What is the correct javascript for a match for selecting datatest=unitprice* ?


text:
Q: How to get fingerprint or key_id from gpg signature in python? I'm using the python-gpg library to decrypt / encrypt. Validation while decrypting a mail works fine, but i'm also trying to check which key was used to created a PGP signature, for example when a mail was not encrypted, just signed.
Is there a way to get the fingerprint or key_id from a gpg signature string using the python-gpg lib ? Thanks !

A: Yes, there is.  If you try to validate a signature for a key that is not in your keybox or a specified keybox or keyring, a BadSignatures error will be raised, just as currently occurs with correctly implemented MUAs.  That error message will also return the full key ID (i.e. the fingerprint) of the key or subkey which made the signature.  The function is the same for verifying a signature as you normally would, but in a manner which will catch any BadSignatures errors if they are raised.
Both the examples scripts for verifying detatched signatures and normal signatures or clearsigned messages demonstrate how this is done.  If the message uses PGP/MIME (which it should) then the detached signature verification method should be used, otherwise the other method ought to be used.
The part of the code in detached signature verification example dealing with this error data is this:
import gpg

c = gpg.Context()

try:
    data, result = c.verify(open(filename), open(sig_file))
except gpg.errors.BadSignatures as e:
    print(e)

If the error is raised the output will be the full key ID followed by ": no public key" and no traceback.
This is also covered in the documentation.


text:
Q: How to find a match between non ordered strings I have two data frames in R.
This is the first (just a sample):
ID  Cost        Vehicle_1
6   4291.667    FIAT PUNTO 1.4 EVO
2   5391.667    FIESTA 1.6 120CV
4   4291.667    FIESTA 1.6 120CV
7   3500.000    FIESTA 1.6 120CV
5   4291.667    SEAT IBIZA 1.4 85CV
1   5391.667    SEAT IBIZA 85CV 1.4

This is the second (just a sample):
Vehicle_2                          cost
FIAT PUNTO EVO 1.3 MJT 95CV DPF    0.4021967
FIAT PUNTO EVO 1.3/16V MJT 75CV    0.3737767
FIAT PUNTO EVO 1.4 77CV
FIAT PUNTO EVO 1.4 77CV BENZ+GPL   0.4036200
FIAT PUNTO EVO 1.4 77CV BENZ+MET   0.4122800
FIAT PUNTO EVO 1.4 M.AIR 105CV     0.4702500

I need to find the matches between the columns called Vehicle_1 of the first dataframe and and the column called Vehicle_2 of the second one, even if the strings are not in the same order and there are some words more/less.
I tried with the function all.equal, but it doesn't print the results. In fact, I need to create a new table with the "matching elements".
thanks

A: I suggest the following :
# Here is what your data looks like:
df1 <- data.frame("ID" = 1:6,
                  "Vehicle_1" = c("FIAT PUNTO 1.4 EVO",
                                  "FIESTA 1.6 120CV",
                                  "FIESTA 1.6 120CV",
                                  "FIESTA 1.6 120CV",
                                  "SEAT IBIZA 1.4 85CV",
                                  "SEAT IBIZA 85CV 1.4"))

df2 <- data.frame("ID" = 1:6,
                  "Vehicle_2" = c("FIAT PUNTO EVO 1.3 MJT 95CV DPF",
                                  "FIAT PUNTO EVO 1.3/16V MJT 75CV",
                                  "FIAT PUNTO EVO 1.4 77CV",
                                  "FIAT PUNTO EVO 1.4 77CV ",
                                  "FIAT PUNTO EVO 1.4 77CV BENZ+GPL",
                                  "FIAT PUNTO EVO 1.4 M.AIR 105CV "))

head(df1)
head(df2)

ID           Vehicle_1
1  1  FIAT PUNTO 1.4 EVO
2  2    FIESTA 1.6 120CV
3  3    FIESTA 1.6 120CV
4  4    FIESTA 1.6 120CV
5  5 SEAT IBIZA 1.4 85CV
6  6 SEAT IBIZA 85CV 1.4

ID                        Vehicle_2
1  1  FIAT PUNTO EVO 1.3 MJT 95CV DPF
2  2  FIAT PUNTO EVO 1.3/16V MJT 75CV
3  3          FIAT PUNTO EVO 1.4 77CV
4  4         FIAT PUNTO EVO 1.4 77CV
5  5 FIAT PUNTO EVO 1.4 77CV BENZ+GPL
6  6  FIAT PUNTO EVO 1.4 M.AIR 105CV

# I transform to data.table
library(data.table)
df1 <- data.table::setDT(df1)
df2 <- data.table::setDT(df2)

# I use tstrplit to get the elements from both variables that are
# supposed to be matched
df3 <- df1[, tstrsplit(Vehicle_1, split = ' ')]
df4 <- df2[, tstrsplit(Vehicle_2, split = ' ')]

ncol1 <- ncol(df3)
df_to_check <- cbind(df3,df4)

list_result <- apply(df_to_check,MARGIN = 1, FUN = function(x)
  intersect(x[1:ncol1], x[ncol1+1:length(x)]))

df1[, c("list_match") := list_result]
head(df1)

And here is the result, which I added to df1:
 ID           Vehicle_1     list_match
1:  1  FIAT PUNTO 1.4 EVO FIAT,PUNTO,EVO
2:  2    FIESTA 1.6 120CV             NA
3:  3    FIESTA 1.6 120CV             NA
4:  4    FIESTA 1.6 120CV             NA
5:  5 SEAT IBIZA 1.4 85CV            1.4
6:  6 SEAT IBIZA 85CV 1.4            1.4


text:
Q: AnimeJS Progressive Fill of an SVG path I have an SVG with different paths, and I want to animate the "fill" of these paths so it looks like it's being "hand drawn".
So far i Feel like I'm pretty close using the "strokeDashoffset" of anime.js, but I don't want the "borders" to be animated, I want the inside
Here's what I have :
JS :
  var cssSelector = anime({
    targets: '#cssSelector .lines path',
    strokeDashoffset: [anime.setDashoffset, 0],
    easing: 'easeInOutSine',
    duration: 1500,
    delay: function(el, i) { return i * 250 },
    direction: 'alternate',
    loop: false
  });

SVG/html
  <div id="cssSelector">
    <svg
       width="100%"
       height="auto"
       viewBox="0 0 122.84119 21.053778">
      <g
         transform="translate(-44.718109,-94.290359)">
        <g
           fill="#FFF" fill-rule="evenodd" stroke="currentColor" stroke-width="0.1" class="lines" stroke-linecap="round"
           id="text12">
          <path
             d="m 44.718109,95.475692 h 1.439333 v 19.755558 h -1.439333 z"
             style=""
             id="path14" />
          <path
             d="m 59.899459,114.29991 q -0.536222,0.508 -1.354666,0.79023 -0.790222,0.254 -1.665111,0.254 -1.919111,0 -2.963334,-1.04423 -1.044222,-1.07244 -1.044222,-2.96333 v -9.62378 h -2.709333 v -1.21355 h 2.709333 v -3.217336 h 1.411111 v 3.217336 h 4.684889 v 1.21355 h -4.684889 v 9.48267 q 0,1.43933 0.677334,2.20133 0.705555,0.73378 2.060222,0.73378 1.382889,0 2.286,-0.81844 z"
             style=""
             id="path16" />
          <path
             d="m 97.978291,95.475692 -6.688667,19.755558 h -1.524 L 83.641402,97.507692 77.488958,115.23125 h -1.524 L 69.24807,95.475692 h 1.523999 l 6.011334,17.779998 6.180666,-17.779998 h 1.382889 l 6.152444,17.808218 6.067778,-17.808218 z"
             style=""
             id="path18" />
          <path
             d="m 106.30297,115.34414 q -2.08845,0 -3.78178,-0.95956 -1.66511,-0.95956 -2.624668,-2.65289 -0.959556,-1.72155 -0.959556,-3.86644 0,-2.14489 0.959556,-3.83822 0.959558,-1.72156 2.624668,-2.68112 1.69333,-0.95955 3.78178,-0.95955 2.08844,0 3.75355,0.95955 1.69333,0.95956 2.65289,2.68112 0.95956,1.69333 0.95956,3.83822 0,2.14489 -0.95956,3.86644 -0.95956,1.69333 -2.65289,2.65289 -1.66511,0.95956 -3.75355,0.95956 z m 0,-1.27 q 1.69333,0 3.01977,-0.79023 1.35467,-0.79022 2.11667,-2.20133 0.79022,-1.41111 0.79022,-3.21733 0,-1.80622 -0.79022,-3.21734 -0.762,-1.41111 -2.11667,-2.20133 -1.32644,-0.79022 -3.01977,-0.79022 -1.69334,0 -3.048,0.79022 -1.32645,0.79022 -2.11667,2.20133 -0.762,1.41112 -0.762,3.21734 0,1.80622 0.762,3.21733 0.79022,1.41111 2.11667,2.20133 1.35466,0.79023 3.048,0.79023 z"
             style=""
             id="path20" />
          <path
             d="m 119.37382,103.71658 q 0.67733,-1.60867 2.11667,-2.45533 1.43933,-0.87489 3.49955,-0.87489 v 1.38289 l -0.33866,-0.0282 q -2.45534,0 -3.83823,1.55222 -1.38288,1.524 -1.38288,4.26155 v 7.67645 h -1.41112 v -14.732 h 1.35467 z"
             style=""
             id="path22" />
          <path
             d="m 134.12743,107.35725 -3.83822,3.49955 v 4.37445 h -1.41112 V 94.290359 h 1.41112 v 14.816661 l 9.42622,-8.60777 h 1.80622 l -6.35,5.95489 6.97089,8.77711 h -1.74978 z"
             style=""
             id="path24" />
          <path
             d="m 148.75404,115.34414 q -1.778,0 -3.38667,-0.53623 -1.60866,-0.53622 -2.51177,-1.35466 l 0.64911,-1.12889 q 0.90311,0.762 2.31422,1.27 1.43933,0.508 2.99155,0.508 2.22956,0 3.27378,-0.73378 1.07245,-0.73378 1.07245,-2.032 0,-0.93133 -0.59267,-1.46756 -0.56444,-0.53622 -1.41111,-0.79022 -0.84667,-0.254 -2.34245,-0.53622 -1.74977,-0.31044 -2.82222,-0.67733 -1.07244,-0.36689 -1.83444,-1.18534 -0.762,-0.81844 -0.762,-2.25777 0,-1.74978 1.43933,-2.87867 1.46756,-1.15711 4.14867,-1.15711 1.41111,0 2.794,0.39511 1.38289,0.39511 2.25778,1.04422 l -0.64912,1.12889 q -0.90311,-0.64911 -2.06022,-0.98778 -1.15711,-0.33866 -2.37066,-0.33866 -2.06023,0 -3.10445,0.762 -1.04422,0.762 -1.04422,2.00377 0,0.98778 0.59267,1.55223 0.59266,0.53622 1.43933,0.81844 0.87489,0.254 2.42711,0.56444 1.72156,0.31045 2.76578,0.67734 1.07244,0.33866 1.80622,1.12889 0.73378,0.79022 0.73378,2.17311 0,1.83444 -1.524,2.93511 -1.524,1.10067 -4.28978,1.10067 z"
             style=""
             id="path26" />
          <path
             d="m 165.55552,95.475692 h 1.63689 l -0.28222,14.082888 h -1.07245 z m 0.81845,19.868448 q -0.47978,0 -0.81845,-0.33867 -0.33866,-0.33867 -0.33866,-0.81845 0,-0.47977 0.33866,-0.81844 0.33867,-0.33867 0.81845,-0.33867 0.508,0 0.84666,0.33867 0.33867,0.33867 0.33867,0.81844 0,0.47978 -0.33867,0.81845 -0.33866,0.33867 -0.84666,0.33867 z"
             style=""
             id="path28" />
        </g>
      </g>
    </svg>
  </div>

And here's the result (after the animation)

My first idea was to draw the stroke inside of the element with a big "stroke-width", but appearently there's nothing to do so.
Thanks for your help and sorry for bad english :)

A: Apparently there is no way to do it with pure CSS. ended up following this tutorial and it worked Great
https://medium.com/@anatacreative/handwriting-animation-with-svg-638931410cfa


text:
Q: iOS13 Safari WebSpeechApi Bug: SpeechSynthesisUtterance won't use provided locale There seems to be a bug in iOS 13 (Safari and WkWebView) that makes iOS use the device language voice and not find a suitable voice by looking at the 'lang' provided in the SpeechSynthesisUtterance.
I worked around the issue by setting a suitable voice myself.
This is not needed in other browsers/platforms (eg macOS Safari, iOS < 13, Chrome etc.)
       this._getUtteranceRate().then((rate) => {
          let utterance = new SpeechSynthesisUtterance(words);
          utterance.rate = rate;
          utterance.lang = 'sv-SE';
          utterance.voice = this.voice; //IOS13 fix
          window.speechSynthesis.speak(utterance);
        });

       window.speechSynthesis.onvoiceschanged = () => {
         this.setVoice();
       }

       setVoice() {
            this.voice = window.speechSynthesis.getVoices().find((voice) => {
              return voice.lang === 'sv-SE';
       });
  }

A: It seems one needs to set the voice explicitly on the SpeechSynthesisUtterance for iOS13, as the locale is not used to find the voice.


text:
Q: Use for cycle to print out color boxes I'm trying to print out a series of colour boxes, using the wave option of xcolor.
The result should be a (long) series of color boxes (possibly, but not necessarily) on two columns, which differ from each other by a constant value (I mean whose whavelength is incremented by a constant value).
My proto-code currently looks like:
 \documentclass{article}
 \usepackage{xcolor}
 \begin{document}
 \colorbox[wave]{363}{ \ \strut   } 363\\
 \colorbox[wave]{368}{ \ \strut   } 368\\

 ...
 \end{document}

But I was tired before reaching the end of the spectrum.
How is it possible to obtain the result in which the wavelength (and the number printed afterwards) are discretely incremented (and whose increment is configurable?
Thanks.
Just to clarify: this question is about loops, not colors per se: I'm fine with the output of xcolor

A: This way?
\documentclass{article}
\usepackage{xcolor}
\usepackage{pgffor}
\begin{document}
\noindent
\foreach \lambda in {363,368,373,...,763} {\colorbox[wave]{\lambda}{ \ \strut } \lambda\\}
\end{document}


text:
Q: How to call MySQL stored procedure with select from C# Can any one please help me with this. I didn't use C# a lot ,  and i need to call MySQL stored procedure with 1 input parameter and i need to write down it query output.
My Stored Procedure:
CREATE DEFINER=`root`@`%` PROCEDURE `SP_For_Insert`(var_username varchar(50))

BEGIN

Declare counter int default 0;
Select Count(username) into counter From users where username = var_username;
if counter = 0  then
    select 0 as zero_results;
else
    Select username from users where username=var_username;
end if;
END

I know how to call simple query and store result, but i need this to work.

A: So i found a solution, if some one else had this problem i will post it now
  //for connection parameters
  private static string connectionString = "datasource=localhost;"+
                                "port=3306;"+
                                "Initial Catalog='authorization_schema';"+
                                "username=admin;"+
                                "password=admin123;";

  MySqlConnection connection = new MySqlConnection(connectionString);

  // construct SQL command with parameters (this way you can call SP also)
  IDbCommand cmd = new MySqlCommand("SELECT account, action FROM AUTHORIZATIONS WHERE username=@UserName", connection);

  // construct parameters
  MySqlParameter usernameParam = new MySqlParameter();
  usernameParam.ParameterName = "@UserName";
  usernameParam.Value = username;

  cmd.Parameters.Add(usernameParam);

  / construct data adapter
  IDataAdapter adapter = new MySqlDataAdapter((MySqlCommand)cmd);

  // construct DataSet to store result
  DataSet ds = new DataSet();
  adapter.Fill(ds);


text:
Q: How to restore apache configuration I have placed .htaccess file in my server's root folder with following content:
Redirect 303 /index.html http://mysite.com/index.php

to redirect my index.html to index.php.
Now some of the php files are not displaying, instead a blank page.
I want to restore all the changes done by .htaccess file.
Does anyone have any idea how to get out of this problem or how to restore all the changes done by .htaccess file?

A: rename

*

*.htaccess

to

*

*.htaccess_yyyymmdd

note: this is also a "backup" possibility before you apply new changes.

A: first thing .htacces file would not affect your server configuration,
second, place (restore) your old working .htaccess file


text:
Q: Scala class substitution There is a Java library with classes:
class DefaultFieldFactory {
  ...
  public static String createCaptionByPropertyId(Object propertyId) { ... }
  ...
}

class FieldFactory extends DefaultFieldFactory {
  ...
  // Lot of methods that use DefaultFieldFactory.createCaptionByPropertyId
  ...
}

I am using the FieldFactory class in a Scala project and I need to alter createCaptionByPropertyId method.
How can I do it without AOP and rewriting the FieldFactory class?
Is it possible to substitute DefaultFieldFactory class implementation in package? It is relatively simple and short.
Thanks in advance,
Etam.

A: A static class would go into an object in Scala, which would not inherit the static methods of DefaultFieldFactory -- which, in fact, reflects well the fact that you can't override statics.
This is one reason why statics are frowned upon.

A: I think there is a hacky way to do it... But if you have the source code for the original java class I would strongly recommend you change it.
If not you can create a new implementation of DefaultFieldFactory as an object in your class that hides the  original implementation within your class.  Then the implementation of the DefaultFieldFactory object can call through to the original java implimentations.
// in package x.y.a
class DefaultFieldFactory {
  ...
  public static String createCaptionByPropertyId(Object propertyId) { ... }
  ...
}

// in package x.y.b
class FieldFactory extends DefaultFieldFactory {

  object DefaultFieldFactory{

    def createCaptionByPropertyId(propertyId: AnyRef): String {
      //import the original implimentation
      import x.y.b.DefaultFieldFactory._
      ...
    }
  }

  // Lot of methods that use DefaultFieldFactory.createCaptionByPropertyId
  ...
}

Like I say... not nice!


text:
Q: Pc monitor gets fuzzy After replacing the heatsink and power supply, the monitor got very fuzzy and grainy.
I have changed the cable and even replaced the monitor but the issue remained. It seems that the  monitor is ok and it has something to do with the PC itself.
Any ideas?


text:
Q: How to support right to left in oriantion changed? I set android:supportsRtl="true" in manifest, and it work great. but by change orientation UI change to LTR. how solve It!
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.a.m"
android:installLocation="auto">

<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/Theme.M">

    <activity
        android:name=".LargeImageActivity"
        android:configChanges="orientation|screenSize"
        android:theme="@style/Theme.M2">


text:
Q: How do we extract arrays from a nested numpy array based on conditions on the subarrays? I have an output which is a nested numpy array. Each subarray has 10 float values, from this 'larger' array I want to extract those subarrays which have the maximum value at a specific index.
Edit: (Edited for clarity)
Example of nested array -
[[1 0 0 0] [1 0 0 0] [0 0 1 0] [1 0 0 0] [0 1 0 0] [0 0.99 0 0]

Required output
[[0 1 0 0] [0 0.99 0 0]]  (We take the index as 1 in this example)
I want to extract those subarrays, whose value at the index 0,1,2 etc is the highest. So the condition here is extract all the subarrays where the value at index 1  (for eg) is the maximum.

A: Here is a way to do it :
example = [[8, 5], [8,7], [5.6,1], [7, 9]]

# You choose which specific index you want tha max value
max_value_index= 0

# We use a list comprehension to select the corresponding rows
result = [x for x in example if x[max_value_index] == np.max(x)]

Output :
[[8, 5], [8, 7], [5.6, 1]

A: So from my understanding you have some max_index parameter, and you want to get all rows whose maximum element falls at that index.  To do this you can say "return all rows of my array for which the argmax of this row is equal to the max index", which in numpy is a one-liner:
arr = np.random.randn(100, 10)
max_index = 2
rows_with_max_at_max_index = arr[np.argmax(arr, axis=1) == max_index]  # A (N x 10) array


text:
Q: PubNub - Erratic disconnect behavior This may be working as intended and I am just not fully understanding how disconnects work, but I have a chat client that I set the heartbeat to 30seconds (i know that's low).
Using chrome's debugger throttling I would set throttling profile to offline then immediately watch the time.
1st pass
- Javascript Client disconnect callback fired after ~300s (the default)
- Server side presence "timeout" received ~300s later

2nd pass
- Client disconnect callback fired after exactly 30s (the heartbeat i set)
- Server side presence "timeout" received ~31s

3rd pass
- Client disconnect callback fired after ~270 seconds (30seconds less than     the default)
- Server side presence "timeout" received ~272 seconds

4th pass
- Client disconnect callback fired after ~249 seconds
- Server side presence "timeout" received ~248 seconds

The javascript client is firing the event at pretty much the same time as the "timeout" presence is sent out.  However, I cannot figure out the rhyme or reason why the time it takes them to fire vary so much.
Is it possible to have the system ALWAYS fire the disconnect callback and "timeout" presence after 30sec of connectivity loss?
EDIT: Using the latest SDK 3.14.4
Client 1:
var client = PUBNUB.init({
        subscribe_key: 'sub-key',
        restore: false,
        ssl: true,
        uuid: 'client1',
        heartbeat: 30
    });

    client.subscribe({
        channel: 'mychannel2',
        connect: function () {
            console.log('Connected');
        },
        disconnect: function () {
            console.log('Disconnected');
        },
        reconnect: function () {
            console.log('Reconnected');
        },
        error: function () {
            console.log('Error');
        },
        message: function (message) {
            console.log('Message: ' + JSON.stringify(message));
        }
    });

Client 2:
    var client = PUBNUB.init({
        subscribe_key: 'sub-key',
        restore: true,
        ssl: true,
        uuid: 'client2'
    });

    client.channel_group_add_channel({
        channel: 'mychannel2',
        channel_group: 'mygroup'});

    client.subscribe({
        channel_group: 'mygroup',
        connect: function () {
            console.log('Connected');
        },
        disconnect: function () {
            console.log('Disconnected');
        },
        reconnect: function () {
            console.log('Reconnected');
        },
        error: function () {
            console.log('Error');
        },
        message: function (message) {
            console.log('Message: ' + JSON.stringify(message));
        },
        presence: function (message) {
            console.log('Presence: ' + JSON.stringify(message));
        }
    });


text:
Q: What's the difference between Apollo and Gatsby? I am trying to understand their difference.
From my understanding, Apollo is an implementation of GraphQL, and Gatsby is a framework that uses Apollo to build severside-rendered apps. Is that interpretation correct?
Would appreciate any input!

A: Apollo (apollo-client) is a highly customizable graphql client with normalizing cache.
Gatsby is a node.js based static content generator. Resuls with a kind of [severside rendered] react app that can be 'run' from any (cheap) server supporting static content (static html, js, images) - even without any dynamic content support (f.e. php). Pages are prerendered as html (good for SEO) and transition between them is optimized (preloading).
Gatsby and graphql - it manages internally content in redux but provides graphql api data source consumed (in pages/templates) by own/internal client/lib to create static [fast] pages. This is compile time only 'server+client'. De facto not server and not client (not apollo), more like a set of helpers (customizable compiling system) using graphql querying format to describe templates data requirements, data processing etc.
You can use apollo-client [react] components/hooks in gatsby page templates for run-time data fetching [from static/generated pages]. You can use it in gatsby's node.js compiling environment for data fetching (instead of source plugins).


text:
Q: Dynamically Update Page Content I am building a golf club website in WP and I want to place a current golf course status on the home page.
This will be one or two lines of text only displaying something like this...
"The golf course is currently open and trollies can be used." or maybe something like this..
"The back 9 holes are currently closed for course maintenance. They will be open again tomorrow morning."
I want someone, possibly one of the green staff, who may not be familiar with WP to be able to update this text easily without going into the admin dashboard, locating the page and changing the text.
They may have to do this on their phone for example on arrival at the course in the morning if it is flooded for example and need to close the course.
I want a simple way for them to be able to update the text. When members view the homepage on the golf club website they will be able to see the course status that has been updated.
Any suggestions would be appreciated
Regards
Alan

A: The easiest option I can think of is to add a text field option to the customizer. You can have the staff member install the WordPress App on hes or her phone to adjust the text on the fly when necessary.


text:
Q: jQuery duplicate form with increment ID doesn't work the duplicated forms I have a form with a unique id and a button to do a calculation. I have another button to duplicate the form as much as you want before doing the calculation. I was able to duplicate the form and it's sub fields with an unique ID. But with the help of stackoverflow I've written the code to calculate only the first form. How I can modify my code to calculate the whole duplicated forms.

var myJson = {
    "platforms": [
        {
            "name": "Sitecore",
            "id": "Sitecore",
            "tasktype": [
                {
                    "name": "Promobox",
                    "id": "Promobox",
                    "components": [
                        {
                            "name": "Box 0",
                            "id": "box0",
                            "time": "20"
                        },
                        {
                            "name": "Box 1",
                            "id": "box1",
                            "time": "30"
                        }
                    ]
                },
                {
                    "name": "Video",
                    "id": "Video",
                    "components": [
                        {
                            "name": "Box 2",
                            "id": "box2",
                            "time": "25"
                        },
                        {
                            "name": "Box 3",
                            "id": "box3",
                            "time": "30"
                        }
                    ]
                }
            ]
        },
        {
            "name": "Siab",
            "id": "Siab",
            "tasktype": [
                {
                    "name": "Newswire",
                    "id": "Newswire",
                    "components": [
                        {
                            "name": "Box 4",
                            "id": "box5",
                            "time": "50"
                        },
                        {
                            "name": "Box 5",
                            "id": "box5",
                            "time": "40"
                        }
                    ]
                },
                {
                    "name": "Task Type New",
                    "id": "Task Type New",
                    "components": [
                        {
                            "name": "Box 6",
                            "id": "box6",
                            "time": "20"
                        },
                        {
                            "name": "Box 7",
                            "id": "box7",
                            "time": "100"
                        }
                    ]
                }
            ]
        }
    ]
};

$.each(myJson.platforms, function (index, value) {
    var platform_id;
    var tasktype_id;
    var component_id;

    $("#platform").append('<option rel="' + index + '" value="' + value.id + '">' + value.name + '</option>');

    $("#platform").change(function () {
        $("#tasktype, #component").find("option:gt(0)").remove();
        $("#tasktype").find("option:first").text("Loading...");

        platform_id = $(this).find('option:selected').attr('rel');

        $.each(myJson.platforms[platform_id].tasktype, function (index1, value1) {
            $("#tasktype").find("option:first").text("Select Task Type");
            $("#tasktype").append('<option rel="' + index1 + '" value="' + value1.id + '">' + value1.name + '</option>');
        });

    });

    $("#tasktype").change(function () {
        $("#component").find("option:gt(0)").remove();
        $("#component").find("option:first").text("Loading...");

        tasktype_id = $(this).find('option:selected').attr('rel');

        $.each(myJson.platforms[platform_id].tasktype[tasktype_id].components, function (index2, value2) {
            $("#component").find("option:first").text("Select Component");
            $("#component").append('<option rel="' + index2 + '" value="' + value2.time + '">' + value2.name + '</option>');
        });

    });

    });

    $(document).ready(function () {
        $('#calculate').click(function () {
        let tr = $("
").appendTo("#data tbody");
          $('#calc input, #calc select').each( function (index) {
              var input = $(this);
              $(tr).append('' + $(input).val() + '	');
            });

            const componentFactor = $(tr).children(".row-component").text();
            const units = $(tr).children(".row-units").text();
            const total = componentFactor*units;

            $(tr).append('' + total + '	');
        });
    });

    $(document).ready(function(){
    var calc_index=0;
    $("#addNew").click(function(){
        calc_index++;
        $("#calc").after($("#calc").clone().attr("id","calc" + calc_index));
        $("#calc" + calc_index).css("display","inline");
        $("#calc" + calc_index + " :input").each(function(){
            $(this).attr("name",$(this).attr("name") + calc_index);
            $(this).attr("id",$(this).attr("id") + calc_index);
            });

    });
    });

    $(document).ready(function () {
        $('#calculate').click(function () {
        let tr = $("
").appendTo("#data tbody");
          $('#calc1 input, #calc1 select').each( function (index) {
              var input = $(this);
              $(tr).append('' + $(input).val() + '	');
            });

            const componentFactor = $(tr).children(".row-component").text();
            const units = $(tr).children(".row-units").text();
            const total = componentFactor*units;

            $(tr).append('' + total + '	');
        });
    });

    $("#clear").click(function(){
        location.reload();
    });
<!DOCTYPE html>

 <title>test</title>

Production Units Calculator

    <form id="calc">
    Platform:
    <select id="platform" name="platform">
      <option value="0">Select Platform</option>
    </select>
    Task Type:
    <select id="tasktype" name="tasktype">
      <option value="0">Select Task Type</option>
    </select>
    Component:
    <select id="component" name="component">
      <option value="0">Select Component</option>
    </select>
    Units:
    <input name="units" id="units" type="number" min="0" placeholder="Input Units"/>

    </form>

<button id="calculate" >Calculate</button>
<button id="addNew" >Add New</button>
<button id="clear">Clear</button>

    Platform
    Task Type
    Component
    Units
    Time

A: used selectors on form. May it help

var myJson = {
  "platforms": [{
    "name": "Sitecore",
    "id": "Sitecore",
    "tasktype": [{
      "name": "Promobox",
      "id": "Promobox",
      "components": [{
        "name": "Box 0",
        "id": "box0",
        "time": "20"
      }, {
        "name": "Box 1",
        "id": "box1",
        "time": "30"
      }]
    }, {
      "name": "Video",
      "id": "Video",
      "components": [{
        "name": "Box 2",
        "id": "box2",
        "time": "25"
      }, {
        "name": "Box 3",
        "id": "box3",
        "time": "30"
      }]
    }]
  }, {
    "name": "Siab",
    "id": "Siab",
    "tasktype": [{
      "name": "Newswire",
      "id": "Newswire",
      "components": [{
        "name": "Box 4",
        "id": "box5",
        "time": "50"
      }, {
        "name": "Box 5",
        "id": "box5",
        "time": "40"
      }]
    }, {
      "name": "Task Type New",
      "id": "Task Type New",
      "components": [{
        "name": "Box 6",
        "id": "box6",
        "time": "20"
      }, {
        "name": "Box 7",
        "id": "box7",
        "time": "100"
      }]
    }]
  }]
};

$(function() {
  var platform_id;
  var tasktype_id;
  var component_id;
  $.each(myJson.platforms, function(index, value) {

    $("#platform").append('<option rel="' + index + '" value="' + value.id + '">' + value.name + '</option>');

    $("#platform").change(function() {
      $("#tasktype, #component").find("option:gt(0)").remove();
      $("#tasktype").find("option:first").text("Loading...");

      platform_id = $(this).find('option:selected').attr('rel');

      $.each(myJson.platforms[platform_id].tasktype, function(index1, value1) {
        $("#tasktype").find("option:first").text("Select Task Type");
        $("#tasktype").append('<option rel="' + index1 + '" value="' + value1.id + '">' + value1.name + '</option>');
      });

    });

  });
  $("#tasktype").change(function() {
    $("#component").find("option:gt(0)").remove();
    $("#component").find("option:first").text("Loading...");

    tasktype_id = $(this).find('option:selected').attr('rel');

    $.each(myJson.platforms[platform_id].tasktype[tasktype_id].components, function(index2, value2) {
      $("#component").find("option:first").text("Select Component");
      $("#component").append('<option rel="' + index2 + '" value="' + value2.time + '">' + value2.name + '</option>');
    });

  });

});

$(function() {
  var calc_index = 0;
  $("#addNew").click(function() {
    calc_index++;
    if (calc_index != 1)
      $("#calc" + (calc_index - 1)).after($("#calc").clone().attr("id", "calc" + calc_index));
    else
      $("#calc").after($("#calc").clone().attr("id", "calc" + calc_index));

    $("#calc" + calc_index).css("display", "inline");
    $("#calc" + calc_index + " :input").each(function() {
      $(this).attr("name", $(this).attr("name") + calc_index);
      $(this).attr("id", $(this).attr("id") + calc_index);
    });

  });

  $('#calculate').click(function() {

    $("form[id^='calc']").each(function(index) {
      let tr = $("
").appendTo("#data tbody");
      $(this).find('input,select').each(function() {
        $(tr).append('' + $(this).val() + '	');
      });

      $(tr).append('' + 0 + '	');
    });
    $("#data tbody").find('tr').each(function() {
      var $tr = $(this);
      let componentFactor = $tr.children("td[class^='row-component']").text();
      let units = $tr.children("td[class^='row-units']").text();
      let total = $tr.children("td[class^='row-total']").text();
      if ((componentFactor != "" || units != "") && total == 0) {
        $tr.children("td[class^='row-total']").text(componentFactor * units);
      }
    });

  });
  $("#clear").click(function() {
    $("#data tbody").empty();
  });
});

Production Units Calculator

  <form id="calc">
    Platform:
    <select id="platform" name="platform">
      <option value="0">Select Platform</option>
    </select>
    Task Type:
    <select id="tasktype" name="tasktype">
      <option value="0">Select Task Type</option>
    </select>
    Component:
    <select id="component" name="component">
      <option value="0">Select Component</option>
    </select>
    Units:
    <input name="units" id="units" type="number" min="0" placeholder="Input Units" />

  </form>

<button id="calculate">Calculate</button>
<button id="addNew">Add New</button>
<button id="clear">Clear</button>

      Platform
      Task Type
      Component
      Units
      Time


text:
Q: My bluetooth headset is sizzle and no sound, I use 12.10 I use blueman and bluez, sometimes no sound, sometimes the headset is sizzle...
Can anybody help me?

A: The computer may not be choosing the right hardware to play.
Open the Sound settings (open your Dash and type sound). Go to the Output tab. You should see more than one option.

Click the one that references your Bluetooth headphones. (You may have to double-click it.) Adjust the sounds as required. You can also use the Test Sound button.


text:
Q: Why is android saying no column when i have a column? I have this database code:
 public static final String KEY_ROWID = "_id";
public static final String KEY_FNAME = "fname";
public static final String KEY_LNAME = "lname";
public static final String KEY_MNAME = "mname";
public static final String KEY_CONTACTNUM = "contactNum";
public static final String KEY_LICENSE = "license";
public static final String KEY_USER = "username";
public static final String KEY_PASS = "password";

private static final String DATABASE_NAME = "sampleForFinals";
private static final String DATABASE_TABLE = "drivers";
private static final int DATABASE_VERSION = 1;

private DBHelper ourHelper;
private final Context ourContext;
private SQLiteDatabase ourDatabase;

private static class DBHelper extends SQLiteOpenHelper {
    public DBHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(" CREATE TABLE " + DATABASE_TABLE + "(" +
                KEY_ROWID + "_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
                KEY_FNAME + "TEXT NOT NULL, " +
                KEY_LNAME + "TEXT NOT NULL, " +
                KEY_MNAME + "TEXT NOT NULL, " +
                KEY_CONTACTNUM + "TEXT NOT NULL, " +
                KEY_LICENSE + "TEXT NOT NULL, " +
                KEY_USER + "TEXT NOT NULL, " +
                KEY_PASS + "TEXT NOT NULL);");
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXIST " + DATABASE_NAME);
        onCreate(db);
    }
}

public DatabaseHelper(Context c) {
    ourContext = c;
}

public DatabaseHelper open() {
    ourHelper = new DBHelper(ourContext);
    ourDatabase = ourHelper.getWritableDatabase();
    return this;

}

public void close() {
    ourHelper.close();
}

public long savedata(String fname, String lname, String mname, String contactNum, String license, String user, String pass) {
    ContentValues cv = new ContentValues();
    cv.put(KEY_FNAME, fname);
    cv.put(KEY_LNAME, lname);
    cv.put(KEY_MNAME, mname);
    cv.put(KEY_CONTACTNUM, contactNum);
    cv.put(KEY_LICENSE, license);
    cv.put(KEY_USER, user);
    cv.put(KEY_PASS, pass);
    return ourDatabase.insert(DATABASE_TABLE, null, cv);
}

Here is my register.java
 register.setOnClickListener(new View.OnClickListener()
    {
        @Override
        public void onClick(View v)
        {
                String fname = firstname.getText().toString();
                String lname = lastname.getText().toString();
                String mname = middlename.getText().toString();
                String contact = contactNum.getText().toString();
                String plate = license.getText().toString();
                String user = username.getText().toString();
                String pass = password.getText().toString();

                DatabaseHelper save = new DatabaseHelper(Register.this);
                save.open();
                save.savedata(fname,lname, mname, contact, plate, user, pass);

                firstname.setText("");
                lastname.setText("");
                middlename.setText("");
                contactNum.setText("");
                license.setText("");
                username.setText("");
                password.setText("");
        }
    });

Basically, what the error says is:
table drivers has no column named mname
inserting mname=a username=a lname=a license=a password=a contactNum=4 fname=a
                                                                               android.database.sqlite.SQLiteException: table drivers has no column named mname (code 1): , while compiling: INSERT INTO drivers(mname,username,lname,license,password,contactNum,fname) VALUES (?,?,?,?,?,?,?)

So, the database i use is from FITACADEMY. It is an sqlite. I can see the database tables and the columns and yes mname column does exist in FITACADEMY. I can see it. However, the error says it doesnt have the column 'mname'. I tried to delete all the codes related to 'mname' and it proceeds to 'user' not having a column. So, i removed all the codes related to 'user', then it has an error again of not having the column 'fname'.
Note: This is inserting data into the database.
What is wrong with my code? Ive been finding the error for 3 hours now. I still cant figure it out.

A: You need to have whitespace in your CREATE TABLE SQL between column names and their types. For example:
KEY_MNAME + "TEXT NOT NULL, " +

needs to be
KEY_MNAME + " TEXT NOT NULL, " +

Same problem with all other columns. After updating the SQL, uninstall your app to make onCreate() execute again.

A: Have you updated your database scheme? In this case, you need to increment the database version number here:
private static final int DATABASE_VERSION = 1;

A: You have syntax error on your creating table query so i have correct your query try this
" CREATE TABLE " + DATABASE_TABLE + "( " +
                    KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                    KEY_FNAME + " TEXT NOT NULL, " +
                    KEY_LNAME + " TEXT NOT NULL, " +
                    KEY_MNAME + " TEXT NOT NULL, " +
                    KEY_CONTACTNUM + " TEXT NOT NULL, " +
                    KEY_LICENSE + " TEXT NOT NULL, " +
                    KEY_USER + " TEXT NOT NULL, " +
                    KEY_PASS + " TEXT NOT NULL);"

Increment DB version by 1.
Enjoy :)
And one more thing onUpgrade method your dropping Database instead you should drop table:
db.execSQL("DROP TABLE IF EXIST " + DATABASE_TABLE);


text:
Q: getElementsByName in opera, ie etc this is my code to fix compability getElementById in ie,ff,opera etc
    function getId(item) {
        if( window.mmIsOpera ) return(document.getElementById(item));
        if (document.all) return(document.all[item]);
        if (document.getElementById) return(document.getElementById(item));
    return(false);
    }

my question is, how about getElementsByName in ie,ff, opera..

A: getElementsByTagName is supported by all major browsers:
http://www.quirksmode.org/dom/w3c_core.html

A: i got the solution last night...
and to get value from text field, just add an atribut "name" in form..
like David Dorward said : document.nameOfForm.nameOfTextfield.value


text: Q: Not able to add speech recognition in website Im using localhost server for my website. I have integrated speech recognition in my form fields. As I needed speech recognizer in every field of form therefore I used different view function for that and rendering back to same page. The speech is working perfectly but the problem is When I submit the form The speech recognition starts working however it should save that data into databases.


text:
Q: batchedgemm source code? I have a special sort of problem.
I have some research code that I have developed on my macbook using CUDA 4.1, especially using batchedgemm. I now have to run it on a cluster of gpu's that I have loaned from another institution.
My problem is that the Cluster only has CUDA 4.0 installed, and they are reluctant to upgrade fast.
Does anyone know if I can get the source for batchedgemm somewhere and compile it to work under 4.0?
I've writen my own kernel for doing batched multiplications, but it performes an order of about 10 slower than the library one - I would like to stand on the shoulders of great men instead of on their toes.

A: I understand the reluctance to quickly upgrade a production cluster.  Many clusters use a module system which means multiple versions of the CUDA toolkit can coexist.  The driver, however, needs to be upgraded to a version that supports the latest CUDA in use.  This is why they would be reluctant because they would need to test their users' production codes and applications to avoid regression or failure.
Since CUBLAS is not open source, I recommend you try to develop your code on a separate machine and if you get a large speed up from batching, present that to the administrators as a reason to upgrade.


text:
Q: Passing param to ruby thread Given this snip:
thr = []
for n in 0..6 do
   thr[n] = Thread.new {
       print n
   }
end

for n in 0..6 do
   thr[n].join
end

What I would expect: 0123456
What I get: 2220000
The goal is to create an array of threads and wait for them each to finish. Clearly my understanding of ruby threads is lacking here.
How do I fix this?

A: Don't pass n as a local variable (which has a lexical scope), but do so as a block variable.
The following code will print the numbers from 0 to 6 once each, although their order is not guaranteed.
thr = []
for n in 0..6 do
   thr[n] = Thread.new(n) {|n|
       print n
   }
end

for n in 0..6 do
   thr[n].join
end

The reason your code did not work is because the n within the block refers to n defined in for n in 0..6, which changes during the execution of the block. It is not that you always get 2220000, but in many cases, you get a similar result. What the sequence of 2 at the beginning indicates is that the time it takes for Thread.new(n) to create a new thread and go on to execute print n is approximately equal to the time it takes for the for loop to do two iterations.

A: TL;DR
Other answers may address why your code doesn't work. I will instead address myself to how to get the results you expect.
Threads do not execute in order. If you want ordered output from a series of threads, you should be using Mutex, which is currently not documented for Ruby 2.3.0.
Below, I provide examples of both synchronous and asynchronous threading that provide the ordered output you're looking for. I also provide some notes on thread-safety.
The Simplest Thing That Could Possibly Work
While I provide more complete examples below, the simplest solution to your problem while retaining the flavor of your original code is:
for n in 0..6 do Thread.new { print n }.join end

By using #join within the loop, you ensure that the output is ordered. This will correctly print the following to standard output:

0123456

Using Mutex for Ordering Threads
Here is a more idiomatic example using Mutex#synchronize:
def ordered_threads
  result = ''
  (0..6).each do |n|
    Mutex.new.synchronize { result << n.to_s }
  end
  result
end

ordered_threads
#=> "0123456"

There's actually no need to use Thread#join because all threads are handled sequentially by the Mutex.
Handling Output from Asynchronous Threads
If you don't want the overhead of using #synchronize, then you could always order your output afterwards. For example:
def unordered_threads
  result, threads = [], []
  (0..6).each do |n|
    threads << Thread.new { result << n.to_s }
  end
  threads.each &:join
  result.sort.join
end

unordered_threads
#=> "0123456"

This solution should address your posted use case, even though it is not technically thread-safe. If you need a thread-safe solution, use a Mutex or thread-safe objects like those provided by the thread_safe gem.

A: You could use tap to create a copy of variable n, so modification to it in the loop does not impact the already created Thread objects.
thr = []
for n in 0..6 do
    n.tap do |n|
       thr[n] = Thread.new {
           print n
       }
    end
end

for n in 0..6 do
   thr[n].join
end
#=> 0123456


text:
Q: How would an empty HashMap with .containsKey() be true? I am a beginner programmer working on a Two Sum problem. An array of integers are given as well as an integer, target. The intention of the program is to find which two numbers in the array of integers add up to the target integer. The most efficient solution I am seeing is quite ingenious in how it iterates over all of the integers in the array and checks if the difference between each integer in the array and the target number is another integer in the array. Then those two would be the solution. My issue is with the HashMap part. How would an empty HashMap .containsKey() work if it is empty and has no keys in it?
class Solution {
    public int[] twoSum(int[] nums, int target) {
        int n=nums.length;
        Map<Integer,Integer> map=new HashMap<>();
        int[] result=new int[2];
        for(int i=0;i<n;i++){
            if(map.containsKey(target-nums[i])){
                result[1]=i;
                result[0]=map.get(target-nums[i]);
                return result;
            }
            map.put(nums[i],i);
        }
        return result;
    }
}

I tried to research solution explanations but all of them just said that the solution checks if the  values are in the map but how would any values be in the map if it is empty and was never linked to the integers array? Thanks a lot for the help.

A: I give you a phone book. I ask you if 'Ryan Siegrist' is in it. You open it up intending to scan it (or perhaps you're going to be smarter about it and use a fancy algorithm, such as binary searching by opening it to the middle page to see if you should go 'higher' or 'lower') - and it turns out the phone book is simply empty.
The correct answer is of course 'no, Ryan Siegrist is not in this empty phone book'.
HashMap is no different. .containsKey(whateverYouLike) returns false if you invoke it on an empty list. Why wouldn't it?
The stated algorithm does nothing the first time you loop, but note that at the end of the for look, whether the if ( containsKey ) check worked out or failed, an entry is added to the map. So the second and further runs through that loop, the map is no longer empty.

A: Short version:
If the map is empty and it does not contain a key. Then the line:
map.put(nums[i],i);

will still execute. This is because it is outside of the if check.
Long version
So when the code first iterates through the array, the HashMap is always empty at first because it was initialized as such:
Map<Integer,Integer> map=new HashMap<>();

Then the first iteration of the if check returns false:
if(map.containsKey(target-nums[i]))

But it still executes the line of code which will associate the map with the value of nums at the index of i with the index of i as the value for the map.
Then the loop will continue iterating until a solution is found or the loop terminates.


text:
Q: qt qstring toStdString loss of minus sign I am using a qstring and using the function toStdString(). When I do this I lose a minus sign:
'332-_09I_W'

this text becomes:
'332_09I_W'

What can I do to prevent this?
EDIT: Actually, the problem is not when i use toStdString(), it is when I set the text in my qTextEdit. The change occurs here:
myTextEdit->setHtml(myString);

A: I've tried:
QString qs("332-_091_W");
std::string st = qs.toStdString();
ui->textEdit->setHtml(st.c_str());

It gives no problem to me. Which version of Qt are you using?
However, from the documentation:

setHtml() changes the text of the text edit. Any previous text is removed
  and the  undo/redo history is cleared. The input text is
  interpreted as rich text in html format.
      Note: It is the responsibility of the caller to make sure that the text is correctly  decoded when a QString containing HTML is created
  and passed to setHtml().

The minus/hyphen symbol is ambiguous in HTML, try to change it in the QString (before passing it to setHtml()) with −


text:
Q: Bluetooth python handle reconnection automatically I made a python program on Raspberry Pi able to connect in classic bluetooth (not BLE) with sensors. To do this, I used socket programming. I can perfectly connect to several sensors simultaneously and exchange data (receive/transmit) between the Raspberry Pi and the sensors.
Overall, the most important lines in my code are the following:
import bluetooth
import socket

addr_sensor1 = xx:xx:xx:xx:xx:xx
port_sensor1 = 1

sock_sensor1=bluetooth.BluetoothSocket(bluetooth.RFCOMM)
sock_sensor1.connect((addr_sensor1, port_sensor1))

sock_sensor1.send("Message\n")

while True :
    while char != '\n' :
        char = str(sock_sensor1.recv(1).decode("utf-8", "ignore"))
        data = data + char
    print(str(data))

The problem I can't solve is when one of the sensors is out of range of the Raspberry Pi, it ends up disconnecting. I would like it if when the sensor is within range of the Raspberry Pi again, the python script is able to automatically reconnect to the sensor.
Do you know of any method to solve this problem? Even another method with other libraries?
Thanks in advance


text:
Q: C# reflection cast to variable type Just started studying reflection and im having a lot of issues. I want to cast to find the type of properties and then set them. So i wanted to cast to these properties type.
protected override object Load(SqlDataReader dr)
        {
            object item = Activator.CreateInstance(klass);

            foreach (var p in klass.GetProperties())
            {
                MethodInfo pSet = p.GetSetMethod();
                Type pType= p.PropertyType;
                object setParam = dr[p.Name];
                object[] paramArray = (object[])Array.CreateInstance(pType, 1);
                paramArray[0] = setParam;
                pSet.Invoke(item, paramArray);
            }
            return item;
        }

A: As they said you need to add your errors, but from what i see you have two problems:
You use klass as Type instead of typeof(klass)
You try to cast a whole array to a new type - this can be solved using Array.ConvertAll... but the easier way would be to just initialize a regular array using: object[] paramArray = new object[1].
good luck


text:
Q: Import csv data into influxdb from python This has almost certainly been asked.
I have timeseries data that looks like this in a .csv file. The data has no heading, but this is what the different fields are: date,time,open,high,low,close,volume,0
2017-09-22,21:50:00,131.36,131.415,131.35,131.39,78489,0
2017-09-22,21:55:00,131.39,131.4,131.37,131.38,95322,0
2017-09-22,22:00:00,131.38,131.6,131.31,131.39,1212804,0

I am attempting to import this data into InfluxDB from python. I see in the documentation that you have to create the json for it line by line, but I am uncertain how this is done:
This is close, but no cigar. Assume I have the string already split and the datetime-timestamp already in the correct format. When I print the json_body below, I get e.g.,
[{'fields': {'Int_value': '1212804', 'Float_value': '131.39'}, 'time': datetime.datetime(2017, 9, 22, 22, 0), 'measurement': 'quote'}]

which doesn't seem right - I seem to be getting only one float value.
What is the correct JSON for input to InfluxDB?
import datetime
import random
import time
import os
import csv
from csv import reader
import argparse
from influxdb import client as influxdb

db = influxdb.InfluxDBClient("127.0.0.1", 8086, "", "", "stocks")

def read_data(filename):
    print filename
    with open(filename) as f:
        lines = f.readlines()[1:]

    return lines

if __name__ == '__main__':
    filename = r"jnj.us.csv"
    lines = read_data(filename)
    for rawline in lines:
        line = rawline.split(",")
        d= getPythonDateTimeFromStr(line[0], line[1])
        #EVERYTHING UP TO HERE WORKS. Not sure how to create the json below
        #====================================
        json_body = [
        {
            "measurement": "quote",
            "time": d,
            "fields": {
                "Float_value": line[2],
                "Float_value": line[3],
                "Float_value": line[4],
                "Float_value": line[5],
                "Int_value": line[6]
            }
        }
        ]

        print json_body

        db.write_points(json_body )

A: Duh,
"fields": {
            "Float_value": line[2],
            "Float_value": line[3],
            "Float_value": line[4],
            "Float_value": line[5],
            "Int_value": line[6]
 }

Should be
"fields": {
            "Open": line[2],
            "High": line[3],
            "Low": line[4],
            "Close": line[5],
            "Volume": line[6]
 }


text:
Q: Homology of connected sum of real projective spaces Let $A_k=RP^2\sharp RP^2\sharp \cdots \sharp RP^2$ be a connected sum of $k$ copies of real projective space. With coefficients in $\mathbb{Z}$, it is clear $H_n(A_k)=0$ when $n\geq2$ and $H_0(A_k)=\mathbb{Z}$. However I'm trying to find $H_1(A_k)$.
After searching with google,I found that $H_1(A_k)=\mathbb{Z}^{k-1}\oplus \mathbb{Z}/2\mathbb{Z}$. and I think induction can deal with this. I tried to put $U=A_n$ with one point deleted and $V=RP^2$ with one point deleted in Mayer sequence $H_1(U\cap V)\to H_1(U)\oplus H_1(V)\to H_1(A_{n+1})$ but failed because I don't know what shape $U,U\cap V$ reformation retract to. what U and V should I put here?
Could you explain how to do this step-by-step? (like what theorems applied here so I can review it myself)
As far as I remember, my professor's already taught about homology group, Mayer-Vietoris, CW-complex, Euler characteristic...etc (but not cohomology)
Thanks for your help.

A: Let $X$ be the first $(k - 1)$ factors in $A_k$ and $Y$ be the last factor. Let $S^1$ be the circle that connects $X$ with $Y$. Let $W$ be a neighborhood of $S^1$ that deformation retracts onto $S^1$. Define $U = X \cup W$, $V = Y \cup W$.
Using he Mayer-Vietoris sequence for reduced homology, we have the following exact sequence:
$$
\tilde H_1(U \cap V) \xrightarrow{\varphi} \tilde H_1(U) \oplus \tilde H_1(V) \xrightarrow{\psi} \tilde H_1(A_k) \rightarrow 0
$$
By considering the fundamental polygon for $\Bbb R \textrm P^2$, one can see that $U$ deformation retracts onto the wedge sum of $(k - 1)$ circles. Similarly, $V$ deformation retracts onto a circle. Hence $\tilde H_1(U) \cong \Bbb Z^{k-1}$, $\tilde H_1(V) \cong \Bbb Z$. Since $U \cap V = W$ deformation retracts onto $S^1$, we have $\tilde H_1(U \cap V) \cong \Bbb Z$.
What's left is to find $\ker \psi = \operatorname{im} \varphi$ and apply the first isomorphism theorem.
From the definition of the Mayer-Vietoris sequence, $\varphi = (i_*, j_*)$ where $i : U \cap V \hookrightarrow U$, $j : U \cap V \hookrightarrow V$ are the inclusion maps.
Since the generator of $\tilde H_1(U \cap V)$ goes twice around each generator of the circles of $U$, we have
$$
i_*(1) = \underbrace{(2, \ldots, 2)}_{(k - 1) \text{ times}}.
$$
Similarly, $j_*(1) = 2$.
Hence
$$
\ker \psi \cong \underbrace{(2, \ldots, 2)}_{k \text{ times}} \Bbb Z.$$
By an application of the first isomorphism theorem, we have
$$
\tilde H_1(A_k) \cong \left(\tilde H_1(U) \oplus \tilde H_1(V)\right) / \ker \psi = \Bbb Z^{k-1} \oplus \Bbb Z_2.
$$

Note that one can prove the following more general result:

If $M_1$ and $M_2$ are closed manifolds then there are isomorphisms $H_i(M_1 \# M_2) \cong H_i(M_1) \oplus H_i(M_2)$ for $0 < i < n$, with one exception: If both $M_1$ and $M_2$ are nonorientable, then $H_{n−1}(M_1 \# M_2)$ is obtained from $H_{n−1}(M_1) \oplus H_{n−1}(M_2)$ by replacing one of the two $\Bbb Z_2$ summands by a $\Bbb Z$ summand.

The proof is similar to what I have above, but requires some manifold theory.

A: You can try drawing the polygon related to that connected sum, and use Mayer-Vietoris with $U$ equals your space minus a point, and $V$ a disk containing that point and strictly contained in your space. Then $U \cap V$ is  $S^1$ and you should have no problems in completing the computation.


text:
Q: Solution of a complex equation Is the solution to this equation only a matter of using the quadratic formula or do I have to do something more?
My results:
$$x_1 = 1+i,\quad x_2 = 1-i$$
The equation:
$$ x^2 - 2x + 2 = 0. $$

A: Yes you are correct that you can just plug this into the quadratic formula since the polynomial is of the degree two. Another approach that can help to see it also is by completing the square. By this I mean that we can say
$$x^2-2x+1=-1$$
i.e. we subtract $1$ from both sides, and by doing this we can now say that
$$(x-1)^2=-1$$
and therefore
$$x=1\pm \sqrt{-1}=1\pm i$$
Another good thing to keep in mind is that if you ever find a complex root to an equation, then it's complex conjugate is also a root, which is exactly what we see here.


text:
Q: jQuery validation in a separate file .js I have a HTML file with a contact form. I want a jQuery validation for this form, but in other file, with .js extension. JQuery validates the form when it is written in the HTML file. But if I transcribe it for .js, it doesn't work.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-br" lang="pt-br">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Escola Desafio - Contato</title>
        <link rel="stylesheet" type="text/css" href="css/style.css">
        <script language="javaScript" src="js/scripts.js"></script>
        <script language="javaScript" src="js/scripts1.js"></script>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/jquery.validate.min.js"></script>
        <script type='text/javascript'>//<![CDATA[
            $(window).load(function(){
                $(document).ready(function () {
                    $('#frmContato').validate({ // initialize the plugin
                        rules: {
                            nome: {
                                required: true
                            },
                            field2: {
                                required: true
                            }
                        },
                        errorPlacement: function(){
                            return false;
                        },
                        submitHandler: function (form) { // for demo
                            alert('valid form submitted'); // for demo
                            return false; // for demo
                        }
                    });
                });
            });//]]>
        </script>
    </head>
    <body>
<form id="frmContato" method="post" name="frmContato">
                    <input type="text" name="nome" id="nome" title="Insira o nome completo" placeholder="Nome Completo" onkeyup="AllowAlphabet()"/>
                        <select name="assunto" id="assunto" title="Escolha um assunto" class="select">
                            <option value="" selected="selected">Selecione um assunto</option>
                            <option value="duvidas">Dúvidas/Informações</option>
                            <option value="falha">Falha/Erro/Indisponibilidade</option>
                            <option value="lentidao">Lentidão</option>
                            <option value="liberacao">Liberação/Bloqueio de Senha</option>
                            <option value="reclamacao">Reclamações/Críticas</option>
                            <option value="sugestao">Sugestões/Elogios</option>
                        </select>
                    <input type="email" id="email" name="email" title="Insira o seu e-mail" placeholder="E-mail" />
                    <textarea placeholder="Escreva a sua mensagem aqui" rows="4" cols="50" class="textarea"></textarea>
                    <input id="btnEnviar" type="submit" value="Enviar" class="inline" onsubmit="return validateForm()"/>
                </form>
        </div>
    </body>
</html>

This is my .js:
 window.onload = function(){
        $('#nome').keypress(function(e) {
            var keyCode = (e.keyCode ? e.keyCode : e.which); // Variar a chamada do keyCode de acordo com o ambiente.
                if (keyCode > 47 && keyCode < 58) {
                    e.preventDefault();
                }
        });
};

I tried to do so :
window.onload = function(){
    //alert("teste");
    //alert("teste");

    $('#nome').keypress(function(e) {
        var keyCode = (e.keyCode ? e.keyCode : e.which); // Variar a chamada do keyCode de acordo com o ambiente.
            if (keyCode > 47 && keyCode < 58) {
                e.preventDefault();
            }
    });
};

window.load = function(){
    $(document).ready(function () {
        $('#frmContato').validate({ // initialize the plugin
            rules: {
                nome: {
                    required: true
                },
                field2: {
                    required: true
                }
            },
            errorPlacement: function(){
                return false;
            },
            submitHandler: function (form) { // for demo
                alert('valid form submitted'); // for demo
                    return false; // for demo
                }
            });
        });
    });
};


text:
Q: CPPDepend Detection of virtual function usage I'm having a slight problem with CPPDepend's ability to detect virtual function usage. Consider the following scenario. Two classes, CParentClass and CChildClass, where CChildClass is derived from CParentClass. The CParentClass has a virtual function Test and CChildClass overrides the base class version of Test.
When it comes to usage, for various reasons I want to do something like the following:-
CChildClass * pMyChild = new CChildClass();
CParentClass * pParentClass = (CParentClass*)pMyChild;
int B = pParentClass->Test();
delete pParentClass;

This results in pMyChild's Test function being called, as desired, yet CPPDepend doesn't detect this and claims that the code is never reached. If I add the word "virtual" to the Test function header in CChildClass (in addition to the one already in CParentClass) then CPPDepend claims everything is ok.
Can anyone shed some light on this for me please as it feels wrong that I should have to put virtual in the derived class function as well as the base class function.
A similar issue can be seen with CDialog destructors in derived classes. Without the virtual in the derived class destructor declaration, CPPDepend complains.
Thanks for any help you can give.
Regards
Neil.

A: CppDepend do a static analysis not a dynamic one, and give the dependencies from a static point of view and it's more interesting. Indeed what's important is the dependency related to the design choices, for example in your case the object is declared as CParentClass, so the method is coupled with the contract of CParentClass, and in the runtime it could invoke a method from child classes.


text:
Q: Reading one checkbox status and setting another checkbox dependently in javascript I have limited knowledge and experience with Adobe Javascript which I am using to refine some complex forms. I am copying the content of a number of questionnaire to a summary page which I will use to export data to a database. I have successfully achieved this with text and numeric fields using the following script in the destination (summary) field's custom calculation script:
var v1 = getField("source_field").value;
event.value=v1

In the case where the destination field needs a numeric value use of +getfield(source_field) corrects the problem of generating a NaN error (Not a Number). Thanks to epascarello!!
My problem is that I need to copy checkboxes from the source questionnaires to checkboxes in the summary page. The above code(s) do not work – the destination checkbox remains unchanged. I suspect I need to read the status (off / on) of the source checkbox and set the destination checkbox accordingly. I don't know how to construct this code which likely involves a conditional and specific checkbox setting commands. I have looked at examples on the 'net but can't successfully pull it together. Can anyone help please?


text:
Q: Can someone help troubleshoot the cause of this error: ActiveRecord::Migration Error PG::WrongObjectType 'table' is not a view I am having some issues with a migration on my rails application. When I execute the pending migrations I receive an error that looks like this:
PG::WrongObjectType: ERROR:  "contributions" is not a view

This is a snippet of the migration file:
class ReplaceContributionView < ActiveRecord::Migration
  def up
    execute <<-SQL
      CREATE OR REPLACE VIEW contributions AS (
      (
      SELECT id,
        id AS person_id,
        project_id AS project_id,
        name_fact_id AS name_fact_id,
        null AS position_id
      FROM people
      WHERE project_id IS NOT NULL

      .........etc etc. ...........
  end

  def down
   .........
  end
end

Checking my development database for the contributions table shows that it is indeed a view.
\d contributions

Materialized view "public.contributions"
Column    |  Type   | Modifiers
--------------+---------+-----------
 id           | bigint  |
 person_id    | bigint  |
 project_id   | integer |
 name_fact_id | integer |
 position_id  | integer |
Indexes:
    "index_contributions_on_id" UNIQUE, btree (id)
    "index_contributions_on_project_id" btree (project_id)

I also want to point out that migrating on my test database produces no error whatsoever and I am able to migrate and rollback without problems.
I'm stuck on this migration and can't do a thing until it resolves. What could be the problem? It clearly is a view unless view and materialized view are different things. Does anyone have any ideas? Help would be appreciated.

A: Try dropping the view and then creating it instead of 'CREATE OR REPLACE VIEW':
def up
  execute('DROP VIEW contributions')
  execute('CREATE VIEW contributions AS (
    (
    SELECT id,
      id AS person_id,
      project_id AS project_id,
      name_fact_id AS name_fact_id,
      null AS position_id
    FROM people
    WHERE project_id IS NOT NULL

    .........etc etc. ...........'
end

Also, you may want to consider naming the table 'v_contributions' so that it is clear that table is a view table.


text:
Q: C program spends 77% of the time in _platform_memmove$VARIANT$Haswell I'm profiling some numerical code written in C (profiler is Instruments, compiler is clang on Mac OSX 10.11.6). As much as 77.3% of the running time is spent in _platform_memmove$VARIANT$Haswell.
In the assembly output, the above function is called by DYLD-STUB$$memcpy. However, I have no memcpy's in my C code (I do have some malloc's though).
Going deeper, it seems that the assembly command rep is responsible for taking up so much time. From this post, it seems that rep is not doing anything useful. Why does the compiler insert it? And where do the memcpy's come from?
I also tried compiling with -g, but then _platform_memmove$VARIANT$Haswell is not gobbling up almost all of the time anymore.

A: After a bit of more searching, I found the problem: I was passing a struct to a function, which gets copied each time, hence the memcpy.
I changed the function to accept a pointer to the struct, which sped up my code by a factor 5.


text:
Q: heroku no such table: auth_user error when trying to run create superuser I'm trying to create my django app w/ Heroku however I'm stuck on this error. I have seen some information on heroku not being able to use sqllite so I've been trying to update to postgres but not sure why that's not reflected here.
sqlite3.OperationalError: no such table: auth_user
heroku run python3 manage.py createsuperuser

 ›   Warning: heroku update available from 7.41.0 to 7.60.1.
Running python3 manage.py createsuperuser on ⬢ generic-heroku-app... up, run.5883 (Free)
On development database

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/app/.heroku/python/lib/python3.7/site-packages/django/db/backends/sqlite3/base.py", line 423, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: auth_user

DB from settings.py
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=600)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': '**',
        'USER': '**',
        'PASSWORD': '**',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}

Edit: this thread shows some solid info but I still can't seem to make it work with this info. Not sure where I'm going wrong.. "no such table" error on Heroku after django syncdb passed
Any help would be greatly appreciated!

A: If your project is connected with github deploy, then in your project, in Procfile, add:
release: python manage.py migrate
web: gunicorn myproject.wsgi


text:
Q: How to resize Canvas scrollable widget? The idea is that the scrollable canvas and its text widgets grow or fill the entire root/toplevel when I resize it.
I can do this if I work on Frames but for a scrollable frame you need to create a canvas widget and make it scrollable. Now I don't know if the problem is the canvas or the inserted widgets on the canvas?
import tkinter as tk
from tkinter import ttk

class ScrollableFrame():
    def __init__(self, container, *args, **kwargs):
        self.container = container
        self.canvas = tk.Canvas(self.container, bg="green")
        self.scrollbar = ttk.Scrollbar(self.container, orient="horizontal", command=self.canvas.xview)
        self.scrollable_frame = tk.Frame(self.canvas)
        self.scrollable_frame.grid(sticky="wesn")
        self.scrollable_frame.bind("<Configure>", lambda e: self.canvas.configure(scrollregion=self.canvas.bbox("all")))

        self.canvas.create_window((0, 0), window=self.scrollable_frame, anchor="nw")
        self.canvas.configure(xscrollcommand=self.scrollbar.set)

        self.canvas.grid(row=0, column=0, sticky="wesn")
        self.scrollbar.grid(row=1, column=0, sticky="wesn")

if __name__ == "__main__":
    root = tk.Tk()
    root.configure(bg="grey20")

    s = ScrollableFrame(root)

    t = tk.Text(s.scrollable_frame)
    t.grid(row=0, column=0, sticky="wesn")

    t2 = tk.Text(s.scrollable_frame)
    t2.grid(row=0, column=1, sticky="wesn")

    root.mainloop()

I'm glad for help

A: Base on the requirement in the comment, you want to grow/shrink the two text boxes when the root window is resized.  Below is the modified code with the necessary changes to achieve it:
import tkinter as tk
from tkinter import ttk

class ScrollableFrame():
    def __init__(self, container, *args, **kwargs):
        self.container = container
        self.canvas = tk.Canvas(self.container, bg="green")
        self.scrollbar = ttk.Scrollbar(self.container, orient="horizontal", command=self.canvas.xview)
        self.scrollable_frame = tk.Frame(self.canvas)
        self.scrollable_frame.grid(sticky="wesn")
        self.scrollable_frame.bind("<Configure>", lambda e: self.canvas.configure(scrollregion=self.canvas.bbox("all")))

        self.canvas.create_window((0, 0), window=self.scrollable_frame, anchor="nw", tags="scrollable")
        self.canvas.configure(xscrollcommand=self.scrollbar.set)

        self.canvas.grid(row=0, column=0, sticky="wesn")
        self.scrollbar.grid(row=1, column=0, sticky="we") # fill horizontally only

        # make self.canvas to fill all the available space of container
        container.rowconfigure(0, weight=1)
        container.columnconfigure(0, weight=1)

        # resize self.scrollable_frame when self.canvas is resized
        self.canvas.bind("<Configure>", lambda e: self.canvas.itemconfig("scrollable", width=e.width, height=e.height))

if __name__ == "__main__":
    root = tk.Tk()
    root.configure(bg="grey20")

    s = ScrollableFrame(root)

    # make the two text boxes to fill all the space of s.scrollable_frame
    s.scrollable_frame.rowconfigure(0, weight=1)
    s.scrollable_frame.columnconfigure((0,1), weight=1)

    t = tk.Text(s.scrollable_frame)
    t.grid(row=0, column=0, sticky="wesn")

    t2 = tk.Text(s.scrollable_frame)
    t2.grid(row=0, column=1, sticky="wesn")

    root.mainloop()

So basically the logic is when the root window is resized, the canvas is resized to fill the root window.  Then the frame (scrollable_frame) inside the canvas is resized to fill the canvas and finally the two text widgets are resized to fill the scrollable_frame.


text:
Q: CruiseControl.rb always running my projects in production mode? I'm curious as to why when I build my project using CruiseControl.rb, it runs it in production mode? Even though my application should not be in production mode. I even tried to specify: ENV['RAILS_ENV'] ||= 'development' in my app's environment.rb

A: That environment.rb line will only set your environment to development if the environment is not already set.
For information about how they suggest configuring your build environments, see:
Their Manual Entry on the subject


text:
Q: TFS Does TFS still need .vspcc files? We're using TFS and we're having problems when we switch branches, it's throwing up problems with the TFS bindings every single time.
We still have
.vspcc files
.vsscc files
which is I'm guessing where it stores the bindings, does anyone have any advice on how to easily switch between branches in TFS without pain?

A: These files are used to store files that are excluded from source control - and yes, they are themselves under source control. I've never had to worry about these before, so I don't think that's where the problem is.
Bindings are normally stored in your actual proj and sln files.
If you have problems with binding, you actually have some problem with your workspace. Either make a new workspace in a new local folder, and get everything from the server there from scratch (i.e. setting up the workspace mapping through visual studio, opening your solution via the source explorer etc. Don't use any clever tricks here - otherwise strange things happen), or try going to File -> Source Control -> Change Source Control, unbinding all projects and rebinding them. VS will blindly write the binding info anew into your project and sln files if you do this.
Especially make sure that all server paths you're checking out can be mapped to a local path.
Switching between branches is just done by opening the appropriate solution file from the appropriate folder/branch. It's not normal that this gives you problems, obviously.


text:
Q: How start Flutter (Error creating project) When I want to create a project it knocks out the following:
Error creating project
Flutter create command was unsuccessful

Some details(Ubuntu 18.04.3 LTS , JDK 11 , Android Studio 4.1.1)

A: I'm a Windows user, but it's maybe a problem of the Path of Java at PATH environment
1- open PATH environment.
2- remove everything Java related that does not point to the JDK folder.
3- add just field called  JAVA_HOME and give it the value of The Java SDK.

A: Flutter seems to be installed.
You should run flutter create app_name, where app_name is a folder to be created (does not exist).
The name of the folder should be in lowercase and no spaces