问:
AttributeError: 'bool' object has no attribute 'pop' - Odoo v8 to Odoo v10 community
I have this method, which is a button:

```<code>@api.multi
def search_partner_seniat(self):
    """ Check vat of the partner and update iva rate
    """
    self.ensure_one()
    vat = self.vat.upper()
    res = {
        'name': _('The requested contributor does not exist'),
        'vat_subjected': False,
        'vat': vat,
        'wh_iva_agent': False,
        'wh_iva_rate': 0.0
    }

    if 'VE' in vat:
        vat = vat[2:]

    # assumption: both methods in new api style
    if self.env['res.partner'].check_vat_ve(vat):
        res = self.env['seniat.url']._dom_giver(vat)
    self.write(res)

    return {
        'type': 'ir.actions.act_window',
        'res_model': 'search.info.partner.seniat',
        'view_mode': 'form',
        'view_type': 'form',
        'res_id': self.id,
        'views': [(False, 'form')],
        'target': 'new',
    }
</code>```

It should return the NIF of a res.partner, bt every time I click on it, it throws me this:

```<code>Traceback (most recent call last):
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 638, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 675, in dispatch
result = self._call_function(**self.params)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 331, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/service/model.py", line 119, in wrapper
return f(dbname, *args, **kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 324, in checked_call
result = self.endpoint(*a, **kw)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 933, in __call__
return self.method(*args, **kw)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 504, in response_wrap
response = f(*args, **kw)
File "/home/kristian/odoov10/odoo-10.0rc1c-20161005/odoo/addons/web/controllers/main.py", line 866, in call_button
action = self._call_kw(model, method, args, {})
File "/home/kristian/odoov10/odoo-10.0rc1c-20161005/odoo/addons/web/controllers/main.py", line 854, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/api.py", line 681, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/api.py", line 672, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/kristian/odoov10/gilda/l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py", line 65, in search_partner_seniat
self.write(res)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/models.py", line 3518, in write
vals.pop(field, None)
AttributeError: 'bool' object has no attribute 'pop'
</code>```

The error comes here:

```<code>    if self.env['res.partner'].check_vat_ve(vat):
        res = self.env['seniat.url']._dom_giver(vat)
    self.write(res)
</code>```

I don't know if these two models might be the cause, they are working fine as I recall, on partner:

```<code>@api.model
def check_vat_ve(self, vat): #, context=None
    """ Check Venezuelan VAT number, locally called RIF.
    RIF: JXXXXXXXXX RIF VENEZOLAN
         IDENTIFICATION CARD: VXXXXXXXXX
         FOREIGN IDENTIFICATION CARD: EXXXXXXXXX
    """

    #if context is None:
        #context = {}
    if re.search(r'^[VJEGP][0-9]{9}$', vat):
        return True
    if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):
        return True
    return False
</code>```

On seniat_url:

```<code>@api.multi
def _dom_giver(self, vat):
    """ Check and validates that the vat is a passport,
    id or rif, to send information to SENIAT and returns the
    partner info that provides.
    """
    #if context is None:
        #context = {}
    name = ''
    url_seniat = ''

    url_obj = self.search([], limit=1) #self.browse(self.search([]))#[0] #(cr, uid, self.search(cr, uid, []))[0]
    #url1 = url_obj.name + '%s' %(value or '')
    #url2 = url_obj.url_seniat + '%s' %(value or '')
    if url_obj.name:
        name = url_obj.name

    if url_obj.url_seniat:
        url_seniat = url_obj.url_seniat
    url1 = name + '%s'
    url2 = url_seniat + '%s'
    vat = self._validate_rif(vat) #cr, uid, vat, context=None
    if vat:
        return self._get_rif(vat, url1, url2) #cr, uid, vat, url1, url2, context=context
    else:
        return False
</code>```

Any ideas?

These are methods migrated from v8 to v10 community.

答: res could be False when function _dom_giver return False. You should check if res is not False before calling write method. </p>

Body:
I have this method, which is a button:

@api.multi
def search_partner_seniat(self):
    """ Check vat of the partner and update iva rate
    """
    self.ensure_one()
    vat = self.vat.upper()
    res = {
        'name': _('The requested contributor does not exist'),
        'vat_subjected': False,
        'vat': vat,
        'wh_iva_agent': False,
        'wh_iva_rate': 0.0
    }

    if 'VE' in vat:
        vat = vat[2:]

    # assumption: both methods in new api style
    if self.env['res.partner'].check_vat_ve(vat):
        res = self.env['seniat.url']._dom_giver(vat)
    self.write(res)

    return {
        'type': 'ir.actions.act_window',
        'res_model': 'search.info.partner.seniat',
        'view_mode': 'form',
        'view_type': 'form',
        'res_id': self.id,
        'views': [(False, 'form')],
        'target': 'new',
    }

It should return the NIF of a res.partner, bt every time I click on it, it throws me this:

Traceback (most recent call last):
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 638, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 675, in dispatch
result = self._call_function(**self.params)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 331, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/service/model.py", line 119, in wrapper
return f(dbname, *args, **kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 324, in checked_call
result = self.endpoint(*a, **kw)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 933, in __call__
return self.method(*args, **kw)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/http.py", line 504, in response_wrap
response = f(*args, **kw)
File "/home/kristian/odoov10/odoo-10.0rc1c-20161005/odoo/addons/web/controllers/main.py", line 866, in call_button
action = self._call_kw(model, method, args, {})
File "/home/kristian/odoov10/odoo-10.0rc1c-20161005/odoo/addons/web/controllers/main.py", line 854, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/api.py", line 681, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/api.py", line 672, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/kristian/odoov10/gilda/l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py", line 65, in search_partner_seniat
self.write(res)
File "/home/kristian/.virtualenvs/odoov10/lib/python2.7/site-packages/odoo-10.0rc1c_20161005-py2.7.egg/odoo/models.py", line 3518, in write
vals.pop(field, None)
AttributeError: 'bool' object has no attribute 'pop'

The error comes here:

    if self.env['res.partner'].check_vat_ve(vat):
        res = self.env['seniat.url']._dom_giver(vat)
    self.write(res)

I don't know if these two models might be the cause, they are working fine as I recall, on partner:

@api.model
def check_vat_ve(self, vat): #, context=None
    """ Check Venezuelan VAT number, locally called RIF.
    RIF: JXXXXXXXXX RIF VENEZOLAN
         IDENTIFICATION CARD: VXXXXXXXXX
         FOREIGN IDENTIFICATION CARD: EXXXXXXXXX
    """

    #if context is None:
        #context = {}
    if re.search(r'^[VJEGP][0-9]{9}$', vat):
        return True
    if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):
        return True
    return False

On seniat_url:

@api.multi
def _dom_giver(self, vat):
    """ Check and validates that the vat is a passport,
    id or rif, to send information to SENIAT and returns the
    partner info that provides.
    """
    #if context is None:
        #context = {}
    name = ''
    url_seniat = ''

    url_obj = self.search([], limit=1) #self.browse(self.search([]))#[0] #(cr, uid, self.search(cr, uid, []))[0]
    #url1 = url_obj.name + '%s' %(value or '')
    #url2 = url_obj.url_seniat + '%s' %(value or '')
    if url_obj.name:
        name = url_obj.name

    if url_obj.url_seniat:
        url_seniat = url_obj.url_seniat
    url1 = name + '%s'
    url2 = url_seniat + '%s'
    vat = self._validate_rif(vat) #cr, uid, vat, context=None
    if vat:
        return self._get_rif(vat, url1, url2) #cr, uid, vat, url1, url2, context=context
    else:
        return False

Any ideas?

These are methods migrated from v8 to v10 community.


来源: stackexchange

问:
How to do a git push from within a Bamboo Script task
We are treating git as a database for some of our configurations and csv files. I have a Bamboo plan where I checkout some code (from Stash), run a node script and generate some csv files.
I need to be able to 'git push' these to a certain repository.
I have a Script task where I am writing something like this -

```<code>git remote add central ssh://git@stashRepoUrl:port/xyz.git
git config --global user.name "Bamboo"
git config --global user.email "bamboo@xyz.com"

git add src/main/resources/lookups/main/common/*
git add src/main/resources/lookups/main/reference/*
git commit -m "FROM BAMBOO JOB"

git push -u central featureBranchName
</code>```

I am getting the following error - hostkey verification failed.

How do I setup ssh between my stash repo and this 'bamboo agent'? I am sure someone might have tried this already.

Thanks!

答:
You need to manually do (just once), withthe account used by your script:

```<code>ssh -T git@stashRepoUrl -p port
</code>```

That will trigger a question to which you answer yes (to update the ~/.ssh/known_hosts)

Then your script can proceed.

Note that I would also set manually the line:

```<code>git remote add central ssh://git@stashRepoUrl:port/xyz.git
</code>```

You only need to use that command once, not each time your script runs.

ContentLicense: CC BY-SA 3.0

Body:
We are treating git as a database for some of our configurations and csv files. I have a Bamboo plan where I checkout some code (from Stash), run a node script and generate some csv files.
I need to be able to 'git push' these to a certain repository.
I have a Script task where I am writing something like this -

git remote add central ssh://git@stashRepoUrl:port/xyz.git
git config --global user.name "Bamboo"
git config --global user.email "bamboo@xyz.com"

git add src/main/resources/lookups/main/common/*
git add src/main/resources/lookups/main/reference/*
git commit -m "FROM BAMBOO JOB"

git push -u central featureBranchName

I am getting the following error - hostkey verification failed.

How do I setup ssh between my stash repo and this 'bamboo agent'? I am sure someone might have tried this already.

Thanks!

Body:
You need to manually do (just once), withthe account used by your script:

ssh -T git@stashRepoUrl -p port

That will trigger a question to which you answer yes (to update the ~/.ssh/known_hosts)

Then your script can proceed.

Note that I would also set manually the line:

git remote add central ssh://git@stashRepoUrl:port/xyz.git

You only need to use that command once, not each time your script runs.


问:
IIS Express - HTTP Error 500.19 0x800700b7 on 'mimeMap' for 'fileExtension' set to '.svg'
I was adding the ability to serve SVG & WOFF files to my Azure hosted web application. I found the following instructions:

https://blogs.iis.net/richma/archive/2014/01/07/adding-mime-types-to-your-windows-azure-web-site.aspx

Which I have followed by adding the below text to my Web.config file:

```<code><staticContent>
    <mimeMap fileExtension=".json" mimeType="application/json" />
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
</code>```

This works when published to Azure. However, now I get the following error from IIS-Express whenever I attempt to start up the website in Debug mode locally for every resource the website attempts to serve.

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information:

Module:           CustomErrorModule

Notification     SendResponse

Handler          StaticFile

Error Code       0x800700b7

Config Error     Cannot add duplicate collection entry of type 'mimeMap' with unique key  attribute 'fileExtension' set to '.svg'

Config File      snip\web.config

Requested URL    http://snip:14466/resources/img/snip.png

Physical Path    C:*snip*\Resources\img*snip*.png

Logon Method     Anonymous

Logon User       Anonymous

Config Source:

```<code>   58: <mimeMap fileExtension=".json" mimeType="application/json" />
   59: <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
   60: <mimeMap fileExtension=".woff" mimeType="application/x-font-woff"/>
</code>```

It clearly hates my mimeMap for .svg but this works fine out in Azure Websites. Is there something I am missing for locally running these changes to the Web.config?

答:
I found that if you have any mimeMap items duplicated between your Web.Config in the directory hosting your app and the default %UserProfile%\Documents\IISExpress\config\applicationhost.config it will fail for them all.

Same solution worked: made sure to <remove> each <mimeMap> entry.

Body:
I was adding the ability to serve SVG & WOFF files to my Azure hosted web application. I found the following instructions:

https://blogs.iis.net/richma/archive/2014/01/07/adding-mime-types-to-your-windows-azure-web-site.aspx

Which I have followed by adding the below text to my Web.config file:

<staticContent>
    <mimeMap fileExtension=".json" mimeType="application/json" />
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
    <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>

This works when published to Azure. However, now I get the following error from IIS-Express whenever I attempt to start up the website in Debug mode locally for every resource the website attempts to serve.

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information:

Module:           CustomErrorModule

Notification     SendResponse

Handler          StaticFile

Error Code       0x800700b7

Config Error     Cannot add duplicate collection entry of type 'mimeMap' with unique key  attribute 'fileExtension' set to '.svg'

Config File      snip\web.config

Requested URL    http://snip:14466/resources/img/snip.png

Physical Path    C:*snip*\Resources\img*snip*.png

Logon Method     Anonymous

Logon User       Anonymous

Config Source:

   58: <mimeMap fileExtension=".json" mimeType="application/json" />
   59: <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
   60: <mimeMap fileExtension=".woff" mimeType="application/x-font-woff"/>

It clearly hates my mimeMap for .svg but this works fine out in Azure Websites. Is there something I am missing for locally running these changes to the Web.config?


问:
Input shape of stacked RNNs
I'm trying to stack a few RNNs in series using Keras with a TensorFlow back-end. I can create a model with a single SimpleRNN layer, but when I try to add second SimpleRNN layer, I can't figure out the appropriate input size.

```<code>from keras import models
from keras.layers.recurrent import SimpleRNN
from keras.layers import Activation

model = models.Sequential()

hidden_units = 256
skeleton_dimensions = 3 * 16  # 3 dimensions for 16 joints
input_temporal_length = 7

in_shape = (input_temporal_length, skeleton_dimensions,)

# three hidden layers of 256 each
model.add(SimpleRNN(hidden_units, input_shape=in_shape,
                    activation='relu', use_bias=True,))
# what input shape is this supposed to have?
model.add(SimpleRNN(hidden_units, input_shape=(1, skeleton_dimensions,),
                    activation='relu', use_bias=True,))
</code>```

What should my second SimpleRNN have as input shape?

The documentation of the Recurrent Layers seems to imply:

Output shape

if return_sequences: 3D tensor with shape  (batch_size, timesteps,
  units).

else, 2D tensor with shape (batch_size, units).

Given return_sequences is automatically set to False I tried to set the input_shape of the next dimension appropriately, but I get the error:

```<code>Using TensorFlow backend.
Traceback (most recent call last):
  File "rnn_agony.py", line 19, in <module>
    activation='relu', use_bias=True,))
  File "/usr/local/lib/python3.5/dist-packages/keras/models.py", line 455, in add
    output_tensor = layer(self.outputs[0])
  File "/usr/local/lib/python3.5/dist-packages/keras/layers/recurrent.py", line 252, in __call__
    return super(Recurrent, self).__call__(inputs, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 511, in __call__
    self.assert_input_compatibility(inputs)
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 413, in assert_input_compatibility
    str(K.ndim(x)))
ValueError: Input 0 is incompatible with layer simple_rnn_2: expected ndim=3, found ndim=2
</code>```

答: If you are stacking RNNs, you need to set return_sequences=True and you will no longer need to set input_shape. This makes intuitive sense, since RNNs expect input sequences.

Title: Input shape of stacked RNNs

Body:
I'm trying to stack a few RNNs in series using Keras with a TensorFlow back-end. I can create a model with a single SimpleRNN layer, but when I try to add second SimpleRNN layer, I can't figure out the appropriate input size.

from keras import models
from keras.layers.recurrent import SimpleRNN
from keras.layers import Activation

model = models.Sequential()

hidden_units = 256
skeleton_dimensions = 3 * 16  # 3 dimensions for 16 joints
input_temporal_length = 7

in_shape = (input_temporal_length, skeleton_dimensions,)

# three hidden layers of 256 each
model.add(SimpleRNN(hidden_units, input_shape=in_shape,
                    activation='relu', use_bias=True,))
# what input shape is this supposed to have?
model.add(SimpleRNN(hidden_units, input_shape=(1, skeleton_dimensions,),
                    activation='relu', use_bias=True,))

What should my second SimpleRNN have as input shape?

The documentation of the Recurrent Layers seems to imply:

Output shape

if return_sequences: 3D tensor with shape  (batch_size, timesteps,
  units).

else, 2D tensor with shape (batch_size, units).

Given return_sequences is automatically set to False I tried to set the input_shape of the next dimension appropriately, but I get the error:

Using TensorFlow backend.
Traceback (most recent call last):
  File "rnn_agony.py", line 19, in <module>
    activation='relu', use_bias=True,))
  File "/usr/local/lib/python3.5/dist-packages/keras/models.py", line 455, in add
    output_tensor = layer(self.outputs[0])
  File "/usr/local/lib/python3.5/dist-packages/keras/layers/recurrent.py", line 252, in __call__
    return super(Recurrent, self).__call__(inputs, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 511, in __call__
    self.assert_input_compatibility(inputs)
  File "/usr/local/lib/python3.5/dist-packages/keras/engine/topology.py", line 413, in assert_input_compatibility
    str(K.ndim(x)))
ValueError: Input 0 is incompatible with layer simple_rnn_2: expected ndim=3, found ndim=2

ContentLicense: CC BY-SA 4.0


问:
MCR: segmentation violation detected on Linux x64 machine
we have just intalled MCR for a linux x64 machine, and we are getting the error below when trying to run our algorithm. No problem running that algorithm in other machine we are using.

Any help?

```<code> ------------------------------------------------------------------------
         Segmentation violation detected at Tue May 26 10:27:27 2015
  ------------------------------------------------------------------------

  Configuration:
    Crash Decoding     : Disabled
    Current Visual     : 0x21 (class 4, depth 24)
    Default Encoding   : UTF-8
    GNU C Library      : 2.21 stable
    MATLAB Architecture: glnxa64
    MATLAB Root        : /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81
    MATLAB Version     : 8.1.0.604 (R2013a)
    Operating System   : Linux 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 x86_64
    Processor ID       : x86 Family 6 Model 42 Stepping 7, GenuineIntel
    Virtual Machine    : Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
    Window System      : The X.Org Foundation (11701000), display :0

  Fault Count: 1

  Abnormal termination:
  Segmentation violation

  Register State (from fault):
    RAX = 0000000000000000  RBX = 00007f257d226160
    RCX = 0000000000000000  RDX = 0000000000000003
    RSP = 00007f25f720fff0  RBP = 00007f25f7210110
    RSI = 0000000000000000  RDI = 00007f257d225350

     R8 = 0000000000000018   R9 = 0000000000000000
    R10 = 00007f257d225000  R11 = 00007f257d226478
    R12 = 00007f257d490fa0  R13 = 0000000000000006
    R14 = 00007f257d225758  R15 = 00007f25f2400580

    RIP = 00007f260e9158ba  EFL = 0000000000010206

     CS = 0033   FS = 0000   GS = 0000

  Stack Trace (from fault):
  [  0] 0x00007f260e9158ba                        /lib64/ld-linux-x86-64.so.2+00051386
  [  1] 0x00007f260e91e4b1                        /lib64/ld-linux-x86-64.so.2+00087217
  [  2] 0x00007f260e919464                        /lib64/ld-linux-x86-64.so.2+00066660
  [  3] 0x00007f260e91d9a3                        /lib64/ld-linux-x86-64.so.2+00084387
  [  4] 0x00007f260d28afc9                   /lib/x86_64-linux-gnu/libdl.so.2+00004041
  [  5] 0x00007f260e919464                        /lib64/ld-linux-x86-64.so.2+00066660
  [  6] 0x00007f260d28b62d                   /lib/x86_64-linux-gnu/libdl.so.2+00005677
  [  7] 0x00007f260d28b061                   /lib/x86_64-linux-gnu/libdl.so.2+00004193 dlopen+00000049
  [  8] 0x00007f26098d0ce1 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81//bin/glnxa64/libut.so+00281825
  [  9] 0x00007f2602060354 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00328532
  [ 10] 0x00007f260205487d /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00280701 _ZN13Mlm_MATLAB_fn8try_loadEv+00000045
  [ 11] 0x00007f260204b95e /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00244062 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000078
  [ 12] 0x00007f25ffe6d11c /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcos.so+02208028
  [ 13] 0x00007f260208a58c /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00501132
  [ 14] 0x00007f260205fa6a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00326250
  [ 15] 0x00007f260204baf8 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00244472 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000488
  [ 16] 0x00007f26010f3778 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02107256
  [ 17] 0x00007f26010f31f9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02105849
  [ 18] 0x00007f2601051acc /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01444556 inCallFcnWithTrap+00000092
  [ 19] 0x00007f25fc21cbda /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00125914
  [ 20] 0x00007f25fc219039 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00110649
  [ 21] 0x00007f25fc219268 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00111208
  [ 22] 0x00007f25fc2193d9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00111577
  [ 23] 0x00007f25fc236977 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00231799
  [ 24] 0x00007f25fc237f8d /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00237453
  [ 25] 0x00007f25fc238024 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00237604 _Z16UIJ_SetJavaFrameP10WinRec_tagPvb+00000020
  [ 26] 0x00007f25fed65a05 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05204485
  [ 27] 0x00007f25fed7351b /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05260571 UIJ_CreatePeerWindow+00000443
  [ 28] 0x00007f25fdd1c848 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwuix.so+00493640 _Z20create_figure_windowP10WinRec_tag+00000424
  [ 29] 0x00007f25fedbc492 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05559442
  [ 30] 0x00007f25fedbd5ff /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05563903
  [ 31] 0x00007f25fee61537 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06235447
  [ 32] 0x00007f25ffa04e0d /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00728589
  [ 33] 0x00007f25ffa00e55 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00712277 _ZN11UDInterface32notifyChildAddedAndParentChangedEPS_+00000213
  [ 34] 0x00007f25ffa01178 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00713080 _ZN11UDInterface8addRightEPS_+00000328
  [ 35] 0x00007f25ffa014b8 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00713912 _ZN11UDInterface13addFirstBelowEPS_+00000072
  [ 36] 0x00007f25fee3ba2f /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06081071
  [ 37] 0x00007f25fee62126 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06238502
  [ 38] 0x00007f25ff9fe8f9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00702713 _ZN11UDInterface4setEEP16UDDatabaseClientP10UDPropInfoPvP13UDErrorStatus+00001065
  [ 39] 0x00007f25fee6053c /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06231356
  [ 40] 0x00007f25fee3939b /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06071195
  [ 41] 0x00007f25fee54741 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06182721
  [ 42] 0x00007f25fee4437b /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06116219
  [ 43] 0x00007f25fee44b46 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06118214
  [ 44] 0x00007f25fed736d3 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05261011 hgFigure+00000243
  [ 45] 0x00007f25c66b7188 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhgbuiltins.so+00569736
  [ 46] 0x00007f25c668f43a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhgbuiltins.so+00406586
  [ 47] 0x00007f25c668f529 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhgbuiltins.so+00406825
  [ 48] 0x00007f260205fa6a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00326250
  [ 49] 0x00007f260204baf8 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00244472 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000488
  [ 50] 0x00007f2601115256 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02245206
  [ 51] 0x00007f26010c5a86 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01919622
  [ 52] 0x00007f26010ca374 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01938292
  [ 53] 0x00007f26010c6993 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01923475
  [ 54] 0x00007f26010c7797 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01927063
  [ 55] 0x00007f2601132e50 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02367056
  [ 56] 0x00007f26020996b2 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00562866 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000594
  [ 57] 0x00007f2601301bf6 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04262902
  [ 58] 0x00007f260130237a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04264826
  [ 59] 0x00007f2601302eea /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04267754
  [ 60] 0x00007f2601165bbd /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02575293
  [ 61] 0x00007f2601191412 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02753554
  [ 62] 0x00007f260119153f /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02753855
  [ 63] 0x00007f26012ae500 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+03921152
  [ 64] 0x00007f26010ca8ac /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01939628
  [ 65] 0x00007f26010c6993 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01923475
  [ 66] 0x00007f26010c7797 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01927063
  [ 67] 0x00007f2601132e50 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02367056
  [ 68] 0x00007f26020996b2 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00562866 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000594
  [ 69] 0x00007f2601301bf6 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04262902
  [ 70] 0x00007f260130237a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04264826
  [ 71] 0x00007f2601302eea /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04267754
  [ 72] 0x00007f2601165bbd /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02575293
  [ 73] 0x00007f2601191412 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02753554
  [ 74] 0x00007f260119153f /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02753855
  [ 75] 0x00007f26012ae500 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+03921152
  [ 76] 0x00007f26010ca8ac /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01939628
  [ 77] 0x00007f26010c6993 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01923475
  [ 78] 0x00007f26010c7797 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01927063
  [ 79] 0x00007f2601132e50 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02367056
  [ 80] 0x00007f26020996b2 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00562866 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000594
  [ 81] 0x00007f26010f3778 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02107256
  [ 82] 0x00007f26010f31f9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02105849
  [ 83] 0x00007f2601051acc /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01444556 inCallFcnWithTrap+00000092
  [ 84] 0x00007f26010b80fb /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01863931
  [ 85] 0x00007f2601050998 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01440152 _Z28inCallFcnWithTrapInDesiredWSiPP11mxArray_tagiS1_PKcbP15inWorkSpace_tag+00000104
  [ 86] 0x00007f2601ab99a9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwiqm.so+02931113 _ZN3iqm15BaseFEvalPlugin7executeEP15inWorkSpace_tagRN5boost10shared_ptrIN14cmddistributor17IIPCompletedEventEEE+00000457
  [ 87] 0x00007f26028376a9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcr.so+00390825
  [ 88] 0x00007f2601a914fa /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwiqm.so+02766074
  [ 89] 0x00007f2601a804ad /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwiqm.so+02696365
  [ 90] 0x00007f25fdd195c6 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwuix.so+00480710
  [ 91] 0x00007f25fdd26df2 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwuix.so+00536050
  [ 92] 0x00007f260cc56862 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81//bin/glnxa64/libmwservices.so+01845346
  [ 93] 0x00007f260cc5750f /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81//bin/glnxa64/libmwservices.so+01848591 _Z25svWS_ProcessPendingEventsiib+00001615
  [ 94] 0x00007f26028255ef /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcr.so+00316911
  [ 95] 0x00007f2602825f5c /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcr.so+00319324
  [ 96] 0x00007f260281f592 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcr.so+00292242
  [ 97] 0x00007f260d85f6aa              /lib/x86_64-linux-gnu/libpthread.so.0+00030378
  [ 98] 0x00007f260d594eed                    /lib/x86_64-linux-gnu/libc.so.6+01076973 clone+00000109

  If this problem is reproducible, please submit a Service Request via:
      http://www.mathworks.com/support/contact_us/

  A technical support engineer might contact you with further information.
</code>```

答:
NO, you don't need to run matlab a as root user. After installing Matlab, install matlab-support package, </p>

```<code> sudo apt-get purge matlab-support
</code>```

<p>, where you can configure who should able to the Matlab and so on. </p>

Body:
we have just intalled MCR for a linux x64 machine, and we are getting the error below when trying to run our algorithm. No problem running that algorithm in other machine we are using.

Any help?

 ------------------------------------------------------------------------
         Segmentation violation detected at Tue May 26 10:27:27 2015
  ------------------------------------------------------------------------

  Configuration:
    Crash Decoding     : Disabled
    Current Visual     : 0x21 (class 4, depth 24)
    Default Encoding   : UTF-8
    GNU C Library      : 2.21 stable
    MATLAB Architecture: glnxa64
    MATLAB Root        : /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81
    MATLAB Version     : 8.1.0.604 (R2013a)
    Operating System   : Linux 3.19.0-15-generic #15-Ubuntu SMP Thu Apr 16 23:32:37 UTC 2015 x86_64
    Processor ID       : x86 Family 6 Model 42 Stepping 7, GenuineIntel
    Virtual Machine    : Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
    Window System      : The X.Org Foundation (11701000), display :0

  Fault Count: 1

  Abnormal termination:
  Segmentation violation

  Register State (from fault):
    RAX = 0000000000000000  RBX = 00007f257d226160
    RCX = 0000000000000000  RDX = 0000000000000003
    RSP = 00007f25f720fff0  RBP = 00007f25f7210110
    RSI = 0000000000000000  RDI = 00007f257d225350

     R8 = 0000000000000018   R9 = 0000000000000000
    R10 = 00007f257d225000  R11 = 00007f257d226478
    R12 = 00007f257d490fa0  R13 = 0000000000000006
    R14 = 00007f257d225758  R15 = 00007f25f2400580

    RIP = 00007f260e9158ba  EFL = 0000000000010206

     CS = 0033   FS = 0000   GS = 0000

  Stack Trace (from fault):
  [  0] 0x00007f260e9158ba                        /lib64/ld-linux-x86-64.so.2+00051386
  [  1] 0x00007f260e91e4b1                        /lib64/ld-linux-x86-64.so.2+00087217
  [  2] 0x00007f260e919464                        /lib64/ld-linux-x86-64.so.2+00066660
  [  3] 0x00007f260e91d9a3                        /lib64/ld-linux-x86-64.so.2+00084387
  [  4] 0x00007f260d28afc9                   /lib/x86_64-linux-gnu/libdl.so.2+00004041
  [  5] 0x00007f260e919464                        /lib64/ld-linux-x86-64.so.2+00066660
  [  6] 0x00007f260d28b62d                   /lib/x86_64-linux-gnu/libdl.so.2+00005677
  [  7] 0x00007f260d28b061                   /lib/x86_64-linux-gnu/libdl.so.2+00004193 dlopen+00000049
  [  8] 0x00007f26098d0ce1 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81//bin/glnxa64/libut.so+00281825
  [  9] 0x00007f2602060354 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00328532
  [ 10] 0x00007f260205487d /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00280701 _ZN13Mlm_MATLAB_fn8try_loadEv+00000045
  [ 11] 0x00007f260204b95e /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00244062 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000078
  [ 12] 0x00007f25ffe6d11c /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcos.so+02208028
  [ 13] 0x00007f260208a58c /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00501132
  [ 14] 0x00007f260205fa6a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00326250
  [ 15] 0x00007f260204baf8 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00244472 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000488
  [ 16] 0x00007f26010f3778 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02107256
  [ 17] 0x00007f26010f31f9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02105849
  [ 18] 0x00007f2601051acc /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01444556 inCallFcnWithTrap+00000092
  [ 19] 0x00007f25fc21cbda /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00125914
  [ 20] 0x00007f25fc219039 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00110649
  [ 21] 0x00007f25fc219268 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00111208
  [ 22] 0x00007f25fc2193d9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00111577
  [ 23] 0x00007f25fc236977 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00231799
  [ 24] 0x00007f25fc237f8d /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00237453
  [ 25] 0x00007f25fc238024 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libuij.so+00237604 _Z16UIJ_SetJavaFrameP10WinRec_tagPvb+00000020
  [ 26] 0x00007f25fed65a05 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05204485
  [ 27] 0x00007f25fed7351b /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05260571 UIJ_CreatePeerWindow+00000443
  [ 28] 0x00007f25fdd1c848 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwuix.so+00493640 _Z20create_figure_windowP10WinRec_tag+00000424
  [ 29] 0x00007f25fedbc492 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05559442
  [ 30] 0x00007f25fedbd5ff /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05563903
  [ 31] 0x00007f25fee61537 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06235447
  [ 32] 0x00007f25ffa04e0d /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00728589
  [ 33] 0x00007f25ffa00e55 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00712277 _ZN11UDInterface32notifyChildAddedAndParentChangedEPS_+00000213
  [ 34] 0x00007f25ffa01178 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00713080 _ZN11UDInterface8addRightEPS_+00000328
  [ 35] 0x00007f25ffa014b8 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00713912 _ZN11UDInterface13addFirstBelowEPS_+00000072
  [ 36] 0x00007f25fee3ba2f /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06081071
  [ 37] 0x00007f25fee62126 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06238502
  [ 38] 0x00007f25ff9fe8f9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwudd.so+00702713 _ZN11UDInterface4setEEP16UDDatabaseClientP10UDPropInfoPvP13UDErrorStatus+00001065
  [ 39] 0x00007f25fee6053c /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06231356
  [ 40] 0x00007f25fee3939b /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06071195
  [ 41] 0x00007f25fee54741 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06182721
  [ 42] 0x00007f25fee4437b /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06116219
  [ 43] 0x00007f25fee44b46 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+06118214
  [ 44] 0x00007f25fed736d3 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhg.so+05261011 hgFigure+00000243
  [ 45] 0x00007f25c66b7188 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhgbuiltins.so+00569736
  [ 46] 0x00007f25c668f43a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhgbuiltins.so+00406586
  [ 47] 0x00007f25c668f529 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwhgbuiltins.so+00406825
  [ 48] 0x00007f260205fa6a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00326250
  [ 49] 0x00007f260204baf8 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00244472 _ZN13Mfh_MATLAB_fn11dispatch_fhEiPP11mxArray_tagiS2_+00000488
  [ 50] 0x00007f2601115256 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02245206
  [ 51] 0x00007f26010c5a86 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01919622
  [ 52] 0x00007f26010ca374 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01938292
  [ 53] 0x00007f26010c6993 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01923475
  [ 54] 0x00007f26010c7797 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01927063
  [ 55] 0x00007f2601132e50 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02367056
  [ 56] 0x00007f26020996b2 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00562866 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000594
  [ 57] 0x00007f2601301bf6 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04262902
  [ 58] 0x00007f260130237a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04264826
  [ 59] 0x00007f2601302eea /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04267754
  [ 60] 0x00007f2601165bbd /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02575293
  [ 61] 0x00007f2601191412 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02753554
  [ 62] 0x00007f260119153f /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02753855
  [ 63] 0x00007f26012ae500 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+03921152
  [ 64] 0x00007f26010ca8ac /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01939628
  [ 65] 0x00007f26010c6993 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01923475
  [ 66] 0x00007f26010c7797 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01927063
  [ 67] 0x00007f2601132e50 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02367056
  [ 68] 0x00007f26020996b2 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00562866 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000594
  [ 69] 0x00007f2601301bf6 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04262902
  [ 70] 0x00007f260130237a /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04264826
  [ 71] 0x00007f2601302eea /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+04267754
  [ 72] 0x00007f2601165bbd /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02575293
  [ 73] 0x00007f2601191412 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02753554
  [ 74] 0x00007f260119153f /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02753855
  [ 75] 0x00007f26012ae500 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+03921152
  [ 76] 0x00007f26010ca8ac /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01939628
  [ 77] 0x00007f26010c6993 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01923475
  [ 78] 0x00007f26010c7797 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01927063
  [ 79] 0x00007f2601132e50 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02367056
  [ 80] 0x00007f26020996b2 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_dispatcher.so+00562866 _ZN8Mfh_file11dispatch_fhEiPP11mxArray_tagiS2_+00000594
  [ 81] 0x00007f26010f3778 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02107256
  [ 82] 0x00007f26010f31f9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+02105849
  [ 83] 0x00007f2601051acc /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01444556 inCallFcnWithTrap+00000092
  [ 84] 0x00007f26010b80fb /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01863931
  [ 85] 0x00007f2601050998 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwm_interpreter.so+01440152 _Z28inCallFcnWithTrapInDesiredWSiPP11mxArray_tagiS1_PKcbP15inWorkSpace_tag+00000104
  [ 86] 0x00007f2601ab99a9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwiqm.so+02931113 _ZN3iqm15BaseFEvalPlugin7executeEP15inWorkSpace_tagRN5boost10shared_ptrIN14cmddistributor17IIPCompletedEventEEE+00000457
  [ 87] 0x00007f26028376a9 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcr.so+00390825
  [ 88] 0x00007f2601a914fa /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwiqm.so+02766074
  [ 89] 0x00007f2601a804ad /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwiqm.so+02696365
  [ 90] 0x00007f25fdd195c6 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwuix.so+00480710
  [ 91] 0x00007f25fdd26df2 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwuix.so+00536050
  [ 92] 0x00007f260cc56862 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81//bin/glnxa64/libmwservices.so+01845346
  [ 93] 0x00007f260cc5750f /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81//bin/glnxa64/libmwservices.so+01848591 _Z25svWS_ProcessPendingEventsiib+00001615
  [ 94] 0x00007f26028255ef /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcr.so+00316911
  [ 95] 0x00007f2602825f5c /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcr.so+00319324
  [ 96] 0x00007f260281f592 /usr/local/MATLAB/MATLAB_Compiler_Runtime/v81/bin/glnxa64/libmwmcr.so+00292242
  [ 97] 0x00007f260d85f6aa              /lib/x86_64-linux-gnu/libpthread.so.0+00030378
  [ 98] 0x00007f260d594eed                    /lib/x86_64-linux-gnu/libc.so.6+01076973 clone+00000109

  If this problem is reproducible, please submit a Service Request via:
      http://www.mathworks.com/support/contact_us/

  A technical support engineer might contact you with further information.

Body:
NO, you don't need to run matlab a as root user. After installing Matlab, install matlab-support package,

 sudo apt-get purge matlab-support

, where you can configure who should able to the Matlab and so on.


问:
SQL, combine two aggregates of same table
I have the following table, which contains number of operations performed by operator of a specific department in a specific date for each target_type. sum1 and sum2 are the number of operation 1 and operation 2 on the specific day, the interpretation of operations in question is indicated by the operation_type column.

```<code>statistic_id | department | operator | operation_type | target_type | sum1 | sum2 | date |
</code>```

I would query the table to collect statistics for operation_type 1 on a department 1 in a specific time period grouped by operator and operation_type as follows

```<code>SELECT operator, target_type, SUM(sum1) AS op1, SUM(sum2) AS op2 FROM statistics
WHERE
  department = 1 AND
  operation_type = 1 AND
  (date BETWEEN in_start_date AND in_end_date)
GROUP BY operator, target_type
ORDER BY operator, target_type;
</code>```

As well, I would query the table to collect statistics for operation_type 2 on the same department and time interval grouped by the same criteria

```<code>SELECT operator, target_type, SUM(sum1) AS op3, SUM(sum2) AS op4 FROM statistics
WHERE
  department = 1 AND
  operation_type = 2 AND
  (date BETWEEN in_start_date AND in_end_date)
GROUP BY operator, target_type
ORDER BY operator, target_type;
</code>```

I would like to combine the query results, so I would get result like

```<code>operator | target_type | op1 | op2 | op3 | op4
</code>```

How do I join the table with itself via aggregating different columns based on some common and some diverse criteria, yet grouping by the same set of columns?

答:
```<code>select operator, target_type, op1, op2, op3, op4
from (query 1) a
full outer join (query 2) b
on (a.operator=b.operator and a.target_type=b.target_type)
order by operator, target_type;
</code>```

Now, both queries are very similar (same date range).  You could do with just 1 query:

```<code>SELECT operator, target_type, SUM(case when operation_type=1 then sum1 else 0 end) AS op1, SUM(case when operation_type=1 then sum2 else 0 end) AS op2,
SUM(case when operation_type=2 then sum1 else 0 end) AS op3, SUM(case when operation_type=2 then sum2 else 0 end) AS op4
 FROM statistics
WHERE
  department = 1 AND
  operation_type in (1,2) AND
  (date BETWEEN in_start_date AND in_end_date)
GROUP BY operator, target_type
ORDER BY operator, target_type;
</code>```

Body:
I have the following table, which contains number of operations performed by operator of a specific department in a specific date for each target_type. sum1 and sum2 are the number of operation 1 and operation 2 on the specific day, the interpretation of operations in question is indicated by the operation_type column.

statistic_id | department | operator | operation_type | target_type | sum1 | sum2 | date |

I would query the table to collect statistics for operation_type 1 on a department 1 in a specific time period grouped by operator and operation_type as follows

SELECT operator, target_type, SUM(sum1) AS op1, SUM(sum2) AS op2 FROM statistics
WHERE
  department = 1 AND
  operation_type = 1 AND
  (date BETWEEN in_start_date AND in_end_date)
GROUP BY operator, target_type
ORDER BY operator, target_type;

As well, I would query the table to collect statistics for operation_type 2 on the same department and time interval grouped by the same criteria

SELECT operator, target_type, SUM(sum1) AS op3, SUM(sum2) AS op4 FROM statistics
WHERE
  department = 1 AND
  operation_type = 2 AND
  (date BETWEEN in_start_date AND in_end_date)
GROUP BY operator, target_type
ORDER BY operator, target_type;

I would like to combine the query results, so I would get result like

operator | target_type | op1 | op2 | op3 | op4

How do I join the table with itself via aggregating different columns based on some common and some diverse criteria, yet grouping by the same set of columns?

Body:
select operator, target_type, op1, op2, op3, op4
from (query 1) a
full outer join (query 2) b
on (a.operator=b.operator and a.target_type=b.target_type)
order by operator, target_type;

Now, both queries are very similar (same date range).  You could do with just 1 query:

SELECT operator, target_type, SUM(case when operation_type=1 then sum1 else 0 end) AS op1, SUM(case when operation_type=1 then sum2 else 0 end) AS op2,
SUM(case when operation_type=2 then sum1 else 0 end) AS op3, SUM(case when operation_type=2 then sum2 else 0 end) AS op4
 FROM statistics
WHERE
  department = 1 AND
  operation_type in (1,2) AND
  (date BETWEEN in_start_date AND in_end_date)
GROUP BY operator, target_type
ORDER BY operator, target_type;


问:
For managed languages, will the language runtime need to be embedded into the web assembly executable?
If, for example, Microsoft created a WebAssembly target for .NET, would they need to embed the .NET runtime into the compiled binary? If they didn't, how would things like the garbage collector and base class libraries work?</p>

答:
Simple answer: yes.

To run any language in WebAssembly you have to embed its runtime into your binary. That's true of how Emscripten handles C++ (it embeds musl libc, libc++, libc++abi, compiler-rt, and pthread into your binary), as well as other languages.

Longer, nuanced, answer:

Done right and once available, GC would be part of WebAssembly itself, but you can always embed a Boehm GC at your own risk (scanning the stack in WebAssembly is extra tricky because locals aren't accessible within the VM!).

Not all languages VMs have GC though. They have a bunch of other functionality, some may even want their own just-in-time compilation on top of WebAssembly.

Base class libraries are often just about objet layout, they translate pretty easily to WebAssembly. See libc++abi for what that means for C++.

That said the runtime doesn't have to be in the compiled binary. Two options:

Embed the runtime in JavaScript instead. You can implement significant code in JavaScript, say chunks of a libc. A language VM's runtime isn't really different.

Embed the runtime in a separate, dynamically-linked .wasm file. This means multiple different .wasm file can share the runtime! Multiple websites can even share that runtime.wasm and hope to all cache-hit on compiled code (assuming CORS works out).

In fact, to do anything useful you must do at least some of 1.: WebAssembly doesn't define any APIs to the embedder. In a web embedding the only way to do anything at all is to be called from JavaScript, and / or call into JavaScript, through WebAssembly's import and export sections. In that sense, JavaScript is your application's microkernel, offering capabilities to communicate with the rest of the platform.

This gets tricky when your language runtime requires certain platform capabilities. For example, re-creating a platform's native UI library for the web is no small task. Much of a language's runtime can "just work", but some parts may be significant amounts of work.


问:
How to remove repeated foreach values in jquery
I am working now wordpress this is my code

```<code>jQuery(document).ready(function () {

 <?php
 $var= $product->get_available_variations();
 foreach ($var as $key => $test)
 {

$check=$test['display_price'];
 ?>
 var check='<?php echo $check;?>';

 jQuery('<p>'+check+'</p>').appendTo('.variation_buttons_wrapper');

 <?php
 }
 ?>
</code>```

Actually my task is split foreach values and append another div.But my answer is again and again repeated.My out put is there,

```<code>53.95
39.95
29.95
27.95
53.95
39.95
29.95
27.95
53.95
39.95
29.95
27.95
53.95
39.95
29.95
27.95
</code>```

But i want out put

```<code> 53.95
39.95
29.95
27.95
</code>```

this only.please help me.

答:
you can try this</p>

```<code>jQuery(document).ready(function () {
<?php
    $var= array_unique($product->get_available_variations());
    foreach ($var as $key => $test)
    {  $check=$test['display_price']; ?>

    jQuery('<p>'+<?php echo $check; ?> +'</p>').appendTo('.variation_buttons_wrapper');
<?php } ?>
</code>```

Body:
I am working now wordpress this is my code

jQuery(document).ready(function () {

 <?php
 $var= $product->get_available_variations();
 foreach ($var as $key => $test)
 {

$check=$test['display_price'];
 ?>
 var check='<?php echo $check;?>';

 jQuery('
'+check+'
').appendTo('.variation_buttons_wrapper');

 <?php
 }
 ?>

Actually my task is split foreach values and append another div.But my answer is again and again repeated.My out put is there,

53.95
39.95
29.95
27.95
53.95
39.95
29.95
27.95
53.95
39.95
29.95
27.95
53.95
39.95
29.95
27.95

But i want out put

 53.95
39.95
29.95
27.95

this only.please help me.

Body:
you can try this

jQuery(document).ready(function () {
<?php
    $var= array_unique($product->get_available_variations());
    foreach ($var as $key => $test)
    {  $check=$test['display_price']; ?>

    jQuery('<p>'+<?php echo $check; ?> +'</p>').appendTo('.variation_buttons_wrapper');
<?php } ?>


问:
Null context in onResponse callback method retrofit android
I have a DialogFragment. When i click the OK button, i execute a retrofit call to my api like this

```<code> @Override
            public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) {
                int code = response.code();
                if (code == 200) {
                    LoginResponse lr = response.body();
                    if (lr.getError()) {
                        Utils.showToast(getActivity(), "Error! Los datos son incorrectos.");
                    } else {
                        startActivity(new Intent(getActivity(), ConfigGeneralActivity.class));
                    }
                } else {
                    Toast.makeText(getActivity(), "Error: " + String.valueOf(code), Toast.LENGTH_LONG).show();
                }

            }
</code>```

at this part of the code, getActivity() is null.

Another option is to pass the context from the oncreatedialog to this callback, but when i do this, i got the error that says activity is not attached to fragment.

I know i can implement Otto but it's too complex for what i want to do. I just want to start a new activity from a retrofit callback inside a DialogFragment.

Any ideas? Thanks!

答:
You need to runOnUiThread to get the Context inside OnResponse Callback

Like:

```<code>@Override
public void onResponse(Call call, Response response) throws IOException {
    if (response.isSuccessful()) {
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                //your code
            }
        });
    }
}
</code>```

Body:
I have a DialogFragment. When i click the OK button, i execute a retrofit call to my api like this

 @Override
            public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) {
                int code = response.code();
                if (code == 200) {
                    LoginResponse lr = response.body();
                    if (lr.getError()) {
                        Utils.showToast(getActivity(), "Error! Los datos son incorrectos.");
                    } else {
                        startActivity(new Intent(getActivity(), ConfigGeneralActivity.class));
                    }
                } else {
                    Toast.makeText(getActivity(), "Error: " + String.valueOf(code), Toast.LENGTH_LONG).show();
                }

            }

at this part of the code, getActivity() is null.

Another option is to pass the context from the oncreatedialog to this callback, but when i do this, i got the error that says activity is not attached to fragment.

I know i can implement Otto but it's too complex for what i want to do. I just want to start a new activity from a retrofit callback inside a DialogFragment.

Any ideas? Thanks!

Body:
You need to runOnUiThread to get the Context inside OnResponse Callback

Like:

@Override
public void onResponse(Call call, Response response) throws IOException {
    if (response.isSuccessful()) {
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                //your code
            }
        });
    }
}


问:
How to stream a generated PDF file to a reader inside a DIV and not the browser?
I have the following code that after a PDF is generated submitting a query to SQL will display in browser. But I am looking is to display the file in a PDF viewer in the page and not using the browser reader. The viewer is inside a DIV. You can see the example shown in the image attached, which I run as test to show the file from the local system and not streaming. This function Response.BinaryWrite(bytes); sends the generated PDF to the browser viewer. How can I do for it to display in the viewer inside the DIV instead?

```<code>string reportLabel = lbReports.Text;

document.Add(table);
document.Close();
byte[] bytes = memoryStream.ToArray();

Response.Clear();
Response.AddHeader("Content-Disposition", "inline");

Response.Buffer = true;
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.BinaryWrite(bytes);
</code>```

This is the code that should show the generated PDF file in the DIV:

```<code>string embed = "<object data=\"{0}\" type=\"application/pdf\" width=\"698px\" height=\"450px\">";
embed += "If you are unable to view file, you can download from <a href = \"{0}\">here</a>";
embed += " or download <a target = \"_blank\" href = \"http://get.adobe.com/reader/\">Adobe PDF Reader</a> to view the file.";
embed += "</object>";
ltEmbed.Text = string.Format(embed, ("blabla.pdf")); /*it shows this PDF as local file just for test*/
memoryStream.Close();
this.Context.ApplicationInstance.CompleteRequest();
</code>```

Image here: sample

The idea is to have the file generated temporarily and the user will decide if saving it or not. I have tried other options, but none seems to work, especially if it is inside a DIV. In other words, I am looking to display the dynamic PDF file using ltEmbed.Text = string.Format(embed, ...);

答:
We have used in our project. Try & let me know.

DESIGN

```<code> <div id="pdfPopup" style="display: none;">
    <a href="Javascript:void(0);" id="cl" onclick="document.getElementById('pdfPopup').style.display ='none';"
        class="closebtn2" style="z-index: 1111111;">
        <img src="images/btnClose.png" alt="" />
    </a>

    <div class="overlay" style="visibility: visible !important;">
    </div>

    <div id="popUpContainer" style="border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px;
        background-color: #fff; width: 1000px; height: 600px; top: 20px; left: 50%; margin-left: -500px;
        overflow: auto; position: absolute; z-index: 1111111;">
        <object data="" type="application/pdf" width="100%" height="600px">
        </object>
    </div>

 </div>
</code>```

JS

```<code> function DisplayPDF()
 {
        var PDFServerPath = document.getElementById('<%=hdnPdfPath.ClientID %>').value;
        var x = document.getElementsByTagName('object')[0];
        x.setAttribute("data", PDFServerPath);
        document.getElementById('pdfPopup').style.display = "block";
  }
</code>```

Code

```<code> ScriptManager.RegisterStartupScript(Me, Me.GetType(), "DisplayPDF", "DisplayPDF();", True)
</code>```

Body:
I have the following code that after a PDF is generated submitting a query to SQL will display in browser. But I am looking is to display the file in a PDF viewer in the page and not using the browser reader. The viewer is inside a DIV. You can see the example shown in the image attached, which I run as test to show the file from the local system and not streaming. This function Response.BinaryWrite(bytes); sends the generated PDF to the browser viewer. How can I do for it to display in the viewer inside the DIV instead?

string reportLabel = lbReports.Text;

document.Add(table);
document.Close();
byte[] bytes = memoryStream.ToArray();

Response.Clear();
Response.AddHeader("Content-Disposition", "inline");

Response.Buffer = true;
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.BinaryWrite(bytes);

This is the code that should show the generated PDF file in the DIV:

string embed = "<object data=\"{0}\" type=\"application/pdf\" width=\"698px\" height=\"450px\">";
embed += "If you are unable to view file, you can download from here";
embed += " or download Adobe PDF Reader to view the file.";
embed += "</object>";
ltEmbed.Text = string.Format(embed, ("blabla.pdf")); /*it shows this PDF as local file just for test*/
memoryStream.Close();
this.Context.ApplicationInstance.CompleteRequest();

Image here: sample

The idea is to have the file generated temporarily and the user will decide if saving it or not. I have tried other options, but none seems to work, especially if it is inside a DIV. In other words, I am looking to display the dynamic PDF file using ltEmbed.Text = string.Format(embed, ...);

Body:
We have used in our project. Try & let me know.

DESIGN

 <div id="pdfPopup" style="display: none;">
    <a href="Javascript:void(0);" id="cl" onclick="document.getElementById('pdfPopup').style.display ='none';"
        class="closebtn2" style="z-index: 1111111;">
        <img src="images/btnClose.png" alt="" />
    </a>

    <div class="overlay" style="visibility: visible !important;">
    </div>

    <div id="popUpContainer" style="border-radius: 8px; -webkit-border-radius: 8px; -moz-border-radius: 8px;
        background-color: #fff; width: 1000px; height: 600px; top: 20px; left: 50%; margin-left: -500px;
        overflow: auto; position: absolute; z-index: 1111111;">
        <object data="" type="application/pdf" width="100%" height="600px">
        </object>
    </div>

 </div>

JS

 function DisplayPDF()
 {
        var PDFServerPath = document.getElementById('<%=hdnPdfPath.ClientID %>').value;
        var x = document.getElementsByTagName('object')[0];
        x.setAttribute("data", PDFServerPath);
        document.getElementById('pdfPopup').style.display = "block";
  }

Code

 ScriptManager.RegisterStartupScript(Me, Me.GetType(), "DisplayPDF", "DisplayPDF();", True)


问:
Yii2 sendfile response
I am new to Yii2 and I would really appreciated if anyone could help me to solve the problem. I want to make a download link and I use

```<code>Yii::$app->response->sendFile($path, $name, ['inline' => false])->send();
</code>```

in download function but it just read the content of the file and display straight in the page. What I want to do is when users click the download link, the download dialog will pop up or the file will be automatically downloaded, rather than display the content. Can anyone please help me?

答:
Instead of :

```<code> sendFile();
</code>```

Try :

```<code>xSendFile()
</code>```

Title: Yii2 sendfile response

Body:
I am new to Yii2 and I would really appreciated if anyone could help me to solve the problem. I want to make a download link and I use

Yii::$app->response->sendFile($path, $name, ['inline' => false])->send();

in download function but it just read the content of the file and display straight in the page. What I want to do is when users click the download link, the download dialog will pop up or the file will be automatically downloaded, rather than display the content. Can anyone please help me?

Body:
Instead of :

 sendFile();

Try :

xSendFile()


问:
How to hide a window in Windows 7, just like desktop managers do
When I install a virtual desktop manager on Windows 7, and I switch to a different virtual desktop, all the current windows disappear, also disappearing from the Start Menu.

I want to hide some of a particular application's windows, but not all of them, in a similar manner. How can I hide a window like this?

In particular, I need to hide a VirtualBox Seamless mode window, so I'm not sure minimizing the window will work. It does, however, disappear when using virtual desktop managers.

答: The answer is simply ShowWindow(SW_HIDE) and ShowWindow(SW_SHOW). I think "Virtual Desktop Managers" just hide windows and show them as necessary when the desktops change.

ContentLicense: CC BY-SA 2.5


问:
How to open sql project/solution from my Desktop to another laptop?
I made a software application with c# and it is connected to my sql on my own desktop and We have to present it to our professor so I connected my application with on my friend's laptop but I can't run the program because the server from my sql is the server that I used on my desktop and I can't open my sql project or solution on her laptop as well. Please help! Thank you!</p>

答:
You both need to be connected over network (LAN). Then, first check your friend laptop IP address and try accessing your database server using IP-address. For example :

```<code> http://localhost:port/
</code>```

to

```<code> http://ip-address-:port/
</code>```

Similar change, you need to make in your code as well.

Body:
You both need to be connected over network (LAN). Then, first check your friend laptop IP address and try accessing your database server using IP-address. For example :

 http://localhost:port/

to

 http://ip-address-:port/

Similar change, you need to make in your code as well.


问:
get class from java.util.List<SomeType>
how to get class from this expression java.util.List</p>

答:
You can try something like this:</p>

```<code>Class<List<Foo>> cls = (Class<List<Foo>>)(Object)List.class
</code>```

Title: get class from java.util.List<SomeType>

Body:
You can try something like this:

Class<List<Foo>> cls = (Class<List<Foo>>)(Object)List.class


问:
Insert into same table avoiding duplicate
```<code>Table enrollments
-----------------

id      classId     userId
--      -------     ------
1         1           1
--      -------     ------
</code>```

after this stats: want to reject inserting whenever again inserting { classId=1, userId=1 }

If user inserts same classId and userId then it should rejects inserting.
I've already tried:

```<code>INSERT INTO enrollments(classId, userId)
    VALUES('{$classId}', '{$userId}')
    WHERE
    NOT EXISTS(SELECT NULL FROM
                enrollments WHERE
                    classId='{$classId}' AND userId='{$userId}')
</code>```

答:
Adding classId and userId are combined as unique, so same classId and userId can't be inserted if it exists previously in table.

```<code>ALTER TABLE enrollments
ADD CONSTRAINT UC_Person UNIQUE (classId,userId);
</code>```

Body:
Table enrollments
-----------------

id      classId     userId
--      -------     ------
1         1           1
--      -------     ------

after this stats: want to reject inserting whenever again inserting { classId=1, userId=1 }

If user inserts same classId and userId then it should rejects inserting.
I've already tried:

INSERT INTO enrollments(classId, userId)
    VALUES('{$classId}', '{$userId}')
    WHERE
    NOT EXISTS(SELECT NULL FROM
                enrollments WHERE
                    classId='{$classId}' AND userId='{$userId}')

Body:
Adding classId and userId are combined as unique, so same classId and userId can't be inserted if it exists previously in table.

ALTER TABLE enrollments
ADD CONSTRAINT UC_Person UNIQUE (classId,userId);


问:
Retrieving a property of a JSON object by index?
Assuming this JSON object:

```<code>var obj = {
    "set1": [1, 2, 3],
    "set2": [4, 5, 6, 7, 8],
    "set3": [9, 10, 11, 12]
};
</code>```

The "set2" property may be retrieved like so:

```<code>obj["set2"]
</code>```

Is there a way to retrieve the "set2" property by index? It is the second property of the JSON object. This does not work (of course):

```<code>obj[1]
</code>```

So, let's say that I want to retrieve the second property of the JSON object, but I don't know its name - how would I do it then?

Update: Yes, I understand that objects are collections of unordered properties. But I don't think that the browsers mess with the "original" order defined by the JSON literal / string.

Body:
Assuming this JSON object:

var obj = {
    "set1": [1, 2, 3],
    "set2": [4, 5, 6, 7, 8],
    "set3": [9, 10, 11, 12]
};

The "set2" property may be retrieved like so:

obj["set2"]

Is there a way to retrieve the "set2" property by index? It is the second property of the JSON object. This does not work (of course):

obj[1]

So, let's say that I want to retrieve the second property of the JSON object, but I don't know its name - how would I do it then?

Update: Yes, I understand that objects are collections of unordered properties. But I don't think that the browsers mess with the "original" order defined by the JSON literal / string.

Body:
Simple solution, just one line..

var obj = {
    "set1": [1, 2, 3],
    "set2": [4, 5, 6, 7, 8],
    "set3": [9, 10, 11, 12]
};

obj = Object.values(obj);

obj[1]....


问:
Dynamically adding words to a context in REBOL
Imagine the following REBOL code:

```foo: context [bar: 3]```

I now have a context foo in which 'bar is defined. How can I dynamically inject a new word into this context? Is it possible?

I've tried:

```set/any in foo 'baz 3```

But that doesn't work because the expression in foo 'baz fails because there is no word 'baz defined in the foo context.

I should add that I realize one way to do this is as follows:

```foo-prototype: [bar: 3]
foo: context foo-prototype
foo: context head append foo-prototype [baz: 3]```

But what if you don't have access to foo's prototype block?

答:
You can achieve the same by using the existing object as a prototype to create a new object. </p>

```<code>>> foo: make object! [bar: 3]
>> foo: make foo [baz: 3]
>> probe foo
make object! [
    bar: 3
    baz: 3
]
</code>```

OwnerDisplayName: Revolucent

Body:
Imagine the following REBOL code:

foo: context [bar: 3]

I now have a context foo in which 'bar is defined. How can I dynamically inject a new word into this context? Is it possible?

I've tried:

set/any in foo 'baz 3

But that doesn't work because the expression in foo 'baz fails because there is no word 'baz defined in the foo context.

I should add that I realize one way to do this is as follows:

foo-prototype: [bar: 3]
foo: context foo-prototype
foo: context head append foo-prototype [baz: 3]

But what if you don't have access to foo's prototype block?

LastEditorDisplayName: Revolucent

Body:
You can achieve the same by using the existing object as a prototype to create a new object.

>> foo: make object! [bar: 3]
>> foo: make foo [baz: 3]
>> probe foo
make object! [
    bar: 3
    baz: 3
]

OwnerDisplayName: Peter W A Wood