text:
Q: Como usar .append hidediv para ocultar um campo zoom do formulário É um formulario no Fluig e esse campo que quero ocultar é um campo zoom que busca um dataset, ele fica aparecendo na primeira atividade sendo que usei o appen para ocultar o mesmo mas ainda assim aparece
Append que estou usando para esconder o campo no formulario.
.append('$(\'*[name="causa"]\').css(\'display\', \'none\');var closers = $(\'*[name="causa"]\').closest(\'.form-field\').find(\'input, textarea, select\');var hideDiv = true;$.each(closers, function(i, close) {if (close.style.display != \'none\' && close.type != \'hidden\') {hideDiv = false;}});if (hideDiv == true) {$(\'*[name="causa"]\').closest(\'.form-field\').css(\'display\', \'none\');}');
        customHTML.append('</script>');
        customHTML.append('<script>');
        customHTML
                .append('$(\'*[name="causa"]\').closest("li").hide()');
        customHTML.append('</script>');
    }

Esse é o meu campo zoom no formulario:
<div>
                <div class="col-xs-12 col-sm-3 col-md-12">
                    <b> Causa do Chamado: </b>
                    <input type="zoom" class="form-control" id="causa" name="causa"
                        data-zoom="{
                            'datasetId':'_xlsGetCausaTI',
                            'displayKey':'des_causa',
                            'placeholder':'',
                            'fields':[
                                {
                                   'field':'des_causa',
                                   'label':'Selecione a Causa'
                                }
                                ]
                            }"  />

                        </div>
            </div>

A: Fiz um

var activity = getValue('WKNumState');

    if (activity == 3 || activity == 0) {
        form.setVisibleById("div_causa", false)
        form.setVisibleById("div_aprdes", false)
        form.setVisibleById("div_usertxt", false)
        form.setVisibleById("div_prioridadesolic", false)

``` e resolveu.


text:
Q: How te get an element from .fields I am having trouble getting the property filename from the req.files that I get from the router. Here's what I get:

And here's how I've been trying to get the filename of each (I am only using 2 pictures in this example but I could get more than two images so that's why I am iterating with the forEach)
let arrayImages = [];

if (req.files) {
  Array(req.files).forEach(image => {
    arrayImages.push(image[0].filename);
  })
}

A: Hi everyone thanks for all the help, i finally figured it out!
let arrayImages = [];
for (const clave in req.files) {
    array = req.files[clave]
    arrayImages.push(`${array[0].filename}`);
}

that way i've got the fieldname of each element

A: The root of your data from screen is an object.
So try to code like that:
let arrayImages = [];

if (req.files) {
  Object.values(req.files).forEach(arr => {
    arrayImages.push(arr[0].filename);
  })
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to increase the android action bar tabs text size I used TabsPagerAdapter and ViewPager to implement tabs in my action bar. I did it but my problem is tabs text is showing small size in tablets(tvdpi device). Can u please tell me how to increase tabs text size.
Thank you.
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
    ActionBar actionBar = getSupportActionBar();
    TabsPagerAdapter mAdapter = new TabsPagerAdapter(getSupportFragmentManager(),
            getIntent().getBundleExtra("rechargeInfo"));

    viewPager.setAdapter(mAdapter);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

     //Adding Tabs
    for (String tab_name : tabs) {
        actionBar.addTab(actionBar.newTab().setText(tab_name)
                .setTabListener(this));
    }

    /**
     * on swiping the viewpager make respective tab selected
     * */
    viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            actionBar.setSelectedNavigationItem(position);
        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {
        }

        @Override
        public void onPageScrollStateChanged(int arg0) {
        }
    });
}

@Override
public void onTabReselected(Tab arg0, FragmentTransaction arg1) {
    // TODO Auto-generated method stub

}

@Override
public void onTabSelected(Tab tab, FragmentTransaction arg1) {
    // TODO Auto-generated method stub
    viewPager.setCurrentItem(tab.getPosition());

}

@Override
public void onTabUnselected(Tab arg0, FragmentTransaction arg1) {
    // TODO Auto-generated method stub

}

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.amulyam.users.BalanceFragment;
import com.amulyam.users.RechargeActivity;
import com.amulyam.users.SpecialOffersFragment;

public class TabsPagerAdapter extends FragmentStatePagerAdapter {
    private Bundle rechargeInfo;

    public TabsPagerAdapter(FragmentManager fm, Bundle rechargeInfo) {
        super(fm);
        this.rechargeInfo = rechargeInfo;
    }

    @Override
    public Fragment getItem(int index) {

        switch (index) {
        case 0:
            // Special Offers fragment activity
            return new SpecialOffersFragment();
        case 1:
            // Balance fragment activity
            return new BalanceFragment();
        case 2:
            // Recharge fragment activity

            RechargeActivity rechargeActivity = new RechargeActivity();
            rechargeActivity.setArguments(rechargeInfo);

            return rechargeActivity;
        }

        return null;
    }

    @Override
    public int getCount() {
        // get item count - equal to number of tabs
        return 3;
    }

}

A: try this.. it would help you
TextView x = (TextView) tabHost.getTabWidget().getChildAt(0).findViewById(android.R.id.title);
x.setTextSize(25);

A: I think you ment you are using swipe tabs. if that is what you ment then you can go to the pager layout and inside the android.support.v4.view.PagerTitleStrip
write android:textSize="xxsp" where xx is the size you want.
for example I did it like so:
    <android.support.v4.view.ViewPager

  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:id="@+id/pager"
  android:layout_height="match_parent">

  <android.support.v4.view.PagerTitleStrip
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:id="@+id/title"
      android:layout_gravity="top"
      android:textSize="25sp"
      >
  </android.support.v4.view.PagerTitleStrip>

 </android.support.v4.view.ViewPager>

and you can do the same for the color and backgrounds:
android:textColor="@color/black"
Hope this will help you


text:
Q: Two views for a single view controller I am totally new to iOS programming. I am developing an app where I need a different view for portrait and another for landscape orientation. Even if the view is different, the buttons and other controls are the same in both the views. So I want to keep the same connections from the buttons/labels to the view controller for both the views. so that if I change the value of a label in my view controller, it should change in the view irrespective of the view I am presenting.
Now the problem I am facing is that I am not able to add two different root views to an item in the story board. I have tried to add two different sub views to the main view. That way I am able to create the views, but I am not able to connect buttons from both the views to a single connection. For example,
@property (strong, nonatomic) IBOutlet UIButton *buttonNext;

can be connected to a next button in only one view.
Inorder to get around that problem, I have created two different views in the story board, added the same view controller for both. Then created a segue for each view as follows:
@property (strong, nonatomic) IBOutlet UIView *portraitView;
@property (strong, nonatomic) IBOutlet UIView *landscapeView;

And in my view controller I have added:
- (void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
[self adjustViewsForOrientation:toInterfaceOrientation];
}

- (void) adjustViewsForOrientation:(UIInterfaceOrientation)orientation {
//NSLog(self.view.restorationIdentifier);
if (orientation == UIInterfaceOrientationMaskLandscape || orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
{
    if(self.landscapeView == nil)
    {
        self.landscapeView =[[UIView alloc] init];
    }
   self.view = landscapeView;
}
else if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown)
{
    self.view = portraitView;
}
}

The problem is that the second view is not loading properly. Initially it is getting loaded as nil. Even when I initialize the view in the code, it is not initializing subviews/controls inside the view. I am stuck with this for the past three days. Any help would be much appreciated.
EDIT 1:
I have added a sample code in here: http://cl.ly/2z3f3E290f0R

A: U can try this with single view :
First
In viewDidLoad method, code for Device Orientation
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter]  addObserver:self selector:@selector(orientationChanged) name:@"UIDeviceOrientationDidChangeNotification" object:nil];

Second
Method for OrientationChanged
-(void)orientationChanged {

    //Check for Portrait Mode
    if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation))
    {
       x=25; y=30;
    }
    //Lanscape mode
    else {
       x=50; y=40;
    }

    [button setFrame:CGRectMake(x, y, 80, 80)];
}

Here, you can take 'X' & 'Y' whatever you want.
This method always calls whenever device will be rotated.
Hopefully, it will help you.
Thanks.

A: Try this
 UIDeviceOrientation newOrientation = [[UIDevice currentDevice] orientation];
        if (newOrientation != UIDeviceOrientationUnknown && newOrientation != UIDeviceOrientationFaceUp && newOrientation != UIDeviceOrientationFaceDown)
        {
            if(orientation != newOrientation)
            {
                //ORIENTATION HAS CHANGED. Do orientation logic
                if(
                   (newOrientation == UIDeviceOrientationLandscapeLeft || newOrientation == UIDeviceOrientationLandscapeRight)&&(orientation == UIDeviceOrientationPortrait || orientation == UIDeviceOrientationPortraitUpsideDown))
                {
                    NSLog(@"Changed orientation to Landscape");
                    // Clear the current view and insert the orientation-specific view
                    [self clearCurrentView];
                    [self.view insertSubview:titleLandscapeView atIndex:0];
                }
                else if (
                         (newOrientation == UIDeviceOrientationPortrait || newOrientation == UIDeviceOrientationPortraitUpsideDown)&&(orientation == UIDeviceOrientationLandscapeLeft || orientation == UIDeviceOrientationLandscapeRight))
                {
                    NSLog(@"Changed orientation to Portrait");
                    // Clear the current view and insert the orientation-specific view
                    [self clearCurrentView];
                    [self.view insertSubview:titlePortraitView atIndex:0];
                }
                orientation = newOrientation;
            }

 -(void) clearCurrentView{
        if (titleLandscapeView.superview){
            NSLog(@"clear titleLandscapeView");
            [titleLandscapeView removeFromSuperview];
        } else if (titlePortraitView.superview){
            NSLog(@"clear titlePortraitView");
            [titlePortraitView removeFromSuperview];
        } else
        {
            NSLog(@"Neither titleLandscapeView nor titlePortraitView");
        }
    }


text:
Q: audio streaming server I'm a php developer, trying to develop a website to stream on-demand music to the users.
After a lot of googling I'm confused about which kind of server or tools should I use? I've seen some like WOWZA or SHOUTCAST, but I don't know which one is the best for my needs.
I want to provide high quality audio files. So maybe I should use 320kbps mp3 format or something else but with the same quality.
I don't need live streaming. I just need on-demand streaming of the music files and the ability for the user to create his/her own playlists.
The user shouldn't be able to download the music files.

A: Icecast/SHOUTcast are not appropriate for your use.  They take a single stream and send it to multiple connections simultaneously.  They are not "on-demand" servers where each user can listen to separate content.
For your use case, you can implement something in PHP.  All you are really doing is sending media files to the client.  You mentioned that you wanted to keep the client from downloading those files... this is impossible.  If the client can play it, the client can save it, and there is no way around this.  However, there are some things you can do that prevent it from being as easy as linking to a file.
Don't store your audio in the web server's document root.  All media files should be served only from your PHP scripts.  This gives you control over the requests coming in.  Look into readfile().  This also allows you an easy path to get off of simply loading files from disk (which you will want when you start to grow beyond 100k media files).
A URL for a media file should only work once, and for a specific user session ID.  Generate these URLs on the fly, with a time limit on them.  If the URL for the media file is requested by someone who doesn't have a valid session on your site, don't serve it.  If the link is expired, don't serve it.  This is what prevents someone from getting the URL and posting it on some message board.  Only valid users of your site with current valid sessions should be able to get at your media files.
Rate-limit requests.  Don't allow a user to be able to download more files at a time than is needed.  If they request 100 files in 1 second, don't serve them.
Implementing all of these concepts is something I leave to you.  How you do so depends your needs, and is not something that is typically done in a 5-line snippet of code.


text:
Q: Запретить индексации с одного из доменов Есть сайт, который доступен по следующим доменам:
http://www.consult-unity.ru/
https://consult-unity.ru
https://studentprograms.ru
Как сделать запрет на индексацию по доменам:
http://www.consult-unity.ru/
https://consult-unity.ru
В итоге нужно, чтобы сайт был доступен для индексации только по домену https://studentprograms.ru

A: На обоих сайтах http://www.consult-unity.ru/ https://consult-unity.ru разместите robots.txt с содержанием

User-agent: *
  Disallow: /


text:
Q: ASP.NET Conditional Markup Rendering According to Web.config Key I have a key in web.config as -
<add key="IsDemo" value ="true"/>

I want to show/hide markup based on above web.config entry for a non-server html tag without using code behind file (as there is no .cs file and there are no runat=server controls).
Something similar to following pseudo code:
IF ( IsDemo == "true" )
THEN

        <.....>

ENDIF

Does anyone know that we can write such conditional logic in .aspx markup?
Please help!!!
EDIT:
Section I'm hiding or showing have some data like username and password. So, I do not want user to use Firebug or Web Developer Tools to see hidden markup. markup should not go to client side.

A: Solution:-
<% If (ConfigurationManager.AppSettings("IsDemo").ToLower().Equals("true")) Then%>

       <.....>

<% Else%>

        <.....>

<% End If%>

A: The syntax for something like that would be
<% if(System.Configuration.ConfigurationManager.AppSettings["IsDemo"] == "true") %>
<% { %>

<% } %>

This assumes that the page is in C#.
You can firm this code up by being more defensive around the AppSettings retrieval e.g. what happens in the case where the value is null etc.

A: If I understand it right, you don't want to use server-side (aspx components, with runat="server" attribute) and just want to control display of html on aspx page then try this solution.
Create a property in codebehind file (or better still in some other config helper class):
//IN C# (OR VB) file
protected string Demo{
    get{
            return ConfigurationManager.AppSettings["IsDemo"]=="true"?
                   "none":"block";
      }
}

In aspx page:
<tr style="display:<%= Demo%>;">
    blah blah


text:
Q: How to setup a MS SQL BI development environment on local machine We need to setup a local development machine (with BIDS) to develop SSIS packages as we do not want to install BIDS on the database server itself.
Is there any guides on how to do that?

A: Here is a link to a guide to doing this for sql 2008:
http://www.mssqltips.com/tip.asp?tip=1807


text:
Q: Updating md5 to sha512 authorizenet I am updating the md5 to sha512 for DPM authorizenet-
Please help me out -
I am not getting it work.
see code change -
while generating fingerprint for x_hp_hash -
from md5 -
if (function_exists('hash_hmac')) {

return hash_hmac("md5", $api_login_id . "^" . $fp_sequence . "^" .

 $fp_timestamp . "^" . $amount . "^", $transaction_key);
}

return bin2hex(mhash(MHASH_MD5, $api_login_id . "^" . $fp_sequence . "^" . $fp_timestamp . "^" . $amount . "^", $transaction_key));

to sha512 -
$signature_key = hex2bin($signature_key);

if (function_exists('hash_hmac')) {

return hash_hmac("sha512", $api_login_id . "^" . $fp_sequence . "^" .

 $fp_timestamp . "^" . $amount . "^", $signature_key);

}

return bin2hex(mhash(MHASH_SHA512, $api_login_id . "^" . $fp_sequence . "^" . $fp_timestamp . "^" . $amount . "^", $signature_key));

While getting reponse and comparing the x_sha_hash value
 from md5 -
if(strtoupper(md5($this->md5_setting . $this->api_login_id . $this

->transaction_id . $amount)) == $this->md5_hash){
        //valid
 } else{
        //not valid
 }

Changed to sha512 -
$this->signature_key = hex2bin($this->signature_key);

$string = '^'.$this->api_login_id.'^'.$this->transaction_id.'^'.$amount.'^';

if(strtoupper(HASH_HMAC('sha512', $string, $this->signature_key)) == $this->SHA2_Hash){
  //valid

} else{
  //not valid

}

What I am doing wrong?
When validating the transaction at my end it is saying please check your md5 setting. It validates on the basis of last code shown in the snippet.
my signature Key = E284BDC12A45A7F5B0933A352EB1C3F25E91A3B92360693D94E4366190EF12E78F6CFE8601751F719DA7A72ABBA117BF0161F8A1DD894DADE3C56A838D8355AD
x_hp_hash submitting using the second code snippet (i.e sha512 fingerprint)
x_hp_hash = b4c9e1878f88aa9c4f808761ed8ceee71ab117cc0f1297b2d850e28351f08fc52bd528a7538c832568c674a1d5095ead1a5383a626c9797587ab16bae76e45fb
after submitting getting in reponse -
X_SHA2_Hash - 19AB7947709CF6CB2B8415784EBD7669FCDE5D83B69EC8C716203806A3235308187668F5783F9CA0F1AE8A47808EDAB241025A8AF61A2FABC27FA6AAAEA8FFD8
generated hash code  -
3E6427E67271B1F0732D3D95217D25EE4D7C4103C906A6CB70943498698157F48F7BECD5C7E5393CF2A489B464070A7778F15757385E8F29029CFC3F66256F05
using last snippet above.
so these are not equal so not a valid transaction.

A: I got it working
Thanks to the https://community.developer.authorize.net/t5/Integration-and-Testing/Working-php-hash-verification/td-p/65774/highlight/false
Instead of using only following three fields

$api_login_id
  $transaction_id
  $amount;

I had to use all the following fields see -
$hashData = implode('^', [
$_POST['x_trans_id'],
$_POST['x_test_request'],
$_POST['x_response_code'],
$_POST['x_auth_code'],
$_POST['x_cvv2_resp_code'],
$_POST['x_cavv_response'],
$_POST['x_avs_code'],
$_POST['x_method'],
$_POST['x_account_number'],
$_POST['x_amount'],
$_POST['x_company'],
$_POST['x_first_name'],
$_POST['x_last_name'],
$_POST['x_address'],
$_POST['x_city'],
$_POST['x_state'],
$_POST['x_zip'],
$_POST['x_country'],
$_POST['x_phone'],
$_POST['x_fax'],
$_POST['x_email'],
$_POST['x_ship_to_company'],
$_POST['x_ship_to_first_name'],
$_POST['x_ship_to_last_name'],
$_POST['x_ship_to_address'],
$_POST['x_ship_to_city'],
$_POST['x_ship_to_state'],
$_POST['x_ship_to_zip'],
$_POST['x_ship_to_country'],
$_POST['x_invoice_num'],
]);
$hash = hash_hmac('sha512', '^'.$hashData.'^', hex2bin($signatureKey));
$hash = strtoupper($hash);
if($this->SHA2_Hash === $hash) {
  //valid
}

So use all the x_fields from authorize.net to generate hashcode


text:
Q: Is there a way to automatically assign new users a disk quota limit as they are created on edubuntu? I am new to ubuntu, I recently set up an edubuntu ltsp 14.04 server. I manually assigned disk quota limit to already existing users. Is there a way to make the server automatically assign quota limit to new users as they are being created? maybe a script or something?
Help is really needed here...

A: Actually, you can have this set.  Edit /etc/adduser.conf and add 'QUOTAUSER={user}' where {user} is set to either a user that you want to clone quota settings from, or a generic account with quota defined.  See 'man adduser.conf' for more info.

A: Instead of assigning the quota to every user you could assign the quota to a group.
Then simply add the new users to this group when you create them.


text: Q: Using tfcompile to AOT Compile Tensorflow Graph for iOS Is it possible to use tfcompile to AOT compile a Tensorflow graph to run on iOS? This will presumably require cross-compiling. If so, how do I set tfcompile to compile the graph for iOS?


text:
Q: Odoo 13 hide delete button from all forms Is there any module that has this functionallity?
I want to hide the delete button, so that only the users that are part of an specific group can see the delete option.
There is an OCA module that does this, but for the Export button
Thanks beforehands

A: Odoo 13 hide delete button from all forms
add attribute all of tags tree and form in xml
 <tree delete="1" >
 <tree string="Users" delete="false">
 <form  delete="false">


text:
Q: PHP-getelementsbytagname method not exist in DOMNode class I readed this DOMNode document and I found there isn't getelementsbytagname method in DOMNode. But, in my code I can use getelementsbytagname method with DOMNode. Can someone explain me why?
There is my code:
$dom = new DOMDocument;
@$dom->loadHTMLFile('http://www.poemjoy.com/show-8-27-1.html');

$xpath = new DOMXpath($dom);
$articles = $xpath->query('//div[@class="poem_detail"]');

            foreach($articles as $tnode)
            {
                $ep=$tnode->getElementsByTagName('p');
            }

The $tnode is DOMNode type variable. I didn't find getelementsbytagname method in the document I mention before.Why can I use it?
Can someone please explain to me?

A: From the documentation you linked to in your question:

For clarification:
The assumingly 'discoverd' by previous posters and seemingly
  undocumented methods (.getElementsByTagName and .getAttribute) on this
  class (DOMNode) are in fact methods of the class DOMElement, which
  inherits from DOMNode.
See: http://www.php.net/manual/en/class.domelement.php

i.e. $tnode is a DOMElement and not just a DOMNode.
The specification of the DOM standard (which PHP implements) describes the permitted node types in a DOM document. These are:

Document, DocumentType, DocumentFragment, Element, Text, ProcessingInstruction, and Comment
Source

It also notes that these elements are simply called nodes meaning that, strictly speaking, there is really no such thing as a DOMNode but rather the DOMNode is a general term used to talk about any one of those node types.
In your particular case (and as shown in the standard) getElementsByTagName is only a member of Element and Document.
Since your selector is to select div elements you are actually getting a NodeList of DOMElement objects and not DOMNode objects and you can use getElementsByTagName. However this is dangerous because there is no guarantee that all your results will be DOMElement objects, therefore it's good to typecheck before you use the function.


text:
Q: Text object to Path: how to remove a single path from a double path produced when you use print method in Raphael js using cambam fonts? When I use the print method on Raphael js to convert text to path it produces a double path(an outline) of each character. I have searched on line and noticed that there are some fonts like: camBam fonts that seem to be true type fonts but they actually are tricking the font creators to see them as outline of a characters while they are putting 2 same lines on top of each other.   I was wondering If there is any way to programmatically (using js)  split those lines(paths) on top of each other and remove one of them?
Here is the svg code to an svg file that contains paths that are on top of each other and are the same for letter s (for example) :
Update : Sorry, here I've updated the right svg code:
<svg height="100%" version="1.1" width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0, 0, 600,600"><desc>Created with Snap</desc><defs></defs><path d="M79.5111111111111,59.87405972222222C79.89444444444443,66.13517083333333,70.94999999999999,63.32405972222222,65.45555555555555,63.96294861111111C70.94999999999999,63.451837499999996,79.89444444444443,66.00739305555555,79.5111111111111,59.87405972222222C79,52.84628194444444,66.09444444444443,56.67961527777778,65.58333333333333,49.77961527777778C65.19999999999999,44.15739305555556,73.24999999999999,46.457393055555556,78.48888888888888,45.94628194444444C73.24999999999999,46.329615277777776,65.19999999999999,44.15739305555556,65.58333333333333,49.77961527777778C66.09444444444443,56.67961527777778,79,52.84628194444444,79.5111111111111,59.87405972222222C79.5111111111111,59.87405972222222,79.5111111111111,59.87405972222222,79.5111111111111,59.87405972222222" fill="#ff0000" stroke="#0000ff"></path><rect x="0" y="30" width="330" height="51" fill="none" stroke="#000000"></rect></svg>

Update2:
And here is paths produced from both fonts
And if you manipulated it manually in inkscape or illustrator you can see that the letter s has 2 lines on top of each other that makes up that letter:
How can I remove one of the 2 lines(paths) using js? And if I have a whole text that has been converted to paths similar to the s character, how can I apply that removal function to all the text to make it single paths texts?
Update3:
I have the following code that tries to split the s path in half:
var sTotalpx = textpaths.getTotalLength();
var sSinglepath = Snap.path.getSubpath(textpaths, (sTotalpx/2), sTotalpx);
console.log(sSinglepath.toString());

And the path result is showing half of s and doubled line(paths)instead of the whole s with single line(path). Any workaround ideas please?!
Update 4:
I read somewhere that when you use svg editors:"  when using overlapping paths, use 'combine' or 'union' options to fuse the shapes together and remove overlaps."
How this is possible programmatically using js please?

A: There seems to be a problem in this definition (I added linebreaks to see better) :
M
79.5111111111111,59.87405972222222
C79.89444444444443,66.13517083333333,70.94999999999999,63.32405972222222,65.45555555555555,63.96294861111111
C70.94999999999999,63.451837499999996,79.89444444444443,66.00739305555555,79.5111111111111,59.87405972222222
C79,52.84628194444444,66.09444444444443,56.67961527777778,65.58333333333333,49.77961527777778
C65.19999999999999,44.15739305555556,73.24999999999999,46.457393055555556,78.48888888888888,45.94628194444444
C73.24999999999999,46.329615277777776,65.19999999999999,44.15739305555556,65.58333333333333,49.77961527777778
C66.09444444444443,56.67961527777778,79,52.84628194444444,79.5111111111111,59.87405972222222
C79.5111111111111,59.87405972222222,
79.5111111111111,59.87405972222222,
79.5111111111111,59.87405972222222

The last definition starting with a C is just wrong. This might be where your problem is coming from. You could try without this last part...?
This is the W3C documentation for SVG paths that is useful to read it through ;-)
Let me know if that works for you

A: I'm aware it's an outdated question but looks like this is rather rare ... I found this thread while searching for solution with very similiar problem.
I needed single line font and used CamBam font, too. I used 'text-to-svg' to get SVG paths (probably the same results as with Raphael.js).
After some tests and reading I figured out that theese fonts are 'looped' to create [looking as] fillable (closed) paths, being more compatible with strictly systems. This is done by drawing path in reverse order.
For simple, open chars this problem is not so hard - SIMPLY it's enough to find 'central symmetricity point' in the middle of svg path sequence and drop the rest. But this is not trivial problem, too.
In this case it's a last point of middle(4-th) C[urve] command (78.48888888888888,45.94628194444444). From that point you can see mirror symmetric in control point's positions ... but excluding the first point of first C command next to 'reversing point'. There can be L[ine] command in the middle, too.
To get rid of error filling svg path must have attribute fill="none".
As mentioned eariler - it's quite easy with simple chars - in many cases looping result can be different! There can be one, two or more closed loops followed with exactly (or almost?) the same loops but preserving  [original drawing] sequence ('1a, 1b, 1a, 1b' or '1a, 1b, 1c, 1a, 1b, 1c'), not 1 by 1 copy ('1a, 1a, 1b, 1b') ... and probably (didn't checked this) mixed with 'symmetric looped' paths (to be divided) between them!
PS. This is theory ... I don't have ready, inplemented solution yet. I'll do it in a near future.

A: To group two paths, you want to put them together under a parent <g> tag.


text:
Q: Convert this SQL to Doctrine Query Language (DQL) I got following SQL query
SELECT a.*
FROM payment_schedule a, (
    SELECT loan_application_id, MAX(due_date) max_date
    FROM payment_schedule
    WHERE payment_type_id <> 3
    GROUP BY 1
) AS b
WHERE a.loan_application_id = b.loan_application_id
AND a.due_date = b.max_date

I want to convert this to DQL, I tried the following
SELECT
    a.*
FROM
    Loan\Entity\PaymentSchedule a, (
        SELECT
            IDENTITY(ps2.loanApplication), MAX(ps2.dueDate) max_date
        FROM
            Loan\Entity\PaymentSchedule ps2
        GROUP BY 1
    ) AS b
WHERE IDENTITY(a.loanApplication) = IDENTITY(b.loanApplication)
AND a.dueDate = b.max_date

This does not work, how do i construct such query in DQL ?
Thanks.


text:
Q: How to define a function that can be directly printed like Date in JavaScript The Date, we all know that once we instantiate it, say
var now = new Date();

We can directly print now as a string, event it is an object
console.log(now); //Sun Mar 12 2017 12:48:21...

And this will work the same:
console.log(Date());

How this works? and how do I defined a user function like this?

A: If you do it this way, you won't be modifying the native Date constructor:

var DateConstructor = function() {
  this.date = new Date();
};

DateConstructor.prototype.printDate = function() {
  console.log(this.date);
};

var date = new DateConstructor();

date.printDate();

Edit: March 27
I think I understand the question now. You're asking: "If the Date constructor is returning an object as its instance, why does the object console.log as a string? How can I reproduce this with my own constructors?"
It looks like the Date constructor doesn't return normal object types. And even though its typeof returns "object", it, in some ways, behaves more like the "string" type. Strings don't console.log as objects, yet they have methods such as spit on their prototype.
As far as I know. There's no way to create javascript constructors that return anything other than objects. However, it seems that the native Date constructor lives outside this rule.
Here's an interesting article about JS constructor returns.


text:
Q: postgres: update a row on conflict insert and return old values I need a query to update a row in table, but if the id doesn't exist it inserts default values. Also it has to avoid threads race conditions.
I found an answer here that should be fine
https://stackoverflow.com/a/7927957/8372336
Using this query:
UPDATE tbl x
SET    tbl_id = 24
     , name = 'New Gal'
FROM  (SELECT tbl_id, name FROM tbl WHERE tbl_id = 4 FOR UPDATE) y
WHERE  x.tbl_id = y.tbl_id
RETURNING y.tbl_id AS old_id, y.name AS old_name, x.tbl_id, x.name;

So I think it should return old values after updating and it should prevent threads race conditions.
But I need to add an insert if the row doesn't exist and also return the inserted values this time (old values doesn't make sense because they didn't exist).
So basically I need to do something like
INSERT INTO tbl
    (...) VALUES (...)
    RETURNING ..., ...
ON CONFLICT DO
UPDATE tbl x
SET    tbl_id = 24
     , name = 'New Gal'
FROM  (SELECT tbl_id, name FROM tbl WHERE tbl_id = 4 FOR UPDATE) y
WHERE  x.tbl_id = y.tbl_id
RETURNING y.tbl_id AS old_id, y.name AS old_name, x.tbl_id, x.name;

but i'm not sure if something like this could work. how can i make it work and make it sure of race conditions?

A: Somehow, this seems to work:
insert into t (x)
    values ('a0'), ('b')
    on conflict (x) do update
        set x = excluded.x || '0'
    returning i, x, (select x from t t2 where t2.i = t.i);

I am surprised because t is in scope in the subquery, but excluded is not.  Hmmm . . . perhaps that is because it is not part of the on conflict clause but part of the overall insert.  That starts to make sense.
Here is a db<>fiddle for this version.
I think your code would look like:
INSERT INTO tbl (...)
    VALUES (...)
ON CONFLICT DO
UPDATE tbl x
    SET tbl_id = 24,
        name = 'New Gal'
RETURNING (SELECT t2.tbl_id FROM tbl t2 WHERE t2.tbl_id = tbl.tbl_id) AS old_id,
          (SELECT t2.name FROM tbl t2 WHERE t2.tbl_id = tbl.tbl_id) AS old_name,
          x.tbl_id, x.name;


text:
Q: How to display coins in json for each Tab in datatable? Hello I am trying to display json data in each tab and with datatable
Can any one tell me how can I do this?
I try looking on google No luck
i like it to be like this
 https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_tabs_dynamic&stacked=h
but with datatable and its own coin list like btc first tab etc  from json file
EDIT the code what stacey gave me it dont show  it just shows me a blank page like below image  unless its java script? But need it in json?
https://i.stack.imgur.com/jp6w5.jpg
list.json

 [{"coinlist",
"Bitcoin faucets":
"faucet name":"btc Faucet",
 "minutes": "5",
 "amount": "90",
 "claim link": "http://bitcoinsfaucets.com",
         // next faucet off bitcoin goes here!
   },
{
  "eth faucets":
"faucet name":"eth Faucet",
 "minutes": "15",
 "amount": "1000",
 "claim link": "http://ethwebsite.com",
  // next faucet off eth goes here!
   },
{
  "bitcore faucets":
"faucet name":"bitcore Faucet",
 "minutes": "24",
 "amount": "5000",
 "claim link": "http://bitcorefaucets.com",
         // next faucet off bitcore goes here!
   },
{

"primecoin faucets":

"faucet name":"prime Faucet",

 "minutes": "55",

 "amount": "3000",

 "claim link": "http://primecoinfaucets.com",

         // next faucet off primecoin goes here!

  ]
 }
]

datatable

                name
                timer
                amount
                cliam link

javascript

A: I fixed your data but this is just a very basic start, you can use this as an example to build what you are looking for - but you need to read up about Javascript Objects and keys - so you know how to use create valid data objects! You might try reading something like this - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects.

var data = {
 "coinlist": {
  "bitcoin_faucets": {
   "faucet_name": "btc Faucet",
   "minutes": "5",
   "amount": "90",
   "claim_link": "http://bitcoinsfaucets.com"
  },
  "eth_faucets": {
   "faucet_name": "eth Faucet",
   "minutes": "15",
   "amount": "1000",
   "claim_link": "http://ethwebsite.com"
  },
  "bitcore_faucets": {
   "faucet_name": "bitcore Faucet",
   "minutes": "24",
   "amount": "5000",
   "claim_link": "http://bitcorefaucets.com"
  },
  "primecoin_faucets": {
   "faucet_name": "prime Faucet",
   "minutes": "55",
   "amount": "3000",
   "claim_link": "http://primecoinfaucets.com"
  }
 }
}

$('document').ready(function(){
   var links = document.getElementsByTagName('a');
   var i = 0;
   for (coin in data.coinlist) {
     links[i].innerHTML = coin;
     i++;
   }
  $('li > a').click(function(){
    var table = $('#list')
    var type = $(this).data('type');
    var name = $(this).text().replace(' ','_')
    var the_data = data.coinlist[name];

    for (sub in the_data) {
        console.log('sub '+sub)
        var field = the_data[sub]
        $('#'+sub).find('span').text(field)
        if (sub == 'faucet_name' || sub == 'claim_link') {
          var newlink = the_data['claim_link'];
         // console.log(newlink)
          $('#'+sub).find('a').prop('href',newlink)
        }
     }

    console.log('type '+name)

    $('#content'+type).append(table)
    $('table').css('display', 'block')
  })
    $('li > a').first().trigger('click');
})
table {
  display:none;
}
<!DOCTYPE html>

  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

Coin Lists

Home

Menu 1

Menu 2

Menu 3


text:
Q: "An existing connection was forcibly closed by the remote host" when connecting to same site in SSL Ok, for our site, which I will say is "https://www.foo-bar.com", and is a .NET MVC 4.5.1 application, we have the following code:
var http = (HttpWebRequest)WebRequest.Create("https://www.foo-bar.com/category.rss");
var response = http.GetResponse();

var stream = response.GetResponseStream();
var sr = new StreamReader(stream);
s = sr.ReadToEnd();

This works locally, AND it works in production under "http", but as soon as we go to https, we get the following error:
{
   "ClassName":"System.Net.WebException",
   "Message":"The underlying connection was closed: An unexpected error occurred on a send.",
   "Data":null,
   "InnerException":{
      "ClassName":"System.IO.IOException",
      "Message":"Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.",
      "Data":null,
      "InnerException":{
         "NativeErrorCode":10054,
         "ClassName":"System.Net.Sockets.SocketException",
         "Message":"An existing connection was forcibly closed by the remote host",
         "Data":null,
         "InnerException":null,
         "HelpURL":null,
         "StackTraceString":" at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)\r\n at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)",
         "RemoteStackTraceString":null,
         "RemoteStackIndex":0,
         "ExceptionMethod":"8\nReceive\nSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Net.Sockets.Socket\nInt32 Receive(Byte[], Int32, Int32, System.Net.Sockets.SocketFlags)",
         "HResult":-2147467259,
         "Source":"System",
         "WatsonBuckets":null
      },
      "HelpURL":null,
      "StackTraceString":" at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)\r\n at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)\r\n at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)\r\n at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)\r\n at System.Net.TlsStream.CallProcessAuthentication(Object state)\r\n at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)\r\n at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)\r\n at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)\r\n at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)\r\n at System.Net.ConnectStream.WriteHeaders(Boolean async)",
      "RemoteStackTraceString":null,
      "RemoteStackIndex":0,
      "ExceptionMethod":"8\nRead\nSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Net.Sockets.NetworkStream\nInt32 Read(Byte[], Int32, Int32)",
      "HResult":-2146232800,
      "Source":"System",
      "WatsonBuckets":null
   },
   "HelpURL":null,
   "StackTraceString":" at System.Net.HttpWebRequest.GetResponse()\r\n at ASP._Page_Views_home_Test_cshtml.Execute() in c:\\inetpub\\wwwroot\\foobarweb_dev\\Views\\Home\\Test.cshtml:line 14",
   "RemoteStackTraceString":null,
   "RemoteStackIndex":0,
   "ExceptionMethod":"8\nGetResponse\nSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Net.HttpWebRequest\nSystem.Net.WebResponse GetResponse()",
   "HResult":-2146233079,
   "Source":"System",
   "WatsonBuckets":null
}

I've read suggestion to edit the following settings, and I have tinkered with them all, but no matter what combination I use, I still get the above error:
http.KeepAlive
http.ProtocolVersion
http.ServicePoint.ConnectionLimit
http.Timeout

If I try this in another project on my local computer, connecting to the "https" version of the site works. It is only when connecting from within the site over SSL.
I am stumped, and I'm not even sure if this is a code issue, a server issue, or maybe even a proxy/firewall issue.

A: Check the TLS version of the host "https://www.foo-bar.com" and the .NET TLS version of your project. They should be equal.
Check by "Immediate window":
System.Net.ServicePointManager.SecurityProtocol

A: The issue is something with the SSL -- probably a certificate issue of some sort. If it is public facing I would start by running SSL Labs Analyizer at it to see if that helps sniff out the cert problem.

A: I had this same problem and resolved it by adding the following to my Powershell script:
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy

A: Had this on a .NET Framework 4.0 app and the solution for us was as found here. Create the following four DWORD keys and set them all to a value of 1 to enable strong cryptography and have the OS manage which version to use:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\SystemDefaultTlsVersions
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\SchUseStrongCrypto
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SystemDefaultTlsVersions
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319\SchUseStrongCrypto


text:
Q: Is there an easy way to read a .md (markdown) file as a character vector into R I have a raw markdown file that I have taken from online, and I want to read the text into R as a character vector. Is there a good way of doing this?
Thanks.

A: You can read (most) files line by line using readLines, which should also work for markdown. Take a look at the documentation.
You specify the file to read using the con argument, e.g.
readLines(con = "markdown.md")


text:
Q: Overlaying Legend in Map Plot Covers Plot I am attempting to create a plot using the map library. However, the legend always seems to be covering the map, while I would like it to be off to the side so the plot is visible. Here is the code that generates the map in question:
library(maps)
library(maptools)
map(database = "county", region = "Michigan")
legend("center", c("Legend 1","Legend 2"), horiz = FALSE)

And here is the image generated (with the legend obscuring the plot).

Any ideas on how to move the legend over? Thanks!

A: One can use the x and y parameters for the legend.  In this case one could specify the lat and long of where you would like to place the legend or use the default positions:
"bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center"
Example:
legend( c("Legend 1","Legend 2"), x="bottomleft")

or specify the x and y coordinates (with the latitude and longitude).  For the state of Michigan:
legend( c("Legend 1","Legend 2"), x=-90, y=43)

If the legend is still not in correct location, consider manually setting the plotting limits for the chart:
map(database = "county", region = "Michigan", xlim=c(-91, -82))


text:
Q: 7zip command line - Create executable jars I have an executable .jar-File which works, but I want to add some files to the .jar-File with another program. My idea was to use the 7zip command line extension, but when I try to add something to the .jar-File. I use this command:
7za.exe a -t7z C:\myfiles\thejar.jar C:\filestoadd\* -r
Everytime I try to do this the CMD throws me an error and says:
Error: C:\myfiles\thejar.jar is not supported archive
Well, ok. Then my Idea was to unpack the file thejar.jar, add the files to the directory where the files from thejar.jar were extracted and create a .zip with the extension .jar. When I did this, the file thejar.jar was about 1MB smaller than before with adding files to it. I tried different compression-methods but it was always smaller. When I tried to execute the .jar, an error-message popped up and said Invalid or corrupt jarfile. I already googled my problem, but I haven't got an answer for now... Can you help me?

A: The simple / recommended solution is to use the jar command that is included in every Java JDK to add the extra files to the JAR.
It is also possible to  create a JAR file using JarOutputStream:

*

*How to use JarOutputStream to create a JAR file?
The trouble with using 7zip, or any other "standard" zip utility is that you might accidentally use some modern zipfile feature that the Java utilities don't understand.

You also asked (in comments) if you are permitted to copy the jar.exe and jli.dll from an Oracle JDK / JRE into your own project.

*

*Read the license!  We are not lawyers here and we can't give you proper legal advice.

*My understanding is that that would be a violation of the Oracle license and copyright.  Embedding a full JRE is permitted, but cherry-picking is not permitted.

*Consider using OpenJDK instead.  The licensing for OpenJDK is GPL based and there are no copyright-based restrictions on redistributing a vanilla distribution.  Not even modifying and redistributing it ... so long as you make available source code and build instructions for any changes you make to it1.

Finally, note that this is moot in Java 11 onwards.  Oracle now only distributes full JDK's.  So that means that if your customer installs "Java" from Oracle, the jar command will be included.

1 - You only have to worry about trademark.  Basically, the trademark license says you are not permitted to call a product "Java", etc if it deviates from the "standard" in non-permitted ways.  Lookup the details for yourself.

A: -t7z will create a 7z archive, not a zip. You need -tzip instead.

A: I know this is an old post but if anyone is searching for info the following works great and makes a jar that will execute correctly, I ran across this post myself looking for info and in the end came up with the following.
For me this method was the easiest way to do what I needed, and just easier and faster then using jar, plus works great as batch file
C:\Progra~1\7-Zip\7z.exe a -tzip -mx9 -spf -r Filename.jar *


text:
Q: Laravel Nova, route not found I've installed Laravel Nova (using Laravel 5.6). App\Providers\NovaServiceProvider::class is registered in my config/app.php file. But when I go to https://localhost:1234/nova I get a 404 error.
I have cleared my caches and run a composer dump-autoload. How can I get this route working?
EDIT: When I run php artisan route:list the nova-api routes are there but there is no route for nova.
Also, the migrations were not copied across after nova:install. I am working with an existing Laravel project.

A: I ran into this problem too. Add Nova::routes(); to your routes/web.php and reload /nova in your browser.

A: You have to clear the config cache for the changes to actually apply:
php artisan config:clear

A:
Verify App\Providers\NovaServiceProvider is in your provider list.

*

*Go to config/app.php

*Add App\Providers\NovaServiceProvider::class, to the providers
Note that this answer is relative to @jszobody's anwser and a direct answer to a question following up upon that aforementioned tweet.
https://twitter.com/taylorotwell/status/1032300773655408640
Without this, it is possible to see the Nova panel, though it remains empty. A fresh install at this time will show a "Help" Card on the Dashboard.

A: From Taylor (if you are using an earlier version than Nova 1.0.1):

If you are having issues with Nova not registering a /nova route when using "php artisan serve"... try upgrading Nova and updating your route registration in your NovaServiceProvider to match this image... (add "register" on end of chain).

https://twitter.com/taylorotwell/status/1032298042773393408

A: If you have disabled Package Discovery / Autodiscover by adjusting your composer.json like so:
"extra": {
    "laravel": {
        "dont-discover": [
            "*"
        ]
    }
}

You need to add the the NovaCoreServiceProvider and Nova alias to your config/app.php manually.
'providers' => [
    Laravel\Nova\NovaCoreServiceProvider::class,
],
'aliases' => [
    'Nova' => Laravel\Nova\Nova::class,
]

If you look at the composer.json of laravel/nova in your vendor folder you can see this:
"extra": {
    "laravel": {
        "providers": [
            "Laravel\\Nova\\NovaCoreServiceProvider"
        ],
        "aliases": {
            "Nova": "Laravel\\Nova\\Nova"
        }
    }
},

A: I had the same issue. Resolved by finally remember to enable HTTP rewrite.
a2enmod rewrite

then restart apache
sudo systemctl restart apache2

A: check if the route does not require an id
for example /student/:id

A: I realize it has been some time since this was posted, and there are other answers, but today I encountered the same problem a fresh install seemingly out of nowhere and resolved it by adding
\Laravel\Nova\NovaCoreServiceProvider::class to the providers array in config/app.php.
After doing so, I ran artisan route:clear to clear and rebuild the route cache, and the problem was resolved.
I have no idea what could have caused this issue, as I've bootstrapped multiple new laravel projects with nova the exact same way and never encountered this issue.

A: One option is to debug to check all Nova routes.
Add the lines above in the NovaServiceProvider class boot() function.
    public function boot()
    {
        parent::boot();
        Nova::serving(function (ServingNova $event) {
            $request = $event->request;
            \Log::debug(Nova::resourceInformation($request));
        }


text:
Q: There is no "Run after install" checkbox in Mono Game ClickOnce installer I have created a game with Mono Game 3.4 distributed by the ClickOnce wizard, using Visual Studio Express 2015.
I would like to distribute only on Windows. The ClickOnce wizard works well, but I don't want the program to automatically run after ClickOnce. But how do I do it?


text:
Q: How does it derived from LHS term $$\sin\left(\frac{720n\pi}{600}\right) = -\sin\left(\frac{4n\pi}{5}\right).$$
It is a part of derivation I found in an example but this step is not clear to me if I tried to just divide and use reminder but it is not same and $\sin(n\pi) = 0$ so it is not near to above step.
Please explain.

A: $$\sin{(720/600 n \pi)}$$$$=\sin{(6/5 n \pi)}$$$$=\sin{((2-4/5) n \pi)}$$
$$=\sin{(2 n \pi-4/5n\pi)}$$$$=\sin{(-4/5 n \pi)}$$$$=-\sin{(4/5 n \pi)}$$

A: Hint. We have that
$$\sin(720/600\cdot n\cdot\pi)=\sin((2-4/5)\cdot\pi\cdot n). $$
Then recall that $\sin(x+2n\pi)=\sin(x)$ and $\sin(-x)=-\sin(x)$ for all $x\in\mathbb{R}$ and $n\in\mathbb{Z}$.

A: $$\frac{720}{600} = \frac{72}{60}=\frac{12}{10}=\frac{6}{5} = 2 - \frac{4}{5}.$$
Now you write $$\sin\left(\frac{\pi n \cdot 720}{600}\right) =\sin\left( 2\pi n -\frac{\pi n \cdot 4}{5}\right) =  \sin\left(-\frac{\pi n \cdot 4}{5}\right) =-\sin\left(\frac{\pi n \cdot 4}{5}\right)$$


text:
Q: SQL Select table name A database had has 4 tables that has the same columns EG. SalesJAn, SalesFeb, SalesMarch, SalesApril.
I want to run a query in SQL server or in report builder Where i can change the table name  based on a selection which one of 4 tables will be queried . Eg Filter in report builder
Like this
declare @tablename varchar(50)
set @tablename = 'test'
select * from @tablename

A: You can create a procedure which will do a select for a given table name. This procedure could look like this:
CREATE PROCEDURE EXECUTE_SELECT
@tbl sysname
AS
BEGIN
 SET NOCOUNT ON;
 DECLARE @SQL NVARCHAR(MAX);
 SET @SQL =  N' SELECT * FROM ' + QUOTENAME(@tbl)
 EXECUTE sp_executesql @SQL
END

Then you can execute this procedure for every table name you want. Please see here an example according to your description: db<>fiddle
If this doesn't help you, please point out which exactly you still need to know. Thank you.


text:
Q: How to get details of a facebook post from post url using facebook api? I want to fetch the details of a facebook post from the post's url. The post will be a public post.
Is it possible to do this via facebook api? If its possible,how?(a link or explanation)
I tried reading through graph api. But I couldn't find the relevant information.

A: You can get any object by fetching it by id and passing encoded url as id. It was working for me as far as now anyway.
simply call:
https://graph.facebook.com/v2.6/?id=[ENCODED_URL]&access_token=[TOKEN]

Also. Post url contains id anyway, so you can just extract the id from url string.


text:
Q:  dropdown option value is not saved to database in wordpress plugin settings page I'm building a Wordpress plugin with a settings page in the admin dashboard.
I have several inputs including text fields, checkbox and select dropdowns.
I save the data with a <form> to options.php, as is recommended by Wordpress.
The checkbox and text field values successfully get saved to the database on submit, but the <select> element (the selected option) does not. I can't understand why.
This is my code:
<?php
//Create menu link
function awb_options_menu_link() {
    $awb_options_page = add_options_page(
        'Add WhatsApp Button Options', // title
        'Add WhatsApp Button', // title of the menu link
        'manage_options', // capabilities credentials, at least able to X
        'awb-options', // menu URL slug
        'awb_options_content' // name of the function that displays the option page content
    );
}

function awb_validate_inputs( $input ) {

    // Create our array for storing the validated options
    $output = array();

    // Loop through each of the incoming options
    foreach( $input as $key => $value ) {

        // Check to see if the current option has a value. If so, process it.
        if( isset( $input[$key] ) ) {

            // Strip all HTML and PHP tags and properly handle quoted strings
            $output[$key] = strip_tags( stripslashes( $input[ $key ] ) );

        } // end if

    } // end foreach

    // Return the array processing any additional functions filtered by this action
    return apply_filters( 'awb_validate_inputs', $output, $input );
}

// Create a select dropdown form input for awb_settings[distance_from_bottom_mu]
function  distance_from_bottom_mu_dropdown_fn() {
    $items = array("px", "%");
    $option_with_default = isset( $awb_settings['distance_from_bottom_mu'] ) ? $awb_settings['distance_from_bottom_mu'] : '%';
    echo "<select id=\"awb_settings[distance_from_bottom_mu]\" name=\"awb_settings[distance_from_bottom_mu]\" style=\"vertical-align: baseline;\">";
    foreach($items as $item) {
        $selected = ($option_with_default == $item) ? 'selected="selected"' : '';
        echo "<option value=\"$item\" $selected>$item</option>";
    }
    echo "</select>";
}

// Create options page content
function awb_options_content() {

    // Init Options Global
    global $awb_options;

    // Create default button text
    $button_text = isset( $awb_options['button_text'] ) ? sanitize_text_field( $awb_options['button_text'] ) : _e('Send us a WhatsApp', 'add-whatsapp-button');
    $awb_location_values = array('right', 'left');

    ob_start(); ?>

<?php _e('Add WhatsApp Button Settings', 'add-whatsapp-button') ?>

<?php _e('Settings page for the Add WhatsApp Button plugin. Check out the preview screen below to see how your button would look on a smartphone before saving your settings to the database.', 'add-whatsapp-button') ?>

            <form method="POST" action="options.php">
                <?php settings_fields('awb_settings_group'); ?>

                            <?php _e('Enable WhatsApp Button', 'add-whatsapp-button') ?>
                            <input name="awb_settings[enable]" type="checkbox" id="awb_settings[enable]" value="1" <?php checked('1', $awb_options['enable']); ?>>

                            <?php _e('Button Text', 'add-whatsapp-button') ?>

                                <input name="awb_settings[button_text]" type="text" id="awb_settings[button_text]" value="<?php echo $button_text; ?>" class="regular-text">

<?php _e('Enter the text you want the button to show. Recommended: up to 18 characters.', 'add-whatsapp-button'); ?>

                            <?php _e('Breakpoint', 'add-whatsapp-button') ?>

                                <input name="awb_settings[enable_breakpoint]" type="checkbox" id="awb_settings[enable_breakpoint]" value="1" <?php checked('1', $awb_options['enable_breakpoint']); ?>>

<?php _e('Check this box in order to only display the WhatsApp button up to a certain screen width.', 'add-whatsapp-button'); ?>

                                    <input name="awb_settings[breakpoint]" type="number" id="awb_settings[breakpoint]" value="<?php echo sanitize_text_field( $awb_options['breakpoint'] ); ?>" class="small-text"><?php _e('px', 'add-whatsapp-button'); ?>

<?php _e('Enter your desired screen width breakpoint here. Default is 600px.', 'add-whatsapp-button'); ?>

                            <?php _e('Button Background Color', 'add-whatsapp-button') ?>

                                <input name="awb_settings[button_bg_color]" type="text" id="awb_settings[button_bg_color]"  value="<?php echo sanitize_text_field( $awb_options['button_bg_color'] ); ?>" class="udi-color-picker" />

<?php _e('Choose a background color for your button. Default is green (#20B038)', 'add-whatsapp-button'); ?>

                            <?php _e('Button Distance from Bottom', 'add-whatsapp-button') ?>

                                <input name="awb_settings[distance_from_bottom]" type="number" id="awb_settings[distance_from_bottom]"  value="<?php echo sanitize_text_field( $awb_options['distance_from_bottom'] ); ?>" class="small-text" />
                                <?php distance_from_bottom_mu_dropdown_fn(); ?>

<?php _e('Choose your button\'s Distance from the bottom of the screen, in percentages or pixels. Default is 10%.', 'add-whatsapp-button'); ?>

                        <?php _e('Button Location on Screen', 'add-whatsapp-button') ?>

                                <select id="awb_settings[button_location]" name="awb_settings[button_location]" style="vertical-align: baseline;">
                                    <option value="right" <?php selected( $awb_settings['button_location'], 'right' ); ?>>right</option>
                                    <option value="left" <?php selected( $awb_settings['button_location'], 'left' ); ?>>left</option>
                                </select>

<?php _e('Choose whether your button will appear on the left side or right side of the screen', 'add-whatsapp-button'); ?>

<?php _e('Button Preview', 'add-whatsapp-button'); ?>

                                <?php echo $button_text; ?>

<input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes', 'add-whatsapp-button') ?>">

            </form>

    <?php
    echo ob_get_clean();
}

add_action('admin_menu', 'awb_options_menu_link');

//register plugin settings
function awb_register_settings() {
    register_setting('awb_settings_group', 'awb_settings', 'awb_validate_inputs');
}

add_action('admin_init', 'awb_register_settings');

Anyone have any idea why the <select> option value does not save to the database?

A: I printed out the $awb_options array with print_r, and it turns out the value is indeed saved into the database correctly, but the saved value wouldn't display properly.
After re-examining my code I noticed I mixed up $awb_settings (which I used to post the settings to the DB) and $awb_options, which is the variable in the wp_options table that actually holds the array of saved settings. I accidentally called $awb_settings['button_location'] and not $awb_options['button_location'] in the input value. That was my mistake... A stupid one I would agree.


text:
Q: Why is Git not found after installing OS X Lion? I just upgraded to OS X Lion and now cannot initialize Git where it used to work fine:
$ git add .

-bash: git: command not found

I'm new to Git and to programming, so I'm sure it's a quick fix, any help is greatly appreciated.  Thanks guys!

A: If /usr/local/git already exists, you'll need to either add it to your $PATH or make a symlink placing the symlink inside a directory that is in your existing PATH.
A common practice is to make /usr/local/bin if it doesn't exist and add a link:
sudo -s
mkdir -p /usr/local/bin
ln -s /usr/local/git/bin/git /usr/local/bin/git
exit

A: Lion (and Snow Leopard) didn't ship with git - so perhaps the way you installed git didn't survive the upgrade. You'll need to find your copy of git or just get a new copy. Using spotlight to search your Time Machine backups might be fruitful to find the files and know if it's a path issue or the binaries are truly gone after Lion migrated your data.
All of your repos stored in user space are fine. Do try to get the same or newer version of git.
The command line mdfind -name git will list all files that spotlight has seen with git in the name. Most installations of git should survive an upgrade to Lion and you only have to clean up your environment or link to the binary from somewhere in your $PATH.
Xcode 4(4.0-4.2) drops git into /Developer/usr/bin along with most of the other tools you need like make and gcc. It might be simplest to maintain git after getting the (currently) free Xcode from the App Store. Xcode 4.3 puts giy and other tools in Applications/Xcode.app/Contents/Developer/usr/bin.
To avoid issues with different versions, you might want to make sure any old versions are gone from your hard drive. (and certainly from your $PATH)

A: Step 1: Reinstall git (I just installed the Snow Leopard version from here) if it's not in:

/usr/local

Step 2: Open Terminal and do the following:

cd /etc
sudo nano bashrc

Then in nano at the top of the file write (as aaron suggested)

PATH=/usr/local/git/bin:$PATH

Press Ctrl+X to quit nano and press Y to save. Then exit terminal and reopen and git should be working for you.

A: Possibly, you had installed git through MacPorts or Fink.
I think it will take some time to have a release of either for Lion... or possibly you should try and reinstall it...
Indeed, it seems that you need to install MacPorts from trunk to get Lion compatibility...
Fink has also got some hints about upgrading to Lion.

A: If you have XCode installed, the best solution is Xcode -> Preferences -> Downloads -> Install Command Line Tools.
This put git (among other things) at /usr/bin/git.
If you don't have Xcode installed, then installing it just for git would definitely be overkill.

A: I think you will find that Git is still installed on your system.  It looks like the PATH is just messed up.  Check to see if /usr/local/git still exists on your system.
I just added the following to my ~/.bashrc file and everything is back to normal.
PATH=/usr/local/git/bin:$PATH

To be more specific, this site - http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html - details the difference between .bashrc and .bash_profile. If you use Mac's terminal with Git, then adding the above PATH specification to your .bash_profile will do the job. Of course, you'll have to close the Terminal window and open a new one because the .bash_profile file is loaded on a Terminal window's opening.
In summary, adding this to .bash_profile would work too.

A: From StackOverflow:
export PATH=$PATH:/usr/local/git/bin/

then run source ~/.bash_profile in Terminal
Link to the post there: https://stackoverflow.com/questions/6810059/git-on-mac-os-x-lion/6810082#6810082

A: If you are using brew, just run this command from the terminal.
brew install git

A: This happened because git stop being part of the $PATH (for some migration reason).
There is a very simple way of fixing this in OS X:
In OS X, you can add variables to $PATH by changing the file
/etc/paths

so, you can put back git doing the following:
sudo vim /etc/paths

add /usr/local/git/bin to the end of the file, save, and exit. Restart shell. Git should work.

A: Just download the newest version from here: http://code.google.com/p/git-osx-installer/
Install it, open up a new terminal, and it works like before :D

A: Same issue here, downloaded and installed the snow leopard version from google code and off I went. Needed to quit and re-open terminal though...
All is well again..

A: When there is git path already,
just add directory to your PATH variable.
echo 'export PATH=/usr/local/git/bin:$PATH' >> ~/.profile

A: I fixed it by downloading and reinstalling git from here.

A: I used the App Store to install Xcode and it just gives you an all in one app blob.  However it DOES have other apps and installers in it.  I just needed git so the path from that is
export PATH=$PATH:/Applications/Xcode.app/Contents/Developer/usr/bin
Its a bit of a hack, but I don't use Xcode for a lot of stuff.  Add to your bash config as other posters described and your good to go

A: You don't need to modify the path or install the Xcode command-line tools. Just use the "xcrun" utility from the Terminal:
http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/

A: I solved it by following advice on this site:
http://blogger.forgottenskies.com/?p=740
It was just a pathing issue. To be honest, I expected a whole lot more issues. The upgrades are getting smoother. I remember when I upgraded from Tiger to Leopard, just about everything "open source" broke..


text:
Q: React router 'to' through props in const I suspect this is more about React (or JS) than routing.
To avoid props collision, I am using forwardRef, defined in a const. The 'to' I want to set through props passed from parent component, and I cannot get this work. In the example below, where it says to={props.toUrl} it only works if it is to='/hello'. How do I do this, so I can use the ButtonRouter component from the Demo component?
import React from "react";
import { MemoryRouter as Router } from "react-router";
import { Link } from "react-router-dom";
import Button from "@material-ui/core/Button";

const CollisionLink = React.forwardRef((props, ref) => (
  <Link innerRef={ref} to={props.toUrl} {...props} />
));

function ButtonRouter(props) {
  return (
    <Router>
      <Button component={CollisionLink}>Routing w/o props collision</Button>
    </Router>
  );
}

export default function Demo() {
  return <ButtonRouter toUrl="/hello" />;
}

A: I think you might be missing props from ButtonRouter:
function ButtonRouter(props) {
  return (
    <Router>
      <Button component={(routerProps) => <CollisionLink {...routerProps} {...props} />}>Routing w/o props collision</Button>
    </Router>
  );
}


text:
Q: convert string to decimal or float mysql i have the next problem,
i have a table with a string column, but i need convert this column in decimal or float.
I tried with cast and convert but doesn't work
example
input
3.50
7.10
18.50
27.00
46.50
46.90
117.90
226.70
274.70
Not available
Not available

tried
select cast(price as decimal(16,2)) from products

output
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00

i see this warnings

Warning: #1918 Encountered illegal value '' when converting to DECIMAL

Warning: # 1292 Wrong truncated DECIMAL value:

I need later multiplier this column with another column

A: If you add simple a 0 to the value you get a float or decimal which you can cast or usde directly
everythin that is not a number is cobverteed to 0, but you can Replace Not available with another number

CREATE TABLE textvalue
    (`Input` varchar(13))
;

INSERT INTO textvalue
    (`Input`)
VALUES
    ('3.50'),
    ('7.10'),
    ('18.50'),
    ('27.00'),
    ('46.50'),
    ('46.90'),
    ('117.90'),
    ('226.70'),
    ('274.70'),
    ('Not available'),
    ('Not available')
;

SELECT CAST(Input + 0 AS DECIMAL(12,2))FROM textvalue

| CAST(Input + 0 AS DECIMAL(12,2)) |
| -------------------------------: |
|                             3.50 |
|                             7.10 |
|                            18.50 |
|                            27.00 |
|                            46.50 |
|                            46.90 |
|                           117.90 |
|                           226.70 |
|                           274.70 |
|                             0.00 |
|                             0.00 |

db<>fiddle here

A: Try
select convert(price, decimal(16,2)) from products


text:
Q: How to create a schema for an array of structs in Spark? I am trying to create the schema for the following data:
[{"a": "6"},{"b":"7"}]

My code so far
val data = Seq("""[{"a": "6"},{"b":"7"}]""").toDF()
val schema = StructType(Seq(
               StructField("colA", StructType(
                 Seq(StructField("a", StringType, true))
               ), true),
              StructField("colB", StructType(
                Seq(StructField("b", StringType, true))
              ), true)
             ))
val res = data.withColumn("res", from_json(col("value"), schema))

When I do res.show(), it returns null. Any ideas anyone?

A: You get null, because provided schema doesn't fit the data.
For your data you can nicely create a schema of array of maps:
val res = data.withColumn("res", from_json($"value", ArrayType(MapType(StringType,StringType))))
res.show()
// +--------------------+--------------------+
// |               value|                 res|
// +--------------------+--------------------+
// |[{"a": "6"},{"b":...|[{a -> 6}, {b -> 7}]|
// +--------------------+--------------------+

I don't think you can create an array of structs out of this data. You could, if you had only one dictionary inside the array with different keys or two dicts with same keys. But now you have 2 dicts, both with different keys. Arrays can only store one data type. Since you have 2 different dictionaries, this would require defining a different struct inside the array, what is not possible, arrays can hold only one data type.
Best what I can think of, is create an array of structs, but both structs would have both fields (a and b). But then one of them will be empty  in both structs.
val res = data.withColumn("res", from_json($"value",ArrayType(StructType(Seq(StructField("a",StringType,true),StructField("b",StringType,true))))))
res.show(truncate=false)
// +----------------------+----------------------+
// |value                 |res                   |
// +----------------------+----------------------+
// |[{"a": "6"},{"b":"7"}]|[{6, null}, {null, 7}]|
// +----------------------+----------------------+

A: By default JSON data source can infer schema from an input file using the default inferschema option. So if you have the json stored in a file, you don't need to define it yourself:
val df = spark.read.json("<PATH_to_JSON_File>", multiLine = "true")

You'll need to use multiLine = "true" only if your json record spans multiple lines.
Example:
//read json file into dataframe
val df = spark.read.json("src/main/resources/myJsonFile.json")
df.printSchema()
df.show(false)

You can still define the schema yourself, but note that your array is not consistent. The keys inside have different names, but they are different elements too. You can't define 2 elements with different keys in an enclosing array in your json. It's like defining 2 elements of different types.
So I think your json should look like this : ":[{"a":"6","b":7}]" in which case, your schema should be:
val schema = ArrayType(StructType(Array(
               (StructField("a", StringType, true),
               (StructField("b", StringType, true)
              )), false)

The false field means your array cannot accept null elements, but can still put null into the columns.


text:
Q: Slack API throwing KeyError with Slack Token So I've been trying to make a slack bot and have the following code run to make sure everything is working fine, just been following a video, but VS Code is giving me a key error. I'm using a virtual environment, activated with the right libraries installed. I've used both slackclient and slack_sdk packages and I am still getting the same error. I have looked up similar questions and I have the most updated version of the libraries, installed and uninstalled multiple times to no avail. SLACK_TOKEN is in a .env file in the same directory. Any clue as to why I am getting this error?
import dotenv
import os
from slack_sdk import WebClient
from pathlib import Path
from dotenv import load_dotenv
import slack_sdk

env_path = Path('.')/ '.env'
load_dotenv(dotenv_path=env_path)

client = WebClient(token=os.environ['SLACK_TOKEN'])

A: Your code should work and it works for me. You should recheck your .env file one more time, maybe you have a typo or incorrect .env file format. And if I understand correctly your problem has nothing to do with Slack, the problem with dotenv loading. You can check it by outputting os.environ._data dict and checking the keys of this dict.


text:
Q: Pass/Override Terraform object variable via command line I have a Terraform configuration (v0.14, AWS provider 3.32.0) in which I have defined the parameters for certain resource types as objects (input variables). Here is an (simplified) example:
variable "docker_config" {
  type = object({
    internal = number
    external = number
    protocol = string
  })
  default =
    {
      internal = 8300
      external = 8300
      protocol = "tcp"
    }
}

However, I would like to be able to override individual values via command line or environment variable.
Can I overwrite individual values of the object without having to pass the whole object? So, use default values and override them as needed:
e. g.
TF_VAR_docker_config.internal = 1234
or
TF_VAR_docker_config = "{internal = 1234}"
And this would result in:
    {
      internal = 1234
      external = 8300
      protocol = "tcp"
    }

My tests did not work. Is it possible? If yes, how?

A: Sadly, you can't do this directly. In near future optional should be added to object which will simplify this.
For now, a non-perfect workaround could be to use merge with regular map:
variable "docker_config_default" {
  type = object({
    internal = number
    external = number
    protocol = string
  })

  default = {
      internal = 8300
      external = 8300
      protocol = "tcp"
    }
}

variable "docker_config" {
  type = map

  validation {
    # condition is not perfect and suited only for one
    # attribute overwrite
    condition     = (can(var.docker_config["internal"])
                    || can(var.docker_config["external"])
                    || can(var.docker_config["protocol"]))
    error_message = "Must have internal, external or protocol."
  }
}

locals {
  docker_config = merge(var.docker_config_default, var.docker_config)
}

output "test" {
  value = local.docker_config
}

And you just use local.docker_config in your code.


text:
Q: Revoke app permissions from facebook programmatically I am working on an android app which takes a screenshot in a specific activity and posts it on Facebook for the user (FacebookSDK).
First time, it asks the user for the permissions, asks to login and specify the view(Public, Friends.. etc). When next time again when the activity is called it says like "You have already authorized App" and straight way posts the pic after clicking ok.
Problem is:

*

*The picture is being posted as second picture of the previous post. I intend to post it as an independent second post.

*No permissions or view was asked second time. I intend to ask for permission and view every-time the post is made.

Please help.
Code:
            FacebookSdk.sdkInitialize(getApplicationContext());
            callbackManager = CallbackManager.Factory.create();
            List<String> permissionNeeds = Arrays.asList("publish_actions");

            //this loginManager helps you eliminate adding a LoginButton to your UI
            manager = LoginManager.getInstance();
            manager.logInWithPublishPermissions(this, permissionNeeds);
            manager.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
                @Override
                public void onSuccess(LoginResult loginResult) {
                    shareOnFacebook();
                }
                @Override
                public void onCancel() {
                    Toast.makeText(HallOfFame.this, "Cancelled",Toast.LENGTH_LONG).show();
                }
                @Override
                public void onError(FacebookException exception) {
                    Toast.makeText(HallOfFame.this, "Error Occurred",Toast.LENGTH_LONG).show();
                }
            });
            return true;

The method shareOnFacebook:
// Take Screenshot
    View rootView = findViewById(android.R.id.content).getRootView();;
    rootView.setDrawingCacheEnabled(true);
    Bitmap bitmap = Bitmap.createBitmap(rootView.getDrawingCache());
    //**Bitmap bitmap = rootView.getDrawingCache();
    rootView.setDrawingCacheEnabled(false);

    SharePhoto photo = new SharePhoto.Builder()
            .setBitmap(bitmap)
            .setCaption("Hey Guys..! Checkout my Awesome Pic.")
            .build();

    SharePhotoContent content = new SharePhotoContent.Builder()
            .addPhoto(photo)
            .build();

    ShareApi.share(content, null);
    manager.logOut();
    //        this.finish();
    //        this.onDestroy();
    //        FacebookSdk.clearLoggingBehaviors();


text:
Q: selectable + slider: dont work 'click' inside Using selectable and slider, jquery click function dont work inside these widgets.
$("span.span1").click(function(event){              // dont work inside my selectable block
//$("span.span1").mouseenter(function(event) {      // work! inside
//$("span.span1").mousedown(function(event) {       // work! inside
    console.log("small img");
});

http://jsfiddle.net/nywuctuk/tm8yhoz7/3/
Can i do it avaliable somehow? May be try clear this event from outside events...
p.s. Even MOUSEDOWN work well!! (i think i will use it)
p.s.2 Forgot say about slider. Its using too.

A: Try setting z-index:999 style to ul > li > span, it might help


text:
Q: windows/System32 or windows/SysWOW64 I have a 32 bit application.
How correctly (officially) to find out which folder to install the application, depending on the bit depth of the OS?
Are there any winapi commands that would give out the correct path, if i indicating that the application is 32 bit.
windows/System32 or windows/SysWOW64?
In general, how correctly to do, if i'm not want to check if one of this folder exist?
Minimum supported client needed - Windows XP.

A: You should call SHGetKnownFolderPath supplying FOLDERID_ProgramFiles folder id. It will retrieve correct directory for applications. If you still want to install into system32 (though typical applications should not do it), then you can call it with FOLDERID_SystemX86.


text:
Q: Does the inverse of this function exist? $r(x)=\frac{2x}{1+x^2}$
So I know that the range is $[-1,1]$, and the function is injective. It is surjective as well in the range $[-1,1]$.
I'm trying to show whether this function has an inverse. Up till now I should be able to show that the inverse exists since $r(x)$ is bijective.
However, after solving for the inverse I got $r^{-1}(x)=1\pm\sqrt{1-y^2}$, which is a circle, I got a bit confused whether this inverse of $r(x)$ exists or not. Surely I did something wrong midway? It'd be nice if someone can let me know. Thanks!
Edit: I think I just figured it out. The function is not surjective at all in the range $[-1,1]$. Correct me if I'm wrong, thanks!
Edit 2.0: Sorry, it should be not injective in the range $[-1,1]$, right?

A: $y = \frac {2x}{1+x^2}$
If you can isolate $x$ you have your inverse.
$y(1+x^2) = 2x\\
yx^2 - 2x + y = 0$
Using the quadratic formula
$x = \frac {1 \pm \sqrt {1 - y^2}}{y}$
and
$x = f^{-1}(y) = \begin{cases} \frac {1 - \sqrt {1 - y^2}}{y}&y\ne0\\0&y=0\end{cases}$
maps from $[-1,1] \to [-1,1]$

A: The easiest way to check is to plot the function. If it has a turning point within the allowed domain then it will not have an inverse, since the inverse would need to be many to one. i.e. not a function.

From the plot, it is clear that there are two values for $y=\frac{1}{2}$. Solving for $x$, we see that these are $x=2-\sqrt{3}$ and $x=2+\sqrt{3}$
\begin{align}
\frac{2x}{1+x^2}&=\frac{1}{2}\\
\frac{x}{1+x^2}&=\frac{1}{4}\\
x&=\frac{1}{4}+\frac{1}{4}x^2\\
0&=x^2-4x+1\\
\therefore~x&=\frac{4\pm\sqrt{16-4}}{2}\\
&=\frac{4\pm2\sqrt{3}}{2}\\
&=2\pm\sqrt{3}
\end{align}
Since the function has two $y$ values for at least one $x$, the function is not bijective and does not have an inverse.
Note: the turning points of the function are at $x=\pm1$, if the domain of the function is restricted to this interval, then it will have an inverse. The same is true if $x\in(-\infty,-1]$ and $x\in[1,\infty)$.

A: You have miscalculated the inverse.  Using the quadratic formula to solve for $x$ in the equation $y(1+x^2)=2x$ yields:
$$x=\frac{1 \pm \sqrt{1-y^2}}{y}.$$
One of those roots is extraneous.  The correct answer is (the continuous extension at $x=0$ of) $r^{-1}(x)= \frac{1 - \sqrt{1-y^2}}{y}.$


text:
Q: react : Uncaught Error: Parse Error: Line 5: Unexpected token ILLEGAL I can not understand why and what this error is there - du you know why?
Update: I am running this in an nginx docker container.
Error message:
Uncaught Error: Parse Error: Line 10: Unexpected token ILLEGAL

 at http://x.x.x.x/scripts/example.js:10:undefined

enter code here... R OTHER DEALINGS IN THE SOFTW

index.html
<!DOCTYPE html>

    <title>Hello React</title>

    <link rel="stylesheet" href="css/base.css" />

script/example.js
var Simple = React.createClass({

  getInitialState: function(){
    return { count: 0 };
  },

  handleMouseDown: function(){
    alert('I was told: ' + this.props.message);
    this.setState({ count: this.state.count + 1});
  },

  render: function(){

    return

        Give me the message!

Message conveyed
        {this.state.count} time(s)

    ;
  }
});

React.render(<Simple message="Keep it Simple"/>,
                  document.body);

A: I run in NGINX no problem, I doubt this is an issue, but you never know if it's somehow a JSX compiler issue.  Can you try the below and see if it's the same result in your environment?
var Simple = React.createClass({

  getInitialState: function(){
    return { count: 0 };
  },

  handleMouseDown: function(){
    alert('I was told: ' + this.props.message);
    this.setState({ count: this.state.count + 1});
  },

  render: function(){
    render (

        Give me the message!

Message conveyed
        {this.state.count} time(s)

     )
  }
});

React.render(<Simple message="Keep it Simple"/>,
                  document.body);

A: Problem:
nginx was caching
Solution:
Set nginx.conf setting to "expires off;"


text:
Q: user id does not work with email As per the below link
using the v2 box api: how do I get a user id
the email should work as id for collaboration but when I am trying to use it with email id it fails with following error, and it work fine when i use the account ID
please note I have replaced the actual email id with  in the response
{
"type": "error",
"status": 404,
"code": "not_found",
"context_info": {
    "errors": [
        {
            "reason": "invalid_parameter",
            "name": "id",
            "message": "Invalid value '<my email id>'. 'id' with value '<my emmail id>' not found"
        }
    ]
},
"help_url": "http://developers.box.com/docs/#errors",
"message": "Not Found",
"request_id": "183660525751e95b3044f1d"
}

A: The issue is in the JSON you're sending. Currently you have:
{
    "item": {
        "id": "YOUR_FOLDER_ID",
        "type": "folder"
    },
    "accessible_by": {
        "id": "YOUR_EMAIL"
    },
    "role": "editor"
}

If you're using an email address instead of a user id, it should be with the login attribute i.e.
{
    "item": {
        "id": "YOUR_FOLDER_ID",
        "type": "folder"
    },
    "accessible_by": {
        "login": "YOUR_EMAIL"
    },
    "role": "editor"
}


text:
Q: GET or import $var as input value to Form after the page is loaded - onClick Button? I have a FORM with 2 input fields $first_name and $last_name.
<?
$first_name = get_post_meta($post->ID, 'fname', true);
$last_name = get_post_meta($post->ID, 'lname', true);

$fname_tmp = 'Foo' ; // First Name TEMP
$lname_tmp = 'Bar' ; // Last Name TEMP
?>

<input type="text" value="<? echo $first_name;?>" name="first_name" />
<input type="text" value="<? echo $last_name;?>" name="last_name" />

I want to add a onClick "GET/IMPORT" Button/function in this form. So if a user press this button then inputs field first_name should show Foo and last_name should show Bar
How can I do this? Using PHP?
Many thanks in advance.

A: Have a .php file which will respond to the onclick event triggered in the form.
<?php
$result['fname'] = 'FOO';
$result['lname'] = 'Bar';
echo json_encode($result);
?>

Write a jQuery function to trigger the event and receive response from php
You can add this javascript code anywhere in your page, but between your  is recommended.
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
        $('.button').click(function() {
            $.get('/path-to-php-file', function(data) {
                result = $.parseJSON(data);
                $("input[name='first_name']").val(result.fname);
                $("input[name='last_name']").val(result.lname);
            });
        });
    });
    </script>

Create a button in your form
<input class="button" type="button" value="Get/Import" />

A: I try it. it work. Here is your code.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" >
$(function() {
$(".buttonclass").click(function()
{
var fname_tmp = $("#fname_tmp").val();
if($("#fname_tmp").val()=='') fname_tmp="";

var last_name = $("#lname_tmp").val();
if($("#lname_tmp").val()=='') last_name="";

document.getElementById('first_name').value=fname_tmp;
document.getElementById('last_name').value=last_name;

});
});
</script>

<?php
//$first_name = get_post_meta($post->ID, 'fname', true);
//$last_name = get_post_meta($post->ID, 'lname', true);

$fname_tmp = 'Foo' ; // First Name TEMP
$lname_tmp = 'Bar' ; // Last Name TEMP
?>

<input type="hidden" name="fname_tmp" id="fname_tmp" value="Foo"/>
<input type="hidden" name="lname_tmp" id="lname_tmp" value="Bar"/>

<input type="text" value="<?php echo $first_name;?>" name="first_name" id="first_name"/>
<input type="text" value="<?php echo $last_name;?>" name="last_name" id="last_name"/>
<input type="button" name="mybutton" id="mybutton" value="Click Me" class="buttonclass" />


text:
Q: How to implement a method which can collect what information is display on the screen in android app I want to do a research by monitor user behavior using android app.
So we want to collect how many time they spend in each page in detailed
(not only the total time we need for each portion of page cause the page is very long and scrollable)
it's like we want to collect data like this:

Also I want to ask is there any way I can do it without using WebView?
Some point I forgot to say is
"yes we plan build our own app" and
"we want build a news app but we don't want to show news article using webview but in our own layout instead"
If any other information is required, let me know!

A: I would go on like this:

*

*Try to put your page in not seeable segments

*While someones scrolling put a counter on scrolling

*If counter of scrolling would say your user is on part 1 - part 2 of your page you can start for each part x a new counter

*If hes closing the page you finally collect the whole time spent in your db or you could use a thread saving the time for each segment and if thread gets closed save time

and I'm personally not a fan of webview, but if you don't want to use this page instead of a webpage you have to make your own native App with this design. (what I prefer more than everything :D + you wouldn't have pages being that long and it would be more smooth for users using your app)
Scenario:
Instance variables:

*

*global counter -> all counter times together

*counterP1 -> Counter for part1

*counterP2 -> Counter for part2

*scrollcounter -> starting at 0 [Part1 = 0 to 50, Part2 = 51 to 100 etc. (example)]

*

*Person starts App -> Automatically Part1 -> start counterP1

*Person scrolls DOWN -> Scrollcounter++ -> If scrollcounter > 50 then person will be now in Part2 -> Stop counter P1, add time of counter P1 to global counter and reset counter P1 -> Start counter P2

*Person scrolls UP -> Scrollcounter-- -> If scrollcounter < 51 then person will be back in Part1 -> Stop counter P2, add time of counter P2 to global counter and reset counter P2 -> Start counter P1

and so on :)


text:
Q: Available space on / but /home is running out of space? I have a computer with a ~58GB partition reserved for Fedora 30. I just got a warning that I am running out of space on /home.
I ran df -h and I got this:
Filesystem                               Size  Used Avail Use% Mounted on
devtmpfs                                 3.9G     0  3.9G   0% /dev
tmpfs                                    3.9G  167M  3.7G   5% /dev/shm
tmpfs                                    3.9G  1.9M  3.9G   1% /run
tmpfs                                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mapper/fedora_localhost--live-root   35G   13G   20G  40% /
tmpfs                                    3.9G   20M  3.9G   1% /tmp
/dev/mapper/fedora_localhost--live-home   17G   15G  847M  95% /home
/dev/sda8                                976M  164M  746M  18% /boot
/dev/sda2                                256M  140M  117M  55% /boot/efi
tmpfs                                    789M   11M  778M   2% /run/user/1000

I know that / and /home aren't actually on separate partitions, but why are they separated? And how can I allocate more space to /home?
EDIT:
pvdisplay:

  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
  --- Physical volume ---
  PV Name               /dev/sda9
  VG Name               fedora_localhost-live
  PV Size               <57.79 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              14793
  Free PE               0
  Allocated PE          14793
  PV UUID               YnWhfZ-jzxO-1QbU-k756-YisP-qjuW-Cnf0oC

vgdisplay:

  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
  --- Physical volume ---
  PV Name               /dev/sda9
  VG Name               fedora_localhost-live
  PV Size               <57.79 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              14793
  Free PE               0
  Allocated PE          14793
  PV UUID               YnWhfZ-jzxO-1QbU-k756-YisP-qjuW-Cnf0oC

lvdisplay:
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
  --- Logical volume ---
  LV Path                /dev/fedora_localhost-live/swap
  LV Name                swap
  VG Name                fedora_localhost-live
  LV UUID                JGCKLU-3O7s-lNZU-HjZi-mTn2-HV3J-u376VH
  LV Write Access        read/write
  LV Creation host, time localhost-live, 2019-07-21 19:25:06 -0700
  LV Status              available
  # open                 2
  LV Size                5.88 GiB
  Current LE             1506
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/fedora_localhost-live/home
  LV Name                home
  VG Name                fedora_localhost-live
  LV UUID                QJpqdd-ZzT3-QJ2P-8E6d-oIlW-LiDI-T9KafK
  LV Write Access        read/write
  LV Creation host, time localhost-live, 2019-07-21 19:25:06 -0700
  LV Status              available
  # open                 1
  LV Size                <17.03 GiB
  Current LE             4359
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/fedora_localhost-live/root
  LV Name                root
  VG Name                fedora_localhost-live
  LV UUID                AtjCQZ-a26R-RR8c-IRmo-INqb-rzad-sDuJ9O
  LV Write Access        read/write
  LV Creation host, time localhost-live, 2019-07-21 19:25:09 -0700
  LV Status              available
  # open                 1
  LV Size                <34.88 GiB
  Current LE             8928
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

A: You have one physical volume, /dev/sda9, one volume group, fedora_localhost-live, and three logical volumes root, home, and swap.
The first two logical volumes are mounted at / and /home and your swap isn't mounted anywhere as swap doesn't have a mountpoint but it's still using the space allocated to it.
From your df -h, you can see that the logical volume for root which is /dev/mapper/fedora_localhost--live-root has 35G of total space with 20GB free and the logical volume for home which is /dev/mapper/fedora_localhost--live-home has 17G of total space with only 847MB free which is why it is almost full. You can also see that the space in your volume group is all used up via these lines in vgdisplay:
Total PE              14793
Free PE               0
Allocated PE          14793

With that being said, you can't increase the size of /home as it is because there is no space in its volume group to allocate to it. The only things that you can do are:

*

*If there is space on another physical disk in that machine, you can use fdisk to create another partition and logical volume and then add it to the volume group and extend the space to the home logical volume.

*If the filesystem on the logical volumes is ext4 then you can shrink the root logical volume and then give the extra space to the home logical volume. You can find the type of filesystem with the command lsblk -f or findmnt -o source,fstype. If the filesystem type is xfs then this won't work.

*You can add another physical disk to your machine, use fdisk to set it up, and then create a physical volume, add it to the volume group, and extend the space to the home logical volume.
As you have chosen to go with the second option:

*

*Before you begin, back up your data. This is important in case something goes wrong. I can't stress this enough.

*You will need to boot from a Fedora Live USB or CD/DVD.

*Once in your live session, become root and install the lvm2 package with dnf install lvm2 if it isn't already there.

*Run lvs to make sure that the root logical volume is showing up. If it's not, run vgchange -a y fedora_localhost-live and then run lvs again.

*Check the root logical volume for errors with e2fsck -f /dev/mapper/fedora_localhost--live-root.

*As it won't be mounted, you can then reduce the size of the root logical volume with resize2fs /dev/mapper/fedora_localhost--live-root 25G and the shrink it with lvresize -L 25G /dev/mapper/fedora_localhost--live-root.

*Run vgs and you should now see your fedora_localhost-live volume group with 10G free.

*Next, extend the home logical volume to the rest of the space with lvresize -l +100%FREE /dev/mapper/fedora_localhost--live-home and resize it with resize2fs /dev/mapper/fedora_localhost--live-home.

*Run lvs again and you'll be able to see your home logical volume with 10G of free space.

*Reboot.


text:
Q: Date not displayed as expected i have this code:
const mydate = Cypress.dayjs('07 / 12')
cy.get('.dateOptions').contains('July 2017').click()
cy.get('.display').should('contain', mydate.format('DD/MM/YYYY'))

My question is that why the date is displaying 12/07/2001 instead of 12/07/2017
the error is:
expected  to contain 12/07/2001

A: You have to add the year also it seems. It should be changed to const mydate = Cypress.dayjs('07/12/2017').
Test:
const dayjs = require('dayjs')

describe('test suite', () => {

    it('Test', () => {
        const date = dayjs('07/12/2022').format('DD/MM/YYYY')
        cy.log(date)
    })
})

Test Runner screenshot: